Commit 8bd02cb4 authored by netyouli's avatar netyouli

添加我的界面和我的作品界面

parent bbc7d200
...@@ -116,6 +116,8 @@ PODS: ...@@ -116,6 +116,8 @@ PODS:
- Flutter - Flutter
- image_picker_ios (0.0.1): - image_picker_ios (0.0.1):
- Flutter - Flutter
- in_app_review (0.2.0):
- Flutter
- keyboard_utils (0.0.1): - keyboard_utils (0.0.1):
- Flutter - Flutter
- open_filex (0.0.2): - open_filex (0.0.2):
...@@ -180,6 +182,7 @@ DEPENDENCIES: ...@@ -180,6 +182,7 @@ DEPENDENCIES:
- fluwx (from `.symlinks/plugins/fluwx/ios`) - fluwx (from `.symlinks/plugins/fluwx/ios`)
- image_gallery_saver (from `.symlinks/plugins/image_gallery_saver/ios`) - image_gallery_saver (from `.symlinks/plugins/image_gallery_saver/ios`)
- image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`) - image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`)
- in_app_review (from `.symlinks/plugins/in_app_review/ios`)
- keyboard_utils (from `.symlinks/plugins/keyboard_utils/ios`) - keyboard_utils (from `.symlinks/plugins/keyboard_utils/ios`)
- open_filex (from `.symlinks/plugins/open_filex/ios`) - open_filex (from `.symlinks/plugins/open_filex/ios`)
- package_info (from `.symlinks/plugins/package_info/ios`) - package_info (from `.symlinks/plugins/package_info/ios`)
...@@ -256,6 +259,8 @@ EXTERNAL SOURCES: ...@@ -256,6 +259,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/image_gallery_saver/ios" :path: ".symlinks/plugins/image_gallery_saver/ios"
image_picker_ios: image_picker_ios:
:path: ".symlinks/plugins/image_picker_ios/ios" :path: ".symlinks/plugins/image_picker_ios/ios"
in_app_review:
:path: ".symlinks/plugins/in_app_review/ios"
keyboard_utils: keyboard_utils:
:path: ".symlinks/plugins/keyboard_utils/ios" :path: ".symlinks/plugins/keyboard_utils/ios"
open_filex: open_filex:
...@@ -315,6 +320,7 @@ SPEC CHECKSUMS: ...@@ -315,6 +320,7 @@ SPEC CHECKSUMS:
GTMSessionFetcher: c9e714f7eec91a55641e2bab9f45fd83a219b882 GTMSessionFetcher: c9e714f7eec91a55641e2bab9f45fd83a219b882
image_gallery_saver: cb43cc43141711190510e92c460eb1655cd343cb image_gallery_saver: cb43cc43141711190510e92c460eb1655cd343cb
image_picker_ios: 4a8aadfbb6dc30ad5141a2ce3832af9214a705b5 image_picker_ios: 4a8aadfbb6dc30ad5141a2ce3832af9214a705b5
in_app_review: 318597b3a06c22bb46dc454d56828c85f444f99d
keyboard_utils: ab24bc711be9e91a5937c20489056b8dd650fecc keyboard_utils: ab24bc711be9e91a5937c20489056b8dd650fecc
open_filex: 6e26e659846ec990262224a12ef1c528bb4edbe4 open_filex: 6e26e659846ec990262224a12ef1c528bb4edbe4
OrderedSet: aaeb196f7fef5a9edf55d89760da9176ad40b93c OrderedSet: aaeb196f7fef5a9edf55d89760da9176ad40b93c
......
...@@ -7,7 +7,7 @@ import Flutter ...@@ -7,7 +7,7 @@ import Flutter
_ application: UIApplication, _ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool { ) -> Bool {
let ksj = WXApi.registerApp("wxac6457d4b052cc48", universalLink: "https://order.1clickpass.com/app/") let ksj = WXApi.registerApp("wxc2db450107fa65e1", universalLink: "https://order.1clickpass.com/app/")
GeneratedPluginRegistrant.register(with: self) GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions) return super.application(application, didFinishLaunchingWithOptions: launchOptions)
......
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"> <plist version="1.0">
<dict> <dict>
<key>SKStoreReviewController</key>
<true/>
<key>CADisableMinimumFrameDurationOnPhone</key> <key>CADisableMinimumFrameDurationOnPhone</key>
<true/> <true/>
<key>CFBundleDevelopmentRegion</key> <key>CFBundleDevelopmentRegion</key>
...@@ -35,7 +37,7 @@ ...@@ -35,7 +37,7 @@
<string>weixin</string> <string>weixin</string>
<key>CFBundleURLSchemes</key> <key>CFBundleURLSchemes</key>
<array> <array>
<string>wxac6457d4b052cc48</string> <string>wxc2db450107fa65e1</string>
</array> </array>
</dict> </dict>
</array> </array>
......
...@@ -6,6 +6,7 @@ import 'package:chart/common/utils/utils.dart'; ...@@ -6,6 +6,7 @@ import 'package:chart/common/utils/utils.dart';
import '../../entity/login_entity.dart'; import '../../entity/login_entity.dart';
import '../../entity/user_entity.dart'; import '../../entity/user_entity.dart';
import '../../pages/my/models.dart';
import '../entities/applePayList.dart'; import '../entities/applePayList.dart';
/// 用户 /// 用户
...@@ -230,6 +231,14 @@ class UserAPI { ...@@ -230,6 +231,14 @@ class UserAPI {
// UserLoginResponseEntity.fromJson(response); // UserLoginResponseEntity.fromJson(response);
} }
static Future<UserInfoResponse> getUserInfoV2() async {
var response = await HttpUtil().get(
'/user/info',
);
return UserInfoResponse.fromJson(response);
// UserLoginResponseEntity.fromJson(response);
}
// /api/user/info // /api/user/info
static Future<MsmEntity> sendSms( static Future<MsmEntity> sendSms(
Map<String, dynamic>? params, Map<String, dynamic>? params,
......
...@@ -26,6 +26,8 @@ class AppRoutes { ...@@ -26,6 +26,8 @@ class AppRoutes {
static const CREATION_PAGE_DETAIL = '/creation-detail'; static const CREATION_PAGE_DETAIL = '/creation-detail';
static const ASSISTANT_PAGE = '/assistant'; static const ASSISTANT_PAGE = '/assistant';
static const MY_PAGE = '/my'; static const MY_PAGE = '/my';
static const MY_WORK = '/my/work';
static const SETTINGS_PAGE = '/my/settings';
static const ASSISTANT_ITEM = '/creation-item'; static const ASSISTANT_ITEM = '/creation-item';
// AssistantItemBinding // AssistantItemBinding
// UserPrivacyPage // UserPrivacyPage
......
...@@ -11,7 +11,7 @@ import 'package:chart/pages/frame/android_pay_list/view.dart'; ...@@ -11,7 +11,7 @@ import 'package:chart/pages/frame/android_pay_list/view.dart';
import 'package:chart/pages/frame/notfound/index.dart'; import 'package:chart/pages/frame/notfound/index.dart';
import 'package:chart/pages/frame/pay_list/view.dart'; import 'package:chart/pages/frame/pay_list/view.dart';
import 'package:chart/pages/home/index.dart'; import 'package:chart/pages/home/index.dart';
import 'package:chart/pages/my/index.dart'; import 'package:chart/pages/settings/index.dart';
import 'package:chart/pages/privacy/index.dart'; import 'package:chart/pages/privacy/index.dart';
import 'package:chart/pages/template/index.dart'; import 'package:chart/pages/template/index.dart';
import 'package:chart/pages/user_privacy/index.dart'; import 'package:chart/pages/user_privacy/index.dart';
...@@ -34,6 +34,10 @@ import '../../pages/ai-draw-image/bindings.dart'; ...@@ -34,6 +34,10 @@ import '../../pages/ai-draw-image/bindings.dart';
import '../../pages/ai-draw-image/view.dart'; import '../../pages/ai-draw-image/view.dart';
import '../../pages/frame/android_pay_list/index.dart'; import '../../pages/frame/android_pay_list/index.dart';
import '../../pages/frame/pay_list/bindings.dart'; import '../../pages/frame/pay_list/bindings.dart';
import '../../pages/my-work/bindings.dart';
import '../../pages/my-work/view.dart';
import '../../pages/my/bindings.dart';
import '../../pages/my/view.dart';
import 'routes.dart'; import 'routes.dart';
class AppPages { class AppPages {
...@@ -100,6 +104,11 @@ class AppPages { ...@@ -100,6 +104,11 @@ class AppPages {
// ] // ]
), ),
GetPage(
name: AppRoutes.MY_WORK,
page: () => MyWorkPage(),
binding: MyWorkBinding(),
),
GetPage( GetPage(
name: AppRoutes.SIGN_IN, name: AppRoutes.SIGN_IN,
page: () => SignInPage(), page: () => SignInPage(),
...@@ -207,6 +216,11 @@ class AppPages { ...@@ -207,6 +216,11 @@ class AppPages {
page: () => AssistantPage(), page: () => AssistantPage(),
binding: AssistantBinding(), binding: AssistantBinding(),
), ),
GetPage(
name: AppRoutes.SETTINGS_PAGE,
page: () => SettingsPage(),
binding: SettingsBinding(),
),
GetPage( GetPage(
name: AppRoutes.MY_PAGE, name: AppRoutes.MY_PAGE,
page: () => MyPage(), page: () => MyPage(),
......
...@@ -31,6 +31,8 @@ class UserStore extends GetxController { ...@@ -31,6 +31,8 @@ class UserStore extends GetxController {
// 是否登录 // 是否登录
late final _isLogin = false.obs; late final _isLogin = false.obs;
var loginDidChange = false.obs;
// 令牌 token // 令牌 token
String token = ''; String token = '';
...@@ -97,6 +99,7 @@ class UserStore extends GetxController { ...@@ -97,6 +99,7 @@ class UserStore extends GetxController {
if (profile.id != '') { if (profile.id != '') {
_isLogin.value = true; _isLogin.value = true;
loginDidChange.toggle();
} }
} }
} else { } else {
...@@ -115,6 +118,7 @@ class UserStore extends GetxController { ...@@ -115,6 +118,7 @@ class UserStore extends GetxController {
_profile.value = IntegralEntity( _profile.value = IntegralEntity(
id: '', token: '', username: '', integral: 0, expireTime: null); id: '', token: '', username: '', integral: 0, expireTime: null);
_isLogin.value = false; _isLogin.value = false;
loginDidChange.toggle();
} }
Future refreshInfo() async { Future refreshInfo() async {
...@@ -137,6 +141,7 @@ class UserStore extends GetxController { ...@@ -137,6 +141,7 @@ class UserStore extends GetxController {
if (profile.id != '') { if (profile.id != '') {
_isLogin.value = true; _isLogin.value = true;
loginDidChange.toggle();
} }
await setToken(res.token); await setToken(res.token);
...@@ -149,6 +154,7 @@ class UserStore extends GetxController { ...@@ -149,6 +154,7 @@ class UserStore extends GetxController {
expireTime: res.expireTime, expireTime: res.expireTime,
)); ));
_isLogin.value = true; _isLogin.value = true;
loginDidChange.toggle();
Get.back(); Get.back();
// await MainController.to.asyncLoadBannerData(); // await MainController.to.asyncLoadBannerData();
} }
...@@ -165,6 +171,7 @@ class UserStore extends GetxController { ...@@ -165,6 +171,7 @@ class UserStore extends GetxController {
expireTime: res.expireTime, expireTime: res.expireTime,
)); ));
_isLogin.value = true; _isLogin.value = true;
loginDidChange.toggle();
Get.back(); Get.back();
// Get.put(ApplicationController()); // Get.put(ApplicationController());
// Get.offAndToNamed(AppRoutes.Application); // Get.offAndToNamed(AppRoutes.Application);
...@@ -234,6 +241,7 @@ class UserStore extends GetxController { ...@@ -234,6 +241,7 @@ class UserStore extends GetxController {
// if (_isLogin.value) await UserAPI.logout(); // if (_isLogin.value) await UserAPI.logout();
await StorageService.to.remove(STORAGE_USER_TOKEN_KEY); await StorageService.to.remove(STORAGE_USER_TOKEN_KEY);
_isLogin.value = false; _isLogin.value = false;
loginDidChange.toggle();
token = ''; token = '';
saveProfile(IntegralEntity( saveProfile(IntegralEntity(
id: '', username: '', token: '', expireTime: null, integral: 0)); id: '', username: '', token: '', expireTime: null, integral: 0));
......
...@@ -11,6 +11,7 @@ class AppColor { ...@@ -11,6 +11,7 @@ class AppColor {
static const Color gray5 = Color.fromARGB(255, 40, 40, 40); static const Color gray5 = Color.fromARGB(255, 40, 40, 40);
static const Color gray6 = Color.fromARGB(255, 30, 30, 30); static const Color gray6 = Color.fromARGB(255, 30, 30, 30);
static const Color gray7 = Color.fromARGB(255, 50, 50, 50); static const Color gray7 = Color.fromARGB(255, 50, 50, 50);
static const Color gray8 = Color.fromARGB(255, 200, 200, 200);
static const Color black1 = Color.fromARGB(255, 20, 20, 20); static const Color black1 = Color.fromARGB(255, 20, 20, 20);
static const Color gradient_back1 = Color.fromARGB(255, 15, 24, 29); static const Color gradient_back1 = Color.fromARGB(255, 15, 24, 29);
...@@ -19,6 +20,8 @@ class AppColor { ...@@ -19,6 +20,8 @@ class AppColor {
static const Color yellow1 = Color.fromARGB(255, 150, 100, 30); static const Color yellow1 = Color.fromARGB(255, 150, 100, 30);
static const Color yellow2 = Color.fromARGB(255, 252, 215, 156);
static const Color yellow3 = Color.fromARGB(255, 142, 61, 24);
/// 页面背景颜色 /// 页面背景颜色
static const Color scaffoldBackground = Color(0xFFFFFFFF); static const Color scaffoldBackground = Color(0xFFFFFFFF);
......
...@@ -36,7 +36,7 @@ void main() async { ...@@ -36,7 +36,7 @@ void main() async {
const SystemUiOverlayStyle(systemNavigationBarColor: Colors.black); const SystemUiOverlayStyle(systemNavigationBarColor: Colors.black);
SystemChrome.setSystemUIOverlayStyle(systemUiOverlayStyle); SystemChrome.setSystemUIOverlayStyle(systemUiOverlayStyle);
} }
registerWxApi(appId: "wxac6457d4b052cc48", registerWxApi(appId: "wxc2db450107fa65e1",
doOnAndroid: true, doOnAndroid: true,
doOnIOS: true, doOnIOS: true,
universalLink: "https://order.1clickpass.com/app/"); universalLink: "https://order.1clickpass.com/app/");
......
...@@ -16,46 +16,71 @@ import 'controller.dart'; ...@@ -16,46 +16,71 @@ import 'controller.dart';
SafeArea( SafeArea(
child: Container( child: Container(
decoration: const BoxDecoration( decoration: const BoxDecoration(
color: Colors.white, color: Colors.transparent,
borderRadius: BorderRadius.all(Radius.circular(20))
), ),
padding: const EdgeInsets.fromLTRB(20, 20, 20, 20), height: 190,
height: 138, padding: const EdgeInsets.fromLTRB(10, 0, 10, 0),
alignment: Alignment.bottomCenter,
child: Column( child: Column(
children: [ children: [
InkWell( Container(
onTap: () { decoration: const BoxDecoration(
controller.selectBlendImageUpload(ImageSource.camera); color: AppColor.gray6,
Get.back(); borderRadius: BorderRadius.all(Radius.circular(20))
}, ),
child: Container( child: Column(
height: 44, crossAxisAlignment: CrossAxisAlignment.center,
width: Get.width - 40, children: [
alignment: Alignment.center, InkWell(
decoration: BoxDecoration( onTap: () {
color: AppColor.primary, controller.selectBlendImageUpload(ImageSource.camera);
borderRadius: BorderRadius.circular(22) Get.back();
), },
child: Text("拍照"), child: Container(
height: 50,
width: Get.width - 20,
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20)
),
child: const Text("打开“相机”"),
),
),
const Divider(height: 0.5, color: AppColor.gray1,),
InkWell(
onTap: () {
controller.selectBlendImageUpload(ImageSource.gallery);
Get.back();
},
child: Container(
height: 50,
width: Get.width - 20,
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20)
),
child: const Text("前往“照片”"),
),
)
],
), ),
), ),
SizedBox(height: 10,), const SizedBox(height: 20,),
InkWell( InkWell(
onTap: () { onTap: () {
controller.selectBlendImageUpload(ImageSource.gallery);
Get.back(); Get.back();
}, },
child: Container( child: Container(
height: 44, height: 50,
width: Get.width - 40, width: Get.width - 20,
alignment: Alignment.center, alignment: Alignment.center,
decoration: BoxDecoration( decoration: const BoxDecoration(
color: AppColor.primary, color: AppColor.gray6,
borderRadius: BorderRadius.circular(22) borderRadius: BorderRadius.all(Radius.circular(20))
), ),
child: Text("相册"), child: const Text("取消"),
), ),
) ),
], ],
), ),
) )
......
...@@ -4,7 +4,7 @@ import 'package:chart/common/widgets/wx_share.dart'; ...@@ -4,7 +4,7 @@ import 'package:chart/common/widgets/wx_share.dart';
import 'package:chart/pages/assistant/index.dart'; import 'package:chart/pages/assistant/index.dart';
import 'package:chart/pages/creation/index.dart'; import 'package:chart/pages/creation/index.dart';
import 'package:chart/pages/home/index.dart'; import 'package:chart/pages/home/index.dart';
import 'package:chart/pages/my/index.dart'; import 'package:chart/pages/settings/index.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:chart/common/values/values.dart'; import 'package:chart/common/values/values.dart';
import 'package:chart/common/widgets/widgets.dart'; import 'package:chart/common/widgets/widgets.dart';
...@@ -20,6 +20,7 @@ import 'package:loading_animation_widget/loading_animation_widget.dart'; ...@@ -20,6 +20,7 @@ import 'package:loading_animation_widget/loading_animation_widget.dart';
// import 'package:text_editor/text_editor.dart'; // import 'package:text_editor/text_editor.dart';
// import '../dashboard/dashboard_page.dart'; // import '../dashboard/dashboard_page.dart';
import '../ai-draw-image/view.dart'; import '../ai-draw-image/view.dart';
import '../my/view.dart';
import 'index.dart'; import 'index.dart';
class ApplicationPage extends GetView<ApplicationController> { class ApplicationPage extends GetView<ApplicationController> {
......
import 'package:get/get.dart';
import 'controller.dart';
class MyCollectBinding implements Bindings {
@override
void dependencies() {
Get.lazyPut<MyCollectController>(() => MyCollectController());
}
}
\ No newline at end of file
import 'dart:io';
import 'package:chart/common/apis/apis.dart';
import 'package:chart/common/store/user.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:get/get.dart';
import 'package:intl/intl.dart';
import 'package:share_plus/share_plus.dart';
import 'package:in_app_review/in_app_review.dart';
import '../../common/routers/names.dart';
class MyCollectController extends GetxController {
}
\ No newline at end of file
import 'package:chart/common/routers/routes.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import '../../common/style/color.dart';
import './controller.dart';
class MyCollectPage extends GetView<MyCollectController> {
const MyCollectPage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
// TODO: implement build
throw UnimplementedError();
}
}
\ No newline at end of file
import 'package:get/get.dart';
import 'controller.dart';
class MyWorkBinding implements Bindings {
@override
void dependencies() {
Get.lazyPut<MyWorkController>(() => MyWorkController());
}
}
\ No newline at end of file
import 'dart:io';
import 'package:chart/common/apis/apis.dart';
import 'package:chart/common/store/user.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:get/get.dart';
import 'package:intl/intl.dart';
import 'package:share_plus/share_plus.dart';
import 'package:in_app_review/in_app_review.dart';
import '../../common/routers/names.dart';
import '../ai-draw-image/model.dart';
class MyWorkController extends GetxController {
late ScrollController loadingMoreController = ScrollController(initialScrollOffset: 0);
late EasyRefreshController refreshController = EasyRefreshController();
var models = AIDrawTextToImageModel();
}
\ No newline at end of file
import 'package:chart/common/routers/routes.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart';
import 'package:get/get.dart';
import '../../common/style/color.dart';
import './controller.dart';
class MyWorkPage extends GetView<MyWorkController> {
const MyWorkPage({Key? key}) : super(key: key);
Widget makeListView() {
// TODO: implement build
final controller = Get.find<MyWorkController>();
return Container(
child: EasyRefresh(
controller: controller.refreshController,
header: ClassicalHeader(
bgColor: Colors.white,
textColor: Colors.pink,
infoColor: Colors.pink,
refreshReadyText: '下拉刷新',
refreshingText: '正在努力刷新',
refreshedText: '加载完成',
showInfo: true,
infoText: '正在加载中',
),
footer: ClassicalFooter(
bgColor: Colors.white,
textColor: Colors.pink,
infoColor: Colors.pink,
showInfo: true,
noMoreText: '暂时没有更多了',
loadReadyText: '上拉加载',
loadedText: '加载完毕',
loadText: '上拉加载更多',
loadingText: '正在努力加载更多',
infoText: '正在加载中',
),
child: MasonryGridView.count(
controller: controller.loadingMoreController,
itemCount: controller.models.descriptives.length,
crossAxisCount: 2,
itemBuilder: (BuildContext context, int index) {
return ClipRRect(
borderRadius: BorderRadius.circular(10),
child: Image(image: AssetImage(controller.models.descriptives[index].imageUrl),
fit: BoxFit.cover,
height: index % 2 == 0 ? 260 : 200,
),
);
},
mainAxisSpacing: 10.0,
crossAxisSpacing: 10.0,
),
onLoad: () async {
print('没有更多了.......');
},
onRefresh: () async {
print('下拉刷新~~~~');
},
),
);
}
@override
Widget build(BuildContext context) {
// TODO: implement build
return GetBuilder<MyWorkController>(
init: MyWorkController(),
id: "mywork",
builder: (_) {
return Container(
height: double.infinity,
decoration: const BoxDecoration(
color: AppColor.black1
),
child: Scaffold(
backgroundColor: const Color.fromARGB(0, 29, 33, 60),
appBar: AppBar(
elevation: 0,
title: const Text("我的作品"),
bottomOpacity: 0.1,
backgroundColor: const Color.fromARGB(0, 29, 33, 60),
),
body: SafeArea(
child: makeListView(),
),
),
);
},
);
}
}
\ No newline at end of file
...@@ -7,4 +7,4 @@ class MyBinding implements Bindings { ...@@ -7,4 +7,4 @@ class MyBinding implements Bindings {
void dependencies() { void dependencies() {
Get.lazyPut<MyController>(() => MyController()); Get.lazyPut<MyController>(() => MyController());
} }
} }
\ No newline at end of file
import 'dart:io'; import 'dart:io';
import 'package:chart/pages/my/widgets/share.dart'; import 'package:chart/common/apis/apis.dart';
import 'package:chart/common/store/user.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:fluwx/fluwx.dart'; import 'package:intl/intl.dart';
import 'package:share_plus/share_plus.dart'; import 'package:share_plus/share_plus.dart';
import 'package:in_app_review/in_app_review.dart';
import '../../common/routers/names.dart'; import '../../common/routers/names.dart';
import 'package:fluwx/fluwx.dart' as fluwx; import 'models.dart';
class MyController extends GetxController { class MyController extends GetxController {
MyController(); var cacheSize = 16.43.obs;
var userInfo = Rx<UserInfoData>(UserInfoData(username: "未登录"));
var expireInfo = "--".obs;
@override
void onInit() {
// TODO: implement onInit
super.onInit();
requestUserInfo();
_initData() { ever(UserStore.to.loginDidChange, (didChange) {
update(["my"]); requestUserInfo();
});
} }
dynamic getShareModel(ShareType shareType, ShareInfo shareInfo) { goShare() async {
var scene = fluwx.WeChatScene.SESSION; await Share.shareWithResult(
switch (shareType) { 'https://apps.apple.com/cn/app/ai%E5%86%99%E4%BD%9C%E5%A4%A7%E5%B8%88/id1671136252');
case ShareType.SESSION: }
scene = fluwx.WeChatScene.SESSION;
break;
case ShareType.TIMELINE:
scene = fluwx.WeChatScene.TIMELINE;
break;
case ShareType.COPY_LINK:
break;
case ShareType.DOWNLOAD:
break;
}
if (shareInfo.img != null) { goFeedback() async {
return fluwx.WeChatShareWebPageModel( final InAppReview inAppReview = InAppReview.instance;
shareInfo.url, if (await inAppReview.isAvailable()) {
title: shareInfo.title, inAppReview.requestReview();
thumbnail: fluwx.WeChatImage.network(shareInfo.img),
scene: scene,
);
} else { } else {
return fluwx.WeChatShareWebPageModel( EasyLoading.showToast("评价异常");
shareInfo.url,
title: shareInfo.title,
scene: scene,
);
} }
} }
_initFluwx() async { goClearCache() {
await registerWxApi( cacheSize.value = 0.0;
appId: 'wxac6457d4b052cc48', EasyLoading.showSuccess("清理成功");
doOnAndroid: true,
doOnIOS: true,
universalLink: 'https://order.1clickpass.com/app/',
);
var result = await isWeChatInstalled;
print('is installed $result');
} }
handleToWx() async { void goPay() {
await fluwx.openWeChatCustomerServiceChat( if (UserStore.to.isLogin) {
url: "https://work.weixin.qq.com/kfid/kfc4e77a401df6f7d09", if (Platform.isAndroid) {
corpId: "wwe816b5b616eaf0f3"); Get.toNamed(AppRoutes.AN_PAY_LIST);
// fluwx.shareToWeChat( } else {
// WeChatShareTextModel("source text", scene: WeChatScene.TIMELINE)); Get.toNamed(AppRoutes.PAY_LIST);
} }
} else {
handleShare() async { Get.toNamed(AppRoutes.SIGN_IN);
await Share.shareWithResult( }
'https://apps.apple.com/cn/app/ai%E5%86%99%E4%BD%9C%E5%A4%A7%E5%B8%88/id1671136252');
}
void onTap() {}
// @override
// void onInit() {
// super.onInit();
// }
@override
void onReady() {
super.onReady();
_initData();
_initFluwx();
} }
// @override requestUserInfo() async {
// void onClose() { if (UserStore.to.isLogin) {
// super.onClose(); final res = await UserAPI.getUserInfoV2();
// } if (res.status != 200) {
EasyLoading.showError(res.message ?? "获取个人信息失败");
void virtualPay() { }
if (Platform.isAndroid) { userInfo.value = res.data ?? UserInfoData(username: "未登录");
Get.toNamed(AppRoutes.AN_PAY_LIST); /**
} else { * if let text = chatController.userInfo?.expireTime, !text.isEmpty {
Get.toNamed(AppRoutes.PAY_LIST); if text.isExpireTime {
cell?.detailTextLabel?.text = "已过期: \(text.expireTime)"
} else {
cell?.detailTextLabel?.text = "到期日: \(text.expireTime)"
}
} else {
cell?.detailTextLabel?.text = "可用积分: \(chatController.userInfo?.integral ?? 0)"
}
*/
final expireTime = userInfo.value.expireTime;
if (expireTime != null && expireTime.isNotEmpty) {
final expDate = DateTime.parse(expireTime);
final today = DateTime.now();
final difference = expDate.compareTo(today);
String formattedDateTime = DateFormat('yyyy-MM-dd HH:mm').format(expDate);
if (difference < 0) {
// 已过期
expireInfo.value = "已过期: $formattedDateTime";
} else {
expireInfo.value = "到期日: $formattedDateTime";
}
} else {
expireInfo.value = "当前可用积分: ${userInfo.value.integral ?? 0}";
}
} }
} }
} }
\ No newline at end of file
class UserInfoResponse {
int? status;
String? message;
UserInfoData? data;
int? timestamp;
UserInfoResponse({this.status, this.message, this.data, this.timestamp});
UserInfoResponse.fromJson(Map<String, dynamic> json) {
status = json['status'];
message = json['message'];
data = json['data'] != null ? new UserInfoData.fromJson(json['data']) : null;
timestamp = json['timestamp'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['status'] = this.status;
data['message'] = this.message;
if (this.data != null) {
data['data'] = this.data?.toJson();
}
data['timestamp'] = this.timestamp;
return data;
}
}
class UserInfoData {
int? id;
String? username;
String? password;
int? signIn;
String? signTime;
String? updateTime;
String? createTime;
int? delFlag;
int? userType;
int? integral;
String? openId;
String? unionId;
String? expireTime;
String? token;
String? source;
String? shareCode;
String? deviceType;
String? gopenId;
UserInfoData(
{this.id,
this.username,
this.password,
this.signIn,
this.signTime,
this.updateTime,
this.createTime,
this.delFlag,
this.userType,
this.integral,
this.openId,
this.unionId,
this.expireTime,
this.token,
this.source,
this.shareCode,
this.deviceType,
this.gopenId});
UserInfoData.fromJson(Map<String, dynamic> json) {
id = json['id'];
username = json['username'];
password = json['password'];
signIn = json['signIn'];
signTime = json['signTime'];
updateTime = json['updateTime'];
createTime = json['createTime'];
delFlag = json['delFlag'];
userType = json['userType'];
integral = json['integral'];
openId = json['openId'];
unionId = json['unionId'];
expireTime = json['expireTime'];
token = json['token'];
source = json['source'];
shareCode = json['shareCode'];
deviceType = json['deviceType'];
gopenId = json['gopenId'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['username'] = this.username;
data['password'] = this.password;
data['signIn'] = this.signIn;
data['signTime'] = this.signTime;
data['updateTime'] = this.updateTime;
data['createTime'] = this.createTime;
data['delFlag'] = this.delFlag;
data['userType'] = this.userType;
data['integral'] = this.integral;
data['openId'] = this.openId;
data['unionId'] = this.unionId;
data['expireTime'] = this.expireTime;
data['token'] = this.token;
data['source'] = this.source;
data['shareCode'] = this.shareCode;
data['deviceType'] = this.deviceType;
data['gopenId'] = this.gopenId;
return data;
}
}
\ No newline at end of file
This diff is collapsed.
import 'package:get/get.dart';
import 'controller.dart';
class SettingsBinding implements Bindings {
@override
void dependencies() {
Get.lazyPut<SettingsController>(() => SettingsController());
}
}
import 'dart:io';
import 'package:chart/pages/settings/widgets/share.dart';
import 'package:get/get.dart';
import 'package:fluwx/fluwx.dart';
import 'package:share_plus/share_plus.dart';
import '../../common/routers/names.dart';
import 'package:fluwx/fluwx.dart' as fluwx;
class SettingsController extends GetxController {
SettingsController();
_initData() {
update(["settings"]);
}
dynamic getShareModel(ShareType shareType, ShareInfo shareInfo) {
var scene = fluwx.WeChatScene.SESSION;
switch (shareType) {
case ShareType.SESSION:
scene = fluwx.WeChatScene.SESSION;
break;
case ShareType.TIMELINE:
scene = fluwx.WeChatScene.TIMELINE;
break;
case ShareType.COPY_LINK:
break;
case ShareType.DOWNLOAD:
break;
}
if (shareInfo.img != null) {
return fluwx.WeChatShareWebPageModel(
shareInfo.url,
title: shareInfo.title,
thumbnail: fluwx.WeChatImage.network(shareInfo.img),
scene: scene,
);
} else {
return fluwx.WeChatShareWebPageModel(
shareInfo.url,
title: shareInfo.title,
scene: scene,
);
}
}
_initFluwx() async {
await registerWxApi(
appId: 'wxac6457d4b052cc48',
doOnAndroid: true,
doOnIOS: true,
universalLink: 'https://order.1clickpass.com/app/',
);
var result = await isWeChatInstalled;
print('is installed $result');
}
handleToWx() async {
await fluwx.openWeChatCustomerServiceChat(
url: "https://work.weixin.qq.com/kfid/kfc4e77a401df6f7d09",
corpId: "wwe816b5b616eaf0f3");
// fluwx.shareToWeChat(
// WeChatShareTextModel("source text", scene: WeChatScene.TIMELINE));
}
handleShare() async {
await Share.shareWithResult(
'https://apps.apple.com/cn/app/ai%E5%86%99%E4%BD%9C%E5%A4%A7%E5%B8%88/id1671136252');
}
void onTap() {}
// @override
// void onInit() {
// super.onInit();
// }
@override
void onReady() {
super.onReady();
_initData();
_initFluwx();
}
// @override
// void onClose() {
// super.onClose();
// }
void virtualPay() {
if (Platform.isAndroid) {
Get.toNamed(AppRoutes.AN_PAY_LIST);
} else {
Get.toNamed(AppRoutes.PAY_LIST);
}
}
}
This diff is collapsed.
...@@ -10,6 +10,7 @@ import device_info_plus ...@@ -10,6 +10,7 @@ import device_info_plus
import firebase_auth import firebase_auth
import firebase_core import firebase_core
import flutter_tts import flutter_tts
import in_app_review
import package_info import package_info
import path_provider_foundation import path_provider_foundation
import share_plus import share_plus
...@@ -26,6 +27,7 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { ...@@ -26,6 +27,7 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
FLTFirebaseAuthPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseAuthPlugin")) FLTFirebaseAuthPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseAuthPlugin"))
FLTFirebaseCorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseCorePlugin")) FLTFirebaseCorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseCorePlugin"))
FlutterTtsPlugin.register(with: registry.registrar(forPlugin: "FlutterTtsPlugin")) FlutterTtsPlugin.register(with: registry.registrar(forPlugin: "FlutterTtsPlugin"))
InAppReviewPlugin.register(with: registry.registrar(forPlugin: "InAppReviewPlugin"))
FLTPackageInfoPlugin.register(with: registry.registrar(forPlugin: "FLTPackageInfoPlugin")) FLTPackageInfoPlugin.register(with: registry.registrar(forPlugin: "FLTPackageInfoPlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
SharePlusMacosPlugin.register(with: registry.registrar(forPlugin: "SharePlusMacosPlugin")) SharePlusMacosPlugin.register(with: registry.registrar(forPlugin: "SharePlusMacosPlugin"))
......
...@@ -949,6 +949,22 @@ packages: ...@@ -949,6 +949,22 @@ packages:
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.6.3" version: "2.6.3"
in_app_review:
dependency: "direct main"
description:
name: in_app_review
sha256: "16328b8202d36522322b95804ae5d975577aa9f584d634985849ba1099645850"
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.6"
in_app_review_platform_interface:
dependency: transitive
description:
name: in_app_review_platform_interface
sha256: b12ec9aaf6b34d3a72aa95895eb252b381896246bdad4ef378d444affe8410ef
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.4"
intl: intl:
dependency: "direct main" dependency: "direct main"
description: description:
......
...@@ -133,6 +133,7 @@ dependencies: ...@@ -133,6 +133,7 @@ dependencies:
fluwx: ^3.13.1 fluwx: ^3.13.1
flutter_native_splash: ^2.2.19 flutter_native_splash: ^2.2.19
image_gallery_saver: '^2.0.2' image_gallery_saver: '^2.0.2'
in_app_review: ^2.0.6
# package:bubble/bubble.dart # package:bubble/bubble.dart
dev_dependencies: dev_dependencies:
......
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