Showing
21 changed files
with
1109 additions
and
278 deletions
assets/apple.png
0 → 100644
1.35 KB
assets/icon_wechat_login.png
0 → 100644
5.76 KB
assets/mine_login_wechat.png
0 → 100644
1.91 KB
assets/wechat.png
0 → 100644
7.75 KB
| @@ -42,6 +42,8 @@ PODS: | @@ -42,6 +42,8 @@ PODS: | ||
| 42 | - Reachability (3.2) | 42 | - Reachability (3.2) |
| 43 | - shared_preferences (0.0.1): | 43 | - shared_preferences (0.0.1): |
| 44 | - Flutter | 44 | - Flutter |
| 45 | + - sign_in_with_apple (0.0.1): | ||
| 46 | + - Flutter | ||
| 45 | - sqflite (0.0.2): | 47 | - sqflite (0.0.2): |
| 46 | - Flutter | 48 | - Flutter |
| 47 | - FMDB (>= 2.7.5) | 49 | - FMDB (>= 2.7.5) |
| @@ -74,6 +76,7 @@ DEPENDENCIES: | @@ -74,6 +76,7 @@ DEPENDENCIES: | ||
| 74 | - permission_handler (from `.symlinks/plugins/permission_handler/ios`) | 76 | - permission_handler (from `.symlinks/plugins/permission_handler/ios`) |
| 75 | - photo_manager (from `.symlinks/plugins/photo_manager/ios`) | 77 | - photo_manager (from `.symlinks/plugins/photo_manager/ios`) |
| 76 | - shared_preferences (from `.symlinks/plugins/shared_preferences/ios`) | 78 | - shared_preferences (from `.symlinks/plugins/shared_preferences/ios`) |
| 79 | + - sign_in_with_apple (from `.symlinks/plugins/sign_in_with_apple/ios`) | ||
| 77 | - sqflite (from `.symlinks/plugins/sqflite/ios`) | 80 | - sqflite (from `.symlinks/plugins/sqflite/ios`) |
| 78 | - tpns_flutter_plugin (from `.symlinks/plugins/tpns_flutter_plugin/ios`) | 81 | - tpns_flutter_plugin (from `.symlinks/plugins/tpns_flutter_plugin/ios`) |
| 79 | - url_launcher (from `.symlinks/plugins/url_launcher/ios`) | 82 | - url_launcher (from `.symlinks/plugins/url_launcher/ios`) |
| @@ -124,6 +127,8 @@ EXTERNAL SOURCES: | @@ -124,6 +127,8 @@ EXTERNAL SOURCES: | ||
| 124 | :path: ".symlinks/plugins/photo_manager/ios" | 127 | :path: ".symlinks/plugins/photo_manager/ios" |
| 125 | shared_preferences: | 128 | shared_preferences: |
| 126 | :path: ".symlinks/plugins/shared_preferences/ios" | 129 | :path: ".symlinks/plugins/shared_preferences/ios" |
| 130 | + sign_in_with_apple: | ||
| 131 | + :path: ".symlinks/plugins/sign_in_with_apple/ios" | ||
| 127 | sqflite: | 132 | sqflite: |
| 128 | :path: ".symlinks/plugins/sqflite/ios" | 133 | :path: ".symlinks/plugins/sqflite/ios" |
| 129 | tpns_flutter_plugin: | 134 | tpns_flutter_plugin: |
| @@ -155,6 +160,7 @@ SPEC CHECKSUMS: | @@ -155,6 +160,7 @@ SPEC CHECKSUMS: | ||
| 155 | photo_manager: f7c619c2cc8c2adb8d85c63363babac477de9c67 | 160 | photo_manager: f7c619c2cc8c2adb8d85c63363babac477de9c67 |
| 156 | Reachability: 33e18b67625424e47b6cde6d202dce689ad7af96 | 161 | Reachability: 33e18b67625424e47b6cde6d202dce689ad7af96 |
| 157 | shared_preferences: af6bfa751691cdc24be3045c43ec037377ada40d | 162 | shared_preferences: af6bfa751691cdc24be3045c43ec037377ada40d |
| 163 | + sign_in_with_apple: 34f3f5456a45fd7ac5fb42905e2ad31dae061b4a | ||
| 158 | sqflite: 6d358c025f5b867b29ed92fc697fd34924e11904 | 164 | sqflite: 6d358c025f5b867b29ed92fc697fd34924e11904 |
| 159 | TPNS-iOS: 9b35473a4a0d07f2c2730ea1e66c6749c2b98095 | 165 | TPNS-iOS: 9b35473a4a0d07f2c2730ea1e66c6749c2b98095 |
| 160 | tpns_flutter_plugin: 8dbbee157aab91a878f64d056c1383726a6c5c4d | 166 | tpns_flutter_plugin: 8dbbee157aab91a878f64d056c1383726a6c5c4d |
| @@ -295,6 +295,7 @@ | @@ -295,6 +295,7 @@ | ||
| 295 | "${BUILT_PRODUCTS_DIR}/path_provider/path_provider.framework", | 295 | "${BUILT_PRODUCTS_DIR}/path_provider/path_provider.framework", |
| 296 | "${BUILT_PRODUCTS_DIR}/photo_manager/photo_manager.framework", | 296 | "${BUILT_PRODUCTS_DIR}/photo_manager/photo_manager.framework", |
| 297 | "${BUILT_PRODUCTS_DIR}/shared_preferences/shared_preferences.framework", | 297 | "${BUILT_PRODUCTS_DIR}/shared_preferences/shared_preferences.framework", |
| 298 | + "${BUILT_PRODUCTS_DIR}/sign_in_with_apple/sign_in_with_apple.framework", | ||
| 298 | "${BUILT_PRODUCTS_DIR}/sqflite/sqflite.framework", | 299 | "${BUILT_PRODUCTS_DIR}/sqflite/sqflite.framework", |
| 299 | "${BUILT_PRODUCTS_DIR}/url_launcher/url_launcher.framework", | 300 | "${BUILT_PRODUCTS_DIR}/url_launcher/url_launcher.framework", |
| 300 | "${BUILT_PRODUCTS_DIR}/webview_flutter/webview_flutter.framework", | 301 | "${BUILT_PRODUCTS_DIR}/webview_flutter/webview_flutter.framework", |
| @@ -318,6 +319,7 @@ | @@ -318,6 +319,7 @@ | ||
| 318 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/path_provider.framework", | 319 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/path_provider.framework", |
| 319 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/photo_manager.framework", | 320 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/photo_manager.framework", |
| 320 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/shared_preferences.framework", | 321 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/shared_preferences.framework", |
| 322 | + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/sign_in_with_apple.framework", | ||
| 321 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/sqflite.framework", | 323 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/sqflite.framework", |
| 322 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/url_launcher.framework", | 324 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/url_launcher.framework", |
| 323 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/webview_flutter.framework", | 325 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/webview_flutter.framework", |
| @@ -5,7 +5,7 @@ import 'package:shared_preferences/shared_preferences.dart'; | @@ -5,7 +5,7 @@ import 'package:shared_preferences/shared_preferences.dart'; | ||
| 5 | 5 | ||
| 6 | import 'route/navigate_service.dart'; | 6 | import 'route/navigate_service.dart'; |
| 7 | 7 | ||
| 8 | -class App{ | 8 | +class App { |
| 9 | static FluroRouter router; | 9 | static FluroRouter router; |
| 10 | static GlobalKey<NavigatorState> key = GlobalKey(); | 10 | static GlobalKey<NavigatorState> key = GlobalKey(); |
| 11 | static SharedPreferences sp; | 11 | static SharedPreferences sp; |
| @@ -14,13 +14,13 @@ class App{ | @@ -14,13 +14,13 @@ class App{ | ||
| 14 | static double statusBarHeight; | 14 | static double statusBarHeight; |
| 15 | static double bottomBarHeight; | 15 | static double bottomBarHeight; |
| 16 | static GetIt getIt = GetIt.instance; | 16 | static GetIt getIt = GetIt.instance; |
| 17 | + static bool isInstallWx = false; | ||
| 17 | 18 | ||
| 18 | - static initSp() async{ | 19 | + static initSp() async { |
| 19 | sp = await SharedPreferences.getInstance(); | 20 | sp = await SharedPreferences.getInstance(); |
| 20 | } | 21 | } |
| 21 | 22 | ||
| 22 | - static setupLocator(){ | 23 | + static setupLocator() { |
| 23 | getIt.registerSingleton(NavigateService()); | 24 | getIt.registerSingleton(NavigateService()); |
| 24 | } | 25 | } |
| 25 | - | ||
| 26 | } | 26 | } |
| @@ -113,6 +113,11 @@ class MyAppState extends State<MyApp> { | @@ -113,6 +113,11 @@ class MyAppState extends State<MyApp> { | ||
| 113 | doOnIOS: true, | 113 | doOnIOS: true, |
| 114 | universalLink: "https://xt04.colorcun.com/link/OneKey/"); | 114 | universalLink: "https://xt04.colorcun.com/link/OneKey/"); |
| 115 | var result = await isWeChatInstalled; | 115 | var result = await isWeChatInstalled; |
| 116 | + if (result != null && result) { | ||
| 117 | + App.isInstallWx = true; | ||
| 118 | + } else { | ||
| 119 | + App.isInstallWx = false; | ||
| 120 | + } | ||
| 116 | LogUtil.v("is installed $result"); | 121 | LogUtil.v("is installed $result"); |
| 117 | } | 122 | } |
| 118 | 123 |
| @@ -5,6 +5,7 @@ import 'package:dio/dio.dart'; | @@ -5,6 +5,7 @@ import 'package:dio/dio.dart'; | ||
| 5 | import 'package:dio/dio.dart'; | 5 | import 'package:dio/dio.dart'; |
| 6 | import 'package:dio/dio.dart'; | 6 | import 'package:dio/dio.dart'; |
| 7 | import 'package:flutter/material.dart'; | 7 | import 'package:flutter/material.dart'; |
| 8 | +import 'package:one_key/app.dart'; | ||
| 8 | import 'package:one_key/constant/error.dart'; | 9 | import 'package:one_key/constant/error.dart'; |
| 9 | import 'package:one_key/utils/utils.dart'; | 10 | import 'package:one_key/utils/utils.dart'; |
| 10 | import 'package:one_key/widgets/loading.dart'; | 11 | import 'package:one_key/widgets/loading.dart'; |
| @@ -343,6 +344,10 @@ class DioUtil { | @@ -343,6 +344,10 @@ class DioUtil { | ||
| 343 | } | 344 | } |
| 344 | options.method = method; | 345 | options.method = method; |
| 345 | options.contentType = Headers.formUrlEncodedContentType; | 346 | options.contentType = Headers.formUrlEncodedContentType; |
| 347 | + if (App.sp?.getString("unionid") != null && | ||
| 348 | + App.sp?.getString("unionid").isNotEmpty) { | ||
| 349 | + options.headers = {"unionid": App.sp.getString("unionid")}; | ||
| 350 | + } | ||
| 346 | return options; | 351 | return options; |
| 347 | } | 352 | } |
| 348 | 353 |
lib/pages/create_store/create_store.dart
0 → 100644
| 1 | +import 'package:flutter/material.dart'; | ||
| 2 | +import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
| 3 | +import 'package:one_key/res/colors.dart'; | ||
| 4 | +import 'package:one_key/utils/navigator_util.dart'; | ||
| 5 | +import 'package:one_key/widgets/round_button.dart'; | ||
| 6 | +import 'package:one_key/widgets/system_app_bar.dart'; | ||
| 7 | +import 'package:one_key/widgets/v_empty_view.dart'; | ||
| 8 | + | ||
| 9 | +class CreateStorePage extends StatefulWidget { | ||
| 10 | + CreateStorePage({Key key}) : super(key: key); | ||
| 11 | + | ||
| 12 | + @override | ||
| 13 | + _CreateStorePageState createState() => _CreateStorePageState(); | ||
| 14 | +} | ||
| 15 | + | ||
| 16 | +class _CreateStorePageState extends State<CreateStorePage> { | ||
| 17 | + ScrollController _controller; | ||
| 18 | + List<Map> roomType = []; | ||
| 19 | + | ||
| 20 | + @override | ||
| 21 | + void initState() { | ||
| 22 | + // TODO: implement initState | ||
| 23 | + super.initState(); | ||
| 24 | + _controller = ScrollController(); | ||
| 25 | + for (int i = 0; i < 8; i++) { | ||
| 26 | + roomType.add({ | ||
| 27 | + '$i': {'name': '${i + 3}人间', 'check': true} | ||
| 28 | + }); | ||
| 29 | + } | ||
| 30 | + } | ||
| 31 | + | ||
| 32 | + List<Widget> _roomTypeWidget() { | ||
| 33 | + List<Widget> list = []; | ||
| 34 | + for (int i = 0; i < roomType.length; i++) { | ||
| 35 | + list.add(CheckboxListTile( | ||
| 36 | + value: roomType[i]['$i']['check'], | ||
| 37 | + title: Text(roomType[i]['$i']['name']), | ||
| 38 | + onChanged: (value) { | ||
| 39 | + setState(() { | ||
| 40 | + roomType[i]['$i']['check'] = !roomType[i]['$i']['check']; | ||
| 41 | + }); | ||
| 42 | + })); | ||
| 43 | + } | ||
| 44 | + return list; | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + @override | ||
| 48 | + Widget build(BuildContext context) { | ||
| 49 | + return Scaffold( | ||
| 50 | + appBar: SystemAppBar( | ||
| 51 | + '新建店铺', | ||
| 52 | + onTap: () { | ||
| 53 | + Navigator.pop(context); | ||
| 54 | + }, | ||
| 55 | + ), | ||
| 56 | + body: InkWell( | ||
| 57 | + onTap: () { | ||
| 58 | + FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘 | ||
| 59 | + }, | ||
| 60 | + child: Container( | ||
| 61 | + padding: EdgeInsets.all(ScreenUtil().setWidth(40)), | ||
| 62 | + child: Column( | ||
| 63 | + crossAxisAlignment: CrossAxisAlignment.start, | ||
| 64 | + children: [ | ||
| 65 | + Expanded( | ||
| 66 | + child: SingleChildScrollView( | ||
| 67 | + controller: _controller, | ||
| 68 | + child: Column( | ||
| 69 | + crossAxisAlignment: CrossAxisAlignment.start, | ||
| 70 | + children: [ | ||
| 71 | + Text('1.您的店内有哪些包间类型?', | ||
| 72 | + style: TextStyle( | ||
| 73 | + fontSize: ScreenUtil().setSp(30), | ||
| 74 | + fontWeight: FontWeight.bold)), | ||
| 75 | + VEmptyView(30), | ||
| 76 | + Column(children: _roomTypeWidget()), | ||
| 77 | + ]))), | ||
| 78 | + RoundButton( | ||
| 79 | + text: '下一步', | ||
| 80 | + gradientStart: MyColours.color_199095, | ||
| 81 | + gradientEnd: MyColours.color_199095, | ||
| 82 | + // borderColor: MyColours.color_999999, | ||
| 83 | + radius: ScreenUtil().setWidth(20), | ||
| 84 | + fontSize: 28, | ||
| 85 | + isBold: false, | ||
| 86 | + onPressed: () { | ||
| 87 | + NavigatorUtil.goCreateStorePage(context); | ||
| 88 | + }, | ||
| 89 | + ) | ||
| 90 | + ])))); | ||
| 91 | + } | ||
| 92 | +} |
| @@ -88,7 +88,7 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { | @@ -88,7 +88,7 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { | ||
| 88 | _getIntent(); | 88 | _getIntent(); |
| 89 | Future.delayed(Duration(milliseconds: 30000), () { | 89 | Future.delayed(Duration(milliseconds: 30000), () { |
| 90 | ContactModel.getInstance().uploadLocalContact(context); | 90 | ContactModel.getInstance().uploadLocalContact(context); |
| 91 | - UpdateModel updateModel = new UpdateModel(); | 91 | + UpdateModel updateModel = Provider.of<UpdateModel>(context); |
| 92 | updateModel.checkUpdate(context, showToast: false); | 92 | updateModel.checkUpdate(context, showToast: false); |
| 93 | }); | 93 | }); |
| 94 | timer = Timer.periodic(Duration(minutes: 3), (_) { | 94 | timer = Timer.periodic(Duration(minutes: 3), (_) { |
lib/pages/login/binding_phone.dart
0 → 100644
| 1 | +import 'dart:async'; | ||
| 2 | + | ||
| 3 | +import 'package:flutter/material.dart'; | ||
| 4 | +import 'package:flutter_screenutil/screenutil.dart'; | ||
| 5 | +import 'package:one_key/app.dart'; | ||
| 6 | +import 'package:one_key/res/colors.dart'; | ||
| 7 | +import 'package:one_key/utils/navigator_util.dart'; | ||
| 8 | +import 'package:one_key/widgets/h_empty_view.dart'; | ||
| 9 | +import 'package:one_key/widgets/round_button.dart'; | ||
| 10 | +import 'package:one_key/widgets/system_app_bar.dart'; | ||
| 11 | +import 'package:one_key/widgets/v_empty_view.dart'; | ||
| 12 | + | ||
| 13 | +class BindingPhone extends StatefulWidget { | ||
| 14 | + BindingPhone({Key key}) : super(key: key); | ||
| 15 | + | ||
| 16 | + @override | ||
| 17 | + _BindingPhoneState createState() => _BindingPhoneState(); | ||
| 18 | +} | ||
| 19 | + | ||
| 20 | +class _BindingPhoneState extends State<BindingPhone> { | ||
| 21 | + ScrollController _controller; | ||
| 22 | + FocusNode _phoneNode; | ||
| 23 | + FocusNode _codeNode; | ||
| 24 | + | ||
| 25 | + //定义变量 | ||
| 26 | + Timer _timer; | ||
| 27 | + //倒计时数值 | ||
| 28 | + var countdownTime = 0; | ||
| 29 | + | ||
| 30 | + @override | ||
| 31 | + void initState() { | ||
| 32 | + super.initState(); | ||
| 33 | + _controller = ScrollController(); | ||
| 34 | + _phoneNode = FocusNode(); | ||
| 35 | + _codeNode = FocusNode(); | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + @override | ||
| 39 | + void dispose() { | ||
| 40 | + super.dispose(); | ||
| 41 | + _timer.cancel(); | ||
| 42 | + } | ||
| 43 | + | ||
| 44 | + ///倒计时方法 | ||
| 45 | + startCountdown() { | ||
| 46 | + countdownTime = 60; | ||
| 47 | + final call = (timer) { | ||
| 48 | + setState(() { | ||
| 49 | + if (countdownTime < 1) { | ||
| 50 | + _timer.cancel(); | ||
| 51 | + } else { | ||
| 52 | + countdownTime -= 1; | ||
| 53 | + } | ||
| 54 | + }); | ||
| 55 | + }; | ||
| 56 | + _timer = Timer.periodic(Duration(seconds: 1), call); | ||
| 57 | + } | ||
| 58 | + | ||
| 59 | + @override | ||
| 60 | + Widget build(BuildContext context) { | ||
| 61 | + return Scaffold( | ||
| 62 | + appBar: SystemAppBar( | ||
| 63 | + '绑定手机号', | ||
| 64 | + onTap: () { | ||
| 65 | + Navigator.pop(context); | ||
| 66 | + }, | ||
| 67 | + ), | ||
| 68 | + body: InkWell( | ||
| 69 | + onTap: () { | ||
| 70 | + FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘 | ||
| 71 | + }, | ||
| 72 | + child: Container( | ||
| 73 | + padding: EdgeInsets.all(ScreenUtil().setWidth(40)), | ||
| 74 | + child: Column( | ||
| 75 | + children: [ | ||
| 76 | + Expanded( | ||
| 77 | + child: SingleChildScrollView( | ||
| 78 | + controller: _controller, | ||
| 79 | + child: Column( | ||
| 80 | + children: [ | ||
| 81 | + TextField( | ||
| 82 | + // textAlignVertical: TextAlignVertical.bottom, | ||
| 83 | + maxLines: 1, | ||
| 84 | + // //光标颜色 | ||
| 85 | + // cursorColor: | ||
| 86 | + // widget.isSelect ? Colors.white : MyColours.color_199095, | ||
| 87 | + //输入文本的样式 | ||
| 88 | + style: TextStyle( | ||
| 89 | + fontSize: ScreenUtil().setSp(28), | ||
| 90 | + ), | ||
| 91 | + focusNode: _phoneNode, | ||
| 92 | + decoration: InputDecoration( | ||
| 93 | + contentPadding: EdgeInsets.symmetric( | ||
| 94 | + vertical: ScreenUtil().setWidth(6), | ||
| 95 | + horizontal: ScreenUtil().setWidth(20)), | ||
| 96 | + border: OutlineInputBorder(), | ||
| 97 | + hintText: '请输入手机号码', | ||
| 98 | + hintStyle: TextStyle( | ||
| 99 | + color: MyColours.color_999999, | ||
| 100 | + fontSize: ScreenUtil().setSp(28), | ||
| 101 | + ), | ||
| 102 | + // enabledBorder: new UnderlineInputBorder( | ||
| 103 | + // borderSide: BorderSide.none, | ||
| 104 | + // ), | ||
| 105 | + focusedBorder: OutlineInputBorder( | ||
| 106 | + borderSide: BorderSide( | ||
| 107 | + color: MyColours.color_199095)), | ||
| 108 | + ), | ||
| 109 | + onChanged: (value) {}, | ||
| 110 | + onEditingComplete: () { | ||
| 111 | + FocusScope.of(context) | ||
| 112 | + .requestFocus(FocusNode()); //点击空白处隐藏键盘 | ||
| 113 | + }, | ||
| 114 | + keyboardType: TextInputType.number, | ||
| 115 | + ), | ||
| 116 | + VEmptyView(30), | ||
| 117 | + Container( | ||
| 118 | + // height: ScreenUtil().setWidth(20), | ||
| 119 | + child: Row( | ||
| 120 | + children: [ | ||
| 121 | + Expanded( | ||
| 122 | + child: TextField( | ||
| 123 | + // textAlignVertical: TextAlignVertical.bottom, | ||
| 124 | + maxLines: 1, | ||
| 125 | + // //光标颜色 | ||
| 126 | + // cursorColor: | ||
| 127 | + // widget.isSelect ? Colors.white : MyColours.color_199095, | ||
| 128 | + //输入文本的样式 | ||
| 129 | + style: TextStyle( | ||
| 130 | + fontSize: ScreenUtil().setSp(28), | ||
| 131 | + ), | ||
| 132 | + focusNode: _codeNode, | ||
| 133 | + decoration: InputDecoration( | ||
| 134 | + contentPadding: EdgeInsets.symmetric( | ||
| 135 | + vertical: ScreenUtil().setWidth(6), | ||
| 136 | + horizontal: ScreenUtil().setWidth(20)), | ||
| 137 | + border: OutlineInputBorder(), | ||
| 138 | + hintText: '请输入短信验证码', | ||
| 139 | + hintStyle: TextStyle( | ||
| 140 | + color: MyColours.color_999999, | ||
| 141 | + fontSize: ScreenUtil().setSp(28), | ||
| 142 | + ), | ||
| 143 | + // enabledBorder: new UnderlineInputBorder( | ||
| 144 | + // borderSide: BorderSide.none, | ||
| 145 | + // ), | ||
| 146 | + focusedBorder: OutlineInputBorder( | ||
| 147 | + borderSide: BorderSide( | ||
| 148 | + color: MyColours.color_199095)), | ||
| 149 | + ), | ||
| 150 | + onChanged: (value) {}, | ||
| 151 | + onEditingComplete: () { | ||
| 152 | + FocusScope.of(context) | ||
| 153 | + .requestFocus(FocusNode()); //点击空白处隐藏键盘 | ||
| 154 | + }, | ||
| 155 | + keyboardType: TextInputType.number, | ||
| 156 | + ), | ||
| 157 | + ), | ||
| 158 | + HEmptyView(20), | ||
| 159 | + RoundButton( | ||
| 160 | + height: ScreenUtil().setWidth(88), | ||
| 161 | + width: ScreenUtil().setWidth(240), | ||
| 162 | + text: countdownTime > 0 | ||
| 163 | + ? "${countdownTime}s后重新获取" | ||
| 164 | + : "获取验证码", | ||
| 165 | + radius: ScreenUtil().setWidth(10), | ||
| 166 | + textColor: MyColours.color_333333, | ||
| 167 | + gradientStart: MyColours.color_ffffff, | ||
| 168 | + gradientEnd: MyColours.color_ffffff, | ||
| 169 | + borderColor: MyColours.color_999999, | ||
| 170 | + fontSize: 28, | ||
| 171 | + isBold: false, | ||
| 172 | + onPressed: () { | ||
| 173 | + if (countdownTime == 0) { | ||
| 174 | + startCountdown(); | ||
| 175 | + } | ||
| 176 | + }, | ||
| 177 | + ) | ||
| 178 | + ], | ||
| 179 | + )), | ||
| 180 | + // Spacer(), | ||
| 181 | + ], | ||
| 182 | + ), | ||
| 183 | + ), | ||
| 184 | + ), | ||
| 185 | + RoundButton( | ||
| 186 | + text: '提交', | ||
| 187 | + gradientStart: MyColours.color_199095, | ||
| 188 | + gradientEnd: MyColours.color_199095, | ||
| 189 | + // borderColor: MyColours.color_999999, | ||
| 190 | + radius: ScreenUtil().setWidth(20), | ||
| 191 | + fontSize: 28, | ||
| 192 | + isBold: false, | ||
| 193 | + onPressed: () { | ||
| 194 | + //真正登录成功标志 | ||
| 195 | + App.sp.setBool("isLogin", true); | ||
| 196 | + NavigatorUtil.goIfNeedCreateStorePage(context); | ||
| 197 | + }, | ||
| 198 | + ) | ||
| 199 | + ], | ||
| 200 | + ))), | ||
| 201 | + ); | ||
| 202 | + } | ||
| 203 | +} |
lib/pages/login/if_need_create_store.dart
0 → 100644
| 1 | +import 'package:flutter/material.dart'; | ||
| 2 | +import 'package:flutter_screenutil/screenutil.dart'; | ||
| 3 | +import 'package:one_key/res/colors.dart'; | ||
| 4 | +import 'package:one_key/utils/navigator_util.dart'; | ||
| 5 | +import 'package:one_key/widgets/round_button.dart'; | ||
| 6 | +import 'package:one_key/widgets/system_app_bar.dart'; | ||
| 7 | +import 'package:one_key/widgets/v_empty_view.dart'; | ||
| 8 | + | ||
| 9 | +class IfNeedCreateStore extends StatefulWidget { | ||
| 10 | + IfNeedCreateStore({Key key}) : super(key: key); | ||
| 11 | + | ||
| 12 | + @override | ||
| 13 | + _IfNeedCreateStoreState createState() => _IfNeedCreateStoreState(); | ||
| 14 | +} | ||
| 15 | + | ||
| 16 | +class _IfNeedCreateStoreState extends State<IfNeedCreateStore> { | ||
| 17 | + ScrollController _controller = ScrollController(); | ||
| 18 | + bool noStore = true; | ||
| 19 | + @override | ||
| 20 | + Widget build(BuildContext context) { | ||
| 21 | + return Scaffold( | ||
| 22 | + appBar: SystemAppBar( | ||
| 23 | + 'xxx', | ||
| 24 | + onTap: () { | ||
| 25 | + Navigator.pop(context); | ||
| 26 | + }, | ||
| 27 | + ), | ||
| 28 | + body: Container( | ||
| 29 | + width: double.infinity, | ||
| 30 | + padding: EdgeInsets.all(ScreenUtil().setWidth(40)), | ||
| 31 | + child: Column( | ||
| 32 | + crossAxisAlignment: CrossAxisAlignment.center, | ||
| 33 | + mainAxisAlignment: MainAxisAlignment.center, | ||
| 34 | + children: [ | ||
| 35 | + Text( | ||
| 36 | + noStore ? '您还没有绑定任何店铺' : '您已经是“xxxxx”的员工', | ||
| 37 | + style: TextStyle( | ||
| 38 | + fontSize: ScreenUtil().setSp(30), | ||
| 39 | + fontWeight: FontWeight.bold), | ||
| 40 | + ), | ||
| 41 | + VEmptyView(30), | ||
| 42 | + InkWell( | ||
| 43 | + onTap: () { | ||
| 44 | + if (noStore) { | ||
| 45 | + //跳转至新建店铺流程 | ||
| 46 | + NavigatorUtil.goCreateStorePage(context); | ||
| 47 | + } else { | ||
| 48 | + //进入店铺 | ||
| 49 | + | ||
| 50 | + } | ||
| 51 | + }, | ||
| 52 | + child: Container( | ||
| 53 | + padding: EdgeInsets.symmetric( | ||
| 54 | + horizontal: ScreenUtil().setWidth(30), | ||
| 55 | + vertical: ScreenUtil().setWidth(16)), | ||
| 56 | + decoration: BoxDecoration( | ||
| 57 | + color: MyColours.color_199095, | ||
| 58 | + borderRadius: BorderRadius.circular( | ||
| 59 | + ScreenUtil().setWidth(10))), | ||
| 60 | + constraints: BoxConstraints( | ||
| 61 | + minWidth: ScreenUtil().setWidth(260)), | ||
| 62 | + child: Text( | ||
| 63 | + noStore ? '创建店铺' : '进入xxxxx', | ||
| 64 | + textAlign: TextAlign.center, | ||
| 65 | + style: TextStyle( | ||
| 66 | + color: MyColours.color_ffffff, | ||
| 67 | + fontSize: ScreenUtil().setSp(28)), | ||
| 68 | + ), | ||
| 69 | + )), | ||
| 70 | + noStore | ||
| 71 | + ? Container() | ||
| 72 | + : Container( | ||
| 73 | + margin: | ||
| 74 | + EdgeInsets.only(top: ScreenUtil().setWidth(10)), | ||
| 75 | + padding: EdgeInsets.symmetric( | ||
| 76 | + horizontal: ScreenUtil().setWidth(30), | ||
| 77 | + vertical: ScreenUtil().setWidth(16)), | ||
| 78 | + child: InkWell( | ||
| 79 | + onTap: () { | ||
| 80 | + //跳转至新建店铺流程 | ||
| 81 | + NavigatorUtil.goCreateStorePage(context); | ||
| 82 | + }, | ||
| 83 | + child: Text( | ||
| 84 | + '不是我,我要重新建店', | ||
| 85 | + textAlign: TextAlign.center, | ||
| 86 | + style: TextStyle( | ||
| 87 | + color: MyColours.color_333333, | ||
| 88 | + fontSize: ScreenUtil().setSp(24)), | ||
| 89 | + ), | ||
| 90 | + )), | ||
| 91 | + ]))); | ||
| 92 | + } | ||
| 93 | +} |
| 1 | +import 'dart:async'; | ||
| 2 | +import 'dart:convert'; | ||
| 3 | +import 'dart:io'; | ||
| 4 | + | ||
| 5 | +import 'package:common_utils/common_utils.dart'; | ||
| 6 | +import 'package:dio/dio.dart'; | ||
| 1 | import 'package:flutter/material.dart'; | 7 | import 'package:flutter/material.dart'; |
| 2 | import 'package:flutter_screenutil/flutter_screenutil.dart'; | 8 | import 'package:flutter_screenutil/flutter_screenutil.dart'; |
| 9 | +import 'package:fluwx/fluwx.dart' as fluwx; | ||
| 10 | +import 'package:fluwx/fluwx.dart'; | ||
| 3 | import 'package:one_key/app.dart'; | 11 | import 'package:one_key/app.dart'; |
| 12 | +import 'package:one_key/net/dio_util.dart'; | ||
| 4 | import 'package:one_key/provider/user_model.dart'; | 13 | import 'package:one_key/provider/user_model.dart'; |
| 5 | import 'package:one_key/res/colors.dart'; | 14 | import 'package:one_key/res/colors.dart'; |
| 6 | import 'package:one_key/utils/navigator_util.dart'; | 15 | import 'package:one_key/utils/navigator_util.dart'; |
| 16 | +import 'package:one_key/utils/utils.dart'; | ||
| 7 | import 'package:one_key/widgets/h_empty_view.dart'; | 17 | import 'package:one_key/widgets/h_empty_view.dart'; |
| 18 | +import 'package:one_key/widgets/round_button.dart'; | ||
| 8 | import 'package:one_key/widgets/v_empty_view.dart'; | 19 | import 'package:one_key/widgets/v_empty_view.dart'; |
| 9 | import 'package:provider/provider.dart'; | 20 | import 'package:provider/provider.dart'; |
| 21 | +import 'package:sign_in_with_apple/sign_in_with_apple.dart'; | ||
| 10 | 22 | ||
| 11 | class LoginPage extends StatefulWidget { | 23 | class LoginPage extends StatefulWidget { |
| 12 | @override | 24 | @override |
| @@ -16,46 +28,64 @@ class LoginPage extends StatefulWidget { | @@ -16,46 +28,64 @@ class LoginPage extends StatefulWidget { | ||
| 16 | } | 28 | } |
| 17 | } | 29 | } |
| 18 | 30 | ||
| 19 | -class LoginState extends State<LoginPage> with WidgetsBindingObserver{ | ||
| 20 | - | ||
| 21 | - TextEditingController _sellerCodeController=TextEditingController(); | 31 | +class LoginState extends State<LoginPage> with WidgetsBindingObserver { |
| 32 | + TextEditingController _sellerCodeController = TextEditingController(); | ||
| 22 | TextEditingController _accountController = TextEditingController(); | 33 | TextEditingController _accountController = TextEditingController(); |
| 23 | final TextEditingController _pwdController = TextEditingController(); | 34 | final TextEditingController _pwdController = TextEditingController(); |
| 24 | - final ScrollController _scrollController=new ScrollController(); | 35 | + final ScrollController _scrollController = new ScrollController(); |
| 25 | 36 | ||
| 26 | - final FocusNode _sellerCodeFocusNode=new FocusNode(); | ||
| 27 | - final FocusNode _accountFocusNode=new FocusNode(); | ||
| 28 | - final FocusNode _pwdFocusNode=new FocusNode(); | 37 | + final FocusNode _sellerCodeFocusNode = new FocusNode(); |
| 38 | + final FocusNode _accountFocusNode = new FocusNode(); | ||
| 39 | + final FocusNode _pwdFocusNode = new FocusNode(); | ||
| 29 | 40 | ||
| 30 | - bool obscureText=true;//是否隐藏密码 | ||
| 31 | - bool isActivate=false;//是否激活登录 | 41 | + bool obscureText = true; //是否隐藏密码 |
| 42 | + bool isActivate = false; //是否激活登录 | ||
| 32 | 43 | ||
| 33 | - String errorText="";//错误提示 | 44 | + String errorText = ""; //错误提示 |
| 34 | 45 | ||
| 35 | bool _check = true; | 46 | bool _check = true; |
| 47 | + StreamSubscription<BaseWeChatResponse> _wxlogin; | ||
| 36 | 48 | ||
| 37 | @override | 49 | @override |
| 38 | - void initState(){ | 50 | + void initState() { |
| 39 | // TODO: implement initState | 51 | // TODO: implement initState |
| 40 | super.initState(); | 52 | super.initState(); |
| 53 | + _initFluwx(); | ||
| 41 | isLogin(); | 54 | isLogin(); |
| 42 | WidgetsBinding.instance.addObserver(this); | 55 | WidgetsBinding.instance.addObserver(this); |
| 43 | - WidgetsBinding.instance.addPostFrameCallback((_){ | ||
| 44 | - final UserModel userModel=Provider.of<UserModel>(context,listen: false); | ||
| 45 | - if(userModel!=null&&userModel.user!=null){ | ||
| 46 | - Future.delayed(Duration(milliseconds: 50),(){ | ||
| 47 | - _sellerCodeController.text=userModel.user.sellercode; | ||
| 48 | - _accountController.text=userModel.user.account; | ||
| 49 | - FocusScope.of(context).requestFocus(_pwdFocusNode); | 56 | + WidgetsBinding.instance.addPostFrameCallback((_) { |
| 57 | + final UserModel userModel = | ||
| 58 | + Provider.of<UserModel>(context, listen: false); | ||
| 59 | + if (userModel != null && userModel.user != null) { | ||
| 60 | + Future.delayed(Duration(milliseconds: 50), () { | ||
| 61 | + _sellerCodeController.text = userModel.user.sellercode; | ||
| 62 | + _accountController.text = userModel.user.account; | ||
| 63 | + // FocusScope.of(context).requestFocus(_pwdFocusNode); | ||
| 50 | }); | 64 | }); |
| 51 | } | 65 | } |
| 52 | }); | 66 | }); |
| 53 | } | 67 | } |
| 54 | 68 | ||
| 55 | - handlePostFrame(_){ | ||
| 56 | - // _scrollController.jumpTo(_scrollController.position.maxScrollExtent); | 69 | + //初始化微信SDK |
| 70 | + _initFluwx() async { | ||
| 71 | + await registerWxApi( | ||
| 72 | + appId: "wx85aa3cdd0f791e65", | ||
| 73 | + doOnAndroid: true, | ||
| 74 | + doOnIOS: true, | ||
| 75 | + universalLink: "https://xt04.colorcun.com/link/OneKey/"); | ||
| 76 | + var result = await isWeChatInstalled; | ||
| 77 | + if (result != null && result) { | ||
| 78 | + App.isInstallWx = true; | ||
| 79 | + } else { | ||
| 80 | + App.isInstallWx = false; | ||
| 81 | + } | ||
| 82 | + setState(() {}); | ||
| 83 | + LogUtil.v("is installed $result"); | ||
| 57 | } | 84 | } |
| 58 | 85 | ||
| 86 | + handlePostFrame(_) { | ||
| 87 | + // _scrollController.jumpTo(_scrollController.position.maxScrollExtent); | ||
| 88 | + } | ||
| 59 | 89 | ||
| 60 | @override | 90 | @override |
| 61 | void didChangeMetrics() { | 91 | void didChangeMetrics() { |
| @@ -72,279 +102,562 @@ class LoginState extends State<LoginPage> with WidgetsBindingObserver{ | @@ -72,279 +102,562 @@ class LoginState extends State<LoginPage> with WidgetsBindingObserver{ | ||
| 72 | } | 102 | } |
| 73 | 103 | ||
| 74 | //监听输入框,设置登录按钮状态 | 104 | //监听输入框,设置登录按钮状态 |
| 75 | - setActivate(){ | ||
| 76 | - if(_sellerCodeController.text.isNotEmpty&&_accountController.text.isNotEmpty&&_pwdController.text.isNotEmpty){ | 105 | + setActivate() { |
| 106 | + if (_sellerCodeController.text.isNotEmpty && | ||
| 107 | + _accountController.text.isNotEmpty && | ||
| 108 | + _pwdController.text.isNotEmpty) { | ||
| 77 | setState(() { | 109 | setState(() { |
| 78 | - errorText=""; | ||
| 79 | - isActivate=true; | 110 | + errorText = ""; |
| 111 | + isActivate = true; | ||
| 80 | }); | 112 | }); |
| 81 | - }else{ | 113 | + } else { |
| 82 | setState(() { | 114 | setState(() { |
| 83 | - errorText=""; | ||
| 84 | - isActivate=false; | 115 | + errorText = ""; |
| 116 | + isActivate = false; | ||
| 85 | }); | 117 | }); |
| 86 | } | 118 | } |
| 87 | } | 119 | } |
| 88 | 120 | ||
| 89 | //判断是否登录 | 121 | //判断是否登录 |
| 90 | - void isLogin()async{ | 122 | + void isLogin() async { |
| 91 | await App.initSp(); | 123 | await App.initSp(); |
| 92 | - UserModel userModel=Provider.of<UserModel>(context,listen: false); | 124 | + UserModel userModel = Provider.of<UserModel>(context, listen: false); |
| 93 | userModel.initUser(); | 125 | userModel.initUser(); |
| 94 | - if(App.sp.getBool("isLogin")??false){ | ||
| 95 | - Future.delayed(Duration(milliseconds: 200),(){ | 126 | + if (App.sp.getBool("isLogin") ?? false) { |
| 127 | + Future.delayed(Duration(milliseconds: 200), () { | ||
| 96 | NavigatorUtil.goHomePage(context); | 128 | NavigatorUtil.goHomePage(context); |
| 97 | }); | 129 | }); |
| 130 | + } else { | ||
| 131 | + _getWxCode(); | ||
| 132 | + } | ||
| 133 | + } | ||
| 134 | + | ||
| 135 | + ///微信登陆 | ||
| 136 | + | ||
| 137 | + _wxLogin() { | ||
| 138 | + sendWeChatAuth(scope: "snsapi_userinfo"); | ||
| 139 | + } | ||
| 140 | + | ||
| 141 | + ///获取微信登录code | ||
| 142 | + _getWxCode() { | ||
| 143 | + _wxlogin = fluwx.weChatResponseEventHandler | ||
| 144 | + .distinct((a, b) => a == b) | ||
| 145 | + .listen((res) { | ||
| 146 | + if (res is fluwx.WeChatAuthResponse && res.errCode == 0) { | ||
| 147 | + LogUtil.v("code:" + res.code); | ||
| 148 | + _getAccessToken(res.code); | ||
| 149 | + } else { | ||
| 150 | +// Utils.showToast(res.errStr??"登录失败,请稍后重试"); | ||
| 151 | + } | ||
| 152 | + }); | ||
| 153 | + } | ||
| 154 | + | ||
| 155 | + ///获取微信登录access_token | ||
| 156 | + _getAccessToken(String code) async { | ||
| 157 | + Response response = await DioUtil.getInstance().getDio().get( | ||
| 158 | + "https://api.weixin.qq.com/sns/oauth2/access_token?appid=wx85aa3cdd0f791e65&secret=87c9a23c2e6032b2da75af6b0efc5424&code=$code&grant_type=authorization_code"); | ||
| 159 | + LogUtil.v("access_token:${response.toString()}"); | ||
| 160 | + Map<String, dynamic> responseData = json.decode(response.data.toString()); | ||
| 161 | + if (responseData["errcode"] != null) { | ||
| 162 | +// Utils.showToast(responseData["errmsg"]??"登录,请稍后重试"); | ||
| 163 | + } else { | ||
| 164 | + App.sp.setString("openid", responseData["openid"]); | ||
| 165 | + App.sp.setString("unionid", responseData["unionid"]); | ||
| 166 | + | ||
| 167 | + //跳转至手机号绑定页面 | ||
| 168 | + //判断是否已经绑定手机号码 ******调用接口******* | ||
| 169 | + //有,通过手机号吗或者opened查找店铺信息进行登陆 | ||
| 170 | + //没有,跳转至绑定手机号码页面 | ||
| 171 | + | ||
| 172 | + NavigatorUtil.goBindingPhonePage(context); | ||
| 173 | + | ||
| 174 | + // _getUserInfo(responseData["access_token"], responseData["openid"]); | ||
| 98 | } | 175 | } |
| 99 | } | 176 | } |
| 100 | 177 | ||
| 178 | +// //获取用户信息 | ||
| 179 | +// _getUserInfo(String access_token, String openid) async { | ||
| 180 | +// Response response = await DioUtil.getInstance().getDio().get( | ||
| 181 | +// "https://api.weixin.qq.com/sns/userinfo?access_token=$access_token&openid=$openid"); | ||
| 182 | +// LogUtil.v('userinfo:' + response.data); | ||
| 183 | +// Map<String, dynamic> responseData = json.decode(response.data.toString()); | ||
| 184 | +// if (responseData["errcode"] != null) { | ||
| 185 | +// // Utils.showToast(responseData["errmsg"]??"登录,请稍后重试"); | ||
| 186 | +// } else { | ||
| 187 | +// App.sp.setString("nickName", responseData["nickname"]); | ||
| 188 | +// App.sp.setString("headImg", responseData["headimgurl"]); | ||
| 189 | +// App.sp.setString("unionid", responseData["unionid"]); | ||
| 190 | +// App.sp.setBool("isLogin", true); | ||
| 191 | +// // _fromTypeGo(); | ||
| 192 | +// String unionId = App.sp.getString("unionid"); | ||
| 193 | +// _getMiniOpenid(unionId); | ||
| 194 | +// } | ||
| 195 | +// } | ||
| 196 | +// //获取绑定小程序openid | ||
| 197 | +// _getMiniOpenid(String unionId) async { | ||
| 198 | +// UserModel userInfoProvider = UserModel(); | ||
| 199 | +// // Provider.of<UserInfoProvider>(context, listen: false); | ||
| 200 | +// Map<String, String> params = {"unionid": unionId}; | ||
| 201 | +// String miniOpenid = | ||
| 202 | +// await userInfoProvider.getMiniProgramOpenid(context, params); | ||
| 203 | +// if (miniOpenid == null) { | ||
| 204 | +// goMiniProgramMd(unionId); | ||
| 205 | +// } | ||
| 206 | +// } | ||
| 207 | + | ||
| 208 | + /* | ||
| 209 | + 苹果登录获取用户信息 | ||
| 210 | + */ | ||
| 211 | + _getUserInfoIOS() async { | ||
| 212 | + // Map<String, String> params = {"openid": App.sp.getString("openid")}; | ||
| 213 | + // UserInfoProvider userInfoProvider = | ||
| 214 | + // Provider.of<UserInfoProvider>(context, listen: false); | ||
| 215 | + // UseInfoItemModel useInfoItemModel = | ||
| 216 | + // await userInfoProvider.getUserInfo(context, params); | ||
| 217 | + | ||
| 218 | + // if (ObjectUtil.isNotEmpty(useInfoItemModel.openid)) { | ||
| 219 | + // _hideLoading(context); | ||
| 220 | + // App.sp.setString("nickName", useInfoItemModel.nickname); | ||
| 221 | + // App.sp.setString("headImg", ''); | ||
| 222 | + // App.sp.setString("unionid", ''); | ||
| 223 | + // App.sp.setBool("isLogin", true); | ||
| 224 | + // UserInfoProvider userInfoProvider = new UserInfoProvider(); | ||
| 225 | + // userInfoProvider.initPlatformState(context); | ||
| 226 | + // // Loading.hideLoading(context); | ||
| 227 | + // _fromTypeGo(); | ||
| 228 | + // } else { | ||
| 229 | + // // 已经授权,但是后台库里没有数据,版本差异,重新插入数据库 | ||
| 230 | + // Map param = { | ||
| 231 | + // 'openid': App.sp.getString("openid"), | ||
| 232 | + // 'avatar': 'ios_avatar', | ||
| 233 | + // 'nickname': '', | ||
| 234 | + // 'gender': '1' | ||
| 235 | + // }; | ||
| 236 | + // LoginRespository().appleLogin(context, param, () { | ||
| 237 | + // _getUserInfoIOS(); | ||
| 238 | + // }); | ||
| 239 | + // } | ||
| 240 | + } | ||
| 241 | + | ||
| 242 | + ///苹果登陆 | ||
| 243 | + _iosLogin() async { | ||
| 244 | + // String info = await Utils.getDeviceInfoSystem(); | ||
| 245 | + // int systemInfo = info.compareTo('13'); | ||
| 246 | + // if (systemInfo < 0) { | ||
| 247 | + // Utils.showToast('该系统版本不支持苹果登录'); | ||
| 248 | + // return; | ||
| 249 | + // } | ||
| 250 | + // final credential = await SignInWithApple.getAppleIDCredential( | ||
| 251 | + // scopes: [ | ||
| 252 | + // AppleIDAuthorizationScopes.email, | ||
| 253 | + // AppleIDAuthorizationScopes.fullName, | ||
| 254 | + // ], | ||
| 255 | + // webAuthenticationOptions: WebAuthenticationOptions( | ||
| 256 | + // // TODO: Set the `clientId` and `redirectUri` arguments to the values you entered in the Apple Developer portal during the setup | ||
| 257 | + // clientId: 'com.naji.zdap', | ||
| 258 | + // redirectUri: Uri.parse( | ||
| 259 | + // 'https://flutter-sign-in-with-apple-example.glitch.me/callbacks/sign_in_with_apple', | ||
| 260 | + // ), | ||
| 261 | + // ), | ||
| 262 | + // ); | ||
| 263 | + // _showLoading(context); | ||
| 264 | + // String mdString = Utils.generateMd5(credential.userIdentifier); | ||
| 265 | + // String temp = mdString.substring(8, mdString.length - 2); | ||
| 266 | + // String openid = 'IOSID_$temp'; | ||
| 267 | + // App.sp.setString("openid", openid); | ||
| 268 | + // App.sp.setString("unionid", ''); | ||
| 269 | + // print(openid.length); | ||
| 270 | + | ||
| 271 | + // // 第一次授权 | ||
| 272 | + // if (ObjectUtil.isNotEmpty(credential.familyName)) { | ||
| 273 | + // Map param = { | ||
| 274 | + // 'openid': openid, | ||
| 275 | + // 'avatar': 'ios_avatar', | ||
| 276 | + // 'nickname': '${credential.familyName}${credential.givenName}', | ||
| 277 | + // 'gender': '1' | ||
| 278 | + // }; | ||
| 279 | + // LoginRespository().appleLogin(context, param, () { | ||
| 280 | + // _getUserInfoIOS(); | ||
| 281 | + // }); | ||
| 282 | + // } else { | ||
| 283 | + // if (ObjectUtil.isNotEmpty(App.sp.getString("newUserMsg"))) { | ||
| 284 | + // Map newUserMsg = jsonDecode(App.sp.getString("newUserMsg")); | ||
| 285 | + // //上次失败了,这次重新传 | ||
| 286 | + // LoginRespository().appleLogin(context, newUserMsg, () { | ||
| 287 | + // _getUserInfoIOS(); | ||
| 288 | + // }); | ||
| 289 | + // } else { | ||
| 290 | + // _getUserInfoIOS(); | ||
| 291 | + // } | ||
| 292 | + // } | ||
| 293 | + } | ||
| 294 | + | ||
| 101 | @override | 295 | @override |
| 102 | Widget build(BuildContext context) { | 296 | Widget build(BuildContext context) { |
| 103 | // TODO: implement build | 297 | // TODO: implement build |
| 104 | - ScreenUtil.init(context,width: 750,height: 1334); | ||
| 105 | - final Size size=MediaQuery.of(context).size; | ||
| 106 | - App.screenWidth=size.width; | ||
| 107 | - App.screenHeight=size.height; | ||
| 108 | - App.statusBarHeight=MediaQuery.of(context).padding.top; | ||
| 109 | - App.bottomBarHeight=MediaQuery.of(context).padding.bottom; | 298 | + ScreenUtil.init(context, width: 750, height: 1334); |
| 299 | + final Size size = MediaQuery.of(context).size; | ||
| 300 | + App.screenWidth = size.width; | ||
| 301 | + App.screenHeight = size.height; | ||
| 302 | + App.statusBarHeight = MediaQuery.of(context).padding.top; | ||
| 303 | + App.bottomBarHeight = MediaQuery.of(context).padding.bottom; | ||
| 304 | + | ||
| 305 | + final double prefixIconWidth = ScreenUtil().setWidth(24); | ||
| 110 | 306 | ||
| 111 | - final double prefixIconWidth=ScreenUtil().setWidth(24); | ||
| 112 | return Scaffold( | 307 | return Scaffold( |
| 113 | - backgroundColor: MyColours.color_ffffff, | ||
| 114 | - body: Container( | ||
| 115 | - width: double.infinity, | ||
| 116 | - height: double.infinity, | ||
| 117 | - child: SingleChildScrollView( | ||
| 118 | - controller: _scrollController, | ||
| 119 | - child: Column( | ||
| 120 | - crossAxisAlignment: CrossAxisAlignment.center, | ||
| 121 | - children: <Widget>[ | ||
| 122 | - VEmptyView(218-App.statusBarHeight), | ||
| 123 | - Image.asset("assets/logo.png",width: ScreenUtil().setWidth(217),height: ScreenUtil().setWidth(206),), | ||
| 124 | - VEmptyView(121), | ||
| 125 | - Container( | ||
| 126 | - height: ScreenUtil().setHeight(84), | ||
| 127 | - width: ScreenUtil().setWidth(611), | ||
| 128 | - padding: EdgeInsets.only(left: ScreenUtil().setWidth(20)), | ||
| 129 | - alignment: Alignment.center, | ||
| 130 | - decoration: BoxDecoration( | ||
| 131 | - border: Border.all(color: MyColours.color_bff6f7,width: ScreenUtil().setWidth(2)), | ||
| 132 | - borderRadius: BorderRadius.circular(ScreenUtil().setWidth(8)) | ||
| 133 | - ), | ||
| 134 | - child: Row( | ||
| 135 | - crossAxisAlignment: CrossAxisAlignment.center, | ||
| 136 | - children: <Widget>[ | ||
| 137 | - Image.asset("assets/icon_sellercode.png",width: prefixIconWidth,), | ||
| 138 | - HEmptyView(26), | ||
| 139 | - Text("商户编号",style: TextStyle(color: MyColours.color_353535,fontSize: ScreenUtil().setSp(28)),), | ||
| 140 | - Expanded( | ||
| 141 | - child: TextField( | ||
| 142 | - controller: _sellerCodeController, | ||
| 143 | - focusNode: _sellerCodeFocusNode, | ||
| 144 | - autofocus: _sellerCodeController.text.isEmpty, | ||
| 145 | - style: TextStyle(color: MyColours.color_353535,fontSize: ScreenUtil().setSp(28),textBaseline: TextBaseline.alphabetic), | ||
| 146 | - textAlignVertical: TextAlignVertical.center, | ||
| 147 | - decoration: InputDecoration( | 308 | + backgroundColor: MyColours.color_ffffff, |
| 309 | + body: Container( | ||
| 310 | + width: double.infinity, | ||
| 311 | + height: double.infinity, | ||
| 312 | + child: SingleChildScrollView( | ||
| 313 | + controller: _scrollController, | ||
| 314 | + child: Column( | ||
| 315 | + crossAxisAlignment: CrossAxisAlignment.center, | ||
| 316 | + children: <Widget>[ | ||
| 317 | + VEmptyView(218 - App.statusBarHeight), | ||
| 318 | + Image.asset( | ||
| 319 | + "assets/logo.png", | ||
| 320 | + width: ScreenUtil().setWidth(217), | ||
| 321 | + height: ScreenUtil().setWidth(206), | ||
| 322 | + ), | ||
| 323 | + VEmptyView(121), | ||
| 324 | + Container( | ||
| 325 | + height: ScreenUtil().setHeight(84), | ||
| 326 | + width: ScreenUtil().setWidth(611), | ||
| 327 | + padding: EdgeInsets.only(left: ScreenUtil().setWidth(20)), | ||
| 328 | + alignment: Alignment.center, | ||
| 329 | + decoration: BoxDecoration( | ||
| 330 | + border: Border.all( | ||
| 331 | + color: MyColours.color_bff6f7, | ||
| 332 | + width: ScreenUtil().setWidth(2)), | ||
| 333 | + borderRadius: | ||
| 334 | + BorderRadius.circular(ScreenUtil().setWidth(8))), | ||
| 335 | + child: Row( | ||
| 336 | + crossAxisAlignment: CrossAxisAlignment.center, | ||
| 337 | + children: <Widget>[ | ||
| 338 | + Image.asset( | ||
| 339 | + "assets/icon_sellercode.png", | ||
| 340 | + width: prefixIconWidth, | ||
| 341 | + ), | ||
| 342 | + HEmptyView(26), | ||
| 343 | + Text( | ||
| 344 | + "商户编号", | ||
| 345 | + style: TextStyle( | ||
| 346 | + color: MyColours.color_353535, | ||
| 347 | + fontSize: ScreenUtil().setSp(28)), | ||
| 348 | + ), | ||
| 349 | + Expanded( | ||
| 350 | + child: TextField( | ||
| 351 | + controller: _sellerCodeController, | ||
| 352 | + focusNode: _sellerCodeFocusNode, | ||
| 353 | + // autofocus: _sellerCodeController.text.isEmpty, | ||
| 354 | + style: TextStyle( | ||
| 355 | + color: MyColours.color_353535, | ||
| 356 | + fontSize: ScreenUtil().setSp(28), | ||
| 357 | + textBaseline: TextBaseline.alphabetic), | ||
| 358 | + textAlignVertical: TextAlignVertical.center, | ||
| 359 | + decoration: InputDecoration( | ||
| 148 | hintText: "请输入6位商户编码", | 360 | hintText: "请输入6位商户编码", |
| 149 | - hintStyle: TextStyle(color: MyColours.color_c1c1c1,fontSize: ScreenUtil().setSp(28),), | 361 | + hintStyle: TextStyle( |
| 362 | + color: MyColours.color_c1c1c1, | ||
| 363 | + fontSize: ScreenUtil().setSp(28), | ||
| 364 | + ), | ||
| 150 | border: InputBorder.none, | 365 | border: InputBorder.none, |
| 151 | - contentPadding: EdgeInsets.symmetric(horizontal: 10,vertical: 14), | 366 | + contentPadding: EdgeInsets.symmetric( |
| 367 | + horizontal: 10, vertical: 14), | ||
| 368 | + ), | ||
| 369 | + onChanged: (_) { | ||
| 370 | + setActivate(); | ||
| 371 | + }, | ||
| 372 | + keyboardType: TextInputType.number, | ||
| 152 | ), | 373 | ), |
| 153 | - onChanged: (_){ | ||
| 154 | - setActivate(); | ||
| 155 | - }, | ||
| 156 | - keyboardType: TextInputType.number, | 374 | + ) |
| 375 | + ], | ||
| 376 | + )), | ||
| 377 | + Container( | ||
| 378 | + height: ScreenUtil().setHeight(84), | ||
| 379 | + width: ScreenUtil().setWidth(611), | ||
| 380 | + padding: EdgeInsets.only(left: ScreenUtil().setWidth(20)), | ||
| 381 | + margin: EdgeInsets.only(top: ScreenUtil().setHeight(8)), | ||
| 382 | + alignment: Alignment.center, | ||
| 383 | + decoration: BoxDecoration( | ||
| 384 | + border: Border.all( | ||
| 385 | + color: MyColours.color_bff6f7, | ||
| 386 | + width: ScreenUtil().setWidth(2)), | ||
| 387 | + borderRadius: | ||
| 388 | + BorderRadius.circular(ScreenUtil().setWidth(8))), | ||
| 389 | + child: Row( | ||
| 390 | + crossAxisAlignment: CrossAxisAlignment.center, | ||
| 391 | + children: <Widget>[ | ||
| 392 | + Image.asset( | ||
| 393 | + "assets/icon_account.png", | ||
| 394 | + width: prefixIconWidth, | ||
| 157 | ), | 395 | ), |
| 158 | - ) | ||
| 159 | - ], | ||
| 160 | - ) | ||
| 161 | - ), | ||
| 162 | - Container( | ||
| 163 | - height: ScreenUtil().setHeight(84), | ||
| 164 | - width: ScreenUtil().setWidth(611), | ||
| 165 | - padding: EdgeInsets.only(left: ScreenUtil().setWidth(20)), | ||
| 166 | - margin: EdgeInsets.only(top: ScreenUtil().setHeight(8)), | ||
| 167 | - alignment: Alignment.center, | ||
| 168 | - decoration: BoxDecoration( | ||
| 169 | - border: Border.all(color: MyColours.color_bff6f7,width: ScreenUtil().setWidth(2)), | ||
| 170 | - borderRadius: BorderRadius.circular(ScreenUtil().setWidth(8)) | ||
| 171 | - ), | ||
| 172 | - child: Row( | ||
| 173 | - crossAxisAlignment: CrossAxisAlignment.center, | ||
| 174 | - children: <Widget>[ | ||
| 175 | - Image.asset("assets/icon_account.png",width: prefixIconWidth,), | ||
| 176 | - HEmptyView(26), | ||
| 177 | - Text("工 号",style: TextStyle(color: MyColours.color_353535,fontSize: ScreenUtil().setSp(28)),), | ||
| 178 | - Expanded( | ||
| 179 | - child: TextField( | ||
| 180 | - controller: _accountController, | ||
| 181 | - focusNode: _accountFocusNode, | ||
| 182 | - style: TextStyle(color: MyColours.color_353535,fontSize: ScreenUtil().setSp(28)), | ||
| 183 | - decoration: InputDecoration( | 396 | + HEmptyView(26), |
| 397 | + Text( | ||
| 398 | + "工 号", | ||
| 399 | + style: TextStyle( | ||
| 400 | + color: MyColours.color_353535, | ||
| 401 | + fontSize: ScreenUtil().setSp(28)), | ||
| 402 | + ), | ||
| 403 | + Expanded( | ||
| 404 | + child: TextField( | ||
| 405 | + controller: _accountController, | ||
| 406 | + focusNode: _accountFocusNode, | ||
| 407 | + style: TextStyle( | ||
| 408 | + color: MyColours.color_353535, | ||
| 409 | + fontSize: ScreenUtil().setSp(28)), | ||
| 410 | + decoration: InputDecoration( | ||
| 184 | hintText: "请输入4位工号", | 411 | hintText: "请输入4位工号", |
| 185 | - hintStyle: TextStyle(color: MyColours.color_c1c1c1,fontSize: ScreenUtil().setSp(28)), | 412 | + hintStyle: TextStyle( |
| 413 | + color: MyColours.color_c1c1c1, | ||
| 414 | + fontSize: ScreenUtil().setSp(28)), | ||
| 186 | border: InputBorder.none, | 415 | border: InputBorder.none, |
| 187 | - contentPadding: EdgeInsets.symmetric(horizontal: 10,vertical: 14), | 416 | + contentPadding: EdgeInsets.symmetric( |
| 417 | + horizontal: 10, vertical: 14), | ||
| 418 | + ), | ||
| 419 | + onChanged: (_) { | ||
| 420 | + setActivate(); | ||
| 421 | + }, | ||
| 422 | + keyboardType: TextInputType.number, | ||
| 188 | ), | 423 | ), |
| 189 | - onChanged: (_){ | ||
| 190 | - setActivate(); | ||
| 191 | - }, | ||
| 192 | - keyboardType: TextInputType.number, | 424 | + ) |
| 425 | + ], | ||
| 426 | + )), | ||
| 427 | + Container( | ||
| 428 | + height: ScreenUtil().setHeight(84), | ||
| 429 | + width: ScreenUtil().setWidth(611), | ||
| 430 | + padding: EdgeInsets.only( | ||
| 431 | + left: ScreenUtil().setWidth(20), | ||
| 432 | + right: ScreenUtil().setWidth(27)), | ||
| 433 | + margin: EdgeInsets.only(top: ScreenUtil().setHeight(8)), | ||
| 434 | + alignment: Alignment.center, | ||
| 435 | + decoration: BoxDecoration( | ||
| 436 | + border: Border.all( | ||
| 437 | + color: MyColours.color_bff6f7, | ||
| 438 | + width: ScreenUtil().setWidth(2)), | ||
| 439 | + borderRadius: | ||
| 440 | + BorderRadius.circular(ScreenUtil().setWidth(8))), | ||
| 441 | + child: Row( | ||
| 442 | + crossAxisAlignment: CrossAxisAlignment.center, | ||
| 443 | + children: <Widget>[ | ||
| 444 | + Image.asset( | ||
| 445 | + "assets/icon_pwd.png", | ||
| 446 | + width: prefixIconWidth, | ||
| 193 | ), | 447 | ), |
| 194 | - ) | ||
| 195 | - ], | ||
| 196 | - ) | ||
| 197 | - ), | ||
| 198 | - Container( | ||
| 199 | - height: ScreenUtil().setHeight(84), | ||
| 200 | - width: ScreenUtil().setWidth(611), | ||
| 201 | - padding: EdgeInsets.only(left: ScreenUtil().setWidth(20),right: ScreenUtil().setWidth(27)), | ||
| 202 | - margin: EdgeInsets.only(top: ScreenUtil().setHeight(8)), | ||
| 203 | - alignment: Alignment.center, | ||
| 204 | - decoration: BoxDecoration( | ||
| 205 | - border: Border.all(color: MyColours.color_bff6f7,width: ScreenUtil().setWidth(2)), | ||
| 206 | - borderRadius: BorderRadius.circular(ScreenUtil().setWidth(8)) | ||
| 207 | - ), | ||
| 208 | - child: Row( | ||
| 209 | - crossAxisAlignment: CrossAxisAlignment.center, | ||
| 210 | - children: <Widget>[ | ||
| 211 | - Image.asset("assets/icon_pwd.png",width: prefixIconWidth,), | ||
| 212 | - HEmptyView(26), | ||
| 213 | - Text("密 码",style: TextStyle(color: MyColours.color_353535,fontSize: ScreenUtil().setSp(28)),), | ||
| 214 | - Expanded( | ||
| 215 | - child: TextField( | ||
| 216 | - controller: _pwdController, | ||
| 217 | - focusNode: _pwdFocusNode, | ||
| 218 | - autofocus: _sellerCodeController.text.isNotEmpty&&_accountController.text.isNotEmpty&&_pwdController.text.isEmpty, | ||
| 219 | - style: TextStyle(color: MyColours.color_353535,fontSize: ScreenUtil().setSp(28)), | ||
| 220 | - decoration: InputDecoration( | 448 | + HEmptyView(26), |
| 449 | + Text( | ||
| 450 | + "密 码", | ||
| 451 | + style: TextStyle( | ||
| 452 | + color: MyColours.color_353535, | ||
| 453 | + fontSize: ScreenUtil().setSp(28)), | ||
| 454 | + ), | ||
| 455 | + Expanded( | ||
| 456 | + child: TextField( | ||
| 457 | + controller: _pwdController, | ||
| 458 | + focusNode: _pwdFocusNode, | ||
| 459 | + // autofocus: _sellerCodeController.text.isNotEmpty && | ||
| 460 | + // _accountController.text.isNotEmpty && | ||
| 461 | + // _pwdController.text.isEmpty, | ||
| 462 | + style: TextStyle( | ||
| 463 | + color: MyColours.color_353535, | ||
| 464 | + fontSize: ScreenUtil().setSp(28)), | ||
| 465 | + decoration: InputDecoration( | ||
| 221 | hintText: "请输入密码", | 466 | hintText: "请输入密码", |
| 222 | - hintStyle: TextStyle(color: MyColours.color_c1c1c1,fontSize: ScreenUtil().setSp(28)), | 467 | + hintStyle: TextStyle( |
| 468 | + color: MyColours.color_c1c1c1, | ||
| 469 | + fontSize: ScreenUtil().setSp(28)), | ||
| 223 | border: InputBorder.none, | 470 | border: InputBorder.none, |
| 224 | - contentPadding: EdgeInsets.symmetric(horizontal: 10,vertical: 14), | 471 | + contentPadding: EdgeInsets.symmetric( |
| 472 | + horizontal: 10, vertical: 14), | ||
| 473 | + ), | ||
| 474 | + onChanged: (_) { | ||
| 475 | + setActivate(); | ||
| 476 | + }, | ||
| 477 | + obscureText: obscureText, | ||
| 478 | + keyboardType: TextInputType.text, | ||
| 225 | ), | 479 | ), |
| 226 | - onChanged: (_){ | ||
| 227 | - setActivate(); | 480 | + ), |
| 481 | + GestureDetector( | ||
| 482 | + child: Padding( | ||
| 483 | + padding: EdgeInsets.all(ScreenUtil().setWidth(10)), | ||
| 484 | + child: Image.asset( | ||
| 485 | + obscureText | ||
| 486 | + ? "assets/icon_pwd_show.png" | ||
| 487 | + : "assets/icon_pwd_hide.png", | ||
| 488 | + width: ScreenUtil().setWidth(35), | ||
| 489 | + height: ScreenUtil().setHeight(24), | ||
| 490 | + ), | ||
| 491 | + ), | ||
| 492 | + onTap: () { | ||
| 493 | + setState(() { | ||
| 494 | + obscureText = !obscureText; | ||
| 495 | + }); | ||
| 228 | }, | 496 | }, |
| 229 | - obscureText: obscureText, | ||
| 230 | - keyboardType: TextInputType.text, | 497 | + ) |
| 498 | + ], | ||
| 499 | + )), | ||
| 500 | + Container( | ||
| 501 | + width: ScreenUtil().setWidth(611), | ||
| 502 | + margin: EdgeInsets.only(top: ScreenUtil().setHeight(16)), | ||
| 503 | + alignment: Alignment.centerLeft, | ||
| 504 | + child: Text( | ||
| 505 | + errorText, | ||
| 506 | + style: TextStyle( | ||
| 507 | + color: MyColours.color_d93535, | ||
| 508 | + fontSize: ScreenUtil().setSp(16)), | ||
| 509 | + ), | ||
| 510 | + ), | ||
| 511 | + Consumer<UserModel>( | ||
| 512 | + builder: | ||
| 513 | + (BuildContext context, UserModel value, Widget child) { | ||
| 514 | + return GestureDetector( | ||
| 515 | + onTap: () { | ||
| 516 | + if (!isActivate) return; | ||
| 517 | + if (App.sp.containsKey('unionid')) { | ||
| 518 | + //微信登陆的时候,退出清空数据 | ||
| 519 | + App.sp.remove('openid'); | ||
| 520 | + App.sp.remove("unionid"); | ||
| 521 | + } | ||
| 522 | + Map<String, String> params = { | ||
| 523 | + "seller_code": "${_sellerCodeController.text}", | ||
| 524 | + "alias": "ssahdahgdafgahjkhakjgh", | ||
| 525 | + "account": "${_accountController.text}", | ||
| 526 | + "password": "${_pwdController.text}" | ||
| 527 | + }; | ||
| 528 | + value.login(context, params).then((value) { | ||
| 529 | + setState(() { | ||
| 530 | + errorText = value ?? ""; | ||
| 531 | + }); | ||
| 532 | + }); | ||
| 533 | + }, | ||
| 534 | + child: Container( | ||
| 535 | + height: ScreenUtil().setHeight(80), | ||
| 536 | + width: ScreenUtil().setWidth(611), | ||
| 537 | + margin: | ||
| 538 | + EdgeInsets.only(top: ScreenUtil().setHeight(56)), | ||
| 539 | + alignment: Alignment.center, | ||
| 540 | + decoration: BoxDecoration( | ||
| 541 | + color: isActivate | ||
| 542 | + ? MyColours.color_2bb5b7 | ||
| 543 | + : MyColours.color_2bb5b7, | ||
| 544 | + boxShadow: [ | ||
| 545 | + BoxShadow( | ||
| 546 | + color: MyColours.color_26000000, | ||
| 547 | + offset: Offset(0, ScreenUtil().setWidth(4)), | ||
| 548 | + ) | ||
| 549 | + ], | ||
| 550 | + borderRadius: BorderRadius.all( | ||
| 551 | + Radius.circular(ScreenUtil().setWidth(8)))), | ||
| 552 | + child: Text( | ||
| 553 | + "登录", | ||
| 554 | + style: TextStyle( | ||
| 555 | + color: MyColours.color_ffffff, | ||
| 556 | + fontSize: ScreenUtil().setSp(34)), | ||
| 231 | ), | 557 | ), |
| 232 | ), | 558 | ), |
| 233 | - GestureDetector( | ||
| 234 | - child: Padding(padding: EdgeInsets.all(ScreenUtil().setWidth(10)),child: Image.asset(obscureText?"assets/icon_pwd_show.png":"assets/icon_pwd_hide.png",width: ScreenUtil().setWidth(35),height: ScreenUtil().setHeight(24),),), | ||
| 235 | - onTap: (){ | 559 | + ); |
| 560 | + }, | ||
| 561 | + ), | ||
| 562 | + VEmptyView(140), | ||
| 563 | + Row( | ||
| 564 | + mainAxisAlignment: MainAxisAlignment.center, | ||
| 565 | + children: <Widget>[ | ||
| 566 | + Offstage( | ||
| 567 | + offstage: !App.isInstallWx, | ||
| 568 | + child: InkWell( | ||
| 569 | + child: Image.asset( | ||
| 570 | + Utils.getImgPath('icon_wechat_login'), | ||
| 571 | + width: ScreenUtil().setWidth(56)), | ||
| 572 | + onTap: () { | ||
| 573 | + if (!_check) { | ||
| 574 | + Utils.showToast('请仔细阅读协议'); | ||
| 575 | + return; | ||
| 576 | + } | ||
| 577 | + _wxLogin(); | ||
| 578 | + }, | ||
| 579 | + )), | ||
| 580 | + Platform.isAndroid | ||
| 581 | + ? Text('') | ||
| 582 | + : InkWell( | ||
| 583 | + child: Container( | ||
| 584 | + margin: EdgeInsets.only( | ||
| 585 | + left: Platform.isAndroid | ||
| 586 | + ? ScreenUtil().setWidth(0) | ||
| 587 | + : ScreenUtil().setWidth(50)), | ||
| 588 | + child: Image.asset(Utils.getImgPath('apple'), | ||
| 589 | + width: ScreenUtil().setWidth(46))), | ||
| 590 | + onTap: () { | ||
| 591 | + if (!_check) { | ||
| 592 | + Utils.showToast('请仔细阅读协议'); | ||
| 593 | + return; | ||
| 594 | + } | ||
| 595 | + _iosLogin(); | ||
| 596 | + }), | ||
| 597 | + ], | ||
| 598 | + ), | ||
| 599 | + VEmptyView(20), | ||
| 600 | + Row( | ||
| 601 | + // mainAxisSize: MainAxisSize.min, | ||
| 602 | + crossAxisAlignment: CrossAxisAlignment.center, | ||
| 603 | + children: <Widget>[ | ||
| 604 | + InkWell( | ||
| 605 | + onTap: () { | ||
| 236 | setState(() { | 606 | setState(() { |
| 237 | - obscureText=!obscureText; | 607 | + _check = !_check; |
| 238 | }); | 608 | }); |
| 239 | }, | 609 | }, |
| 240 | - ) | ||
| 241 | - ], | ||
| 242 | - ) | ||
| 243 | - ), | ||
| 244 | - Container( | ||
| 245 | - width: ScreenUtil().setWidth(611), | ||
| 246 | - margin: EdgeInsets.only(top: ScreenUtil().setHeight(16)), | ||
| 247 | - alignment: Alignment.centerLeft, | ||
| 248 | - child: Text(errorText,style: TextStyle(color: MyColours.color_d93535,fontSize: ScreenUtil().setSp(16)),), | ||
| 249 | - ), | ||
| 250 | - Consumer<UserModel>( | ||
| 251 | - builder: (BuildContext context,UserModel value,Widget child){ | ||
| 252 | - return GestureDetector( | ||
| 253 | - onTap: (){ | ||
| 254 | - if(!isActivate)return; | ||
| 255 | - Map<String,String> params={ | ||
| 256 | - "seller_code":"${_sellerCodeController.text}", | ||
| 257 | - "alias":"ssahdahgdafgahjkhakjgh", | ||
| 258 | - "account":"${_accountController.text}", | ||
| 259 | - "password":"${_pwdController.text}" | ||
| 260 | - }; | ||
| 261 | - value.login(context, params).then((value){ | ||
| 262 | - setState(() { | ||
| 263 | - errorText=value??""; | ||
| 264 | - }); | ||
| 265 | - }); | ||
| 266 | - }, | ||
| 267 | - child: Container( | ||
| 268 | - height: ScreenUtil().setHeight(80), | ||
| 269 | - width: ScreenUtil().setWidth(611), | ||
| 270 | - margin: EdgeInsets.only(top: ScreenUtil().setHeight(56)), | ||
| 271 | - alignment: Alignment.center, | ||
| 272 | - decoration: BoxDecoration( | ||
| 273 | - color: isActivate?MyColours.color_2bb5b7:MyColours.color_2bb5b7, | ||
| 274 | - boxShadow: [ | ||
| 275 | - BoxShadow(color: MyColours.color_26000000,offset: Offset(0,ScreenUtil().setWidth(4)),) | ||
| 276 | - ], | ||
| 277 | - borderRadius: BorderRadius.all(Radius.circular(ScreenUtil().setWidth(8))) | ||
| 278 | - ), | ||
| 279 | - child: Text("登录",style: TextStyle(color: MyColours.color_ffffff,fontSize: ScreenUtil().setSp(34)),), | 610 | + child: Container( |
| 611 | + // color: Colors.red, | ||
| 612 | + // height: ScreenUtil().setWidth(34), | ||
| 613 | + padding: EdgeInsets.only( | ||
| 614 | + left: ScreenUtil().setWidth(102), | ||
| 615 | + top: ScreenUtil().setWidth(10), | ||
| 616 | + bottom: ScreenUtil().setWidth(10)), | ||
| 617 | + child: Center( | ||
| 618 | + child: Image.asset( | ||
| 619 | + _check | ||
| 620 | + ? "assets/mine_radio_sel.png" | ||
| 621 | + : "assets/mine_radio_nor.png", | ||
| 622 | + width: ScreenUtil().setWidth(42), | ||
| 623 | + height: ScreenUtil().setWidth(42)), | ||
| 624 | + ))), | ||
| 625 | + HEmptyView(6), | ||
| 626 | + Text( | ||
| 627 | + '已阅读并同意', | ||
| 628 | + style: TextStyle( | ||
| 629 | + fontSize: ScreenUtil().setSp(24), | ||
| 630 | + color: MyColours.color_353535), | ||
| 280 | ), | 631 | ), |
| 281 | - ); | ||
| 282 | - }, | ||
| 283 | - ), | ||
| 284 | - VEmptyView(20), | ||
| 285 | - Row( | ||
| 286 | - // mainAxisSize: MainAxisSize.min, | ||
| 287 | - crossAxisAlignment: CrossAxisAlignment.center, | ||
| 288 | - children: <Widget>[ | ||
| 289 | - InkWell( | 632 | + InkWell( |
| 290 | onTap: () { | 633 | onTap: () { |
| 291 | - setState(() { | ||
| 292 | - _check = !_check; | ||
| 293 | - }); | 634 | + NavigatorUtil.goWebPage(context, '软件服务协议', "xy"); |
| 294 | }, | 635 | }, |
| 295 | - child: Container( | ||
| 296 | - // color: Colors.red, | ||
| 297 | - // height: ScreenUtil().setWidth(34), | ||
| 298 | - padding: EdgeInsets.only( | ||
| 299 | - left: ScreenUtil().setWidth(102), | ||
| 300 | - top: ScreenUtil().setWidth(10), | ||
| 301 | - bottom: ScreenUtil().setWidth(10)), | ||
| 302 | - child: Center( | ||
| 303 | - child: Image.asset( | ||
| 304 | - _check | ||
| 305 | - ? "assets/mine_radio_sel.png" | ||
| 306 | - : "assets/mine_radio_nor.png", | ||
| 307 | - width: ScreenUtil().setWidth(42), | ||
| 308 | - height: ScreenUtil().setWidth(42)), | ||
| 309 | - ))), | ||
| 310 | - HEmptyView(6), | ||
| 311 | - Text( | ||
| 312 | - '已阅读并同意', | ||
| 313 | - style: TextStyle( | ||
| 314 | - fontSize: ScreenUtil().setSp(24), | ||
| 315 | - color: MyColours.color_353535), | ||
| 316 | - ), | ||
| 317 | - InkWell( | ||
| 318 | - onTap: () { | ||
| 319 | - NavigatorUtil.goWebPage(context, '软件服务协议', "xy"); | ||
| 320 | - }, | ||
| 321 | - child: Text( | ||
| 322 | - '《软件服务协议》', | ||
| 323 | - style: TextStyle( | ||
| 324 | - fontSize: ScreenUtil().setSp(24), | ||
| 325 | - color: MyColours.color_2bb5b7), | 636 | + child: Text( |
| 637 | + '《软件服务协议》', | ||
| 638 | + style: TextStyle( | ||
| 639 | + fontSize: ScreenUtil().setSp(24), | ||
| 640 | + color: MyColours.color_2bb5b7), | ||
| 641 | + ), | ||
| 326 | ), | 642 | ), |
| 327 | - ), | ||
| 328 | - Text('及', | ||
| 329 | - style: TextStyle( | ||
| 330 | - fontSize: ScreenUtil().setSp(24), | ||
| 331 | - color: MyColours.color_353535)), | ||
| 332 | - InkWell( | ||
| 333 | - onTap: () { | ||
| 334 | - NavigatorUtil.goWebPage(context, '隐私政策', "zc"); | ||
| 335 | - }, | ||
| 336 | - child: Text('《隐私政策》', | 643 | + Text('及', |
| 337 | style: TextStyle( | 644 | style: TextStyle( |
| 338 | fontSize: ScreenUtil().setSp(24), | 645 | fontSize: ScreenUtil().setSp(24), |
| 339 | - color: MyColours.color_2bb5b7)), | ||
| 340 | - ) | ||
| 341 | - ], | ||
| 342 | - ), | ||
| 343 | - ], | 646 | + color: MyColours.color_353535)), |
| 647 | + InkWell( | ||
| 648 | + onTap: () { | ||
| 649 | + NavigatorUtil.goWebPage(context, '隐私政策', "zc"); | ||
| 650 | + }, | ||
| 651 | + child: Text('《隐私政策》', | ||
| 652 | + style: TextStyle( | ||
| 653 | + fontSize: ScreenUtil().setSp(24), | ||
| 654 | + color: MyColours.color_2bb5b7)), | ||
| 655 | + ) | ||
| 656 | + ], | ||
| 657 | + ), | ||
| 658 | + ], | ||
| 659 | + ), | ||
| 344 | ), | 660 | ), |
| 345 | - ), | ||
| 346 | - ) | ||
| 347 | - ); | 661 | + )); |
| 348 | } | 662 | } |
| 349 | } | 663 | } |
| 350 | - |
| @@ -11,6 +11,7 @@ import 'package:one_key/res/colors.dart'; | @@ -11,6 +11,7 @@ import 'package:one_key/res/colors.dart'; | ||
| 11 | import 'package:one_key/utils/navigator_util.dart'; | 11 | import 'package:one_key/utils/navigator_util.dart'; |
| 12 | import 'package:one_key/utils/utils.dart'; | 12 | import 'package:one_key/utils/utils.dart'; |
| 13 | import 'package:one_key/widgets/MyDivider.dart'; | 13 | import 'package:one_key/widgets/MyDivider.dart'; |
| 14 | +import 'package:one_key/widgets/loading.dart'; | ||
| 14 | import 'package:one_key/widgets/v_empty_view.dart'; | 15 | import 'package:one_key/widgets/v_empty_view.dart'; |
| 15 | import 'package:tpns_flutter_plugin/tpns_flutter_plugin.dart'; | 16 | import 'package:tpns_flutter_plugin/tpns_flutter_plugin.dart'; |
| 16 | 17 | ||
| @@ -18,15 +19,14 @@ import '../app.dart'; | @@ -18,15 +19,14 @@ import '../app.dart'; | ||
| 18 | 19 | ||
| 19 | class UserModel with ChangeNotifier { | 20 | class UserModel with ChangeNotifier { |
| 20 | User _user; | 21 | User _user; |
| 21 | - String _registrationId;//极光推送registrationId | ||
| 22 | - String _token;//信鸽推送token | 22 | + String _registrationId; //极光推送registrationId |
| 23 | + String _token; //信鸽推送token | ||
| 23 | 24 | ||
| 24 | User get user => _user; | 25 | User get user => _user; |
| 25 | 26 | ||
| 26 | - set registrationId(String registrationId)=>_registrationId=registrationId; | ||
| 27 | - | ||
| 28 | - String get registrationId =>_registrationId; | 27 | + set registrationId(String registrationId) => _registrationId = registrationId; |
| 29 | 28 | ||
| 29 | + String get registrationId => _registrationId; | ||
| 30 | 30 | ||
| 31 | String get token => _token; | 31 | String get token => _token; |
| 32 | 32 | ||
| @@ -109,16 +109,38 @@ class UserModel with ChangeNotifier { | @@ -109,16 +109,38 @@ class UserModel with ChangeNotifier { | ||
| 109 | } | 109 | } |
| 110 | } | 110 | } |
| 111 | 111 | ||
| 112 | + // //判断微信登录成功APP用户是否绑定微信小程序,绑定返回绑定的微信小程序openid,否则返回null | ||
| 113 | + // Future<String> getMiniProgramOpenid(BuildContext context, Map req) async { | ||
| 114 | + // try { | ||
| 115 | + // BaseResp<dynamic> baseResp = await DioUtil().request<dynamic>( | ||
| 116 | + // context, Method.get, HttpUrl.get_mini_openid, | ||
| 117 | + // data: req, showLoading: true); | ||
| 118 | + // if (baseResp == null) return null; | ||
| 119 | + // if (baseResp.code == Constant.status_success) { | ||
| 120 | + // App.sp.setString("mini-openid", baseResp.data?.toString() ?? ""); | ||
| 121 | + // App.sp.setString("openid", baseResp.data?.toString() ?? ""); | ||
| 122 | + // // initPlatformState(context); //注册信鸽推送,绑定openid,token关系 | ||
| 123 | + // return baseResp.data?.toString(); | ||
| 124 | + // } else { | ||
| 125 | + // App.sp.setString("mini-openid", ""); | ||
| 126 | + // } | ||
| 127 | + // } catch (e) { | ||
| 128 | + // print(e); | ||
| 129 | + // Loading.hideLoading(context); | ||
| 130 | + // } | ||
| 131 | + | ||
| 132 | + // return null; | ||
| 133 | + // } | ||
| 134 | + | ||
| 112 | ///初始化推送token | 135 | ///初始化推送token |
| 113 | userTokenInit(BuildContext context, Map<String, String> params) async { | 136 | userTokenInit(BuildContext context, Map<String, String> params) async { |
| 114 | BaseResp<dynamic> baseResp = await DioUtil() | 137 | BaseResp<dynamic> baseResp = await DioUtil() |
| 115 | - .request<dynamic>(context, Method.get, HttpUrl.user_token_init,showLoading: false, | ||
| 116 | - data: params) | 138 | + .request<dynamic>(context, Method.get, HttpUrl.user_token_init, |
| 139 | + showLoading: false, data: params) | ||
| 117 | .catchError((error) { | 140 | .catchError((error) { |
| 118 | print(error.toString()); | 141 | print(error.toString()); |
| 119 | }); | 142 | }); |
| 120 | - if (baseResp!=null&&baseResp.code == Constant.status_success) { | ||
| 121 | - } | 143 | + if (baseResp != null && baseResp.code == Constant.status_success) {} |
| 122 | } | 144 | } |
| 123 | 145 | ||
| 124 | //版本更新弹框 | 146 | //版本更新弹框 |
| @@ -164,12 +186,16 @@ class UserModel with ChangeNotifier { | @@ -164,12 +186,16 @@ class UserModel with ChangeNotifier { | ||
| 164 | ), | 186 | ), |
| 165 | ), | 187 | ), |
| 166 | ), | 188 | ), |
| 167 | - MyDivider(ScreenUtil().setWidth(1),ScreenUtil().setWidth(94)), | 189 | + MyDivider( |
| 190 | + ScreenUtil().setWidth(1), ScreenUtil().setWidth(94)), | ||
| 168 | Expanded( | 191 | Expanded( |
| 169 | child: GestureDetector( | 192 | child: GestureDetector( |
| 170 | onTap: () { | 193 | onTap: () { |
| 171 | Navigator.of(context).pop(); | 194 | Navigator.of(context).pop(); |
| 172 | - loginOut(pageContext, {"seller_code":user.sellercode,"account":user.account}); | 195 | + loginOut(pageContext, { |
| 196 | + "seller_code": user.sellercode, | ||
| 197 | + "account": user.account | ||
| 198 | + }); | ||
| 173 | }, | 199 | }, |
| 174 | child: Text( | 200 | child: Text( |
| 175 | "确定", | 201 | "确定", |
| @@ -186,16 +212,18 @@ class UserModel with ChangeNotifier { | @@ -186,16 +212,18 @@ class UserModel with ChangeNotifier { | ||
| 186 | ], | 212 | ], |
| 187 | ), | 213 | ), |
| 188 | ); | 214 | ); |
| 189 | - return Center(child: UnconstrainedBox( | ||
| 190 | - constrainedAxis: Axis.vertical, | ||
| 191 | - child: ConstrainedBox( | ||
| 192 | - constraints: BoxConstraints(maxWidth: ScreenUtil().setWidth(560)), | ||
| 193 | - child: DefaultTextStyle( | ||
| 194 | - style: TextStyle(decoration: TextDecoration.none), | ||
| 195 | - child: widget, | ||
| 196 | - ) | 215 | + return Center( |
| 216 | + child: UnconstrainedBox( | ||
| 217 | + constrainedAxis: Axis.vertical, | ||
| 218 | + child: ConstrainedBox( | ||
| 219 | + constraints: | ||
| 220 | + BoxConstraints(maxWidth: ScreenUtil().setWidth(560)), | ||
| 221 | + child: DefaultTextStyle( | ||
| 222 | + style: TextStyle(decoration: TextDecoration.none), | ||
| 223 | + child: widget, | ||
| 224 | + )), | ||
| 197 | ), | 225 | ), |
| 198 | - ),); | 226 | + ); |
| 199 | return AlertDialog( | 227 | return AlertDialog( |
| 200 | content: widget, | 228 | content: widget, |
| 201 | contentPadding: EdgeInsets.zero, | 229 | contentPadding: EdgeInsets.zero, |
| @@ -213,6 +241,11 @@ class UserModel with ChangeNotifier { | @@ -213,6 +241,11 @@ class UserModel with ChangeNotifier { | ||
| 213 | if (baseResp.code != Constant.status_success) { | 241 | if (baseResp.code != Constant.status_success) { |
| 214 | Utils.showToast(baseResp.msg ?? "退出登录失败,请稍后重试"); | 242 | Utils.showToast(baseResp.msg ?? "退出登录失败,请稍后重试"); |
| 215 | } else { | 243 | } else { |
| 244 | + if (App.sp.containsKey('unionid')) { | ||
| 245 | + //微信登陆的时候,退出清空数据 | ||
| 246 | + App.sp.remove('openid'); | ||
| 247 | + App.sp.remove("unionid"); | ||
| 248 | + } | ||
| 216 | App.sp.setBool("isLogin", false); | 249 | App.sp.setBool("isLogin", false); |
| 217 | XgFlutterPlugin().stopXg(); | 250 | XgFlutterPlugin().stopXg(); |
| 218 | NavigatorUtil.goLoginPage(context); | 251 | NavigatorUtil.goLoginPage(context); |
| @@ -11,9 +11,12 @@ import 'package:one_key/pages/coupon/coupon_edit_page.dart'; | @@ -11,9 +11,12 @@ import 'package:one_key/pages/coupon/coupon_edit_page.dart'; | ||
| 11 | import 'package:one_key/pages/coupon/coupon_history_page.dart'; | 11 | import 'package:one_key/pages/coupon/coupon_history_page.dart'; |
| 12 | import 'package:one_key/pages/coupon/coupon_page.dart'; | 12 | import 'package:one_key/pages/coupon/coupon_page.dart'; |
| 13 | import 'package:one_key/pages/coupon/coupon_selecet_page.dart'; | 13 | import 'package:one_key/pages/coupon/coupon_selecet_page.dart'; |
| 14 | +import 'package:one_key/pages/create_store/create_store.dart'; | ||
| 14 | import 'package:one_key/pages/detail/notebook_detail_change_page.dart'; | 15 | import 'package:one_key/pages/detail/notebook_detail_change_page.dart'; |
| 15 | import 'package:one_key/pages/home/home_page.dart'; | 16 | import 'package:one_key/pages/home/home_page.dart'; |
| 16 | import 'package:one_key/pages/invicate/invitation_page.dart'; | 17 | import 'package:one_key/pages/invicate/invitation_page.dart'; |
| 18 | +import 'package:one_key/pages/login/binding_phone.dart'; | ||
| 19 | +import 'package:one_key/pages/login/if_need_create_store.dart'; | ||
| 17 | import 'package:one_key/pages/login/login_page.dart'; | 20 | import 'package:one_key/pages/login/login_page.dart'; |
| 18 | import 'package:one_key/pages/detail/handle_online_page.dart'; | 21 | import 'package:one_key/pages/detail/handle_online_page.dart'; |
| 19 | import 'package:one_key/pages/detail/notebook_detail_page.dart'; | 22 | import 'package:one_key/pages/detail/notebook_detail_page.dart'; |
| @@ -269,3 +272,30 @@ var baseInfoPageHandler = new Handler( | @@ -269,3 +272,30 @@ var baseInfoPageHandler = new Handler( | ||
| 269 | 272 | ||
| 270 | return BaseInfoPage(); | 273 | return BaseInfoPage(); |
| 271 | }); | 274 | }); |
| 275 | + | ||
| 276 | +///绑定手机号码页面 | ||
| 277 | +var bindingPhonePageHandler = new Handler( | ||
| 278 | + handlerFunc: (BuildContext context, Map<String, List<Object>> params) { | ||
| 279 | + // CouponSunModel couponSunModel = CouponSunModel.fromJson(json.decode( | ||
| 280 | + // FluroConvertUtils.fluroCnParamsDecode(params["couponSunModel"].first))); | ||
| 281 | + | ||
| 282 | + return BindingPhone(); | ||
| 283 | +}); | ||
| 284 | + | ||
| 285 | +///是否新建店铺页面 | ||
| 286 | +var ifNeedCreateStorePageHandler = new Handler( | ||
| 287 | + handlerFunc: (BuildContext context, Map<String, List<Object>> params) { | ||
| 288 | + // CouponSunModel couponSunModel = CouponSunModel.fromJson(json.decode( | ||
| 289 | + // FluroConvertUtils.fluroCnParamsDecode(params["couponSunModel"].first))); | ||
| 290 | + | ||
| 291 | + return IfNeedCreateStore(); | ||
| 292 | +}); | ||
| 293 | + | ||
| 294 | +///新建店铺页面 | ||
| 295 | +var createStorePageHandler = new Handler( | ||
| 296 | + handlerFunc: (BuildContext context, Map<String, List<Object>> params) { | ||
| 297 | + // CouponSunModel couponSunModel = CouponSunModel.fromJson(json.decode( | ||
| 298 | + // FluroConvertUtils.fluroCnParamsDecode(params["couponSunModel"].first))); | ||
| 299 | + | ||
| 300 | + return CreateStorePage(); | ||
| 301 | +}); |
| @@ -28,6 +28,9 @@ class Routes { | @@ -28,6 +28,9 @@ class Routes { | ||
| 28 | static String coupon_select = "/coupon_select"; //优惠券选择 | 28 | static String coupon_select = "/coupon_select"; //优惠券选择 |
| 29 | static String coupon_detail = "/coupon_detail"; //优惠券详情页 | 29 | static String coupon_detail = "/coupon_detail"; //优惠券详情页 |
| 30 | static String base_info = "/base_info"; //个人资料页面 | 30 | static String base_info = "/base_info"; //个人资料页面 |
| 31 | + static String binding_phone = "/binding_phone"; //绑定手机号码页面 | ||
| 32 | + static String if_need_create_store = "/if_need_create_store"; //是否选择新建店铺页面 | ||
| 33 | + static String create_store = "/create_store"; //新建店铺 | ||
| 31 | 34 | ||
| 32 | static void configureRoutes(FluroRouter router) { | 35 | static void configureRoutes(FluroRouter router) { |
| 33 | router.notFoundHandler = new Handler( | 36 | router.notFoundHandler = new Handler( |
| @@ -59,6 +62,12 @@ class Routes { | @@ -59,6 +62,12 @@ class Routes { | ||
| 59 | router.define(coupon_edit, handler: handleCouponEditPageHandler); | 62 | router.define(coupon_edit, handler: handleCouponEditPageHandler); |
| 60 | router.define(coupon_select, handler: handleCouponSelectPageHandler); | 63 | router.define(coupon_select, handler: handleCouponSelectPageHandler); |
| 61 | router.define(coupon_detail, handler: handleCouponDetailPageHandler); | 64 | router.define(coupon_detail, handler: handleCouponDetailPageHandler); |
| 62 | - router.define(base_info, handler: baseInfoPageHandler); | 65 | + router.define(base_info, handler: baseInfoPageHandler); |
| 66 | + router.define(binding_phone, handler: bindingPhonePageHandler); | ||
| 67 | + router.define(if_need_create_store, handler: ifNeedCreateStorePageHandler); | ||
| 68 | + router.define(create_store, handler: createStorePageHandler); | ||
| 69 | + | ||
| 70 | + | ||
| 71 | + | ||
| 63 | } | 72 | } |
| 64 | } | 73 | } |
| @@ -192,4 +192,23 @@ class NavigatorUtil { | @@ -192,4 +192,23 @@ class NavigatorUtil { | ||
| 192 | {replace = false}) { | 192 | {replace = false}) { |
| 193 | return _navigateTo(context, "${Routes.base_info}", replace: replace); | 193 | return _navigateTo(context, "${Routes.base_info}", replace: replace); |
| 194 | } | 194 | } |
| 195 | + | ||
| 196 | + /// 绑定手机号吗页面 | ||
| 197 | + static Future<dynamic> goBindingPhonePage(BuildContext context, | ||
| 198 | + {replace = false}) { | ||
| 199 | + return _navigateTo(context, "${Routes.binding_phone}", replace: replace); | ||
| 200 | + } | ||
| 201 | + | ||
| 202 | + /// 是否新建店铺页面 | ||
| 203 | + static Future<dynamic> goIfNeedCreateStorePage(BuildContext context, | ||
| 204 | + {replace = false}) { | ||
| 205 | + return _navigateTo(context, "${Routes.if_need_create_store}", | ||
| 206 | + replace: replace); | ||
| 207 | + } | ||
| 208 | + | ||
| 209 | + /// 新建店铺页面 | ||
| 210 | + static Future<dynamic> goCreateStorePage(BuildContext context, | ||
| 211 | + {replace = false}) { | ||
| 212 | + return _navigateTo(context, "${Routes.create_store}", replace: replace); | ||
| 213 | + } | ||
| 195 | } | 214 | } |
| @@ -27,6 +27,19 @@ import '../app.dart'; | @@ -27,6 +27,19 @@ import '../app.dart'; | ||
| 27 | typedef BookTimeSetCallback = void Function(bool needChange); | 27 | typedef BookTimeSetCallback = void Function(bool needChange); |
| 28 | 28 | ||
| 29 | class Utils { | 29 | class Utils { |
| 30 | + static getDeviceInfoSystem() async { | ||
| 31 | + DeviceInfoPlugin deviceInfo = DeviceInfoPlugin(); | ||
| 32 | + if (Platform.isIOS) { | ||
| 33 | + IosDeviceInfo iosInfo = await deviceInfo.iosInfo; | ||
| 34 | + print('Running on ${iosInfo.utsname.machine}'); | ||
| 35 | + return iosInfo.systemVersion; | ||
| 36 | + } else if (Platform.isAndroid) { | ||
| 37 | + AndroidDeviceInfo androidInfo = await deviceInfo.androidInfo; | ||
| 38 | + print('Running on ${androidInfo.model}'); | ||
| 39 | + return androidInfo; | ||
| 40 | + } | ||
| 41 | + } | ||
| 42 | + | ||
| 30 | ///检测是否有相机或者相册权限 | 43 | ///检测是否有相机或者相册权限 |
| 31 | static getPickPermission(BuildContext context, VoidCallback callback, | 44 | static getPickPermission(BuildContext context, VoidCallback callback, |
| 32 | PermissionGroup permissionGroup) async { | 45 | PermissionGroup permissionGroup) async { |
| @@ -258,8 +271,7 @@ class Utils { | @@ -258,8 +271,7 @@ class Utils { | ||
| 258 | } | 271 | } |
| 259 | 272 | ||
| 260 | //分享邀请函 | 273 | //分享邀请函 |
| 261 | - static goShareInvicationToWeChat( | ||
| 262 | - String rid, String uid) async { | 274 | + static goShareInvicationToWeChat(String rid, String uid) async { |
| 263 | String _webPageUrl = "http://colorcun.com/"; | 275 | String _webPageUrl = "http://colorcun.com/"; |
| 264 | // String _thumbnail = | 276 | // String _thumbnail = |
| 265 | // "https://xt04.colorcun.com/h5/index.html#/?id=163854&hasInvitation=1"; | 277 | // "https://xt04.colorcun.com/h5/index.html#/?id=163854&hasInvitation=1"; |
| @@ -835,6 +835,13 @@ packages: | @@ -835,6 +835,13 @@ packages: | ||
| 835 | url: "https://pub.flutter-io.cn" | 835 | url: "https://pub.flutter-io.cn" |
| 836 | source: hosted | 836 | source: hosted |
| 837 | version: "0.2.3" | 837 | version: "0.2.3" |
| 838 | + sign_in_with_apple: | ||
| 839 | + dependency: "direct main" | ||
| 840 | + description: | ||
| 841 | + name: sign_in_with_apple | ||
| 842 | + url: "https://pub.flutter-io.cn" | ||
| 843 | + source: hosted | ||
| 844 | + version: "2.5.4" | ||
| 838 | simple_gesture_detector: | 845 | simple_gesture_detector: |
| 839 | dependency: transitive | 846 | dependency: transitive |
| 840 | description: | 847 | description: |
-
Please register or login to post a comment