diff --git a/lib/pages/user/account_and_safety/account_and_safety_page.dart b/lib/pages/user/account_and_safety/account_and_safety_page.dart new file mode 100644 index 0000000..63a7b24 --- /dev/null +++ b/lib/pages/user/account_and_safety/account_and_safety_page.dart @@ -0,0 +1,59 @@ +import 'package:flutter/material.dart'; +import 'package:recook/constants/header.dart'; +import 'package:recook/widgets/custom_app_bar.dart'; +import 'package:recook/widgets/sc_tile.dart'; + +class AccountAndSafetyPage extends StatefulWidget { + AccountAndSafetyPage({Key key}) : super(key: key); + + @override + _AccountAndSafetyPageState createState() => _AccountAndSafetyPageState(); +} + +class _AccountAndSafetyPageState extends State { + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: AppColor.frenchColor, + appBar: CustomAppBar( + appBackground: Colors.white, + title: Text( + '账户与安全', + style: TextStyle( + color: AppColor.blackColor, + ), + ), + themeData: AppBarTheme(brightness: Brightness.light), + leading: _backButton(context), + ), + body: ListView( + padding: EdgeInsets.only(top: rSize(16)), + children: [ + SCTile.normalTile("支付密码设置", listener: () { + // push(RouteName.USER_SET_PASSWORD); + AppRouter.push(context, RouteName.USER_SET_PASSWORD_VARCODE); + }), + SCTile.normalTile("注销账户", listener: () { + // push(RouteName.USER_SET_PASSWORD); + AppRouter.push(context, RouteName.USER_DELETE_ACCOUNT_PAGE); + }), + ], + ), + ); + } + + _backButton(context) { + if (Navigator.canPop(context)) { + return IconButton( + icon: Icon( + AppIcons.icon_back, + size: 17, + color: AppColor.blackColor, + ), + onPressed: () { + Navigator.maybePop(context); + }); + } else + return SizedBox(); + } +} diff --git a/lib/pages/user/account_and_safety/delete_account_page.dart b/lib/pages/user/account_and_safety/delete_account_page.dart new file mode 100644 index 0000000..a367414 --- /dev/null +++ b/lib/pages/user/account_and_safety/delete_account_page.dart @@ -0,0 +1,163 @@ +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:recook/constants/header.dart'; +import 'package:recook/widgets/alert.dart'; +import 'package:recook/widgets/custom_app_bar.dart'; + +class DeleteAccountPage extends StatefulWidget { + DeleteAccountPage({Key key}) : super(key: key); + + @override + _DeleteAccountPageState createState() => _DeleteAccountPageState(); +} + +class _DeleteAccountPageState extends State { + final deleteInfo = [ + '您的账户无法登录与使用', + '身份、账户信息、会员权益将被清空且无法恢复', + '您账户内的资产(余额、瑞币、优惠券、权益卡等)将会被清空且无法恢复', + '您已完成的交易将无法处理售后', + '您将无法便捷地查询帐号历史交易记录', + ]; + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: CustomAppBar( + appBackground: Colors.white, + title: Text( + '注销账户', + style: TextStyle( + color: AppColor.blackColor, + ), + ), + themeData: AppBarTheme(brightness: Brightness.light), + leading: _backButton(context), + ), + bottomNavigationBar: Container( + color: Colors.white, + padding: EdgeInsets.all(rSize(16)), + child: SafeArea( + top: false, + bottom: true, + child: Row( + children: [ + Expanded( + child: FlatButton( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(rSize(4)), + ), + padding: EdgeInsets.zero, + color: Color(0xFFF0F0F0), + onPressed: () { + showDialog( + context: context, + child: NormalTextDialog( + title: '注销提示', + content: '确定注销账户?', + items: ['取消'], + type: NormalTextDialogType.delete, + listener: (index) { + switch (index) { + case 0: + Navigator.pop(context); + break; + } + }, + deleteItem: '确定', + deleteListener: () { + //TODO 注销账号 + SystemNavigator.pop(); + }, + ), + ); + }, + textColor: Color(0xFF666666), + child: Padding( + padding: EdgeInsets.symmetric( + vertical: rSize(12), + ), + child: Text('确认注销'), + ), + ), + ), + SizedBox(width: rSize(16)), + Expanded( + child: FlatButton( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(rSize(4)), + ), + padding: EdgeInsets.zero, + color: Color(0xFFDB2D2D), + onPressed: () => Navigator.pop(context), + child: Padding( + padding: EdgeInsets.symmetric( + vertical: rSize(12), + ), + child: Text('不注销了'), + ), + ), + ), + ], + ), + ), + ), + body: ListView( + padding: EdgeInsets.all(rSize(16)), + children: [ + Text( + '请注意,一旦注销账户:', + style: TextStyle( + color: Color(0xFF333333), + fontSize: rSP(20), + fontWeight: FontWeight.bold, + ), + ), + SizedBox(height: rSize(30)), + ]..addAll(deleteInfo.map((e) => _buildChildTile(e))), + ), + ); + } + + _buildChildTile(String title) { + return Container( + child: Row( + children: [ + Container( + width: rSize(8), + height: rSize(8), + margin: EdgeInsets.only(right: rSize(10)), + decoration: BoxDecoration( + color: Color(0xFFE2E2E2), + borderRadius: BorderRadius.circular(rSize(4)), + ), + ), + Expanded( + child: Text( + title, + style: TextStyle( + fontSize: rSP(14), + color: Color(0xFF333333), + ), + ), + ), + ], + ), + margin: EdgeInsets.only(bottom: rSize(20)), + ); + } + + _backButton(context) { + if (Navigator.canPop(context)) { + return IconButton( + icon: Icon( + AppIcons.icon_back, + size: 17, + color: AppColor.blackColor, + ), + onPressed: () { + Navigator.maybePop(context); + }); + } else + return SizedBox(); + } +} diff --git a/lib/pages/user/setting_page.dart b/lib/pages/user/setting_page.dart index dca0de0..538290b 100644 --- a/lib/pages/user/setting_page.dart +++ b/lib/pages/user/setting_page.dart @@ -51,9 +51,9 @@ class _SettingItemListViewState extends BaseStoreState { SCTile.normalTile("个人资料", needDivide: true, listener: () { push(RouteName.USER_INFO_PAGE); }), - SCTile.normalTile("支付密码设置", listener: () { - // push(RouteName.USER_SET_PASSWORD); - push(RouteName.USER_SET_PASSWORD_VARCODE); + SCTile.normalTile('账户与安全', + needDivide: true, needArrow: true, listener: () { + push(RouteName.ACCOUNT_AND_SAFETY_PAGE); }), getEmptyBox(), // SCTile.normalTile("清除缓存", needDivide: true, listener: () {}), diff --git a/lib/utils/app_router.dart b/lib/utils/app_router.dart index 6b6676e..b20fb4e 100644 --- a/lib/utils/app_router.dart +++ b/lib/utils/app_router.dart @@ -39,6 +39,8 @@ import 'package:recook/pages/shop/upgrade/shop_upgrade_code_page.dart'; import 'package:recook/pages/upgradeCard/upgrade_card_page.dart'; import 'package:recook/pages/upgradeCard/upgrade_card_send_user_list_page.dart'; import 'package:recook/pages/user/about_us_page.dart'; +import 'package:recook/pages/user/account_and_safety/account_and_safety_page.dart'; +import 'package:recook/pages/user/account_and_safety/delete_account_page.dart'; import 'package:recook/pages/user/cash_withdraw_history_page.dart'; import 'package:recook/pages/user/cash_withdraw_result_page.dart'; import 'package:recook/pages/user/invite/invite_search_page.dart'; @@ -208,6 +210,12 @@ class RouteName { static const String USER_INVITE_SEARCH = "/UserInviteSearch"; static const String USER_BILLING_DETAILS = "/UserBillingDetails"; static const String USER_SET_PASSWORD_VARCODE = "/UserSetPasswordVarCode"; + + ///账户与安全 + static const String ACCOUNT_AND_SAFETY_PAGE = "AccountAndSafetyPage"; + + ///注销账户 + static const String USER_DELETE_ACCOUNT_PAGE = "/UserDeleteAccountPage"; static const String USER_SET_PASSWORD = "/UserSetPassword"; static const String USER_SET_PASSWORD_AGAIN = "/UserSetPasswordAgain"; static const String USER_INFO_ADDRESS_PAGE = "/UserInfoAddressPage"; @@ -432,6 +440,10 @@ final Map _routes = { //设置支付密码 RouteName.USER_SET_PASSWORD_VARCODE: (context, {arguments}) => UserSetPasswordVarCode(), + RouteName.USER_DELETE_ACCOUNT_PAGE: (context, {arguments}) => + DeleteAccountPage(), + RouteName.ACCOUNT_AND_SAFETY_PAGE: (context, {arguments}) => + AccountAndSafetyPage(), RouteName.USER_SET_PASSWORD: (context, {arguments}) => UserSetPassword(), RouteName.USER_SET_PASSWORD_AGAIN: (context, {arguments}) => UserSetPasswordAgain( @@ -591,7 +603,7 @@ final Map _routes = { RouteName.USER_INVOICE_USUALLY_USED: (contex, {arguments}) => InvoiceUsuallyUsedPage(), RouteName.USER_INVOICE_ADD_TITLE: (contex, {arguments}) => - InvoiceAddTitlePage(arguments:arguments), + InvoiceAddTitlePage(arguments: arguments), RouteName.USER_INVOICE_DETAIL_INFOMATION: (contex, {arguments}) => InvoiceDetailInfomationPage( arguments: arguments,