Commit a36cde6a authored by 关振斌's avatar 关振斌

update

parent 0c8e0312
{
"cSpell.words": [
"roduct"
]
}
\ No newline at end of file
......@@ -52,7 +52,7 @@ android {
applicationId "com.example.chart"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
minSdkVersion 19
minSdkVersion 21
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
......
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.chart">
<application
android:label="GPT大师傅"
android:label="AI写作大师"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">
<activity
......
......@@ -2,25 +2,27 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>App</string>
<key>CFBundleIdentifier</key>
<string>io.flutter.flutter.app</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>App</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>11.0</string>
<key>CFBundleAllowMixedLocalizations</key>
<true/>
<key>CFBundleDevelopmentRegion</key>
<string>zh</string>
<key>CFBundleExecutable</key>
<string>App</string>
<key>CFBundleIdentifier</key>
<string>io.flutter.flutter.app</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>App</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>11.0</string>
</dict>
</plist>
......@@ -112,6 +112,8 @@ PODS:
- SDWebImage (5.15.2):
- SDWebImage/Core (= 5.15.2)
- SDWebImage/Core (5.15.2)
- share_plus (0.0.1):
- Flutter
- shared_preferences_foundation (0.0.1):
- Flutter
- FlutterMacOS
......@@ -124,6 +126,8 @@ PODS:
- Toast (4.0.0)
- url_launcher_ios (0.0.1):
- Flutter
- video_player_avfoundation (0.0.1):
- Flutter
- webview_flutter_wkwebview (0.0.1):
- Flutter
......@@ -143,10 +147,12 @@ DEPENDENCIES:
- open_filex (from `.symlinks/plugins/open_filex/ios`)
- package_info (from `.symlinks/plugins/package_info/ios`)
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/ios`)
- share_plus (from `.symlinks/plugins/share_plus/ios`)
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/ios`)
- smart_auth (from `.symlinks/plugins/smart_auth/ios`)
- sqflite (from `.symlinks/plugins/sqflite/ios`)
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
- video_player_avfoundation (from `.symlinks/plugins/video_player_avfoundation/ios`)
- webview_flutter_wkwebview (from `.symlinks/plugins/webview_flutter_wkwebview/ios`)
SPEC REPOS:
......@@ -198,6 +204,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/package_info/ios"
path_provider_foundation:
:path: ".symlinks/plugins/path_provider_foundation/ios"
share_plus:
:path: ".symlinks/plugins/share_plus/ios"
shared_preferences_foundation:
:path: ".symlinks/plugins/shared_preferences_foundation/ios"
smart_auth:
......@@ -206,6 +214,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/sqflite/ios"
url_launcher_ios:
:path: ".symlinks/plugins/url_launcher_ios/ios"
video_player_avfoundation:
:path: ".symlinks/plugins/video_player_avfoundation/ios"
webview_flutter_wkwebview:
:path: ".symlinks/plugins/webview_flutter_wkwebview/ios"
......@@ -238,12 +248,14 @@ SPEC CHECKSUMS:
PromisesObjC: ab77feca74fa2823e7af4249b8326368e61014cb
ReachabilitySwift: 985039c6f7b23a1da463388634119492ff86c825
SDWebImage: 8ab87d4b3e5cc4927bd47f78db6ceb0b94442577
share_plus: 056a1e8ac890df3e33cb503afffaf1e9b4fbae68
shared_preferences_foundation: 297b3ebca31b34ec92be11acd7fb0ba932c822ca
smart_auth: 4bedbc118723912d0e45a07e8ab34039c19e04f2
sqflite: 6d358c025f5b867b29ed92fc697fd34924e11904
SwiftyGif: 93a1cc87bf3a51916001cf8f3d63835fb64c819f
Toast: 91b396c56ee72a5790816f40d3a94dd357abc196
url_launcher_ios: fb12c43172927bb5cf75aeebd073f883801f1993
video_player_avfoundation: e489aac24ef5cf7af82702979ed16f2a5ef84cff
webview_flutter_wkwebview: b7e70ef1ddded7e69c796c7390ee74180182971f
PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3
......
......@@ -361,7 +361,7 @@
DEVELOPMENT_TEAM = Z99J24WADU;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = "GPT大师傅";
INFOPLIST_KEY_CFBundleDisplayName = "AI写作大师";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
......@@ -493,7 +493,7 @@
DEVELOPMENT_TEAM = Z99J24WADU;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = "GPT大师傅";
INFOPLIST_KEY_CFBundleDisplayName = "AI写作大师";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
......@@ -519,7 +519,7 @@
DEVELOPMENT_TEAM = Z99J24WADU;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = "GPT大师傅";
INFOPLIST_KEY_CFBundleDisplayName = "AI写作大师";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
......
......@@ -2,14 +2,16 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSPhotoLibraryUsageDescription</key>
<string>需要相册权限发送图片</string>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>CFBundleLocalizations</key>
<array>
<string>zh</string>
</array>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
<string>GPT大师傅</string>
<string>AI写作大师</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
......@@ -24,10 +26,16 @@
<string>$(FLUTTER_BUILD_NAME)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
<array>
<dict/>
</array>
<key>CFBundleVersion</key>
<string>$(FLUTTER_BUILD_NUMBER)</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSPhotoLibraryUsageDescription</key>
<string>需要相册权限发送图片</string>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
<key>UILaunchStoryboardName</key>
......
......@@ -2,6 +2,10 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.developer.associated-domains</key>
<array>
<string>applinks:www.fusiontech.cn/</string>
</array>
<key>com.apple.developer.in-app-payments</key>
<array/>
</dict>
......
import 'package:chart/common/entities/entities.dart';
import 'package:chart/common/utils/utils.dart';
import '../../entity/login_entity.dart';
import '../../entity/user_entity.dart';
/// 用户
class UserAPI {
/// 登录
static Future<UserLoginResponseEntity> login({
UserLoginRequestEntity? params,
}) async {
static Future<LoginEntity> login(Map<String, dynamic> parameters) async {
var response = await HttpUtil().post(
'/user/login',
data: params?.toJson(),
'/user/register',
data: parameters,
);
return UserLoginResponseEntity.fromJson(response);
return LoginEntity.fromMap(response['data']);
}
// /pay/notifyApplePay
......@@ -48,6 +47,17 @@ class UserAPI {
// UserLoginResponseEntity.fromJson(response);
}
static Future<MsmEntity> sendSms(
Map<String, dynamic>? params,
) async {
var response = await HttpUtil().get(
'/sms/sendSms',
queryParameters: params,
);
return MsmEntity.fromMap(response);
}
// /sms/sendSms
/// 注册
static Future<UserRegisterRequestEntity> register({
UserRegisterRequestEntity? params,
......
......@@ -67,7 +67,7 @@ class ClassifyDetialEntity {
final String detailDesc;
final int isShow;
final String template;
final List<dynamic> detailParamsEntityList;
final List<detailParamsEntity> detailParamsEntityList;
factory ClassifyDetialEntity.fromJson(String str) =>
ClassifyDetialEntity.fromMap(json.decode(str));
......@@ -82,7 +82,8 @@ class ClassifyDetialEntity {
template: json['template'],
isShow: json['isShow'],
// List<PlanEntity>.from(data.map((x) => PlanEntity.fromMap(x)));
detailParamsEntityList: json['detailParamsEntityList'],
detailParamsEntityList:
detailParamsEntityListFromList(json['detailParamsEntityList']),
// List<DetialItem>.from(
// json['detailParamsEntityList'].map((x) => DetialItem.fromMap(x)))
// tags: List<String>.from(json["tags"]?.map((x) => x) ?? []),
......@@ -103,3 +104,32 @@ class ClassifyDetialEntity {
List<ClassifyDetialEntity> classifyDetialEntityFromList(List data) =>
List<ClassifyDetialEntity>.from(
data.map((x) => ClassifyDetialEntity.fromMap(x)));
List<detailParamsEntity> detailParamsEntityListFromList(List data) =>
List<detailParamsEntity>.from(
data.map((x) => detailParamsEntity.fromMap(x)));
class detailParamsEntity {
detailParamsEntity({
required this.label,
required this.placeHolder,
});
final String label;
final String placeHolder;
Map<String, dynamic> toMap() => {
"label": label,
"placeHolder": placeHolder,
};
factory detailParamsEntity.fromMap(Map<String, dynamic> json) =>
detailParamsEntity(
label: json["label"],
placeHolder: json["placeHolder"],
// List<DetialItem>.from(
// json['detailParamsEntityList'].map((x) => DetialItem.fromMap(x)))
// tags: List<String>.from(json["tags"]?.map((x) => x) ?? []),
// detailParamsEntityList: json["detailParamsEntityList"],
);
}
......@@ -8,5 +8,6 @@ class AppRoutes {
static const Category = '/category';
static const CHAT_PAGE = '/chat_page';
static const PRODUCT_PAGE = '/product';
static const TEMPLATE_PAGE = '/template';
static const PAY_LIST = '/pay';
}
// import 'dart:ffi';
import 'package:chart/pages/frame/product/index.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'routes.dart';
class RouteObservers<R extends Route<dynamic>> extends RouteObserver<R> {
......@@ -15,8 +19,28 @@ class RouteObservers<R extends Route<dynamic>> extends RouteObserver<R> {
void didPop(Route<dynamic> route, Route<dynamic>? previousRoute) {
super.didPop(route, previousRoute);
AppPages.history.remove(route.settings.name);
print('didPop');
print(AppPages.history);
String? name = route.settings.name;
if (name != null) {
bool isProduct = name.contains('product?title');
// print("isProductisProduct$isProduct");
if (isProduct) {
final controller = Get.put(ProductController());
controller.clearState();
}
}
// int route.settings.name.indexOf("roduct?title")>1;
// if(2>10){
// }
// roduct?title
// if(route.settings.name?.indexOf("roduct?title")>=1){
// }
// print('didPop${route.settings.name}');
// print(AppPages.history);
}
@override
......
import 'package:chart/pages/chat/view.dart';
import 'package:chart/pages/frame/notfound/index.dart';
import 'package:chart/pages/frame/pay_list/view.dart';
import 'package:chart/pages/template/index.dart';
import 'package:flutter/material.dart';
import 'package:chart/common/middlewares/middlewares.dart';
import 'package:chart/pages/application/index.dart';
......@@ -70,6 +71,17 @@ class AppPages {
page: () => PayListPage(),
binding: PayListBinding(),
),
GetPage(
name: AppRoutes.SIGN_IN,
page: () => SignInPage(),
binding: SignInBinding(),
),
GetPage(
name: AppRoutes.TEMPLATE_PAGE,
page: () => TemplatePage(),
binding: TemplateBinding()),
// PAY_LIST
// 需要登录
GetPage(
......
......@@ -2,8 +2,10 @@ import 'dart:convert';
import 'package:chart/common/apis/apis.dart';
import 'package:chart/common/entities/entities.dart';
import 'package:chart/common/routers/routes.dart';
import 'package:chart/common/services/services.dart';
import 'package:chart/common/values/values.dart';
import 'package:chart/entity/login_entity.dart';
import 'package:get/get.dart';
import '../../entity/user_entity.dart';
......@@ -40,10 +42,19 @@ class UserStore extends GetxController {
}
}
handleLogin(LoginEntity res) async {
await setToken(res.token);
await saveProfile(
IntegralEntity(id: res.id, username: res.username, token: res.token));
_isLogin.value = true;
Get.offAndToNamed(AppRoutes.Application);
}
getUserInfo(IntegralEntity userInfo) async {
await setToken(userInfo.token);
await saveProfile(userInfo);
// token = StorageService.to.getString(STORAGE_USER_TOKEN_KEY);
// if (token.isNotEmpty) {
......@@ -77,7 +88,6 @@ class UserStore extends GetxController {
// 保存 profile
Future<void> saveProfile(IntegralEntity profile) async {
_isLogin.value = true;
StorageService.to.setString(STORAGE_USER_PROFILE_KEY, jsonEncode(profile));
}
// // 保存 profile
......
......@@ -9,7 +9,8 @@ Widget inputTextEdit({
String? hintText,
bool isPassword = false,
double marginTop = 15,
bool autofocus = false,
bool autofocus = true,
Widget? suffixIcon = null,
}) {
return Container(
height: 44.h,
......@@ -23,10 +24,10 @@ Widget inputTextEdit({
controller: controller,
keyboardType: keyboardType,
decoration: InputDecoration(
hintText: hintText,
contentPadding: EdgeInsets.fromLTRB(20, 10, 0, 9),
border: InputBorder.none,
),
hintText: hintText,
contentPadding: EdgeInsets.fromLTRB(20, 10, 0, 9),
border: InputBorder.none,
suffixIcon: suffixIcon),
style: TextStyle(
color: AppColors.primaryText,
fontFamily: "Avenir",
......
......@@ -10,11 +10,17 @@ import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:glassy/glassy.dart';
import 'package:glassy/glassy_config.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
void main() async {
await Global.init();
Glassy().setConfig(GlassyConfig(
radius: 16,
backgroundColor: Color.fromARGB(255, 217, 217, 217),
backgroundOpacity: 0.2,
borderOpacity: 0.5));
runApp(ChatApp());
}
......@@ -26,7 +32,7 @@ class ChatApp extends StatelessWidget {
return ScreenUtilInit(
designSize: Size(375, 812),
builder: (context, child) => GetMaterialApp(
title: 'GPT大师傅',
title: 'AI写作大师',
theme: AppTheme.light,
debugShowCheckedModeBanner: false,
initialRoute: AppPages.INITIAL,
......
import 'package:chart/common/apis/apis.dart';
import 'package:chart/common/store/store.dart';
import 'package:dash_chat_2/dash_chat_2.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:get/get.dart';
import 'package:uuid/uuid.dart';
......@@ -17,22 +18,28 @@ class ChatNewController extends GetxController {
/// 事件
final _user = const types.User(
id: '82091008-a4aa-4a89-ae75-a22bf8d6f3aa',
// final _user = const types.User(
// id: '82091008-a4aa-4a89-ae75-a22bf8d6f3aa',
// );
ChatUser _user = ChatUser(
id: '1',
// firstName: 'Charles',
// lastName: 'Leclerc',
);
final receiveUser = const types.User(
id: '82091008-a484-4a89-ae75-a22bf8d6f3aa',
firstName: "GPT",
lastName: '大师',
imageUrl:
"https://imgb15.photophoto.cn/20201124/jiqirentupian-39852917_3.jpg"
// imageUrl: "assets/images/300.jpg",
);
final receiveUser = ChatUser(
id: '82091008-a484-4a89-ae75-a22bf8d6f3aa',
firstName: "GPT",
lastName: '大师',
// imageUrl:
// "https://imgb15.photophoto.cn/20201124/jiqirentupian-39852917_3.jpg"
// // imageUrl: "assets/images/300.jpg",
);
/// 事件
void sendMessage(types.PartialText message) async {
void sendMessage(ChatMessage message) async {
// if (state.messageList.isNotEmpty) {
// // data = !_messages.every((element) => element.status != Status.sending);
// }
......@@ -49,10 +56,10 @@ class ChatNewController extends GetxController {
// return;
// }
final textMessage = types.TextMessage(
author: _user,
createdAt: DateTime.now().millisecondsSinceEpoch,
id: const Uuid().v4(),
final textMessage = ChatMessage(
user: _user,
createdAt: DateTime.now(),
// id: const Uuid().v4(),
text: "${message.text}",
);
......@@ -75,10 +82,10 @@ class ChatNewController extends GetxController {
String? result = await NewsAPI.sendMessage(
{"question": message.text, "id": "${UserStore.to.profile.id}"});
// _cancelLoading();
final receiveMessage = types.TextMessage(
author: receiveUser,
createdAt: DateTime.now().millisecondsSinceEpoch,
id: const Uuid().v4(),
final receiveMessage = ChatMessage(
user: receiveUser,
createdAt: DateTime.now(),
// id: const Uuid().v4(),
text: "$result",
);
_addMessage(receiveMessage);
......@@ -86,10 +93,10 @@ class ChatNewController extends GetxController {
} catch (e) {
print("eeeeeeee$e");
// _cancelLoading();
final receiveErrorMessage = types.TextMessage(
author: receiveUser,
createdAt: DateTime.now().millisecondsSinceEpoch,
id: const Uuid().v4(),
final receiveErrorMessage = ChatMessage(
user: receiveUser,
createdAt: DateTime.now(),
// id: const Uuid().v4(),
text: "当前用户太多了,请稍等再试",
);
......@@ -98,7 +105,7 @@ class ChatNewController extends GetxController {
}
}
void _addMessage(types.Message message) {
void _addMessage(ChatMessage message) {
state.messageList.insert(0, message);
// state.messageList = [message]
// state.messageList.add(message);
......
// import 'dart:ffi';
import 'package:chart/common/entities/entities.dart';
import 'package:dash_chat_2/dash_chat_2.dart';
import 'package:get/get.dart';
import 'package:flutter_chat_types/flutter_chat_types.dart' as types;
class ChatPageState {
// 新闻翻页 // List<types.Message>
RxList<types.Message> messageList = <types.Message>[].obs;
RxList<ChatMessage> messageList = <ChatMessage>[].obs;
// get _messageList =>
// final _page = 0.obs;
// set page(value) => this._page.value = value;
// get page => this._page.value;
final _page = "hello".obs;
set page(value) => this._page.value = value;
get page => this._page.value;
// RxList<NewsItem> newsList = <NewsItem>[].obs;
}
......@@ -7,6 +7,7 @@ import 'package:get/get.dart';
import 'package:flutter_chat_types/flutter_chat_types.dart' as types;
import '../../../common/widgets/app.dart';
import '../../application/view.dart';
import 'package:dash_chat_2/dash_chat_2.dart';
import 'index.dart';
import 'widgets/widgets.dart';
......@@ -19,10 +20,12 @@ class ChatNewPage extends GetView<ChatNewController> {
@override
Widget build(BuildContext context) {
return Scaffold(
// final c = Get.put(ChatPageController());
final c = Get.put(ChatNewController());
return Obx(() => Scaffold(
appBar: transparentAppBar(
title: Text(
"Chat",
"${c.state.messageList.length}",
style: TextStyle(
color: AppColors.primaryElementText,
fontFamily: 'Montserrat',
......@@ -45,48 +48,58 @@ class ChatNewPage extends GetView<ChatNewController> {
//_nextPage(-1);
},
)),
body: Obx(() => Container(
width: double.infinity,
height: double.infinity,
padding: EdgeInsets.symmetric(horizontal: 0),
decoration: BoxDecoration(
image: DecorationImage(
image: Image.asset("assets/images/bg.png").image,
fit: BoxFit.cover),
),
child: Chat(
// onAttachmentPressed: _handleAttachmentPressed,
// bubbleBuilder: _bubbleBuilder,
theme: const DefaultChatTheme(
// #1e1c39//#1e1c39#1e1c39#1e1c39
// rgba(30, 28, 57, 1.00)
backgroundColor: Color.fromRGBO(30, 28, 57, 0),
// inputBackgroundColor: Colors.red,
),
messages: controller.state.messageList.value,
// messages: controller.state.messageList,
// onAttachmentPressed: _handleAttachmentPressed,
// onMessageTap: _handleMessageTap,
// onPreviewDataFetched: _handlePreviewDataFetched,
// onSendPressed: _handleSendPressed,
showUserAvatars: true,
showUserNames: true,
// UserStore.to.isLogin
// user: _user,
l10n: const ChatL10nEn(
inputPlaceholder: '请输入你的问题,并寻求解答...',
attachmentButtonAccessibilityLabel: '继续',
emptyChatPlaceholder: '暂无聊天信息',
sendButtonAccessibilityLabel: '发送'),
onSendPressed: controller.sendMessage, user: _user,
),
))
body: Container(
width: double.infinity,
height: double.infinity,
padding: EdgeInsets.symmetric(horizontal: 0),
decoration: BoxDecoration(
image: DecorationImage(
image: Image.asset("assets/images/bg.png").image,
fit: BoxFit.cover),
),
child: DashChat(
currentUser: _user,
onSend: c.sendMessage,
messages: c.state.messageList,
),
// Column(children: [
// ]),
// Chat(
// // onAttachmentPressed: _handleAttachmentPressed,
// // bubbleBuilder: _bubbleBuilder,
// theme: const DefaultChatTheme(
// // #1e1c39//#1e1c39#1e1c39#1e1c39
// // rgba(30, 28, 57, 1.00)
// backgroundColor: Color.fromRGBO(30, 28, 57, 0),
// // inputBackgroundColor: Colors.red,
// ),
// messages: controller.state.messageList.value,
// // messages: controller.state.messageList,
// // onAttachmentPressed: _handleAttachmentPressed,
// // onMessageTap: _handleMessageTap,
// // onPreviewDataFetched: _handlePreviewDataFetched,
// // onSendPressed: _handleSendPressed,
// showUserAvatars: true,
// showUserNames: true,
// // UserStore.to.isLogin
// // user: _user,
// l10n: const ChatL10nEn(
// inputPlaceholder: '请输入你的问题,并寻求解答...',
// attachmentButtonAccessibilityLabel: '继续',
// emptyChatPlaceholder: '暂无聊天信息',
// sendButtonAccessibilityLabel: '发送'),
// onSendPressed: controller.sendMessage, user: _user,
// ),
)
// Obx(() => )),
);
));
}
}
final _user = const types.User(
id: '82091008-a4aa-4a89-ae75-a22bf8d6f3aa',
ChatUser _user = ChatUser(
id: '1',
// firstName: 'Charles',
// lastName: 'Leclerc',
);
import 'package:chart/common/apis/apis.dart';
import 'package:chart/common/store/user.dart';
// import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:share_plus/share_plus.dart';
import 'package:get/get.dart';
import 'index.dart';
......@@ -13,6 +17,9 @@ class ProductController extends GetxController {
late final List<String> initDataList;
TextEditingController controller1 = TextEditingController();
TextEditingController controller2 = TextEditingController();
/// 成员变量
/// 事件
......@@ -25,12 +32,21 @@ class ProductController extends GetxController {
);
}
_initFluwx() async {
// await registerWxApi(
// appId: "wx09198480b400500e",
// doOnAndroid: true,
// doOnIOS: true,
// universalLink: "https://com.eallcn.wasp/");
}
/// 生命周期
///在 widget 内存中分配后立即调用。
///你可以用它来为控制器初始化 initialize 一些东西。
@override
void onInit() {
_initFluwx();
super.onInit();
initDataList = ["321321", '321321'];
......@@ -38,14 +54,58 @@ class ProductController extends GetxController {
// 初始静态数据
}
void handleGenText(String text) async {
try {
// var a =
String result = await NewsAPI.sendMessage(
{"question": text, "id": "${UserStore.to.profile.id}"});
share() async {
final a =
state.messageQueenItemQueen.map((element) => element.text).join("");
await Share.share(
a,
// sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size,
);
}
clearState() {
state.genText = '';
state.messageQueenItemQueen.clear();
}
state.genText = result;
} catch (e) {}
void handleGenText() async {
final params = Get.parameters;
if (controller1.text.isNotEmpty) {
// 包含${controller2.text}的${params['title']}
String str = "帮我写一篇${params['firstLabel']}${controller1.text}";
String str1 =
"${controller2.text.isEmpty ? '' : '${params['lastLabel']}包含${controller2.text}'}";
String str3 = "的${params['title']}";
print(str + str1 + str3);
try {
// GetX.pop.pop()
Get.back();
state.loading = true;
EasyLoading.show(status: "AI正在生成中。。。");
String result = await NewsAPI.sendMessage({
"question": str + str1 + str3,
"id": "${UserStore.to.profile.id}"
});
// state.genText = result;
state.messageQueenItemQueen.add(MessageQueenItem(
text: result.replaceAll('\n\n', ''),
isFinish: false,
isWhiteIng: true));
state.isWhite = true;
state.loading = false;
EasyLoading.dismiss();
} catch (e) {
state.loading = false;
}
// print("$str");
} else {
Get.snackbar("错误提示", "您的问题还没有填完", colorText: Colors.white);
}
}
///在 onInit() 之后调用 1 帧。这是进入的理想场所
......@@ -53,10 +113,68 @@ class ProductController extends GetxController {
///async 异步请求。
@override
void onReady() {
// showModal();
// _buildInputForm();
super.onReady();
// async 拉取数据
}
showModal() {
print("awaitawaitawaitawaitawaitawaitawait");
// Share.share('Text I wish to share');
Get.bottomSheet(FormWidget());
// useRootNavigator: false,
// // backgroundColor: Colors.white,
// shape: const RoundedRectangleBorder(
// borderRadius: BorderRadius.only(
// topLeft: Radius.circular(30), topRight: Radius.circular(30)))
// //
// // borderRadius: BorderRadius.all(Radius.circular(30))),,
// );
}
handleNextText() async {
final a =
state.messageQueenItemQueen.map((element) => element.text).join("");
String str = a + '\n\n' + "继续";
state.loading = true;
EasyLoading.show(status: "AI正在生成中。。。");
String result = await NewsAPI.sendMessage(
{"question": str, "id": "${UserStore.to.profile.id}"});
state.loading = false;
state.isWhite = true;
state.messageQueenItemQueen.forEach((element) {
element.isFinish = false;
});
EasyLoading.dismiss();
state.messageQueenItemQueen
.add(MessageQueenItem(text: result, isFinish: false, isWhiteIng: true));
}
handleFinished() {
state.isWhite = false;
// for (int i = 0; i < state.messageQueenItemQueen.length; i++) {
// if (i == index) {
// state.messageQueenItemQueen[i].isWhiteIng = false;
// } else {
// state.messageQueenItemQueen[i].isWhiteIng = true;
// }
// }
// element.isFinish = true;
// state.messageQueenItemQueen[index].isFinish = true;
// state.messageQueenItemQueen.forEach((element) {
// if (element.text != null && element!.text!.contains(element1.text!)) {
// element.isFinish = true;
// }
// });
// print(element);
}
///在 [onDelete] 方法之前调用。 [onClose] 可能用于
///处理控制器使用的资源。就像 closing events 一样,
///或在控制器销毁之前的流。
......@@ -73,6 +191,7 @@ class ProductController extends GetxController {
///dispose 释放内存
@override
void dispose() {
print("disposing");
super.dispose();
// dispose 释放对象
}
......
......@@ -4,3 +4,4 @@ export './state.dart';
export './controller.dart';
export './bindings.dart';
export './view.dart';
export './widgets/widgets.dart';
import 'dart:ffi';
import 'package:get/get.dart';
class ProductState {
// title
final _title = "创作".obs;
set title(value) => this._title.value = value;
get title => this._title.value;
set title(value) => _title.value = value;
get title => _title.value;
final _genText = "".obs;
set genText(value) => this._genText.value = value;
get genText => this._genText.value;
get genText => _genText.value;
final _showModal = false.obs;
set showModal(value) => _showModal.value = value;
get showModal => _showModal.value;
final _loading = false.obs;
set loading(value) => _loading.value = value;
get loading => _loading.value;
final _isWhite = false.obs;
set isWhite(value) => _isWhite.value = value;
get isWhite => _isWhite.value;
RxList<MessageQueenItem> messageQueenItemQueen = <MessageQueenItem>[].obs;
}
class MessageQueenItem {
String? text;
bool isFinish;
bool isWhiteIng;
MessageQueenItem(
{this.text, required this.isFinish, required this.isWhiteIng});
}
import 'dart:convert';
import 'package:glassy/glassy_button.dart';
import 'package:glassy/glassy_card.dart';
import 'package:animated_text_kit/animated_text_kit.dart';
import 'package:chart/common/routers/routes.dart';
import 'package:chart/common/values/values.dart';
import 'package:chart/common/widgets/widgets.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:glassmorphism/glassmorphism.dart';
import 'package:url_launcher/url_launcher.dart';
import 'index.dart';
import 'widgets/widgets.dart';
......@@ -17,101 +21,6 @@ class ProductPage extends GetView<ProductController> {
// return HellowordWidget();
// }
// email的控制器
final TextEditingController emailController = TextEditingController();
// 密码的控制器
final TextEditingController passController = TextEditingController();
Widget _buildInputForm(Map<String, String> params) {
// var str = list['0'];
// list = json.decode(list);
ProductController c = Get.find();
return Container(
width: double.infinity,
// height: 164,
margin: EdgeInsets.only(top: 20.h),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"${params['firstLabel']} :",
style: TextStyle(
// rgba(94, 94, 94, 1.00)
fontSize: 16,
// fontWeight: FontWeight.bold,
height: 1.5,
textBaseline: TextBaseline.alphabetic,
color: Color.fromRGBO(94, 94, 94, 1)),
),
inputTextEdit(
controller: emailController,
keyboardType: TextInputType.text,
hintText: "${params['firstValue']}",
marginTop: 0,
// autofocus: true,
),
Text(
"${params['lastLabel']} :",
style: TextStyle(
// rgba(94, 94, 94, 1.00)
fontSize: 16,
// fontWeight: FontWeight.bold,
height: 1,
color: Color.fromRGBO(94, 94, 94, 1)),
),
// password input
inputTextEdit(
controller: passController,
keyboardType: TextInputType.text,
hintText: "${params['lastValue']}",
// isPassword: true,
),
// 注册、登录 横向布局
Container(
height: 44.h,
margin: EdgeInsets.only(top: 15.h),
child: btnFlatButtonWidget(
onPressed: () {
if (emailController.text.isNotEmpty &&
passController.text.isNotEmpty) {
String str =
"帮我写一篇${params['firstLabel']}${emailController.text} ${params['lastLabel']}包含${passController.text}${params['title']}";
c.handleGenText(str);
print("$str");
} else {
Get.snackbar("错误提示", "您的问题还没有填完", colorText: Colors.white);
}
},
gbColor: AppColors.primaryElement,
title: "生成",
),
),
// Spacer(),
// Fogot password
// Padding(
// padding: EdgeInsets.only(top: 8.0),
// child: TextButton(
// onPressed: controller.handleFogotPassword,
// child: Text(
// "Fogot password?",
// textAlign: TextAlign.center,
// style: TextStyle(
// color: AppColors.secondaryElementText,
// fontFamily: "Avenir",
// fontWeight: FontWeight.w400,
// fontSize: 16.sp,
// height: 1, // 设置下行高,否则字体下沉
// ),
// ),
// ),
// ),
],
),
);
}
@override
Widget build(BuildContext context) {
......@@ -148,53 +57,153 @@ class ProductPage extends GetView<ProductController> {
// Get.back();
// Get.offAll(ApplicationPage());
// await Get.off(ApplicationPage());
c.state.genText = '';
Get.back();
// Get.toNamed(AppRoutes.Application);
// Navigator.of(context).pop();
//_nextPage(-1);
},
)),
body: SingleChildScrollView(
child: Container(
padding: EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"创作",
style: TextStyle(
fontSize: 16, fontWeight: FontWeight.bold, height: 1),
),
Text(
"您选择的模板是:",
style: TextStyle(
fontSize: 16, fontWeight: FontWeight.bold, height: 2),
),
Text(
'${title}',
style: TextStyle(
// rgba(94, 94, 94, 1.00)
fontSize: 16,
// fontWeight: FontWeight.bold,
height: 2,
color: Color.fromRGBO(94, 94, 94, 1)),
),
Text(
"您可以告诉闪文您想写的内容,例如:",
style: TextStyle(
fontSize: 16, fontWeight: FontWeight.bold, height: 2),
),
_buildInputForm({
"firstLabel": firstLabel,
"firstValue": firstValue,
"lastLabel": lastLabel,
"lastValue": lastValue,
"title": title,
}),
Text("${c.state.genText}")
],
)))
body: Container(
width: double.infinity,
height: double.infinity,
padding: EdgeInsets.symmetric(horizontal: 16),
decoration: BoxDecoration(
image: DecorationImage(
image: Image.asset("assets/images/bg.png").image,
fit: BoxFit.cover),
),
child: ListView(children: [
Container(
padding: EdgeInsets.only(top: 16),
// color: Colors.white,
child: Obx(
() => c.state.messageQueenItemQueen.isEmpty
? SizedBox.shrink()
: GlassyCard(
child: Container(
padding: EdgeInsets.only(
top: 16, left: 16, right: 16, bottom: 16),
// color: Colors.pink,
child: _genText()),
),
),
),
SizedBox(
height: 10,
),
Row(
children: c.state.loading
? []
: [
c.state.isWhite
? SizedBox.shrink()
: Expanded(
child: GlassyButton(
onPressed: c.state.messageQueenItemQueen.isEmpty
? c.showModal
: c.handleNextText,
child: Text(
"${c.state.messageQueenItemQueen.isEmpty ? '编辑模版' : '继续'}"),
),
),
c.state.messageQueenItemQueen.isEmpty || c.state.isWhite
? SizedBox.shrink()
: SizedBox(
width: 18,
),
c.state.messageQueenItemQueen.isEmpty
? SizedBox.shrink()
: Expanded(
// //
child: GlassyButton(
onPressed: () async {
c.share();
// final Uri _url = Uri.parse('weixin://');
// await launchUrl(_url);
},
child: const Text("分享"),
),
),
],
)
// ElevatedButton(
// child: Text("继续"),
// onPressed: () {
// },
// ),
// ElevatedButton(
// child: Text("分享"),
// onPressed: () {
// c.share();
// },
// )
]),
)
// body: _buildView(),
));
}
_genText() {
final c = Get.find<ProductController>();
// c.state.loading
return Obx(() => Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
...c.state.messageQueenItemQueen.map((idx) {
final text = idx.isWhiteIng
? AnimatedTextKit(
onFinished: () => {c.handleFinished()},
totalRepeatCount: 1,
animatedTexts: [
TypewriterAnimatedText(
"${idx.text}",
speed: const Duration(milliseconds: 100),
textStyle: TextStyle(
fontSize: 18,
color: Colors.white,
fontWeight: FontWeight.bold),
)
],
)
: Text(
"${idx.text}",
style: TextStyle(
fontSize: 18,
color: Colors.white,
fontWeight: FontWeight.bold),
);
return text;
}).toList(),
],
));
}
}
// AnimatedTextKit(
// onFinished: () => {},
// totalRepeatCount: 1,
// animatedTexts: identical(message.status, Status.sending)
// ? [
// TypewriterAnimatedText('正在思考中......'),
// TypewriterAnimatedText('正在使劲思考中......'),
// TypewriterAnimatedText('正在拼命思考中......'),
// TypewriterAnimatedText('您的问题太有深度,请稍等......'),
// ]
// : [
// TypewriterAnimatedText(
// message.text,
// speed: const Duration(milliseconds: 100),
// )
// ],
// )
// child: Column(
// children: [
// ,
// // FormWidget(),
// ],
// ),
import 'package:chart/common/values/values.dart';
import 'package:chart/common/widgets/widgets.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import '../index.dart';
/// hellowrod
class HellowordWidget extends GetView<ProductController> {
class FormWidget extends GetView<ProductController> {
final TextEditingController emailController = TextEditingController();
// // 密码的控制器
final TextEditingController passController = TextEditingController();
// var str = list['0'];
// list = json.decode(list);
ProductController c = Get.find();
final params = Get.parameters;
// final title = Get.parameters['title'] as String;
// final firstValue = Get.parameters['firstValue'] as String;
// final firstLabel = Get.parameters['firstLabel'] as String;
// final lastValue = Get.parameters['lastValue'] as String;
// final lastLabel = Get.parameters['lastLabel'] as String;
// // backgroundColor: Colors.white,
// shape: const RoundedRectangleBorder(
// borderRadius: BorderRadius.only(
// topLeft: Radius.circular(30), topRight: Radius.circular(30)))
// //
// // borderRadius: BorderRadius.all(Radius.circular(30))),,
// );
@override
Widget build(BuildContext context) {
var count = 0.obs;
// ProductController c = Get.put(ProductController());
// ProductController c = Get.put(ProductController());
// initDataList
return Obx(() => Text("$count"));
// ProductController c = Get.put(ProductController());
// return
// ignore: unnecessary_null_comparison
// Obx(() => controller.state == null ? Container() : Container());
// Center(
// child: Obx(() => Text("controller.state.title")),
// );
return Obx(() => GestureDetector(
behavior: HitTestBehavior.translucent,
onTap: () {
FocusScope.of(context).requestFocus(FocusNode());
},
child: Container(
height: MediaQuery.of(context).size.height * 0.8,
padding: EdgeInsets.only(
top: 20,
left: 16,
right: 16,
),
//
decoration: new BoxDecoration(
// border:
// new Border.all(color: Color(0xFFFF0000), width: 0.5), // 边色与边宽度
color: Colors.white, // 底色
// borderRadius: new BorderRadius.circular((20.0)), // 圆角度
borderRadius: BorderRadius.only(
topLeft: Radius.circular(30), topRight: Radius.circular(30)),
),
child: ListView(children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"${c.state.title}${params['title']}",
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
),
),
Text(
"您可以告诉您想写的内容,例如:",
style: TextStyle(
fontSize: 14, fontWeight: FontWeight.bold, height: 2),
),
SizedBox(
height: 20,
),
TextField(
controller: c.controller1,
textInputAction: TextInputAction.next,
keyboardType: TextInputType.text,
decoration: InputDecoration(
labelText:
"${params['firstLabel']}${params['firstValue']}",
border: OutlineInputBorder(
///设置边框四个角的弧度
borderRadius: BorderRadius.all(Radius.circular(10)),
///用来配置边框的样式
borderSide: BorderSide(
///设置边框的颜色
// color: Colors.red,
///设置边框的粗细
width: 2.0,
),
),
// labelStyle: TextStyle(color: Color(0xFF898E92)),
// enabledBorder: InputBorder.none,
// focusedBorder: InputBorder.none,
),
),
SizedBox(
height: 30,
),
TextField(
controller: c.controller2,
textInputAction: TextInputAction.next,
keyboardType: TextInputType.text,
decoration: InputDecoration(
labelText:
"${params['lastLabel']}${params['lastValue']}",
border: OutlineInputBorder(
///设置边框四个角的弧度
borderRadius: BorderRadius.all(Radius.circular(10)),
///用来配置边框的样式
borderSide: BorderSide(
///设置边框的颜色
// color: Colors.red,
///设置边框的粗细
width: 2.0,
),
),
// labelStyle: TextStyle(color: Color(0xFF898E92)),
// enabledBorder: InputBorder.none,
// focusedBorder: InputBorder.none,
)),
// TextFormField(
// // controller: logic.mobileMemberController,
// // inputFormatters: <TextInputFormatter>[
// // LengthLimitingTextInputFormatter(11)
// // ],
// textInputAction: TextInputAction.next,
// keyboardType: TextInputType.text,
// decoration: InputDecoration(
// labelText:
// "请输入${params['firstLabel']},${params['firstValue']}",
// labelStyle: TextStyle(color: Color(0xFF898E92)),
// enabledBorder: InputBorder.none,
// focusedBorder: InputBorder.none,
// )
// ),
Container(
margin: EdgeInsets.only(
top: 20,
),
width: double.infinity,
child: btnFlatButtonWidget(
onPressed: () {
c.handleGenText();
},
gbColor: AppColors.primaryElement,
title: "创作",
),
),
// Text("${c.state.title}",)
// Container(
// padding: EdgeInsets.all(16),
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Text(
// "创作",
// style: TextStyle(
// fontSize: 16,
// fontWeight: FontWeight.bold,
// height: 1),
// ),
// FormWidget(),
// // _buildInputForm({
// // "firstLabel": firstLabel,
// // "firstValue": firstValue,
// // "lastLabel": lastLabel,
// // "lastValue": lastValue,
// // "title": title,
// // }),
// Text("${c.state.genText}")
// ],
// )),
// Container(
// width: double.infinity,
// // height: 164,
// margin: EdgeInsets.only(top: 20.h),
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Text(
// "${params['firstLabel']} :",
// style: TextStyle(
// // rgba(94, 94, 94, 1.00)
// fontSize: 16,
// // fontWeight: FontWeight.bold,
// height: 1.5,
// textBaseline: TextBaseline.alphabetic,
// color: Color.fromRGBO(94, 94, 94, 1)),
// ),
// inputTextEdit(
// controller: emailController,
// keyboardType: TextInputType.text,
// hintText: "${params['firstValue']}",
// marginTop: 0,
// // autofocus: true,
// ),
// Text(
// "${params['lastLabel']} :",
// style: TextStyle(
// // rgba(94, 94, 94, 1.00)
// fontSize: 16,
// // fontWeight: FontWeight.bold,
// height: 1,
// color: Color.fromRGBO(94, 94, 94, 1)),
// ),
// // password input
// inputTextEdit(
// controller: passController,
// keyboardType: TextInputType.text,
// hintText: "${params['lastValue']}",
// // isPassword: true,
// ),
// // 注册、登录 横向布局
// Container(
// height: 44.h,
// margin: EdgeInsets.only(top: 15.h),
// child: btnFlatButtonWidget(
// onPressed: () {
// if (emailController.text.isNotEmpty &&
// passController.text.isNotEmpty) {
// String str =
// "帮我写一篇${params['firstLabel']}是${emailController.text} ${params['lastLabel']}包含${passController.text}的${params['title']}";
// c.handleGenText(str);
// print("$str");
// } else {
// Get.snackbar("错误提示", "您的问题还没有填完",
// colorText: Colors.white);
// }
// },
// gbColor: AppColors.primaryElement,
// title: "生成",
// ),
// ),
// ],
// ),
// ),
],
)
]),
// color: Colors.white,
)));
}
}
// Widget _buildInputForm(Map<String, String> params) {
// return ;
// }
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:chart/common/apis/apis.dart';
import 'package:chart/common/entities/entities.dart';
......@@ -5,8 +7,12 @@ import 'package:chart/common/routers/routes.dart';
import 'package:chart/common/store/store.dart';
import 'package:chart/common/utils/utils.dart';
import 'package:chart/common/widgets/widgets.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
// import 'package:fluttertoast/fluttertoast.dart';
import 'package:get/get.dart';
import '../../../entity/login_entity.dart';
import '../../../entity/user_entity.dart';
import 'index.dart';
class SignInController extends GetxController {
......@@ -14,6 +20,26 @@ class SignInController extends GetxController {
SignInController();
RxBool showClear = false.obs;
RxBool codeEnable = false.obs;
RxBool checkBox = false.obs;
RxBool loginBtnEable = false.obs;
/// 倒计时的计时器。
late Timer _timer;
/// 当前倒计时的秒数。
late int _seconds = 60;
late bool needRestTime;
RxString verifyStr = '获取验证码'.obs;
TextEditingController mobileMemberController = TextEditingController();
TextEditingController codeController = TextEditingController();
final formKey = GlobalKey<FormState>();
late String identifierForVendor;
// ----------------------------------------------------------------
// email的控制器
final TextEditingController emailController = TextEditingController();
// 密码的控制器
......@@ -34,31 +60,165 @@ class SignInController extends GetxController {
// 执行登录操作
handleSignIn() async {
// if (!duIsEmail(_emailController.value.text)) {
// toastInfo(msg: '请正确输入邮件');
// return;
// }
// if (!duCheckStringLength(_passController.value.text, 6)) {
// toastInfo(msg: '密码不能小于6位');
// return;
// }
if (codeController.text.length < 5) {
EasyLoading.showToast("验证码输入有误");
return;
}
EasyLoading.show(status: '登录中...');
// Map<String, dynamic> routeParams =
// ModalRoute.of(context)!.settings?.arguments as Map<String, dynamic>;
UserLoginRequestEntity params = UserLoginRequestEntity(
email: emailController.value.text,
password: duSHA256(passController.value.text),
);
try {
LoginEntity? res = await UserAPI.login({
"smsCode": codeController.text,
"phone": mobileMemberController.text,
// "id": UserStore.to.profile.id,
});
UserLoginResponseEntity userProfile = await UserAPI.login(
params: params,
);
if (res?.token != null) {
UserStore.to.handleLogin(res);
EasyLoading.showSuccess("登录成功!");
// Navigator.of(context).pushNamed('/');
} else {
EasyLoading.showError("登录失败");
}
EasyLoading.dismiss();
} catch (e) {
EasyLoading.showError("登录失败");
EasyLoading.dismiss();
}
// UserLoginRequestEntity params = UserLoginRequestEntity(
// email: emailController.value.text,
// password: duSHA256(passController.value.text),
// );
// UserLoginResponseEntity userProfile = await UserAPI.login(
// params: params,
// );
// UserStore.to.saveProfile(userProfile);
Get.offAndToNamed(AppRoutes.Application);
// Get.offAndToNamed(AppRoutes.Application);
}
Future<void> initPlatformState() async {
// DeviceInfoPlugin deviceInfoPlugin = DeviceInfoPlugin();
// if (Platform.isIOS) {
// IosDeviceInfo iosDeviceInfo = await deviceInfoPlugin.iosInfo;
// identifierForVendor = iosDeviceInfo.identifierForVendor;
// }
}
setLoginBtnStatus() {
if (mobileMemberController.text.length >= 3) {
loginBtnEable.value = true;
} else {
loginBtnEable.value = false;
}
}
clearField() {
showClear.value = false;
mobileMemberController.clear();
}
checkArgement() {
checkBox.value = !checkBox.value;
}
/// 取消倒计时的计时器。
void _cancelTimer() {
_timer.cancel();
}
/// 启动倒计时的计时器。
void startTimer() {
// 计时器(`Timer`)组件的定期(`periodic`)构造函数,创建一个新的重复计时器。
_timer = Timer.periodic(Duration(seconds: 1), (timer) {
if (_seconds == 0) {
_cancelTimer();
_seconds = 60;
verifyStr.value = '重新发送';
codeEnable.value = true;
return;
}
_seconds--;
verifyStr.value = '已发送$_seconds' + 's';
codeEnable.value = false;
});
}
chageCodeStatus() async {
if (codeEnable.value) {
EasyLoading.show(status: "发送验证码中");
MsmEntity? res =
await UserAPI.sendSms({"phone": mobileMemberController.text});
EasyLoading.dismiss();
if (res.status == 200) {
EasyLoading.showToast('验证码发送成功,请注意查收');
startTimer();
} else {
EasyLoading.showToast(res.message);
}
// MsmEntity? res = await UserService().sendSms({"phone": phone});
} else if (!chinaPhoneNumber(mobileMemberController.text)) {
EasyLoading.showToast("手机号输入有误");
// EasyLoading.show(status: "手机号输入有误");
} else {
EasyLoading.showToast("验证码已发送");
}
}
bool chinaPhoneNumber(String input) {
String regexPhoneNumber =
"^((13[0-9])|(15[^4])|(166)|(17[0-8])|(18[0-9])|(19[8-9])|(147,145))\\d{8}\$";
return RegExp(regexPhoneNumber).hasMatch(input);
}
loginClick() async {
if (!loginBtnEable.value) return;
print(identifierForVendor);
// Fluttertoast.showToast(
// msg: '登录中',
// gravity: ToastGravity.CENTER,
// toastLength: Toast.LENGTH_LONG);
try {
// var response = await Dio().post('', data: {
// 'token': mobileMemberController.text,
// 'imei': identifierForVendor
// });
// Map<String, dynamic> data = response.data;
// if (data["code"] == 200) {
// // StorageManager.sharedPreferences.setString(
// // StorageManager.access_token, mobileMemberController.text);
// // UserModel userModel = UserModel.fromJson(data["data"]);
// // StorageManager.localStorage
// // .setItem(StorageManager.access_user, userModel);
// // Get.offNamed(Routes.MAIN);
// } else {
// Fluttertoast.showToast(msg: '登录失败');
// }
} catch (e) {
// Fluttertoast.showToast(msg: '登录失败');
}
}
@override
void onReady() {
super.onReady();
mobileMemberController.addListener(() {
showClear.value = mobileMemberController.text.isNotEmpty;
codeEnable.value = chinaPhoneNumber(mobileMemberController.text);
setLoginBtnStatus();
});
codeController.addListener(() {
setLoginBtnStatus();
});
initPlatformState();
}
@override
......
import 'package:flutter/material.dart';
import 'package:chart/common/values/values.dart';
import 'package:chart/common/widgets/widgets.dart';
import 'package:flutter/services.dart';
// import 'package:flutter_icons/flutter_icons.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
......@@ -52,7 +54,7 @@ class SignInPage extends GetView<SignInController> {
Container(
margin: EdgeInsets.only(top: 15.h),
child: Text(
"SECTOR",
"AI助理",
textAlign: TextAlign.center,
style: TextStyle(
color: AppColors.primaryText,
......@@ -64,7 +66,7 @@ class SignInPage extends GetView<SignInController> {
),
),
Text(
"news",
"AI助理",
textAlign: TextAlign.center,
style: TextStyle(
color: AppColors.primaryText,
......@@ -89,40 +91,71 @@ class SignInPage extends GetView<SignInController> {
children: [
// email input
inputTextEdit(
controller: controller.emailController,
keyboardType: TextInputType.emailAddress,
hintText: "Email",
controller: controller.mobileMemberController,
keyboardType: TextInputType.phone,
hintText: "手机号",
marginTop: 0,
// autofocus: true,
),
// password input
inputTextEdit(
controller: controller.passController,
keyboardType: TextInputType.visiblePassword,
hintText: "Password",
isPassword: true,
controller: controller.codeController,
keyboardType: TextInputType.number,
hintText: "验证码",
suffixIcon: InkWell(
onTap: () => controller.chageCodeStatus(),
child: Obx(() => Container(
// height: 20,
width: 100,
// padding: EdgeInsets.all(5.0),
decoration: BoxDecoration(
// color: Colors.red,
// border: Border.all(
// color: controller.codeEnable.value
// ? Color(0xFF0165B8)
// : Colors.white),
),
child: Center(
child: Text(
controller.verifyStr.value,
style: TextStyle(
color: controller.codeEnable.value
? Color(0xFF0165B8)
: Color(0xFFACB1B6)),
)),
)),
),
// isPassword: true,
),
// TextFormField(
// controller: controller.mobileMemberController,
// inputFormatters: <TextInputFormatter>[
// LengthLimitingTextInputFormatter(11)
// ],
// textInputAction: TextInputAction.next,
// keyboardType: TextInputType.number,
// decoration: InputDecoration(
// labelText: '请输入手机号',
// labelStyle: TextStyle(color: Color(0xFF898E92)),
// enabledBorder: InputBorder.none,
// focusedBorder: InputBorder.none,
// suffixIcon: Obx(() => Visibility(
// visible: controller.showClear.value,
// child: IconButton(
// icon: Icon(
// Icons.add,
// color: Color(0xFFCBD0D4),
// ),
// onPressed: controller.clearField))))),
// 注册、登录 横向布局
Container(
height: 44.h,
margin: EdgeInsets.only(top: 15.h),
child: Row(
children: [
// 注册
btnFlatButtonWidget(
onPressed: controller.handleNavSignUp,
gbColor: AppColors.thirdElement,
title: "Sign up",
),
Spacer(),
// 登录
btnFlatButtonWidget(
onPressed: controller.handleSignIn,
gbColor: AppColors.primaryElement,
title: "Sign in",
),
],
child: btnFlatButtonWidget(
onPressed: controller.handleSignIn,
gbColor: AppColors.primaryElement,
title: "登录",
),
),
// Spacer(),
......@@ -133,7 +166,7 @@ class SignInPage extends GetView<SignInController> {
child: TextButton(
onPressed: controller.handleFogotPassword,
child: Text(
"Fogot password?",
"忘记密码",
textAlign: TextAlign.center,
style: TextStyle(
color: AppColors.secondaryElementText,
......@@ -225,7 +258,7 @@ class SignInPage extends GetView<SignInController> {
_buildInputForm(),
Spacer(),
_buildThirdPartyLogin(),
_buildSignupButton(),
// _buildSignupButton(),
],
),
),
......
import 'package:chart/common/apis/apis.dart';
import 'package:chart/common/entities/classFyDetail.dart';
import 'package:chart/common/entities/entities.dart';
import 'package:chart/common/routers/routes.dart';
import 'package:chart/entity/plan_entity.dart';
import 'package:chart/pages/template/index.dart';
import 'package:get/get.dart';
import '../../common/services/storage.dart';
......@@ -21,6 +23,12 @@ class MainController extends GetxController {
/// 方法
///
handleToTemplate(int id) {
Get.toNamed(AppRoutes.TEMPLATE_PAGE);
TemplateController.to.handleSetActId(id);
}
// 拉取数据
asyncLoadAllData() async {
state.categories = await NewsAPI.categories(
......@@ -42,10 +50,10 @@ class MainController extends GetxController {
asyncLoadBannerData() async {
final token = StorageService.to.getString(STORAGE_USER_TOKEN_KEY);
if (token.isEmpty) {
IntegralEntity userInfo = await UserAPI.getUserIntegral();
await UserStore.to.getUserInfo(userInfo);
}
// if (token.isEmpty) {
IntegralEntity userInfo = await UserAPI.getUserIntegral();
await UserStore.to.getUserInfo(userInfo);
// }
List<MessageEntity>? list = await NewsAPI.bannerList();
......
......@@ -48,7 +48,7 @@ class DoctorAppBar extends StatelessWidget {
SizedBox(height: 30),
// ignore: prefer_const_constructors
Text(
"欢迎使用GPT大师傅,你可以收获很多",
"欢迎使用AI写作大师,你可以收获很多",
style: TextStyle(color: Colors.white, fontSize: 12),
),
],
......
import 'package:chart/common/routers/routes.dart';
import 'package:chart/entity/plan_entity.dart';
import 'package:flutter/material.dart';
import 'package:flutter_rating_bar/flutter_rating_bar.dart';
......@@ -35,136 +36,145 @@ class BannerPageWidget extends GetView<MainController> {
},
itemCount: controller.state.bannerPage!.length,
itemBuilder: (_, index) {
return Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(16),
),
margin:
EdgeInsets.symmetric(horizontal: 10, vertical: 4),
child: GlassmorphicContainer(
borderRadius: 16,
padding: EdgeInsets.only(bottom: 16),
blur: 14,
alignment: Alignment.bottomCenter,
border: 2,
linearGradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
Color(0xFF0FFFF).withOpacity(0.2),
Color(0xFF0FFFF).withOpacity(0.2),
],
),
borderGradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
Color(0xFF0FFFF).withOpacity(1),
Color(0xFFFFFFF),
Color(0xFF0FFFF).withOpacity(1),
],
return InkWell(
onTap: () => {
controller.handleToTemplate(
controller.state.bannerPage![index].id)
},
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(16),
),
height: 270,
width: double.infinity,
child: Column(
children: [
Row(
children: [
Expanded(
// width: double.infinity,
// height: 400,
child: Stack(
children: [
Container(
width: 300,
height: 130,
padding: EdgeInsets.only(top: 16),
child: Image.asset(
doctorsList[index].image,
fit: BoxFit.contain,
width: double.infinity,
height: double.infinity,
margin:
EdgeInsets.symmetric(horizontal: 10, vertical: 4),
child: GlassmorphicContainer(
borderRadius: 16,
padding: EdgeInsets.only(bottom: 16),
blur: 14,
alignment: Alignment.bottomCenter,
border: 2,
linearGradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
Color(0xFF0FFFF).withOpacity(0.2),
Color(0xFF0FFFF).withOpacity(0.2),
],
),
borderGradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
Color(0xFF0FFFF).withOpacity(1),
Color(0xFFFFFFF),
Color(0xFF0FFFF).withOpacity(1),
],
),
height: 270,
width: double.infinity,
child: Column(
children: [
Row(
children: [
Expanded(
// width: double.infinity,
// height: 400,
child: Stack(
children: [
Container(
width: 300,
height: 130,
padding: EdgeInsets.only(top: 16),
child: Image.asset(
doctorsList[index].image,
fit: BoxFit.contain,
width: double.infinity,
height: double.infinity,
),
),
),
],
],
),
),
),
// SizedBox(width: 40)
],
),
Container(
// ignore: prefer_const_constructors
decoration: BoxDecoration(
// circular(24)
borderRadius: const BorderRadius.only(
bottomLeft: Radius.circular(16),
bottomRight: Radius.circular(16),
// SizedBox(width: 40)
],
),
Container(
// ignore: prefer_const_constructors
decoration: BoxDecoration(
// circular(24)
borderRadius: const BorderRadius.only(
bottomLeft: Radius.circular(16),
bottomRight: Radius.circular(16),
),
// color: Colors.white,
),
//
// color: Colors.white,
),
//
// color: Colors.white,
height: 132,
child: Padding(
padding: EdgeInsets.symmetric(
vertical: 20, horizontal: 20),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(
controller.state.bannerPage![index]
.classifyName,
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.white,
fontSize: 24),
),
SizedBox(height: 5),
Text(
controller.state.bannerPage![index]
.classifyDesc,
style: TextStyle(
color: Colors.white,
fontSize: 16),
),
SizedBox(height: 5),
Row(
children: [
RatingBar.builder(
unratedColor:
Colors.grey.withOpacity(0.5),
itemSize: 15,
initialRating: doctorsList[index]
.reviewScore
.toDouble(),
minRating: 0,
allowHalfRating: true,
direction: Axis.horizontal,
itemPadding: EdgeInsets.symmetric(
horizontal: 5),
itemCount: 5,
updateOnDrag: false,
itemBuilder: (context, _) => Icon(
Icons.star,
color: Colors.orange,
height: 132,
child: Padding(
padding: EdgeInsets.symmetric(
vertical: 20, horizontal: 20),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(
controller.state.bannerPage![index]
.classifyName,
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.white,
fontSize: 24),
),
SizedBox(height: 5),
Text(
controller.state.bannerPage![index]
.classifyDesc,
style: TextStyle(
color: Colors.white,
fontSize: 16),
),
SizedBox(height: 5),
Row(
children: [
RatingBar.builder(
unratedColor: Colors.grey
.withOpacity(0.5),
itemSize: 15,
initialRating:
doctorsList[index]
.reviewScore
.toDouble(),
minRating: 0,
allowHalfRating: true,
direction: Axis.horizontal,
itemPadding:
EdgeInsets.symmetric(
horizontal: 5),
itemCount: 5,
updateOnDrag: false,
itemBuilder: (context, _) =>
Icon(
Icons.star,
color: Colors.orange,
),
onRatingUpdate: (value) {},
),
onRatingUpdate: (value) {},
),
SizedBox(width: 1),
Text(
"(103个用户使用过)",
style: TextStyle(
color: Colors.white,
fontSize: 12),
)
],
),
],
),
)),
],
SizedBox(width: 1),
Text(
"(103个用户使用过)",
style: TextStyle(
color: Colors.white,
fontSize: 12),
)
],
),
],
),
)),
],
),
),
),
);
......
......@@ -41,7 +41,7 @@ class NewsCategoriesWidget extends GetView<MainController> {
SizedBox(height: 30),
// ignore: prefer_const_constructors
Text(
"欢迎使用GPT大师傅,你可以收获很多",
"欢迎使用AI写作大师,你可以收获很多",
style:
TextStyle(color: Colors.white, fontSize: 12.sp),
),
......@@ -49,7 +49,9 @@ class NewsCategoriesWidget extends GetView<MainController> {
),
GestureDetector(
onTap: () {
Get.toNamed(AppRoutes.PAY_LIST);
Get.toNamed(AppRoutes.SIGN_IN);
// AppRoutes.SIGN_IN
// Get.toNamed(AppRoutes.PAY_LIST);
},
// {Navigator.of(context).pushNamed('/pay')},
child: Container(
......
......@@ -23,6 +23,9 @@ class ListPageWidget extends GetView<MainController> {
Widget build(BuildContext context) {
final list = controller.state.bannerPageDetail;
// final controller = Get.put(ChatPageController());
final c = Get.put(ProductController());
return Obx(() => controller.state.bannerPageDetail!.isEmpty
? Container()
: Container(
......@@ -74,8 +77,8 @@ class ListPageWidget extends GetView<MainController> {
// rgba(119, 119, 119, 1.00)
Text(
// "主题:取暖器",
"${controller.state.bannerPageDetail![index].detailParamsEntityList[0]['label']}:" +
"${controller.state.bannerPageDetail![index].detailParamsEntityList[0]['placeHolder']}",
"${controller.state.bannerPageDetail![index].detailParamsEntityList[0].label}:" +
"${controller.state.bannerPageDetail![index].detailParamsEntityList[0].placeHolder}",
textAlign: TextAlign.left,
style: TextStyle(
height: 1.5,
......@@ -85,8 +88,8 @@ class ListPageWidget extends GetView<MainController> {
),
),
Text(
"${controller.state.bannerPageDetail![index].detailParamsEntityList[1]['label']}:" +
"${controller.state.bannerPageDetail![index].detailParamsEntityList[1]['placeHolder']}",
"${controller.state.bannerPageDetail![index].detailParamsEntityList[1].label}:" +
"${controller.state.bannerPageDetail![index].detailParamsEntityList[1].placeHolder}",
textAlign: TextAlign.left,
style: TextStyle(
color: Color.fromRGBO(119, 119, 119, 1),
......@@ -160,24 +163,27 @@ class ListPageWidget extends GetView<MainController> {
var firstLabel = controller
.state
.bannerPageDetail![index]
.detailParamsEntityList[0]['label'];
.detailParamsEntityList[0]
.label;
var firstValue = controller
.state
.bannerPageDetail![index]
.detailParamsEntityList[0]
['placeHolder'];
.state
.bannerPageDetail![index]
.detailParamsEntityList[0]
.placeHolder;
var lastLabel = controller
.state
.bannerPageDetail![index]
.detailParamsEntityList[1]['label'];
.detailParamsEntityList[1]
.label;
var lastValue = controller
.state
.bannerPageDetail![index]
.detailParamsEntityList[1]
['placeHolder'];
.state
.bannerPageDetail![index]
.detailParamsEntityList[1]
.placeHolder;
var title = controller.state
.bannerPageDetail![index].detailName;
Get.toNamed("${AppRoutes.PRODUCT_PAGE}",
Get.toNamed(AppRoutes.PRODUCT_PAGE,
parameters: {
"title": title,
"firstValue": firstValue,
......@@ -185,7 +191,11 @@ class ListPageWidget extends GetView<MainController> {
"lastValue": lastValue,
"lastLabel": lastLabel
});
Future.delayed(Duration(milliseconds: 100),
() {
// print("延时1秒执行");
c.showModal();
});
// "${controller.state.bannerPageDetail![index].detailParamsEntityList[1]['label']}:" +
// "${controller.state.bannerPageDetail![index].detailParamsEntityList[1]['placeHolder']}",
},
......
import 'package:chart/common/routers/routes.dart';
import 'package:chart/entity/plan_entity.dart';
import 'package:chart/pages/frame/notfound/index.dart';
import 'package:dash_chat_2/dash_chat_2.dart';
import 'package:flutter/material.dart';
import 'package:chart/common/values/values.dart';
import 'package:flutter_chat_types/flutter_chat_types.dart';
......@@ -100,10 +101,20 @@ class SiperBannerWidget extends GetView<MainController> {
child: InkWell(
onTap: () {
// message.question
ChatUser _user = ChatUser(
id: '1',
// firstName: 'Charles',
// lastName: 'Leclerc',
);
Get.toNamed(
"${AppRoutes.CHAT_PAGE}?question=${message.question}");
c.sendMessage(PartialText(text: "${message.question}"));
c.sendMessage(ChatMessage(
text: "${message.question}",
user: _user,
createdAt: DateTime.now(),
));
},
child: Row(
children: [
......
import 'package:get/get.dart';
import 'controller.dart';
class TemplateBinding implements Bindings {
@override
void dependencies() {
Get.lazyPut<TemplateController>(() => TemplateController());
}
}
import 'package:chart/common/entities/classFyDetail.dart';
import 'package:get/get.dart';
import '../../common/apis/apis.dart';
import 'index.dart';
class TemplateController extends GetxController {
TemplateController();
static TemplateController get to => Get.put(TemplateController());
final state = TemplateState();
// title
final _actId = 0.obs;
set actId(value) => _actId.value = value;
get actId => _actId.value;
// tap
void handleTap(int index) {
Get.snackbar(
"标题",
"消息",
);
}
handleSetActId(int id) {
actId = id;
}
/// 在 widget 内存中分配后立即调用。
@override
void onInit() {
ever(_actId, (value) {
// print("ever ----> $value");
_fetchSwiperItems(value);
});
super.onInit();
}
_fetchSwiperItems(int value) async {
if (!state.mapItem.containsKey(value)) {
List<ClassifyDetialEntity>? _classFyList =
await NewsAPI.classFyDetialList({"id": value});
state.mapItem[value] = _classFyList;
}
// state.mapItem.containsKey(value);
}
/// 在 onInit() 之后调用 1 帧。这是进入的理想场所
@override
void onReady() {
super.onReady();
}
/// 在 [onDelete] 方法之前调用。
@override
void onClose() {
super.onClose();
}
/// dispose 释放内存
@override
void dispose() {
super.dispose();
}
}
library template;
export './state.dart';
export './controller.dart';
export './bindings.dart';
export './view.dart';
import 'package:chart/common/entities/classFyDetail.dart';
import 'package:get/get.dart';
class TemplateState {
RxMap mapItem = Map().obs;
}
import 'package:chart/common/widgets/widgets.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:get/get_connect/sockets/src/socket_notifier.dart';
import 'index.dart';
import 'widgets/widgets.dart';
class TemplatePage extends GetView<TemplateController> {
const TemplatePage({Key? key}) : super(key: key);
// 主视图
Widget _buildView() {
return const HelloWidget();
}
@override
Widget build(BuildContext context) {
return GetBuilder<TemplateController>(
builder: (_) {
return Scaffold(
appBar: transparentAppBar(
title: const Text(
"template",
style: TextStyle(color: Colors.white),
)),
body: _buildView());
},
);
}
}
import 'package:card_swiper/card_swiper.dart';
import 'package:chart/common/entities/classFyDetail.dart';
import 'package:chart/pages/frame/product/index.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:glassmorphism/glassmorphism.dart';
import 'package:flutter_staggered_animations/flutter_staggered_animations.dart';
import '../../../common/routers/names.dart';
import '../../main/controller.dart';
import '../index.dart';
/// hello
class HelloWidget extends GetView<TemplateController> {
const HelloWidget({Key? key}) : super(key: key);
Widget _renderList(int index) {
final c = Get.find<MainController>();
final productController = Get.put(ProductController());
return GlassmorphicContainer(
width: Get.mediaQuery.size.width * 0.9,
height: Get.mediaQuery.size.height * 0.8,
// margin: EdgeInsets.only(bottom: 60),
// padding: EdgeInsets.all(20),
// ignore: sort_child_properties_last
child: Obx(() => controller.state.mapItem[controller.actId] == null
? SizedBox.shrink()
: Container(
// color: Colors.white,
padding: EdgeInsets.all(20),
child: GridView.builder(
itemCount:
controller.state.mapItem[controller.actId]!.length ?? 0,
itemBuilder: (BuildContext context, int index) {
return AnimationConfiguration.staggeredGrid(
position: index,
duration: const Duration(milliseconds: 375),
columnCount: 30,
child: SlideAnimation(
verticalOffset: 50.0,
child: FadeInAnimation(
child: Container(
// margin: EdgeInsets.all(10),
// width: 100,
// height: 100,
// color: Colors.amber,
child: GlassmorphicContainer(
width: 100,
height: 100,
borderRadius: 16,
// ignore: sort_child_properties_last
child: InkWell(
onTap: () async {
print("onTaponTaponTaponTaponTap");
// await Get.put(ProductController());
final act = controller
.state.mapItem[controller.actId]
[index] as ClassifyDetialEntity;
var firstLabel =
act.detailParamsEntityList[0].label;
var firstValue = act
.detailParamsEntityList[0].placeHolder;
var lastLabel =
act.detailParamsEntityList[1].label;
var lastValue = act
.detailParamsEntityList[1].placeHolder;
var title = act.detailName;
Get.toNamed(AppRoutes.PRODUCT_PAGE,
parameters: {
"title": title,
"firstValue": firstValue,
"firstLabel": firstLabel,
"lastValue": lastValue,
"lastLabel": lastLabel
});
Future.delayed(Duration(milliseconds: 100),
() {
// print("延时1秒执行");
productController.showModal();
});
},
child: Center(
child: Container(
// height: double.infinity,
// width: double.infinity,
// color: Colors.red,
child: Column(
mainAxisAlignment:
MainAxisAlignment.center,
children: [
Icon(
Icons.ac_unit,
color: Colors.pink,
),
// IconButton(
// padding: EdgeInsets.all(10),
// color: Colors.white,
// onPressed: () {},
// style: ButtonStyle(
// backgroundColor:
// MaterialStateProperty.all(
// Color.fromARGB(
// 255, 95, 85, 112))),
// icon: Icon(Icons.ac_unit),
// ),
// const Icon(
// Icons.ac_unit,
// color: Colors.pink,
// backgroundColor: Colors.purple,
// icons: Icons.add_alert_outlined,
// iconStyle: IconStyle(
// iconsColor: Colors.white,
// backgroundColor: Colors.purple,
// ),
// ),
Text(
"${controller.state.mapItem[controller.actId][index].detailName}",
style: TextStyle(
color: Colors.white,
),
)
],
),
),
)),
// margin: EdgeInsets.all(20),
// flex: 4,
// margin: EdgeInsets.only(top: 16),
blur: 14,
alignment: Alignment.bottomCenter,
border: 2,
linearGradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
const Color(0xFF0FFFF).withOpacity(0.2),
const Color(0xFF0FFFF).withOpacity(0.2),
],
),
borderGradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
const Color(0xFF0FFFF).withOpacity(1),
const Color(0xFFFFFFF),
const Color(0xFF0FFFF).withOpacity(1),
],
)),
)),
),
);
},
gridDelegate: SliverGridDelegateWithMaxCrossAxisExtent(
maxCrossAxisExtent: 120.0,
childAspectRatio: 1.0, //宽高比为2
mainAxisSpacing: 20,
crossAxisSpacing: 20,
)),
)),
borderRadius: 16,
blur: 14,
alignment: Alignment.bottomCenter,
border: 2,
linearGradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
const Color(0xFF0FFFF).withOpacity(0.2),
const Color(0xFF0FFFF).withOpacity(0.2),
],
),
borderGradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
const Color(0xFF0FFFF).withOpacity(1),
const Color(0xFFFFFFF),
const Color(0xFF0FFFF).withOpacity(1),
],
),
// child: ,
);
}
@override
Widget build(BuildContext context) {
MainController c = Get.put(MainController());
return Container(
height: double.infinity,
width: double.infinity,
decoration: BoxDecoration(
image: DecorationImage(
image: Image.asset("assets/images/bg.png").image,
fit: BoxFit.cover),
),
child: Obx(() => Swiper(
// scrollDirection: Axis.vertical,
// autoplay: true,
onIndexChanged: (value) =>
controller.handleSetActId(c.state.bannerPage![value].id),
itemCount: c.state.bannerPage!.length,
pagination: SwiperPagination(),
control: null,
itemBuilder: (BuildContext context, int index) {
return Align(
// width: 100,
// height: 100,
child: _renderList(index),
);
},
)),
);
// Center(
// child: Obx(() => Text(controller.state.title)),
// );
}
}
// Row(
// children: [
// GlassmorphicFlexContainer(
// borderRadius: 16,
// // margin: EdgeInsets.all(20),
// flex: 4,
// // margin: EdgeInsets.only(top: 16),
// blur: 14,
// alignment: Alignment.bottomCenter,
// border: 2,
// linearGradient: LinearGradient(
// begin: Alignment.topLeft,
// end: Alignment.bottomRight,
// colors: [
// const Color(0xFF0FFFF).withOpacity(0.2),
// const Color(0xFF0FFFF).withOpacity(0.2),
// ],
// ),
// borderGradient: LinearGradient(
// begin: Alignment.topLeft,
// end: Alignment.bottomRight,
// colors: [
// const Color(0xFF0FFFF).withOpacity(1),
// const Color(0xFFFFFFF),
// const Color(0xFF0FFFF).withOpacity(1),
// ],
// )),
// GlassmorphicFlexContainer(
// borderRadius: 16,
// margin: EdgeInsets.only(top: 16),
// blur: 14,
// alignment: Alignment.bottomCenter,
// border: 2,
// linearGradient: LinearGradient(
// begin: Alignment.topLeft,
// end: Alignment.bottomRight,
// colors: [
// const Color(0xFF0FFFF).withOpacity(0.2),
// const Color(0xFF0FFFF).withOpacity(0.2),
// ],
// ),
// borderGradient: LinearGradient(
// begin: Alignment.topLeft,
// end: Alignment.bottomRight,
// colors: [
// const Color(0xFF0FFFF).withOpacity(1),
// const Color(0xFFFFFFF),
// const Color(0xFF0FFFF).withOpacity(1),
// ],
// ))
// ],
// ),
library widgets;
export './hello.dart';
......@@ -58,7 +58,7 @@ class HomePageState extends State<ChatPage> {
late UserModel _userModel;
// late UserSubscribeModel _userSubscribeModel;
bool _isLoadingData = false;
String _appTitle = 'GPT大师傅';
String _appTitle = 'AI写作大师';
// int _loadingIndex = 0;
// ignore: prefer_final_fields
......@@ -112,7 +112,7 @@ class HomePageState extends State<ChatPage> {
// : SystemUiOverlayStyle.light,
child: Scaffold(
appBar: AppBar(
title: Text("GPT大师傅"),
title: Text("AI写作大师"),
backgroundColor: Color.fromRGBO(41, 45, 62, 1.00),
),
// SailAppBar(
......
......@@ -66,7 +66,7 @@ class HomePageState extends State<HomePage> {
// late UserSubscribeModel _userSubscribeModel;
bool _isLoadingData = false;
String _appTitle = 'GPT大师傅';
String _appTitle = 'AI写作大师';
dynamic _selectedIndex = 0;
final Connectivity _connectivity = Connectivity();
// int _loadingIndex = 0;
......
......@@ -157,7 +157,7 @@ class _MyHomePageState extends State<LoginPage> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"GPT大师傅",
"AI写作大师",
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
......
import 'package:chart/constant/app_colors.dart';
import 'package:chart/pages/dashboard/components/list.dart';
// import 'package:chart/pages/dashboard/components/list.dart';
import 'package:flutter/material.dart';
// import 'package:chart/constant/app_colors.dart';
import 'package:chart/constant/app_dimens.dart';
......
......@@ -27,7 +27,7 @@ class UserPageState extends State<UserPage> {
// TODO: implement build
print("${_userModel.isLogin}");
// appBar: AppBar(
// title: Text("GPT大师傅"),
// title: Text("AI写作大师"),
// backgroundColor: Color.fromRGBO(41, 45, 62, 1.00),
// ),
// // SailAppBar(
......
......@@ -10,6 +10,7 @@ import firebase_auth
import firebase_core
import package_info
import path_provider_foundation
import share_plus
import shared_preferences_foundation
import smart_auth
import sqflite
......@@ -21,6 +22,7 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
FLTFirebaseCorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseCorePlugin"))
FLTPackageInfoPlugin.register(with: registry.registrar(forPlugin: "FLTPackageInfoPlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
SharePlusMacosPlugin.register(with: registry.registrar(forPlugin: "SharePlusMacosPlugin"))
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
SmartAuthPlugin.register(with: registry.registrar(forPlugin: "SmartAuthPlugin"))
SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin"))
......
......@@ -190,6 +190,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.3"
dash_chat_2:
dependency: "direct main"
description:
name: dash_chat_2
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.15"
dbus:
dependency: transitive
description:
......@@ -473,6 +480,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "5.1.0"
flutter_staggered_animations:
dependency: "direct main"
description:
name: flutter_staggered_animations
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.1"
flutter_staggered_grid_view:
dependency: "direct main"
description:
......@@ -539,6 +553,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.0"
glassy:
dependency: "direct main"
description:
name: glassy
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.6"
gradient_widgets:
dependency: "direct main"
description:
......@@ -882,6 +903,20 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.1"
share_plus:
dependency: "direct main"
description:
name: share_plus
url: "https://pub.dartlang.org"
source: hosted
version: "6.3.1"
share_plus_platform_interface:
dependency: transitive
description:
name: share_plus_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "3.2.0"
shared_preferences:
dependency: "direct main"
description:
......@@ -1090,6 +1125,41 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.2"
video_player:
dependency: transitive
description:
name: video_player
url: "https://pub.dartlang.org"
source: hosted
version: "2.5.1"
video_player_android:
dependency: transitive
description:
name: video_player_android
url: "https://pub.dartlang.org"
source: hosted
version: "2.3.10"
video_player_avfoundation:
dependency: transitive
description:
name: video_player_avfoundation
url: "https://pub.dartlang.org"
source: hosted
version: "2.3.8"
video_player_platform_interface:
dependency: transitive
description:
name: video_player_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "6.0.1"
video_player_web:
dependency: transitive
description:
name: video_player_web
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.13"
visibility_detector:
dependency: transitive
description:
......
......@@ -101,6 +101,10 @@ dependencies:
cached_network_image: ^3.0.0
# 包信息
package_info: ^2.0.0
share_plus: ^6.3.1
glassy: ^0.0.6
dash_chat_2: ^0.0.15
flutter_staggered_animations: ^1.1.1
# package:bubble/bubble.dart
dev_dependencies:
......
......@@ -7,12 +7,15 @@
#include "generated_plugin_registrant.h"
#include <connectivity_plus/connectivity_plus_windows_plugin.h>
#include <share_plus/share_plus_windows_plugin_c_api.h>
#include <smart_auth/smart_auth_plugin.h>
#include <url_launcher_windows/url_launcher_windows.h>
void RegisterPlugins(flutter::PluginRegistry* registry) {
ConnectivityPlusWindowsPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("ConnectivityPlusWindowsPlugin"));
SharePlusWindowsPluginCApiRegisterWithRegistrar(
registry->GetRegistrarForPlugin("SharePlusWindowsPluginCApi"));
SmartAuthPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("SmartAuthPlugin"));
UrlLauncherWindowsRegisterWithRegistrar(
......
......@@ -4,6 +4,7 @@
list(APPEND FLUTTER_PLUGIN_LIST
connectivity_plus
share_plus
smart_auth
url_launcher_windows
)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment