| 1 | import 'package:cake_wallet/routes.dart'; |
| 2 | import 'package:cake_wallet/src/screens/base_page.dart'; |
| 3 | import 'package:cake_wallet/generated/i18n.dart'; |
| 4 | import 'package:cake_wallet/cake_pay/src/widgets/cake_pay_tile.dart'; |
| 5 | import 'package:cake_wallet/src/widgets/primary_button.dart'; |
| 6 | import 'package:cake_wallet/src/widgets/scrollable_with_bottom_section.dart'; |
| 7 | import 'package:cake_wallet/view_model/cake_pay/cake_pay_account_view_model.dart'; |
| 8 | import 'package:flutter/material.dart'; |
| 9 | import 'package:flutter_mobx/flutter_mobx.dart'; |
| 10 | |
| 11 | class CakePayAccountPage extends BasePage { |
| 12 | CakePayAccountPage(this.cakePayAccountViewModel); |
| 13 | |
| 14 | final CakePayAccountViewModel cakePayAccountViewModel; |
| 15 | |
| 16 | @override |
| 17 | Widget leading(BuildContext context) { |
| 18 | return MergeSemantics( |
| 19 | child: SizedBox( |
| 20 | height: 37, |
| 21 | width: 37, |
| 22 | child: ButtonTheme( |
| 23 | minWidth: double.minPositive, |
| 24 | child: Semantics( |
| 25 | label: S.of(context).seed_alert_back, |
| 26 | child: TextButton( |
| 27 | style: ButtonStyle( |
| 28 | overlayColor: WidgetStateColor.resolveWith((states) => Colors.transparent), |
| 29 | ), |
| 30 | onPressed: () => Navigator.pop(context), |
| 31 | child: backButton(context), |
| 32 | ), |
| 33 | ), |
| 34 | ), |
| 35 | ), |
| 36 | ); |
| 37 | } |
| 38 | |
| 39 | @override |
| 40 | Widget middle(BuildContext context) { |
| 41 | return Text( |
| 42 | S.current.account, |
| 43 | style: Theme.of(context).textTheme.titleMedium?.copyWith( |
| 44 | color: Theme.of(context).colorScheme.onSurface, |
| 45 | fontWeight: FontWeight.w600, |
| 46 | ), |
| 47 | ); |
| 48 | } |
| 49 | |
| 50 | @override |
| 51 | Widget body(BuildContext context) { |
| 52 | return ScrollableWithBottomSection( |
| 53 | contentPadding: EdgeInsets.all(24), |
| 54 | content: Column( |
| 55 | children: [ |
| 56 | SizedBox(height: 20), |
| 57 | Observer( |
| 58 | builder: (_) => Container( |
| 59 | decoration: BoxDecoration( |
| 60 | border: Border( |
| 61 | bottom: BorderSide( |
| 62 | width: 1.0, |
| 63 | color: Theme.of(context).colorScheme.outlineVariant, |
| 64 | ), |
| 65 | ), |
| 66 | ), |
| 67 | child: CakePayTile( |
| 68 | title: S.of(context).email_address, subTitle: cakePayAccountViewModel.email), |
| 69 | ), |
| 70 | ), |
| 71 | ], |
| 72 | ), |
| 73 | bottomSectionPadding: EdgeInsets.all(30), |
| 74 | bottomSection: Column( |
| 75 | children: [ |
| 76 | PrimaryButton( |
| 77 | color: Theme.of(context).colorScheme.primary, |
| 78 | textColor: Theme.of(context).colorScheme.onPrimary, |
| 79 | text: S.of(context).logout, |
| 80 | onPressed: () { |
| 81 | cakePayAccountViewModel.logout(); |
| 82 | Navigator.pushNamedAndRemoveUntil(context, Routes.dashboard, (route) => false); |
| 83 | }, |
| 84 | ), |
| 85 | ], |
| 86 | ), |
| 87 | ); |
| 88 | } |
| 89 | } |