diff --git a/lib/providers/chest_provider.dart b/lib/providers/chest_provider.dart index b2ba860b56c942b06ee5ef72969c5741ec243755..c7059dd84233472dfebf0db688737b2764b28138 100644 --- a/lib/providers/chest_provider.dart +++ b/lib/providers/chest_provider.dart @@ -3,11 +3,10 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:gecko/globals.dart'; import 'package:gecko/models/chest_data.dart'; -import 'package:gecko/models/scale_functions.dart'; import 'package:gecko/models/wallet_data.dart'; -import 'package:gecko/models/widgets_keys.dart'; import 'package:gecko/providers/my_wallets.dart'; import 'package:gecko/providers/substrate_sdk.dart'; +import 'package:gecko/widgets/commons/confirmation_dialog.dart'; import 'package:provider/provider.dart'; class ChestProvider with ChangeNotifier { @@ -21,8 +20,7 @@ class ChestProvider with ChangeNotifier { if (answer ?? false) { await sub.deleteAccounts(getChestWallets(chest)); await chestBox.delete(chest.key); - final myWalletProvider = - Provider.of<MyWalletsProvider>(context, listen: false); + final myWalletProvider = Provider.of<MyWalletsProvider>(context, listen: false); myWalletProvider.pinCode = ''; @@ -52,36 +50,10 @@ class ChestProvider with ChangeNotifier { } Future<bool?> _confirmDeletingChest(context, String? walletName) async { - return showDialog<bool>( + return showConfirmationDialog( context: context, - barrierDismissible: true, - builder: (BuildContext context) { - return AlertDialog( - title: Text( - 'areYouSureToDeleteWallet'.tr(args: [walletName!]), - style: scaledTextStyle(fontSize: 16), - ), - actions: <Widget>[ - TextButton( - child: Text("no".tr(), - style: - scaledTextStyle(fontSize: 16, color: Colors.blueAccent), - key: keyCancel), - onPressed: () { - Navigator.pop(context, false); - }, - ), - TextButton( - child: Text("yes".tr(), - style: scaledTextStyle(fontSize: 16, color: Colors.red), - key: keyConfirm), - onPressed: () { - Navigator.pop(context, true); - }, - ), - ], - ); - }, + type: ConfirmationDialogType.warning, + message: 'areYouSureToDeleteWallet'.tr(args: [walletName!]), ); } } diff --git a/lib/screens/home.dart b/lib/screens/home.dart index 336df01bbed332fe36b1a04a36d7ec138eb0172f..bf0eac494b3e8422ce2e0fb05f8ae39997852c7c 100644 --- a/lib/screens/home.dart +++ b/lib/screens/home.dart @@ -225,25 +225,27 @@ Widget welcomeHome(context) { Padding( padding: const EdgeInsets.only(top: 1), child: Row(mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ - Text( - "fastAppDescription".tr(args: [currencyName]), - textAlign: TextAlign.center, - style: scaledTextStyle( - color: Colors.white, - fontSize: 19, - fontWeight: FontWeight.w700, - shadows: const <Shadow>[ - Shadow( - offset: Offset(0, 0), - blurRadius: 20, - color: Colors.black, - ), - Shadow( - offset: Offset(0, 0), - blurRadius: 20, - color: Colors.black, - ), - ], + Expanded( + child: Text( + "fastAppDescription".tr(args: [currencyName]), + textAlign: TextAlign.center, + style: scaledTextStyle( + color: Colors.white, + fontSize: isTall ? 19 : 17, + fontWeight: FontWeight.w700, + shadows: const <Shadow>[ + Shadow( + offset: Offset(0, 0), + blurRadius: 20, + color: Colors.black, + ), + Shadow( + offset: Offset(0, 0), + blurRadius: 20, + color: Colors.black, + ), + ], + ), ), ) ]), @@ -270,10 +272,10 @@ Widget welcomeHome(context) { Expanded( child: Stack(children: <Widget>[ Padding( - padding: EdgeInsets.only(top: scaleSize(55)), + padding: EdgeInsets.only(top: scaleSize(isTall ? 55 : 0)), child: Image( image: const AssetImage('assets/home/gecko-bienvenue.png'), - height: scaleSize(180), + height: scaleSize(isTall ? 180 : 160), ), ), Positioned( @@ -293,7 +295,7 @@ Widget welcomeHome(context) { foregroundColor: Colors.white, backgroundColor: orangeC, elevation: 0, - padding: EdgeInsets.symmetric(vertical: scaleSize(12)), + padding: EdgeInsets.symmetric(vertical: scaleSize(8)), shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(12), ), @@ -330,7 +332,7 @@ Widget welcomeHome(context) { key: keyRestoreChest, style: OutlinedButton.styleFrom( side: BorderSide(width: scaleSize(4), color: orangeC), - padding: EdgeInsets.symmetric(vertical: scaleSize(12)), + padding: EdgeInsets.symmetric(vertical: scaleSize(8)), shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(12), ), diff --git a/lib/screens/myWallets/change_pin.dart b/lib/screens/myWallets/change_pin.dart index 38289eca11d80419edf19024d46e820f40112113..c4420d473a55de58b0ec20d3002fda78725f5d38 100644 --- a/lib/screens/myWallets/change_pin.dart +++ b/lib/screens/myWallets/change_pin.dart @@ -45,20 +45,29 @@ class _ChangePinScreenState extends State<ChangePinScreen> { backgroundColor: backgroundColor, appBar: GeckoAppBar(widget.walletName!), body: SafeArea( - child: Column(children: <Widget>[ - const SizedBox(height: 80), - Text( - 'choosePassword'.tr(), - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 16.0, - color: Colors.grey[600], - fontWeight: FontWeight.w400, + child: SingleChildScrollView( + child: Padding( + padding: const EdgeInsets.symmetric(vertical: 20, horizontal: 16), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: <Widget>[ + const SizedBox(height: 60), + Text( + 'choosePassword'.tr(), + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 16.0, + color: Colors.grey[600], + fontWeight: FontWeight.w400, + ), + ), + const SizedBox(height: 30), + pinForm(context), + const SizedBox(height: 40), + ], ), ), - const SizedBox(height: 30), - pinForm(context), - ]), + ), ), ); } diff --git a/lib/screens/myWallets/chest_options.dart b/lib/screens/myWallets/chest_options.dart index a9497496338e948a9a212cbc61badc10027a23cf..af4ed41ec14bfb4e77cc4bc18e7491e90ae7b51a 100644 --- a/lib/screens/myWallets/chest_options.dart +++ b/lib/screens/myWallets/chest_options.dart @@ -59,6 +59,7 @@ class ChestOptionsContent extends StatelessWidget { final isAlone = myWalletProvider.listWallets.length == 1; return Column( + spacing: 5, children: [ InkWell( key: keyShowSeed, @@ -74,8 +75,7 @@ class ChestOptionsContent extends StatelessWidget { ); }, child: Container( - height: scaleSize(48), - padding: EdgeInsets.symmetric(horizontal: scaleSize(16)), + padding: EdgeInsets.symmetric(horizontal: scaleSize(16), vertical: scaleSize(12)), child: Row( children: [ Icon( @@ -84,11 +84,14 @@ class ChestOptionsContent extends StatelessWidget { color: Colors.black87, ), ScaledSizedBox(width: 16), - Text( - 'displayMnemonic'.tr(), - style: scaledTextStyle( - fontSize: 16, - color: Colors.black87, + Expanded( + child: Text( + 'displayMnemonic'.tr(), + style: scaledTextStyle( + fontSize: 16, + color: Colors.black87, + ), + softWrap: true, ), ), ], @@ -112,8 +115,7 @@ class ChestOptionsContent extends StatelessWidget { ); }, child: Container( - height: scaleSize(48), - padding: EdgeInsets.symmetric(horizontal: scaleSize(16)), + padding: EdgeInsets.symmetric(horizontal: scaleSize(16), vertical: scaleSize(12)), child: Row( children: [ Icon( @@ -122,11 +124,14 @@ class ChestOptionsContent extends StatelessWidget { color: const Color.fromARGB(255, 255, 142, 142), ), ScaledSizedBox(width: 16), - Text( - 'changePassword'.tr(), - style: scaledTextStyle( - fontSize: 16, - color: Colors.black87, + Expanded( + child: Text( + 'changePassword'.tr(), + style: scaledTextStyle( + fontSize: 16, + color: Colors.black87, + ), + softWrap: true, ), ), ], @@ -149,8 +154,7 @@ class ChestOptionsContent extends StatelessWidget { } : null, child: Container( - height: scaleSize(48), - padding: EdgeInsets.symmetric(horizontal: scaleSize(16)), + padding: EdgeInsets.symmetric(horizontal: scaleSize(16), vertical: scaleSize(12)), child: Row( children: [ Icon( @@ -159,11 +163,14 @@ class ChestOptionsContent extends StatelessWidget { color: sub.nodeConnected ? Colors.black87 : Colors.grey[400], ), ScaledSizedBox(width: 16), - Text( - 'createDerivation'.tr(), - style: scaledTextStyle( - fontSize: 16, - color: sub.nodeConnected ? Colors.black87 : Colors.grey[500], + Expanded( + child: Text( + 'createDerivation'.tr(), + style: scaledTextStyle( + fontSize: 16, + color: sub.nodeConnected ? Colors.black87 : Colors.grey[500], + ), + softWrap: true, ), ), ], @@ -180,8 +187,7 @@ class ChestOptionsContent extends StatelessWidget { await chestProvider.deleteChest(context, currentChest); }, child: Container( - height: scaleSize(48), - padding: EdgeInsets.symmetric(horizontal: scaleSize(16)), + padding: EdgeInsets.symmetric(horizontal: scaleSize(16), vertical: scaleSize(12)), child: Row( children: [ Image.asset( @@ -190,11 +196,14 @@ class ChestOptionsContent extends StatelessWidget { color: const Color(0xffD80000), ), ScaledSizedBox(width: 16), - Text( - 'deleteChest'.tr(), - style: scaledTextStyle( - fontSize: 16, - color: const Color(0xffD80000), + Expanded( + child: Text( + 'deleteChest'.tr(), + style: scaledTextStyle( + fontSize: 16, + color: const Color(0xffD80000), + ), + softWrap: true, ), ), ], diff --git a/lib/screens/myWallets/manage_membership.dart b/lib/screens/myWallets/manage_membership.dart index 0df90ed1bacb17ae96d159ef0df1e2e753e8adbd..e60898b935d92ec50177d897d03bc9323891f020 100644 --- a/lib/screens/myWallets/manage_membership.dart +++ b/lib/screens/myWallets/manage_membership.dart @@ -102,7 +102,6 @@ class ManageMembership extends StatelessWidget { Widget migrateIdentity(BuildContext context) { return Container( - height: scaleSize(48), margin: EdgeInsets.symmetric(vertical: scaleSize(8)), child: InkWell( key: keyMigrateIdentity, @@ -115,7 +114,7 @@ class ManageMembership extends StatelessWidget { ); }, child: Padding( - padding: EdgeInsets.symmetric(horizontal: scaleSize(16)), + padding: EdgeInsets.symmetric(horizontal: scaleSize(16), vertical: scaleSize(12)), child: Row( children: [ Icon( @@ -140,7 +139,6 @@ class ManageMembership extends StatelessWidget { Widget revokeMyIdentity(BuildContext context) { return Container( - height: scaleSize(48), margin: EdgeInsets.symmetric(vertical: scaleSize(8)), child: InkWell( key: keyRevokeIdty, @@ -170,7 +168,7 @@ class ManageMembership extends StatelessWidget { ); }, child: Padding( - padding: EdgeInsets.symmetric(horizontal: scaleSize(19)), + padding: EdgeInsets.symmetric(horizontal: scaleSize(16), vertical: scaleSize(12)), child: Row( children: [ Image.asset( diff --git a/lib/screens/myWallets/restore_chest.dart b/lib/screens/myWallets/restore_chest.dart index d1d7d3df22122c0150bf4b477153b2568da6077a..abef035fe16170b894a74969590274bf0ad05d46 100644 --- a/lib/screens/myWallets/restore_chest.dart +++ b/lib/screens/myWallets/restore_chest.dart @@ -40,135 +40,139 @@ class RestoreChest extends StatelessWidget { appBar: GeckoAppBar('restoreAChest'.tr()), body: SafeArea( child: Stack(children: [ - Column(children: <Widget>[ - ScaledSizedBox(height: isTall ? 20 : 3), - bubbleSpeak('toRestoreEnterMnemonic'.tr()), - ScaledSizedBox(height: isTall ? 20 : 5), - Column(children: <Widget>[ - Row(mainAxisAlignment: MainAxisAlignment.spaceAround, children: <Widget>[ - arrayCell(context, genW.cellController0), - arrayCell(context, genW.cellController1), - arrayCell(context, genW.cellController2), - arrayCell(context, genW.cellController3), + SingleChildScrollView( + child: Column(children: <Widget>[ + ScaledSizedBox(height: isTall ? 20 : 3), + bubbleSpeak('toRestoreEnterMnemonic'.tr()), + ScaledSizedBox(height: isTall ? 20 : 5), + Column(children: <Widget>[ + Row(mainAxisAlignment: MainAxisAlignment.spaceAround, children: <Widget>[ + arrayCell(context, genW.cellController0), + arrayCell(context, genW.cellController1), + arrayCell(context, genW.cellController2), + arrayCell(context, genW.cellController3), + ]), + ScaledSizedBox(height: isTall ? 10 : 3), + Row(mainAxisAlignment: MainAxisAlignment.spaceAround, children: <Widget>[ + arrayCell(context, genW.cellController4), + arrayCell(context, genW.cellController5), + arrayCell(context, genW.cellController6), + arrayCell(context, genW.cellController7), + ]), + ScaledSizedBox(height: isTall ? 10 : 3), + Row(mainAxisAlignment: MainAxisAlignment.spaceAround, children: <Widget>[ + arrayCell(context, genW.cellController8), + arrayCell(context, genW.cellController9), + arrayCell(context, genW.cellController10), + arrayCell(context, genW.cellController11), + ]), ]), - ScaledSizedBox(height: isTall ? 10 : 3), - Row(mainAxisAlignment: MainAxisAlignment.spaceAround, children: <Widget>[ - arrayCell(context, genW.cellController4), - arrayCell(context, genW.cellController5), - arrayCell(context, genW.cellController6), - arrayCell(context, genW.cellController7), - ]), - ScaledSizedBox(height: isTall ? 10 : 3), - Row(mainAxisAlignment: MainAxisAlignment.spaceAround, children: <Widget>[ - arrayCell(context, genW.cellController8), - arrayCell(context, genW.cellController9), - arrayCell(context, genW.cellController10), - arrayCell(context, genW.cellController11), - ]), - ]), - if (genW.isSentenceComplete(context)) - Expanded( + if (genW.isSentenceComplete(context)) + Container( + padding: EdgeInsets.symmetric(vertical: scaleSize(20)), child: Align( - alignment: Alignment.center, - child: ScaledSizedBox( - width: 340, - height: 55, - child: ElevatedButton( - key: keyGoNext, - style: ElevatedButton.styleFrom( - foregroundColor: Colors.white, - backgroundColor: orangeC, - elevation: 0, - padding: EdgeInsets.symmetric(vertical: scaleSize(12)), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(12), - ), - ).copyWith( - elevation: WidgetStateProperty.resolveWith<double>( - (Set<WidgetState> states) { - if (states.contains(WidgetState.pressed)) return 0; - return 8; + alignment: Alignment.center, + child: ScaledSizedBox( + width: 340, + height: 55, + child: ElevatedButton( + key: keyGoNext, + style: ElevatedButton.styleFrom( + foregroundColor: Colors.white, + backgroundColor: orangeC, + elevation: 0, + padding: EdgeInsets.symmetric(vertical: scaleSize(12)), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(12), + ), + ).copyWith( + elevation: WidgetStateProperty.resolveWith<double>( + (Set<WidgetState> states) { + if (states.contains(WidgetState.pressed)) return 0; + return 8; + }, + ), + shadowColor: WidgetStateProperty.all( + Colors.black.withValues(alpha: 0.2), + ), + ), + onPressed: () async { + if (await sub.isMnemonicValid(genW.generatedMnemonic!)) { + genW.resetImportView(); + await Navigator.push( + context, + FaderTransition( + page: skipIntro ? const OnboardingStepNine(scanDerivation: true) : const OnboardingStepSeven(scanDerivation: true), + isFast: true), + ); + } else { + await badMnemonicPopup(context); + } }, + child: Text( + 'restoreThisChest'.tr(), + style: scaledTextStyle(fontSize: 18, fontWeight: FontWeight.w600, color: Colors.white), + ), ), - shadowColor: WidgetStateProperty.all( - Colors.black.withValues(alpha: 0.2), - ), - ), - onPressed: () async { - if (await sub.isMnemonicValid(genW.generatedMnemonic!)) { - genW.resetImportView(); - await Navigator.push( - context, - FaderTransition( - page: skipIntro ? const OnboardingStepNine(scanDerivation: true) : const OnboardingStepSeven(scanDerivation: true), - isFast: true), - ); - } else { - await badMnemonicPopup(context); - } - }, - child: Text( - 'restoreThisChest'.tr(), - style: scaledTextStyle(fontSize: 18, fontWeight: FontWeight.w600, color: Colors.white), ), ), - ), - )) - else - Column(children: [ - ScaledSizedBox(height: 20), - ScaledSizedBox( - width: 180, - height: 50, - child: ElevatedButton( - key: keyPastMnemonic, - style: ElevatedButton.styleFrom( - foregroundColor: Colors.black, - backgroundColor: yellowC, - elevation: 0, - padding: EdgeInsets.symmetric( - vertical: scaleSize(8), - horizontal: scaleSize(16), - ), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(12), - ), - ).copyWith( - elevation: WidgetStateProperty.resolveWith<double>( - (Set<WidgetState> states) { - if (states.contains(WidgetState.pressed)) return 0; - return 4; - }, - ), - shadowColor: WidgetStateProperty.all( - Colors.black.withValues(alpha: 0.15), - ), - ), - onPressed: () { - genW.pasteMnemonic(context); - }, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - Icon( - Icons.content_paste_go, - size: scaleSize(24), - color: Colors.black.withValues(alpha: 0.7), + ) + else + Column(children: [ + ScaledSizedBox(height: 20), + ScaledSizedBox( + width: 180, + // height: 50, + child: ElevatedButton( + key: keyPastMnemonic, + style: ElevatedButton.styleFrom( + foregroundColor: Colors.black, + backgroundColor: yellowC, + elevation: 0, + padding: EdgeInsets.symmetric( + vertical: scaleSize(8), + horizontal: scaleSize(16), ), - Text( - 'pasteFromClipboard'.tr(), - textAlign: TextAlign.center, - style: scaledTextStyle( - fontSize: 15, - fontWeight: FontWeight.w400, - height: 1.2, - ), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(12), ), - ], - )), - ) - ]) - ]), + ).copyWith( + elevation: WidgetStateProperty.resolveWith<double>( + (Set<WidgetState> states) { + if (states.contains(WidgetState.pressed)) return 0; + return 4; + }, + ), + shadowColor: WidgetStateProperty.all( + Colors.black.withValues(alpha: 0.15), + ), + ), + onPressed: () { + genW.pasteMnemonic(context); + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Icon( + Icons.content_paste_go, + size: scaleSize(24), + color: Colors.black.withValues(alpha: 0.7), + ), + Text( + 'pasteFromClipboard'.tr(), + textAlign: TextAlign.center, + style: scaledTextStyle( + fontSize: 15, + fontWeight: FontWeight.w400, + height: 1.2, + ), + ), + ], + )), + ) + ]) + ]), + ), const OfflineInfo(), ]), ), diff --git a/lib/screens/myWallets/show_seed.dart b/lib/screens/myWallets/show_seed.dart index 0c23bb33f5e165063d38ffb1bde4c7664140261a..78bcac4056087a5e0ff0f558fe11f0e378c173f8 100644 --- a/lib/screens/myWallets/show_seed.dart +++ b/lib/screens/myWallets/show_seed.dart @@ -31,110 +31,116 @@ class ShowSeed extends StatelessWidget { backgroundColor: backgroundColor, appBar: GeckoAppBar('myMnemonic'.tr()), body: SafeArea( - child: Column(children: <Widget>[ - const Spacer(flex: 1), - FutureBuilder( - future: sub.getSeed(defaultWallet.address, walletProvider.pinCode), - builder: (BuildContext context, AsyncSnapshot<String?> seed) { - if (seed.connectionState != ConnectionState.done || seed.hasError) { - return ScaledSizedBox( - height: 15, - width: 15, - child: const CircularProgressIndicator( - color: orangeC, - strokeWidth: 2, - ), - ); - } else if (!seed.hasData) { - return const Text(''); - } + child: SingleChildScrollView( + child: Padding( + padding: EdgeInsets.symmetric(vertical: scaleSize(20)), + child: Column( + children: <Widget>[ + FutureBuilder( + future: sub.getSeed(defaultWallet.address, walletProvider.pinCode), + builder: (BuildContext context, AsyncSnapshot<String?> seed) { + if (seed.connectionState != ConnectionState.done || seed.hasError) { + return ScaledSizedBox( + height: 15, + width: 15, + child: const CircularProgressIndicator( + color: orangeC, + strokeWidth: 2, + ), + ); + } else if (!seed.hasData) { + return const Text(''); + } - return Row(mainAxisAlignment: MainAxisAlignment.center, children: [ - Column(children: [ - BuildText(text: 'keepYourMnemonicSecret'.tr(), size: 16), - ScaledSizedBox(height: 35), - sentanceArray(context, seed.data!.split(' ')), - ScaledSizedBox(height: 20), - Row( - children: [ - ScaledSizedBox( - height: 39, - child: ElevatedButton( - style: ElevatedButton.styleFrom( - foregroundColor: Colors.black, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(8), + return Column( + children: [ + BuildText(text: 'keepYourMnemonicSecret'.tr(), size: 16), + ScaledSizedBox(height: 35), + sentanceArray(context, seed.data!.split(' ')), + ScaledSizedBox(height: 20), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + ScaledSizedBox( + height: 39, + child: ElevatedButton( + style: ElevatedButton.styleFrom( + foregroundColor: Colors.black, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(8), + ), + backgroundColor: orangeC, + elevation: 1, + ), + onPressed: () { + Clipboard.setData(ClipboardData(text: seed.data!)); + snackCopySeed(context); + }, + child: Row(children: <Widget>[ + Image.asset( + 'assets/walletOptions/copy-white.png', + height: scaleSize(24), + ), + ScaledSizedBox(width: 7), + Text( + 'copy'.tr(), + style: scaledTextStyle(fontSize: 13, color: Colors.grey[50]), + ) + ]), + ), ), - backgroundColor: orangeC, - elevation: 1, - ), - onPressed: () { - Clipboard.setData(ClipboardData(text: seed.data!)); - snackCopySeed(context); - }, - child: Row(children: <Widget>[ - Image.asset( - 'assets/walletOptions/copy-white.png', - height: scaleSize(24), + ScaledSizedBox(width: 50), + GestureDetector( + onTap: () { + Navigator.push( + context, + MaterialPageRoute(builder: (context) { + return PrintWallet(seed.data); + }), + ); + }, + child: Image.asset( + 'assets/printer.png', + height: scaleSize(38), + ), ), - ScaledSizedBox(width: 7), - Text( - 'copy'.tr(), - style: scaledTextStyle(fontSize: 13, color: Colors.grey[50]), - ) - ]), - ), - ), - ScaledSizedBox(width: 50), - GestureDetector( - onTap: () { - Navigator.push( - context, - MaterialPageRoute(builder: (context) { - return PrintWallet(seed.data); - }), - ); - }, - child: Image.asset( - 'assets/printer.png', - height: scaleSize(38), + ], ), - ), - ], + ], + ); + }), + ScaledSizedBox(height: 50), + ScaledSizedBox( + width: 240, + height: 55, + child: ElevatedButton( + style: ElevatedButton.styleFrom( + foregroundColor: Colors.white, + backgroundColor: orangeC, + elevation: 2, + padding: const EdgeInsets.symmetric(horizontal: 8), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(16), + ), + shadowColor: orangeC.withValues(alpha: 0.3), ), - ]), - ]); - }), - const Spacer(flex: 3), - ScaledSizedBox( - width: 240, - height: 55, - child: ElevatedButton( - style: ElevatedButton.styleFrom( - foregroundColor: Colors.white, - backgroundColor: orangeC, - elevation: 2, - padding: const EdgeInsets.symmetric(horizontal: 8), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(16), - ), - shadowColor: orangeC.withValues(alpha: 0.3), - ), - onPressed: () { - Navigator.pop(context); - }, - child: Text( - 'close'.tr(), - style: scaledTextStyle( - fontSize: 18, - fontWeight: FontWeight.w600, - color: Colors.white, + onPressed: () { + Navigator.pop(context); + }, + child: Text( + 'close'.tr(), + style: scaledTextStyle( + fontSize: 18, + fontWeight: FontWeight.w600, + color: Colors.white, + ), + ), + ), ), - ), + ], ), ), - const Spacer(flex: 2), - ]), + ), )); } diff --git a/lib/screens/myWallets/unlocking_wallet.dart b/lib/screens/myWallets/unlocking_wallet.dart index 8a0a355396cc0ae7740ed4e7eb61f724212a20c5..a10337c0f3249d558bae59b8476af143fe293e3c 100644 --- a/lib/screens/myWallets/unlocking_wallet.dart +++ b/lib/screens/myWallets/unlocking_wallet.dart @@ -55,128 +55,130 @@ class _UnlockingWalletState extends State<UnlockingWallet> { child: Scaffold( backgroundColor: backgroundColor, body: SafeArea( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: <Widget>[ - Padding( - padding: EdgeInsets.only(left: 8, top: isTall ? 14 : 0), - child: IconButton( - key: keyPopButton, - icon: Icon( - Icons.arrow_back, - color: Colors.black, - size: scaleSize(28), + child: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: <Widget>[ + Padding( + padding: EdgeInsets.only(left: 8, top: isTall ? 14 : 0), + child: IconButton( + key: keyPopButton, + icon: Icon( + Icons.arrow_back, + color: Colors.black, + size: scaleSize(28), + ), + onPressed: () { + myWalletProvider.isPinValid = false; + myWalletProvider.isPinLoading = true; + Navigator.pop(context); + }, ), - onPressed: () { - myWalletProvider.isPinValid = false; - myWalletProvider.isPinLoading = true; - Navigator.pop(context); - }, ), - ), - ScaledSizedBox(height: isTall ? 12 : 4), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: <Widget>[ - currentChest.imageFile == null - ? Image.asset( - 'assets/chests/${currentChest.imageName}', - width: scaleSize(isTall ? 95 : 75), - ) - : Image.file( - currentChest.imageFile!, - width: scaleSize(isTall ? 127 : 95), + ScaledSizedBox(height: isTall ? 12 : 4), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: <Widget>[ + currentChest.imageFile == null + ? Image.asset( + 'assets/chests/${currentChest.imageName}', + width: scaleSize(isTall ? 95 : 75), + ) + : Image.file( + currentChest.imageFile!, + width: scaleSize(isTall ? 127 : 95), + ), + ScaledSizedBox(width: 18), + Flexible( + child: Text( + currentChest.name!, + textAlign: TextAlign.center, + style: scaledTextStyle( + fontSize: isTall ? 24 : 20, + color: Colors.black, + fontWeight: FontWeight.w700, ), - ScaledSizedBox(width: 18), - Flexible( - child: Text( - currentChest.name!, - textAlign: TextAlign.center, - style: scaledTextStyle( - fontSize: isTall ? 24 : 20, - color: Colors.black, - fontWeight: FontWeight.w700, ), ), - ), - ], - ), - ScaledSizedBox(height: isTall ? 30 : 15), - Container( - margin: const EdgeInsets.symmetric(horizontal: 16), - padding: EdgeInsets.all(isTall ? 24 : 16), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(24), - boxShadow: [ - BoxShadow( - color: Colors.black.withValues(alpha: 0.05), - blurRadius: 10, - offset: const Offset(0, 5), - ), ], ), - child: Column( - children: [ - Text( - 'toUnlockEnterPassword'.tr(), - textAlign: TextAlign.center, - style: scaledTextStyle( - fontSize: isTall ? 16 : 14, - color: Colors.black87, - fontWeight: FontWeight.w500, + ScaledSizedBox(height: isTall ? 30 : 15), + Container( + margin: const EdgeInsets.symmetric(horizontal: 16), + padding: EdgeInsets.all(isTall ? 24 : 16), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(24), + boxShadow: [ + BoxShadow( + color: Colors.black.withValues(alpha: 0.05), + blurRadius: 10, + offset: const Offset(0, 5), ), - ), - ScaledSizedBox(height: isTall ? 24 : 12), - if (!myWalletProvider.isPinValid && !myWalletProvider.isPinLoading) - Padding( - padding: const EdgeInsets.only(bottom: 16), - child: Text( - "thisIsNotAGoodCode".tr(), - style: scaledTextStyle( - color: Colors.red[700], - fontWeight: FontWeight.w500, - fontSize: 15, - ), + ], + ), + child: Column( + children: [ + Text( + 'toUnlockEnterPassword'.tr(), + textAlign: TextAlign.center, + style: scaledTextStyle( + fontSize: isTall ? 16 : 14, + color: Colors.black87, + fontWeight: FontWeight.w500, ), ), - pinForm(context, pinLenght), - ScaledSizedBox(height: isTall ? 16 : 8), - if (canUnlock) - Consumer<WalletOptionsProvider>(builder: (context, sub, _) { - return InkWell( - key: keyCachePassword, - onTap: () { - walletOptions.changePinCacheChoice(); - }, - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - mainAxisSize: MainAxisSize.min, - children: [ - Icon( - configBox.get('isCacheChecked') ? Icons.check_box : Icons.check_box_outline_blank, - color: orangeC, - size: scaleSize(20), - ), - ScaledSizedBox(width: 8), - Flexible( - child: Text( - 'rememberPassword'.tr(), - style: scaledTextStyle( - fontSize: 12, - color: Colors.grey[700], - fontWeight: FontWeight.w500, + ScaledSizedBox(height: isTall ? 24 : 12), + if (!myWalletProvider.isPinValid && !myWalletProvider.isPinLoading) + Padding( + padding: const EdgeInsets.only(bottom: 16), + child: Text( + "thisIsNotAGoodCode".tr(), + style: scaledTextStyle( + color: Colors.red[700], + fontWeight: FontWeight.w500, + fontSize: 15, + ), + ), + ), + pinForm(context, pinLenght), + ScaledSizedBox(height: isTall ? 16 : 8), + if (canUnlock) + Consumer<WalletOptionsProvider>(builder: (context, sub, _) { + return InkWell( + key: keyCachePassword, + onTap: () { + walletOptions.changePinCacheChoice(); + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + mainAxisSize: MainAxisSize.min, + children: [ + Icon( + configBox.get('isCacheChecked') ? Icons.check_box : Icons.check_box_outline_blank, + color: orangeC, + size: scaleSize(20), + ), + ScaledSizedBox(width: 8), + Flexible( + child: Text( + 'rememberPassword'.tr(), + style: scaledTextStyle( + fontSize: 12, + color: Colors.grey[700], + fontWeight: FontWeight.w500, + ), ), ), - ), - ], - ), - ); - }), - ], + ], + ), + ); + }), + ], + ), ), - ), - ], + ], + ), ), ), ), diff --git a/lib/screens/myWallets/wallet_options.dart b/lib/screens/myWallets/wallet_options.dart index b57846ceb12a9036f50f526a898e738863a2dfaf..2e3e0f200b80d4249b7e9302fa53109d0fcaf2d1 100644 --- a/lib/screens/myWallets/wallet_options.dart +++ b/lib/screens/myWallets/wallet_options.dart @@ -95,9 +95,9 @@ class WalletOptions extends StatelessWidget { await walletProvider.editWalletName(context, [wallet.id[0], wallet.id[1]]); }, child: Container( - height: scaleSize(48), - padding: EdgeInsets.symmetric(horizontal: scaleSize(17)), + padding: EdgeInsets.symmetric(horizontal: scaleSize(17), vertical: scaleSize(12)), child: Row( + crossAxisAlignment: CrossAxisAlignment.center, children: [ Image.asset( 'assets/walletOptions/edit.png', @@ -105,11 +105,14 @@ class WalletOptions extends StatelessWidget { color: const Color(0xFF4A90E2).withValues(alpha: 0.8), ), ScaledSizedBox(width: 18), - Text( - "editWalletName".tr(), - style: scaledTextStyle( - fontSize: 16, - color: Colors.black87, + Expanded( + child: Text( + "editWalletName".tr(), + style: scaledTextStyle( + fontSize: 16, + color: Colors.black87, + ), + softWrap: true, ), ), ], @@ -212,9 +215,9 @@ class WalletOptions extends StatelessWidget { ); }, child: Container( - height: scaleSize(48), - padding: EdgeInsets.symmetric(horizontal: scaleSize(16)), + padding: EdgeInsets.symmetric(horizontal: scaleSize(16), vertical: scaleSize(12)), child: Row( + crossAxisAlignment: CrossAxisAlignment.center, children: [ Image.asset( 'assets/walletOptions/clock.png', @@ -222,11 +225,14 @@ class WalletOptions extends StatelessWidget { color: const Color(0xFF4A90E2).withValues(alpha: 0.8), ), ScaledSizedBox(width: 16), - Text( - "displayActivity".tr(), - style: scaledTextStyle( - fontSize: 16, - color: Colors.black87, + Expanded( + child: Text( + "displayActivity".tr(), + style: scaledTextStyle( + fontSize: 16, + color: Colors.black87, + ), + softWrap: true, ), ), ], @@ -273,9 +279,9 @@ class WalletOptions extends StatelessWidget { : null, child: canDelete ? Container( - height: scaleSize(48), - padding: EdgeInsets.symmetric(horizontal: scaleSize(16)), + padding: EdgeInsets.symmetric(horizontal: scaleSize(16), vertical: scaleSize(12)), child: Row( + crossAxisAlignment: CrossAxisAlignment.center, children: [ Image.asset( 'assets/walletOptions/trash.png', @@ -283,11 +289,14 @@ class WalletOptions extends StatelessWidget { color: const Color(0xffD80000), ), ScaledSizedBox(width: 16), - Text( - 'deleteThisWallet'.tr(), - style: scaledTextStyle( - fontSize: 16, - color: const Color(0xffD80000), + Expanded( + child: Text( + 'deleteThisWallet'.tr(), + style: scaledTextStyle( + fontSize: 16, + color: const Color(0xffD80000), + ), + softWrap: true, ), ), ], @@ -369,9 +378,9 @@ class WalletOptions extends StatelessWidget { } : null, child: Container( - height: scaleSize(48), - padding: EdgeInsets.symmetric(horizontal: scaleSize(16)), + padding: EdgeInsets.symmetric(horizontal: scaleSize(16), vertical: scaleSize(12)), child: Row( + crossAxisAlignment: CrossAxisAlignment.center, children: [ Icon( Icons.check_circle_outline, @@ -379,11 +388,14 @@ class WalletOptions extends StatelessWidget { color: walletProvider.isDefaultWallet ? Colors.grey[400] : const Color(0xFF4CAF50).withValues(alpha: 0.8), ), ScaledSizedBox(width: 16), - Text( - walletProvider.isDefaultWallet ? 'thisWalletIsDefault'.tr() : 'defineWalletAsDefault'.tr(), - style: scaledTextStyle( - fontSize: 16, - color: walletProvider.isDefaultWallet ? Colors.grey[500] : Colors.black87, + Expanded( + child: Text( + walletProvider.isDefaultWallet ? 'thisWalletIsDefault'.tr() : 'defineWalletAsDefault'.tr(), + style: scaledTextStyle( + fontSize: 16, + color: walletProvider.isDefaultWallet ? Colors.grey[500] : Colors.black87, + ), + softWrap: true, ), ), ], @@ -467,9 +479,9 @@ Widget aloneWalletOptions() { } }, child: Container( - height: scaleSize(48), - padding: EdgeInsets.symmetric(horizontal: scaleSize(16)), + padding: EdgeInsets.symmetric(horizontal: scaleSize(16), vertical: scaleSize(12)), child: Row( + crossAxisAlignment: CrossAxisAlignment.center, children: [ Icon( Icons.add_circle_outline, @@ -477,11 +489,14 @@ Widget aloneWalletOptions() { color: sub.nodeConnected ? Color(0xFF4CAF50).withValues(alpha: 0.8) : Colors.grey[400], ), ScaledSizedBox(width: 16), - Text( - 'createNewWallet'.tr(), - style: scaledTextStyle( - fontSize: 16, - color: sub.nodeConnected ? Colors.black87 : Colors.grey[500], + Expanded( + child: Text( + 'createNewWallet'.tr(), + style: scaledTextStyle( + fontSize: 16, + color: sub.nodeConnected ? Colors.black87 : Colors.grey[500], + ), + softWrap: true, ), ), ], @@ -498,8 +513,7 @@ Widget aloneWalletOptions() { ); }, child: Container( - height: scaleSize(48), - padding: EdgeInsets.symmetric(horizontal: scaleSize(16)), + padding: EdgeInsets.symmetric(horizontal: scaleSize(16), vertical: scaleSize(12)), child: Row( children: [ SvgPicture.asset( @@ -507,11 +521,14 @@ Widget aloneWalletOptions() { height: scaleSize(24), ), ScaledSizedBox(width: 16), - Text( - 'importG1v1'.tr(), - style: scaledTextStyle( - fontSize: 16, - color: Colors.black87, + Expanded( + child: Text( + 'importG1v1'.tr(), + style: scaledTextStyle( + fontSize: 16, + color: Colors.black87, + ), + softWrap: true, ), ), ], diff --git a/lib/screens/onBoarding/1.dart b/lib/screens/onBoarding/1.dart index f9f73c244125ab2a0ceed4b6be11bae82719da51..0dd40e48429772c3f976cf2698b925295906640f 100644 --- a/lib/screens/onBoarding/1.dart +++ b/lib/screens/onBoarding/1.dart @@ -17,13 +17,15 @@ class OnboardingStepOne extends StatelessWidget { appBar: GeckoAppBar('newWallet'.tr()), body: SafeArea( child: Stack(children: [ - InfoIntro( - text: 'geckoGenerateYourWalletFromMnemonic'.tr(), - assetName: 'fabrication-de-portefeuille.png', - buttonText: '>', - nextScreen: const OnboardingStepTwo(), - pagePosition: 0, - isMd: true, + SingleChildScrollView( + child: InfoIntro( + text: 'geckoGenerateYourWalletFromMnemonic'.tr(), + assetName: 'fabrication-de-portefeuille.png', + buttonText: '>', + nextScreen: const OnboardingStepTwo(), + pagePosition: 0, + isMd: true, + ), ), const OfflineInfo(), ]), diff --git a/lib/screens/onBoarding/10.dart b/lib/screens/onBoarding/10.dart index 70e54b1625237f44b4b47edb78835367598ff548..e29be21cce0e19a4b35907a4361bdf8ed3dfc56e 100644 --- a/lib/screens/onBoarding/10.dart +++ b/lib/screens/onBoarding/10.dart @@ -68,63 +68,65 @@ class _OnboardingStepTenState extends State<OnboardingStepTen> { appBar: GeckoAppBar('myPassword'.tr()), body: SafeArea( child: Stack(children: [ - Column(children: <Widget>[ - ScaledSizedBox(height: isTall ? 25 : 5), - const BuildProgressBar(pagePosition: 9), - ScaledSizedBox(height: isTall ? 25 : 5), - BuildText(text: "geckoWillCheckPassword".tr()), - ScaledSizedBox(height: isTall ? 25 : 0), - const ScanDerivationsInfo(), - Consumer<MyWalletsProvider>(builder: (context, mw, _) { - return Visibility( - visible: !myWalletProvider.isPinValid && !myWalletProvider.isPinLoading, - child: Text( - "thisIsNotAGoodCode".tr(), - style: scaledTextStyle(fontSize: 15, color: Colors.red, fontWeight: FontWeight.w500), - ), - ); - }), - ScaledSizedBox(height: isTall ? 20 : 0), - Consumer<SubstrateSdk>(builder: (context, sub, _) { - return sub.nodeConnected - ? pinForm(context, walletOptions, pinLenght, 1, 2) - : Row(mainAxisAlignment: MainAxisAlignment.center, children: [ - Text( - "youHaveToBeConnectedToValidateChest".tr(), - style: scaledTextStyle( - fontSize: 16, - color: Colors.redAccent, - fontWeight: FontWeight.w500, - ), - textAlign: TextAlign.center, - ), - ]); - }), - Consumer<WalletOptionsProvider>(builder: (context, walletOptions, _) { - return sub.nodeConnected - ? InkWell( - key: keyCachePassword, - onTap: () { - walletOptions.changePinCacheChoice(); - }, - child: Row(children: [ - ScaledSizedBox(height: isTall ? 30 : 0), - const Spacer(), - Icon( - configBox.get('isCacheChecked') ?? false ? Icons.check_box : Icons.check_box_outline_blank, - color: orangeC, - size: scaleSize(22), - ), - ScaledSizedBox(width: 8), + SingleChildScrollView( + child: Column(children: <Widget>[ + ScaledSizedBox(height: isTall ? 25 : 5), + const BuildProgressBar(pagePosition: 9), + ScaledSizedBox(height: isTall ? 25 : 5), + BuildText(text: "geckoWillCheckPassword".tr()), + ScaledSizedBox(height: isTall ? 25 : 0), + const ScanDerivationsInfo(), + Consumer<MyWalletsProvider>(builder: (context, mw, _) { + return Visibility( + visible: !myWalletProvider.isPinValid && !myWalletProvider.isPinLoading, + child: Text( + "thisIsNotAGoodCode".tr(), + style: scaledTextStyle(fontSize: 15, color: Colors.red, fontWeight: FontWeight.w500), + ), + ); + }), + ScaledSizedBox(height: isTall ? 20 : 0), + Consumer<SubstrateSdk>(builder: (context, sub, _) { + return sub.nodeConnected + ? pinForm(context, walletOptions, pinLenght, 1, 2) + : Row(mainAxisAlignment: MainAxisAlignment.center, children: [ Text( - 'rememberPassword'.tr(), - style: scaledTextStyle(fontSize: 14, color: Colors.grey[700]), + "youHaveToBeConnectedToValidateChest".tr(), + style: scaledTextStyle( + fontSize: 16, + color: Colors.redAccent, + fontWeight: FontWeight.w500, + ), + textAlign: TextAlign.center, ), - const Spacer() - ])) - : const Text(''); - }), - ]), + ]); + }), + Consumer<WalletOptionsProvider>(builder: (context, walletOptions, _) { + return sub.nodeConnected + ? InkWell( + key: keyCachePassword, + onTap: () { + walletOptions.changePinCacheChoice(); + }, + child: Row(children: [ + ScaledSizedBox(height: isTall ? 30 : 0), + const Spacer(), + Icon( + configBox.get('isCacheChecked') ?? false ? Icons.check_box : Icons.check_box_outline_blank, + color: orangeC, + size: scaleSize(22), + ), + ScaledSizedBox(width: 8), + Text( + 'rememberPassword'.tr(), + style: scaledTextStyle(fontSize: 14, color: Colors.grey[700]), + ), + const Spacer() + ])) + : const Text(''); + }), + ]), + ), const OfflineInfo(), ]), )), @@ -228,11 +230,14 @@ class _OnboardingStepTenState extends State<OnboardingStepTen> { myWalletProvider.debounceResetPinCode(); // Set default wallet to number 0 of current chest - final defaultWallet = myWalletProvider.listWallets.firstWhereOrNull((w) => w.isMembre) ?? + WalletData? defaultWallet = myWalletProvider.listWallets.firstWhereOrNull((w) => w.isMembre) ?? myWalletProvider.listWallets.firstWhereOrNull((w) => w.hasIdentity) ?? - myWalletProvider.listWallets.firstWhereOrNull((w) => w.number == 0) ?? - myWalletProvider.listWallets.first; - await sub.setCurrentWallet(defaultWallet); + myWalletProvider.listWallets.firstWhereOrNull((w) => w.number == 0); + + if (defaultWallet == null && myWalletProvider.listWallets.isNotEmpty) { + defaultWallet = myWalletProvider.listWallets.first; + } + if (defaultWallet != null) await sub.setCurrentWallet(defaultWallet); Navigator.push( context, diff --git a/lib/screens/onBoarding/11_congratulations.dart b/lib/screens/onBoarding/11_congratulations.dart index 43e6df6df53028c966a84bb5c39170d45a89050a..6f01848bdab5e78c51081e320b507eb6f3c6bf62 100644 --- a/lib/screens/onBoarding/11_congratulations.dart +++ b/lib/screens/onBoarding/11_congratulations.dart @@ -24,19 +24,29 @@ class OnboardingStepEleven extends StatelessWidget { appBar: GeckoAppBar('allGood'.tr()), body: SafeArea( child: Stack(children: [ - Column(children: <Widget>[ - ScaledSizedBox(height: isTall ? 25 : 5), - BuildText(text: "yourChestAndWalletWereCreatedSuccessfully".tr()), - ScaledSizedBox(height: isTall ? 15 : 5), - Image.asset( - 'assets/onBoarding/gecko-clin.gif', - height: scaleSize(isTall ? 330 : 280), + SingleChildScrollView( + child: SizedBox( + width: double.infinity, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: <Widget>[ + ScaledSizedBox(height: isTall ? 25 : 5), + BuildText(text: "yourChestAndWalletWereCreatedSuccessfully".tr()), + ScaledSizedBox(height: isTall ? 15 : 5), + Image.asset( + 'assets/onBoarding/gecko-clin.gif', + height: scaleSize(isTall ? 330 : 280), + ), + Container( + padding: EdgeInsets.symmetric(vertical: scaleSize(20)), + child: finishButton(context), + ), + ScaledSizedBox(height: isTall ? 40 : 5), + ], + ), ), - Expanded( - child: Align(alignment: Alignment.bottomCenter, child: finishButton(context)), - ), - ScaledSizedBox(height: isTall ? 40 : 5), - ]), + ), Align( alignment: Alignment.topLeft, child: ConfettiWidget( diff --git a/lib/screens/onBoarding/2.dart b/lib/screens/onBoarding/2.dart index 2a142fb74a16371856d436f6541790102a90894c..0e777beb3938b08eb1600e646dcdbee0cd557919 100644 --- a/lib/screens/onBoarding/2.dart +++ b/lib/screens/onBoarding/2.dart @@ -18,13 +18,14 @@ class OnboardingStepTwo extends StatelessWidget { appBar: GeckoAppBar('yourMnemonic'.tr()), body: SafeArea( child: Stack(children: [ - InfoIntro( - text: 'keepThisMnemonicSecure'.tr(), - assetName: - 'fabrication-de-portefeuille-impossible-sans-phrase.png', - buttonText: '>', - nextScreen: const OnboardingStepThree(), - pagePosition: 1), + SingleChildScrollView( + child: InfoIntro( + text: 'keepThisMnemonicSecure'.tr(), + assetName: 'fabrication-de-portefeuille-impossible-sans-phrase.png', + buttonText: '>', + nextScreen: const OnboardingStepThree(), + pagePosition: 1), + ), const OfflineInfo(), ]), ), diff --git a/lib/screens/onBoarding/3.dart b/lib/screens/onBoarding/3.dart index 077a1ef3612138b5257b2e6f1eaf5b0cb823d297..6e6aacfaaca96f7a4d2b6d451b444f2565f33c8d 100644 --- a/lib/screens/onBoarding/3.dart +++ b/lib/screens/onBoarding/3.dart @@ -18,13 +18,15 @@ class OnboardingStepThree extends StatelessWidget { appBar: GeckoAppBar('yourMnemonic'.tr()), body: SafeArea( child: Stack(children: [ - InfoIntro( - text: 'warningForgotPassword'.tr(), - assetName: 'forgot_password.png'.tr(), - buttonText: '>', - nextScreen: const OnboardingStepFor(), - pagePosition: 2, - boxHeight: 316, + SingleChildScrollView( + child: InfoIntro( + text: 'warningForgotPassword'.tr(), + assetName: 'forgot_password.png'.tr(), + buttonText: '>', + nextScreen: const OnboardingStepFor(), + pagePosition: 2, + boxHeight: 316, + ), ), const OfflineInfo(), ]), diff --git a/lib/screens/onBoarding/4.dart b/lib/screens/onBoarding/4.dart index 57a33cf624dfe75bc51741590a12e9ef468c149d..d859674841dfefc5492378f29203da8d42225050 100644 --- a/lib/screens/onBoarding/4.dart +++ b/lib/screens/onBoarding/4.dart @@ -18,13 +18,15 @@ class OnboardingStepFor extends StatelessWidget { appBar: GeckoAppBar('yourMnemonic'.tr()), body: SafeArea( child: Stack(children: [ - InfoIntro( - text: 'itsTimeToUseAPenAndPaper'.tr(), - assetName: 'gecko_also_can_forget.png'.tr(), - buttonText: '>', - nextScreen: const OnboardingStepFive(), - pagePosition: 3, - isMd: true), + SingleChildScrollView( + child: InfoIntro( + text: 'itsTimeToUseAPenAndPaper'.tr(), + assetName: 'gecko_also_can_forget.png'.tr(), + buttonText: '>', + nextScreen: const OnboardingStepFive(), + pagePosition: 3, + isMd: true), + ), const OfflineInfo(), ]), ), diff --git a/lib/screens/onBoarding/5.dart b/lib/screens/onBoarding/5.dart index 208c4facb33ed145c3cc49eb1166c6f2e9e3a307..0c347dbeb26dd3ee1f1973ab0b8438297748ef53 100644 --- a/lib/screens/onBoarding/5.dart +++ b/lib/screens/onBoarding/5.dart @@ -147,105 +147,106 @@ class _ChooseChestState extends State<OnboardingStepFive> { appBar: GeckoAppBar('yourMnemonic'.tr()), body: SafeArea( child: Stack(children: [ - Column(children: [ - ScaledSizedBox(height: isTall ? 25 : 5), - const BuildProgressBar(pagePosition: 4), - ScaledSizedBox(height: isTall ? 25 : 5), - BuildText(text: 'geckoGeneratedYourMnemonicKeepItSecret'.tr()), - ScaledSizedBox(height: isTall ? 15 : 5), - sentanceArray(), - ScaledSizedBox(height: isTall ? 17 : 5), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - ScaledSizedBox( - height: 40, - width: 132, - child: ElevatedButton( - style: ElevatedButton.styleFrom( - foregroundColor: Colors.black, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(8), + SingleChildScrollView( + child: Column(children: [ + ScaledSizedBox(height: isTall ? 25 : 5), + const BuildProgressBar(pagePosition: 4), + ScaledSizedBox(height: isTall ? 25 : 5), + BuildText(text: 'geckoGeneratedYourMnemonicKeepItSecret'.tr()), + ScaledSizedBox(height: isTall ? 15 : 5), + sentanceArray(), + ScaledSizedBox(height: isTall ? 17 : 5), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + ScaledSizedBox( + height: 40, + width: 132, + child: ElevatedButton( + style: ElevatedButton.styleFrom( + foregroundColor: Colors.black, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(8), + ), + backgroundColor: orangeC, + elevation: 1, ), - backgroundColor: orangeC, - elevation: 1, + onPressed: () { + Clipboard.setData(ClipboardData(text: generateWalletProvider.generatedMnemonic!)); + snackCopySeed(context); + }, + child: Row(children: <Widget>[ + Image.asset( + 'assets/walletOptions/copy-white.png', + height: scaleSize(23), + ), + const Spacer(), + Text( + 'copy'.tr(), + style: scaledTextStyle(fontSize: 14, color: Colors.grey[50]), + ), + const Spacer(), + ]), ), - onPressed: () { - Clipboard.setData(ClipboardData(text: generateWalletProvider.generatedMnemonic!)); - snackCopySeed(context); - }, - child: Row(children: <Widget>[ - Image.asset( - 'assets/walletOptions/copy-white.png', - height: scaleSize(23), - ), - const Spacer(), - Text( - 'copy'.tr(), - style: scaledTextStyle(fontSize: 14, color: Colors.grey[50]), - ), - const Spacer(), - ]), ), - ), - ScaledSizedBox(width: 70), - GestureDetector( - onTap: () { - Navigator.push( - context, - MaterialPageRoute(builder: (context) { - return PrintWallet(generateWalletProvider.generatedMnemonic!); - }), - ); - }, - child: Image.asset( - 'assets/printer.png', - height: scaleSize(42), + ScaledSizedBox(width: 70), + GestureDetector( + onTap: () { + Navigator.push( + context, + MaterialPageRoute(builder: (context) { + return PrintWallet(generateWalletProvider.generatedMnemonic!); + }), + ); + }, + child: Image.asset( + 'assets/printer.png', + height: scaleSize(42), + ), ), - ), - ], - ), - ScaledSizedBox(height: isTall ? 17 : 5), - Expanded( - child: Align( - alignment: Alignment.bottomCenter, + ], + ), + ScaledSizedBox(height: isTall ? 17 : 5), + Container( + padding: EdgeInsets.symmetric(vertical: scaleSize(20)), child: ScaledSizedBox( width: 350, height: 55, child: ElevatedButton( - key: keyGenerateMnemonic, - style: ElevatedButton.styleFrom( - foregroundColor: Colors.black, - backgroundColor: const Color(0xffFFD58D), - elevation: 2, - padding: const EdgeInsets.symmetric(horizontal: 8), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(16), - ), - shadowColor: const Color(0xffFFD58D).withValues(alpha: 0.3), + key: keyGenerateMnemonic, + style: ElevatedButton.styleFrom( + foregroundColor: Colors.black, + backgroundColor: const Color(0xffFFD58D), + elevation: 2, + padding: const EdgeInsets.symmetric(horizontal: 8), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(16), ), - onPressed: () { - _regenerateMnemonic(); - }, - child: FittedBox( - fit: BoxFit.scaleDown, - child: Text( - "chooseAnotherMnemonic".tr(), - textAlign: TextAlign.center, - style: scaledTextStyle( - fontSize: 18, - fontWeight: FontWeight.w600, - color: Colors.black, - ), + shadowColor: const Color(0xffFFD58D).withValues(alpha: 0.3), + ), + onPressed: () { + _regenerateMnemonic(); + }, + child: FittedBox( + fit: BoxFit.scaleDown, + child: Text( + "chooseAnotherMnemonic".tr(), + textAlign: TextAlign.center, + style: scaledTextStyle( + fontSize: 18, + fontWeight: FontWeight.w600, + color: Colors.black, ), - )), + ), + ), + ), ), ), - ), - ScaledSizedBox(height: isTall ? 20 : 10), - nextButton(context, "iNotedMyMnemonic".tr(), false, widget.skipIntro), - isTall ? const Spacer() : const SizedBox(height: 5), - ]), + ScaledSizedBox(height: isTall ? 20 : 10), + nextButton(context, "iNotedMyMnemonic".tr(), false, widget.skipIntro), + ScaledSizedBox(height: isTall ? 40 : 5), + ]), + ), const OfflineInfo(), ]), ), @@ -265,7 +266,7 @@ Widget nextButton(BuildContext context, String text, bool isFast, bool skipIntro foregroundColor: Colors.white, backgroundColor: orangeC, elevation: 2, - padding: const EdgeInsets.symmetric(vertical: 12), + padding: const EdgeInsets.symmetric(vertical: 8), shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(16), ), diff --git a/lib/screens/onBoarding/6.dart b/lib/screens/onBoarding/6.dart index 923409af28cf4485fb5d9dd322a1d27b4d00aa4a..9f25da9b6aca5d1ced93015828fbdb6057c5b68f 100644 --- a/lib/screens/onBoarding/6.dart +++ b/lib/screens/onBoarding/6.dart @@ -37,71 +37,70 @@ class OnboardingStepSix extends StatelessWidget { }, child: Scaffold( backgroundColor: backgroundColor, - resizeToAvoidBottomInset: false, appBar: GeckoAppBar('yourMnemonic'.tr()), body: SafeArea( child: Stack(children: [ - Align( - alignment: Alignment.topCenter, - child: Column(children: [ - ScaledSizedBox(height: isTall ? 25 : 5), - const BuildProgressBar(pagePosition: 5), - ScaledSizedBox(height: isTall ? 25 : 5), - BuildText(text: "didYouNoteMnemonicToBeSureTypeWord".tr(args: [(generateWalletProvider.nbrWord + 1).toString()]), isMd: true), - ScaledSizedBox(height: isTall ? 40 : 5), - if (isTall) - Text('${generateWalletProvider.nbrWord + 1}', - key: keyAskedWord, style: scaledTextStyle(fontSize: 19, color: orangeC, fontWeight: FontWeight.w500)), - if (isTall) ScaledSizedBox(height: 5), - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(7), - border: Border.all( - color: Colors.grey[600]!, - width: scaleSize(3), - )), - width: scaleSize(340), - child: TextFormField( - key: keyInputWord, - autofocus: true, - enabled: !generateWalletProvider.isAskedWordValid, - controller: wordController, - textInputAction: TextInputAction.next, - onChanged: (value) { - generateWalletProvider.checkAskedWord(value, _mnemonicController.text); - }, - maxLines: 1, - textAlign: TextAlign.center, - decoration: InputDecoration( - labelStyle: scaledTextStyle(fontSize: 18, color: Colors.grey[500], fontWeight: FontWeight.w500), - labelText: generateWalletProvider.isAskedWordValid - ? "itsTheGoodWord".tr() - : "${generateWalletProvider.nbrWordAlpha} ${"nthMnemonicWord".tr()}", - fillColor: const Color(0xffeeeedd), - filled: true, - contentPadding: const EdgeInsets.all(10), - ), - style: scaledTextStyle(fontSize: 25, color: generateWalletProvider.askedWordColor, fontWeight: FontWeight.w500))), - Visibility( - visible: generateWalletProvider.isAskedWordValid, - child: Expanded( - child: Align( - alignment: Alignment.bottomCenter, + SingleChildScrollView( + child: Align( + alignment: Alignment.topCenter, + child: Column(children: [ + ScaledSizedBox(height: isTall ? 25 : 5), + const BuildProgressBar(pagePosition: 5), + ScaledSizedBox(height: isTall ? 25 : 5), + BuildText(text: "didYouNoteMnemonicToBeSureTypeWord".tr(args: [(generateWalletProvider.nbrWord + 1).toString()]), isMd: true), + ScaledSizedBox(height: isTall ? 40 : 5), + if (isTall) + Text('${generateWalletProvider.nbrWord + 1}', + key: keyAskedWord, style: scaledTextStyle(fontSize: 19, color: orangeC, fontWeight: FontWeight.w500)), + if (isTall) ScaledSizedBox(height: 5), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(7), + border: Border.all( + color: Colors.grey[600]!, + width: scaleSize(3), + )), + width: scaleSize(340), + child: TextFormField( + key: keyInputWord, + autofocus: true, + enabled: !generateWalletProvider.isAskedWordValid, + controller: wordController, + textInputAction: TextInputAction.next, + onChanged: (value) { + generateWalletProvider.checkAskedWord(value, _mnemonicController.text); + }, + maxLines: 1, + textAlign: TextAlign.center, + decoration: InputDecoration( + labelStyle: scaledTextStyle(fontSize: 18, color: Colors.grey[500], fontWeight: FontWeight.w500), + labelText: generateWalletProvider.isAskedWordValid + ? "itsTheGoodWord".tr() + : "${generateWalletProvider.nbrWordAlpha} ${"nthMnemonicWord".tr()}", + fillColor: const Color(0xffeeeedd), + filled: true, + contentPadding: const EdgeInsets.all(10), + ), + style: scaledTextStyle(fontSize: 25, color: generateWalletProvider.askedWordColor, fontWeight: FontWeight.w500))), + Visibility( + visible: generateWalletProvider.isAskedWordValid, + child: Container( + padding: EdgeInsets.symmetric(vertical: scaleSize(20)), child: nextButton(context, 'continue'.tr(), skipIntro ? const OnboardingStepNine() : const OnboardingStepSeven(), false), ), ), - ), - // Visibility( - // visible: !_generateWalletProvider.isAskedWordValid, - // child: const Expanded( - // child: Align( - // alignment: Alignment.bottomCenter, - // child: Text(''), - // ), - // ), - // ), - ScaledSizedBox(height: 40), - ]), + // Visibility( + // visible: !_generateWalletProvider.isAskedWordValid, + // child: const Expanded( + // child: Align( + // alignment: Alignment.bottomCenter, + // child: Text(''), + // ), + // ), + // ), + ScaledSizedBox(height: 40), + ]), + ), ), const OfflineInfo(), ]), diff --git a/lib/screens/onBoarding/7.dart b/lib/screens/onBoarding/7.dart index f5a823e133b7aa01f67c66b3c5236280dc7ef038..4d5ac23384a2c90f31a793990214255c143c3e57 100644 --- a/lib/screens/onBoarding/7.dart +++ b/lib/screens/onBoarding/7.dart @@ -19,13 +19,15 @@ class OnboardingStepSeven extends StatelessWidget { appBar: GeckoAppBar('myPassword'.tr()), body: SafeArea( child: Stack(children: [ - InfoIntro( - text: 'geckoWillGenerateAPassword'.tr(), - assetName: 'coffre-fort-code-secret-dans-telephone.png', - buttonText: '>', - nextScreen: OnboardingStepEight(scanDerivation: scanDerivation), - pagePosition: 6, - boxHeight: 320), + SingleChildScrollView( + child: InfoIntro( + text: 'geckoWillGenerateAPassword'.tr(), + assetName: 'coffre-fort-code-secret-dans-telephone.png', + buttonText: '>', + nextScreen: OnboardingStepEight(scanDerivation: scanDerivation), + pagePosition: 6, + boxHeight: 320), + ), const OfflineInfo(), ]), ), diff --git a/lib/screens/onBoarding/8.dart b/lib/screens/onBoarding/8.dart index 4b359161d33035a469f233cb169997b31cf0a154..6816489ce7e791e3366aecc26f35f8517f953af1 100644 --- a/lib/screens/onBoarding/8.dart +++ b/lib/screens/onBoarding/8.dart @@ -19,14 +19,16 @@ class OnboardingStepEight extends StatelessWidget { appBar: GeckoAppBar('myPassword'.tr()), body: SafeArea( child: Stack(children: [ - InfoIntro( - text: 'thisPasswordProtectsYourWalletsInASecureChest'.tr(), - assetName: 'coffre-fort-protege-les-portefeuilles.png', - buttonText: '>', - nextScreen: OnboardingStepNine(scanDerivation: scanDerivation), - pagePosition: 7, - isMd: true, - boxHeight: 320), + SingleChildScrollView( + child: InfoIntro( + text: 'thisPasswordProtectsYourWalletsInASecureChest'.tr(), + assetName: 'coffre-fort-protege-les-portefeuilles.png', + buttonText: '>', + nextScreen: OnboardingStepNine(scanDerivation: scanDerivation), + pagePosition: 7, + isMd: true, + boxHeight: 320), + ), const OfflineInfo(), ]), ), diff --git a/lib/screens/onBoarding/9.dart b/lib/screens/onBoarding/9.dart index 3551a6c78ef00b96ab2701eb47d8a055bb7676d2..1303649af627ec940edb3fa80343babdb2bde72d 100644 --- a/lib/screens/onBoarding/9.dart +++ b/lib/screens/onBoarding/9.dart @@ -43,14 +43,17 @@ class _OnboardingStepNineState extends State<OnboardingStepNine> { appBar: GeckoAppBar('myPassword'.tr()), body: SafeArea( child: Stack(children: [ - Column(children: <Widget>[ - ScaledSizedBox(height: isTall ? 25 : 5), - const BuildProgressBar(pagePosition: 8), - ScaledSizedBox(height: isTall ? 25 : 5), - BuildText(text: "hereIsThePasswordKeepIt".tr()), - ScaledSizedBox(height: isTall ? 60 : 10), - pinForm(context, 1, 2), - ]), + SingleChildScrollView( + padding: EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom), + child: Column(children: <Widget>[ + ScaledSizedBox(height: isTall ? 25 : 5), + const BuildProgressBar(pagePosition: 8), + ScaledSizedBox(height: isTall ? 25 : 5), + BuildText(text: "hereIsThePasswordKeepIt".tr()), + ScaledSizedBox(height: isTall ? 60 : 10), + pinForm(context, 1, 2), + ]), + ), const OfflineInfo(), ]), ), @@ -119,11 +122,7 @@ class _OnboardingStepNineState extends State<OnboardingStepNine> { if (isPinComplex(pin)) { Navigator.push( context, - FaderTransition( - page: OnboardingStepTen( - scanDerivation: widget.scanDerivation, - pinCode: enterPin.text), - isFast: false), + FaderTransition(page: OnboardingStepTen(scanDerivation: widget.scanDerivation, pinCode: enterPin.text), isFast: false), ); } else { hasError = true; @@ -148,22 +147,7 @@ bool isPinComplex(String pin) { if (RegExp(r'^(\d)\1{3}$').hasMatch(pin)) return false; // Check for common sequences - List<String> sequences = [ - '0123', - '1234', - '2345', - '3456', - '4567', - '5678', - '6789', - '9876', - '8765', - '7654', - '6543', - '5432', - '4321', - '3210' - ]; + List<String> sequences = ['0123', '1234', '2345', '3456', '4567', '5678', '6789', '9876', '8765', '7654', '6543', '5432', '4321', '3210']; if (sequences.contains(pin)) return false; // Check if digits are too close to each other diff --git a/lib/screens/wallet_view.dart b/lib/screens/wallet_view.dart index 00e3a6521d2ec3714a23c7479f4ce54b4046ca2d..f8a9a1bd2db036e424f3b696a451b60bd5f7dfe3 100644 --- a/lib/screens/wallet_view.dart +++ b/lib/screens/wallet_view.dart @@ -61,54 +61,59 @@ class _WalletViewScreenState extends State<WalletViewScreen> { ), bottomNavigationBar: const GeckoBottomAppBar(), body: SafeArea( - child: Column(children: <Widget>[ - WalletHeader(address: address), - ScaledSizedBox(height: 20), - Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - _buildActionButton( - context: context, - key: keyViewActivity, - icon: 'assets/walletOptions/clock.png', - label: "displayNActivity".tr(), - onTap: () => Navigator.push( - context, - PageNoTransit(builder: (context) => ActivityScreen(address: address)), - ), - ), - Consumer<SubstrateSdk>(builder: (context, sub, _) { - return FutureBuilder( - future: sub.certState(address), - builder: (context, AsyncSnapshot<CertState> snapshot) { - if (!snapshot.hasData) return const SizedBox.shrink(); - final certState = snapshot.data!; - return Visibility( - visible: certState.status != CertStatus.none, - child: CertStateWidget( - certState: certState, - address: address, - ), + child: SingleChildScrollView( + child: SizedBox( + height: MediaQuery.of(context).size.height - MediaQuery.of(context).padding.top - kBottomNavigationBarHeight, + child: Column(children: <Widget>[ + WalletHeader(address: address), + ScaledSizedBox(height: 20), + Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + _buildActionButton( + context: context, + key: keyViewActivity, + icon: 'assets/walletOptions/clock.png', + label: "displayNActivity".tr(), + onTap: () => Navigator.push( + context, + PageNoTransit(builder: (context) => ActivityScreen(address: address)), + ), + ), + Consumer<SubstrateSdk>(builder: (context, sub, _) { + return FutureBuilder( + future: sub.certState(address), + builder: (context, AsyncSnapshot<CertState> snapshot) { + if (!snapshot.hasData) return const SizedBox.shrink(); + final certState = snapshot.data!; + return Visibility( + visible: certState.status != CertStatus.none, + child: CertStateWidget( + certState: certState, + address: address, + ), + ); + }, ); - }, - ); - }), - _buildActionButton( - context: context, - key: keyCopyAddress, - icon: 'assets/copy_key.png', - label: "copyAddress".tr(), - onTap: () { - Clipboard.setData(ClipboardData(text: address)); - snackCopyKey(context); - }, + }), + _buildActionButton( + context: context, + key: keyCopyAddress, + icon: 'assets/copy_key.png', + label: "copyAddress".tr(), + onTap: () { + Clipboard.setData(ClipboardData(text: address)); + snackCopyKey(context); + }, + ), + ], ), - ], + const Spacer(), + _buildTransferButton(context), + ScaledSizedBox(height: isTall ? 40 : 7), + ]), ), - const Spacer(), - _buildTransferButton(context), - ScaledSizedBox(height: isTall ? 40 : 7), - ]), + ), )); } diff --git a/lib/widgets/balance_display.dart b/lib/widgets/balance_display.dart index 604c1ef8e28188f17bc99bd6485d093d7cdcf5b4..5d39b4578046e45d5f0d999afdb22cbcf03f5989 100644 --- a/lib/widgets/balance_display.dart +++ b/lib/widgets/balance_display.dart @@ -27,9 +27,12 @@ class BalanceDisplay extends StatelessWidget { final isUdUnit = configBox.get('isUdUnit') ?? false; final unitRatio = isUdUnit ? 1 : 100; final valueRatio = _removeDecimalZero((value / balanceRatio) / unitRatio); + final absValueRatio = valueRatio.abs(); late String finalValue; - if (valueRatio >= 1000000) { + if (absValueRatio >= 1000000000) { + finalValue = '${(valueRatio / 1000000000).toStringAsFixed(2)}B'; + } else if (absValueRatio >= 1000000) { finalValue = '${(valueRatio / 1000000).toStringAsFixed(2)}M'; } else { finalValue = valueRatio.toString(); diff --git a/lib/widgets/bubble_speak.dart b/lib/widgets/bubble_speak.dart index a7c12161fa59d2a15bc83353b270d3d293b1009e..140aa955a947e3e8805f6406e60db3b5661150f7 100644 --- a/lib/widgets/bubble_speak.dart +++ b/lib/widgets/bubble_speak.dart @@ -20,18 +20,13 @@ class BubbleSpeak extends StatelessWidget { @override Widget build(BuildContext context) { return Bubble( - padding: long == null - ? const BubbleEdges.all(18) - : BubbleEdges.symmetric(horizontal: long, vertical: 30), + padding: long == null ? BubbleEdges.all(isTall ? 18 : 12) : BubbleEdges.symmetric(horizontal: long, vertical: 30), elevation: 5, color: backgroundColor, child: Text( text, key: textKey, - style: scaledTextStyle( - color: Colors.black, - fontSize: fontSize, - fontWeight: FontWeight.w400), + style: scaledTextStyle(color: Colors.black, fontSize: isTall ? fontSize : fontSize * 0.9, fontWeight: FontWeight.w400), ), ); } @@ -57,8 +52,7 @@ class BubbleSpeakWithTail extends StatelessWidget { alignment: Alignment.bottomRight, clipBehavior: Clip.none, children: [ - BubbleSpeak( - text: text, fontSize: fontSize, textKey: textKey, long: long), + BubbleSpeak(text: text, fontSize: fontSize, textKey: textKey, long: long), Positioned( left: 15, bottom: -scaleSize(28), diff --git a/lib/widgets/buttons/manage_membership_button.dart b/lib/widgets/buttons/manage_membership_button.dart index dd68d3c8bf7ceb3e8aaf76680ed0a68662b6fef7..576ca7f802d8fd3f3cb22fa40bbff69fab4ddc89 100644 --- a/lib/widgets/buttons/manage_membership_button.dart +++ b/lib/widgets/buttons/manage_membership_button.dart @@ -19,8 +19,7 @@ class ManageMembershipButton extends StatelessWidget { ); }, child: Container( - height: scaleSize(48), - padding: EdgeInsets.symmetric(horizontal: scaleSize(16)), + padding: EdgeInsets.symmetric(horizontal: scaleSize(16), vertical: scaleSize(12)), child: Row( children: [ Icon( @@ -29,11 +28,13 @@ class ManageMembershipButton extends StatelessWidget { color: const Color(0xFFFF9800).withValues(alpha: 0.8), ), ScaledSizedBox(width: 16), - Text( - 'manageMembership'.tr(), - style: scaledTextStyle( - fontSize: 16, - color: Colors.black87, + Expanded( + child: Text( + 'manageMembership'.tr(), + style: scaledTextStyle( + fontSize: 16, + color: Colors.black87, + ), ), ), ], diff --git a/lib/widgets/cert_tile.dart b/lib/widgets/cert_tile.dart index c567a93b812d4c0e8814468840f1c49e8848f2ef..144047d1bb79377f12f0b13f344dd7470ba097e2 100644 --- a/lib/widgets/cert_tile.dart +++ b/lib/widgets/cert_tile.dart @@ -26,10 +26,8 @@ class CertTile extends StatelessWidget { padding: const EdgeInsets.only(right: 0), child: ListTile( key: keyTransaction(keyID++), - contentPadding: EdgeInsets.only( - left: 10, right: 0, top: scaleSize(3), bottom: scaleSize(3)), - leading: DatapodAvatar( - address: repository['address'], size: avatarSize), + contentPadding: EdgeInsets.only(left: 10, right: 0, top: scaleSize(3), bottom: scaleSize(3)), + leading: DatapodAvatar(address: repository['address'] ?? '', size: avatarSize), title: Padding( padding: const EdgeInsets.only(bottom: 2), child: Text( @@ -57,12 +55,8 @@ class CertTile extends StatelessWidget { ), ), TextSpan( - text: getShortPubkey(repository['address']), - style: scaledTextStyle( - fontStyle: FontStyle.italic, - fontFamily: 'Monospace', - color: Colors.grey[600], - fontSize: 14), + text: getShortPubkey(repository['address'] ?? ''), + style: scaledTextStyle(fontStyle: FontStyle.italic, fontFamily: 'Monospace', color: Colors.grey[600], fontSize: 14), ), ], ), diff --git a/lib/widgets/certs_list.dart b/lib/widgets/certs_list.dart index 2f653adc7df6c6c55f35c6e4d1501e98fda51acc..9ab2ac695dc17ef166ee10ed21036c58210cd7a0 100644 --- a/lib/widgets/certs_list.dart +++ b/lib/widgets/certs_list.dart @@ -10,10 +10,7 @@ import 'package:graphql_flutter/graphql_flutter.dart'; import 'package:provider/provider.dart'; class CertsList extends StatelessWidget { - const CertsList( - {super.key, - required this.address, - this.direction = CertDirection.received}); + const CertsList({super.key, required this.address, this.direction = CertDirection.received}); final String address; final CertDirection direction; @@ -82,22 +79,16 @@ class CertsList extends StatelessWidget { if (!cert['isActive']) { continue; } - final String issuerAddress = cert[certFrom]['accountId']; - final String issuerName = cert[certFrom]['name']; - final date = - DateTime.parse(cert['updatedIn']['block']['timestamp']); + final String? issuerAddress = cert[certFrom]['accountId']; + final String? issuerName = cert[certFrom]['name']; + final date = DateTime.parse(cert['updatedIn']['block']['timestamp']); final dp = DateTime(date.year, date.month, date.day); - final dateForm = - '${formatNumber(dp.day)}-${formatNumber(dp.month)}-${dp.year}'; + final dateForm = '${formatNumber(dp.day)}-${formatNumber(dp.month)}-${dp.year}'; // Check if we have a more recent certification, we skip if (!listCerts.any((cert) => cert['address'] == issuerAddress)) { - listCerts.add({ - 'address': issuerAddress, - 'name': issuerName, - 'date': dateForm - }); + listCerts.add({'address': issuerAddress, 'name': issuerName, 'date': dateForm}); } } diff --git a/lib/widgets/commons/intro_info.dart b/lib/widgets/commons/intro_info.dart index a583369a5dd5f03784554a7375fd561d8c89b07f..f7a7a5cb700d587d9c1e23050e45bbf0f473185f 100644 --- a/lib/widgets/commons/intro_info.dart +++ b/lib/widgets/commons/intro_info.dart @@ -39,13 +39,12 @@ class InfoIntro extends StatelessWidget { BuildProgressBar(pagePosition: pagePosition), ScaledSizedBox(height: isTall ? 25 : 5), BuildText(text: text, size: textSize, isMd: isMd), - BuildImage( - assetName: assetName, boxHeight: boxHeight, imageWidth: imageWidth), - Expanded( + BuildImage(assetName: assetName, boxHeight: boxHeight, imageWidth: imageWidth), + Container( + padding: EdgeInsets.symmetric(vertical: scaleSize(20)), child: Align( alignment: Alignment.bottomCenter, - child: NextButton( - text: buttonText, nextScreen: nextScreen, isFast: false), + child: NextButton(text: buttonText, nextScreen: nextScreen, isFast: false), ), ), ScaledSizedBox(height: isTall ? 40 : 5), diff --git a/lib/widgets/commons/next_button.dart b/lib/widgets/commons/next_button.dart index 1a5367a91f8437452cd50830d9f4f13f731515c7..cbc9824ef4ee1d5de9295ba9eda55708dfe19ebd 100644 --- a/lib/widgets/commons/next_button.dart +++ b/lib/widgets/commons/next_button.dart @@ -27,7 +27,7 @@ class NextButton extends StatelessWidget { foregroundColor: Colors.white, backgroundColor: orangeC, elevation: 2, - padding: const EdgeInsets.symmetric(vertical: 12), + padding: const EdgeInsets.symmetric(vertical: 2), shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(16), ), diff --git a/lib/widgets/contacts_list.dart b/lib/widgets/contacts_list.dart index ce1df8860fdda72aa139f3a6adfde0d8510a6e98..caa43a35c7eb2fa98c00949e6f979d2c8882578a 100644 --- a/lib/widgets/contacts_list.dart +++ b/lib/widgets/contacts_list.dart @@ -89,8 +89,14 @@ class ContactsList extends StatelessWidget { dense: !isTall, leading: DatapodAvatar(address: g1Wallet.address, size: 47), title: Row(children: <Widget>[ - Text(getShortPubkey(g1Wallet.address), - style: scaledTextStyle(fontSize: 14, fontFamily: 'Monospace', fontWeight: FontWeight.w500), textAlign: TextAlign.center), + Expanded( + child: Text( + getShortPubkey(g1Wallet.address), + style: scaledTextStyle(fontSize: 14, fontFamily: 'Monospace', fontWeight: FontWeight.w500), + textAlign: TextAlign.left, + softWrap: true, + ), + ), ]), trailing: Column(mainAxisAlignment: MainAxisAlignment.center, children: [ ScaledSizedBox( diff --git a/lib/widgets/payment_popup.dart b/lib/widgets/payment_popup.dart index f7ab5d1139772525d77d3b4ac1c32f4b25fdc62b..7e2cc0a38a70ebf723876016adf7394553eb7585 100644 --- a/lib/widgets/payment_popup.dart +++ b/lib/widgets/payment_popup.dart @@ -62,7 +62,11 @@ void paymentPopup(BuildContext context, String toAddress, String? username) { Navigator.push( context, MaterialPageRoute(builder: (context) { - return ActivityScreen(address: acc.address!, transactionId: transactionId, comment: walletViewProvider.comment); + return ActivityScreen( + address: acc.address!, + transactionId: transactionId, + comment: walletViewProvider.comment, + ); }), ); } @@ -80,7 +84,7 @@ void paymentPopup(BuildContext context, String toAddress, String? username) { // Conversion du montant en unités de base final int payAmountValue = balanceRatio == 1 ? (double.parse(payAmount) * balanceRatio * 100).round() : (double.parse(payAmount) * balanceRatio).round(); - //TODO: get real existential deposit value from Duniter storage + // TODO: récupérer la valeur réelle de l'existential deposit depuis le storage de Duniter const existentialDeposit = 200; // Vérifications de validité @@ -95,24 +99,32 @@ void paymentPopup(BuildContext context, String toAddress, String? username) { myWalletProvider.readAllWallets().then((value) => myWalletProvider.listWallets.sort((a, b) => (a.derivation ?? -1).compareTo(b.derivation ?? -1))); showModalBottomSheet<void>( - shape: const RoundedRectangleBorder( - borderRadius: BorderRadius.only( - topRight: Radius.circular(shapeSize), - topLeft: Radius.circular(shapeSize), - ), + shape: const RoundedRectangleBorder( + borderRadius: BorderRadius.only( + topRight: Radius.circular(shapeSize), + topLeft: Radius.circular(shapeSize), ), - isScrollControlled: true, - context: context, - builder: (BuildContext context) { - final sub = Provider.of<SubstrateSdk>(homeContext, listen: false); + ), + isScrollControlled: true, + context: context, + builder: (BuildContext context) { + // Calcul de la hauteur à utiliser : on se base sur scaleSize(380) + // Si l'écran est trop petit, on utilisera 90% de sa hauteur. + final screenHeight = MediaQuery.of(context).size.height; + final double desiredHeight = scaleSize(380); + final double bottomSheetHeight = screenHeight < desiredHeight ? screenHeight * 0.9 : desiredHeight; - return StatefulBuilder(builder: (BuildContext context, StateSetter setState) { + final sub = Provider.of<SubstrateSdk>(homeContext, listen: false); + + return StatefulBuilder( + builder: (BuildContext context, StateSetter setState) { canValidate = canValidatePayment(); final bool isUdUnit = configBox.get('isUdUnit') ?? false; return Padding( padding: EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom), child: Container( - height: scaleSize(380), + // On fixe la hauteur maximale du bottom sheet + height: bottomSheetHeight, decoration: const ShapeDecoration( color: Color(0xffffeed1), shape: RoundedRectangleBorder( @@ -122,329 +134,347 @@ void paymentPopup(BuildContext context, String toAddress, String? username) { ), ), ), - child: Padding( - padding: EdgeInsets.only(top: scaleSize(12), bottom: 0, left: scaleSize(16), right: scaleSize(16)), - child: Column(mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ - Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Text( - 'executeATransfer'.tr(), - style: scaledTextStyle(fontSize: 17, fontWeight: FontWeight.w700), - ), - IconButton( - key: keyPopButton, - iconSize: scaleSize(28), - icon: const Icon(Icons.cancel_outlined), - onPressed: () { - Navigator.pop(context); - }, - ), - ]), - ScaledSizedBox(height: 4), - Text( - 'from'.tr(args: ['']), - style: scaledTextStyle(fontSize: 14, fontWeight: FontWeight.w500, color: Colors.grey[600]), - ), - ScaledSizedBox(height: 4), - Consumer<SubstrateSdk>(builder: (context, sub, _) { - return Container( - decoration: BoxDecoration( - border: Border.all(color: Colors.blueAccent.shade200, width: 1.5), - borderRadius: const BorderRadius.all(Radius.circular(8)), + // Ce container contient un SingleChildScrollView pour autoriser le scroll + // et un ConstrainedBox avec une contrainte minimale égale à la hauteur fixée. + child: SingleChildScrollView( + physics: const BouncingScrollPhysics(), + child: ConstrainedBox( + constraints: BoxConstraints(minHeight: bottomSheetHeight), + child: IntrinsicHeight( + child: Padding( + padding: EdgeInsets.only( + top: scaleSize(12), + bottom: scaleSize(16), + left: scaleSize(16), + right: scaleSize(16), ), - alignment: Alignment.center, - padding: const EdgeInsets.all(0), - child: DropdownButton( - dropdownColor: const Color(0xffffeed1), - elevation: 12, - key: keyDropdownWallets, - value: defaultWallet, - menuMaxHeight: scaleSize(270), - onTap: () { - FocusScope.of(context).requestFocus(amountFocus); - }, - selectedItemBuilder: (_) { - return myWalletProvider.listWallets.map((WalletData wallet) { - return Container( - width: scaleSize(isTall ? 315 : 310), - padding: EdgeInsets.all(scaleSize(7)), - child: Visibility( - visible: wallet.address == defaultWallet.address, - child: Row(mainAxisAlignment: MainAxisAlignment.center, children: [ - NameByAddress( - wallet: wallet, - fontStyle: FontStyle.normal, - size: 16, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: <Widget>[ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + 'executeATransfer'.tr(), + style: scaledTextStyle(fontSize: 17, fontWeight: FontWeight.w700), + ), + IconButton( + key: keyPopButton, + iconSize: scaleSize(28), + icon: const Icon(Icons.cancel_outlined), + onPressed: () { + Navigator.pop(context); + }, + ), + ], + ), + ScaledSizedBox(height: 4), + Text( + 'from'.tr(args: ['']), + style: scaledTextStyle(fontSize: 14, fontWeight: FontWeight.w500, color: Colors.grey[600]), + ), + ScaledSizedBox(height: 4), + Consumer<SubstrateSdk>(builder: (context, sub, _) { + return Container( + decoration: BoxDecoration( + border: Border.all(color: Colors.blueAccent.shade200, width: 1.5), + borderRadius: const BorderRadius.all(Radius.circular(8)), + ), + alignment: Alignment.center, + padding: const EdgeInsets.all(0), + child: DropdownButton( + dropdownColor: const Color(0xffffeed1), + elevation: 12, + key: keyDropdownWallets, + value: defaultWallet, + menuMaxHeight: scaleSize(270), + onTap: () { + FocusScope.of(context).requestFocus(amountFocus); + }, + selectedItemBuilder: (_) { + return myWalletProvider.listWallets.map((WalletData wallet) { + return Container( + width: scaleSize(isTall ? 315 : 310), + padding: EdgeInsets.all(scaleSize(7)), + child: Visibility( + visible: wallet.address == defaultWallet.address, + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + NameByAddress( + wallet: wallet, + fontStyle: FontStyle.normal, + size: 16, + ), + const Spacer(), + Balance(address: wallet.address, size: 16), + ], + ), + ), + ); + }).toList(); + }, + onChanged: (WalletData? newSelectedWallet) async { + defaultWallet = newSelectedWallet!; + await sub.setCurrentWallet(newSelectedWallet); + sub.reload(); + amountFocus.requestFocus(); + setState(() {}); + }, + items: myWalletProvider.listWallets.map((WalletData wallet) { + return DropdownMenuItem( + value: wallet, + key: keySelectThisWallet(wallet.address), + child: Container( + color: const Color(0xffffeed1), + width: scaleSize(isTall ? 315 : 310), + padding: const EdgeInsets.all(10), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + NameByAddress( + wallet: wallet, + fontStyle: FontStyle.normal, + size: 16, + ), + const Spacer(), + Balance(address: wallet.address, size: 16), + ], + ), ), - const Spacer(), - // const Text('data') - Balance(address: wallet.address, size: 16), - ]), - ), - ); - }).toList(); - }, - onChanged: (WalletData? newSelectedWallet) async { - defaultWallet = newSelectedWallet!; - await sub.setCurrentWallet(newSelectedWallet); - sub.reload(); - amountFocus.requestFocus(); - setState(() {}); - }, - items: myWalletProvider.listWallets.map((WalletData wallet) { - return DropdownMenuItem( - value: wallet, - key: keySelectThisWallet(wallet.address), - child: Container( - color: const Color(0xffffeed1), - width: scaleSize(isTall ? 315 : 310), - padding: const EdgeInsets.all(10), - child: Row(mainAxisAlignment: MainAxisAlignment.center, children: [ - NameByAddress( - wallet: wallet, - fontStyle: FontStyle.normal, - size: 16, - ), - const Spacer(), - Balance(address: wallet.address, size: 16), - ]), + ); + }).toList(), ), ); - }).toList()), - ); - }), - ScaledSizedBox(height: 12), - Row( - children: [ - Text( - 'to'.tr(args: ['']), - style: scaledTextStyle(fontSize: 15, fontWeight: FontWeight.w500, color: Colors.grey[600]), - ), - ScaledSizedBox(width: 10), - Text( - username ?? getShortPubkey(toAddress), - style: scaledTextStyle( - fontSize: 17, - fontWeight: FontWeight.w600, - ), - ), - ], - ), - ScaledSizedBox(height: 7), - Row( - children: [ - Text( - 'amount'.tr(), - style: scaledTextStyle(fontSize: 15, fontWeight: FontWeight.w500, color: Colors.grey[600]), - ), - const Spacer(), - if (fees > 0) - InkWell( - onTap: () => infoFeesPopup(context), - child: Row( + }), + ScaledSizedBox(height: 12), + Row( children: [ - Icon(Icons.info_outlined, color: orangeC, size: scaleSize(21)), - ScaledSizedBox(width: 5), Text( - 'fees'.tr(args: [fees.toString(), currencyName]), - style: scaledTextStyle( - color: orangeC, - fontSize: 13, - fontWeight: FontWeight.w500, - ), + 'to'.tr(args: ['']), + style: scaledTextStyle(fontSize: 15, fontWeight: FontWeight.w500, color: Colors.grey[600]), + ), + ScaledSizedBox(width: 10), + Text( + username ?? getShortPubkey(toAddress), + style: scaledTextStyle(fontSize: 17, fontWeight: FontWeight.w600), ), ], ), - ), - ScaledSizedBox(width: 10), - ], - ), - ScaledSizedBox(height: 10), - Focus( - onFocusChange: (focused) { - if (!commentFocus.hasFocus) { - setState(() { - FocusScope.of(context).requestFocus(amountFocus); - }); - } - }, - child: TextField( - textInputAction: TextInputAction.done, - onEditingComplete: () async { - if (walletViewProvider.isCommentVisible) { - commentFocus.requestFocus(); - } else if (canValidate) { - await executeTransfert(); - } - }, - key: keyAmountField, - controller: walletViewProvider.payAmount, - autofocus: true, - focusNode: amountFocus, - maxLines: 1, - textAlign: TextAlign.center, - autocorrect: false, - keyboardType: const TextInputType.numberWithOptions(decimal: true), - onChanged: (_) async { - fees = await sub.txFees( - defaultWallet.address, toAddress, double.parse(walletViewProvider.payAmount.text == '' ? '0' : walletViewProvider.payAmount.text)); - setState(() {}); - }, - inputFormatters: <TextInputFormatter>[ - FilteringTextInputFormatter.deny(',', replacementString: '.'), - FilteringTextInputFormatter.allow(RegExp(r'(^\d+\.?\d{0,2})')), - ], - decoration: InputDecoration( - hintText: '0.00', - suffix: Text( - isUdUnit ? 'ud'.tr(args: ['']) : currencyName, - style: const TextStyle(fontSize: 14), - ), - filled: true, - fillColor: Colors.transparent, - focusedBorder: OutlineInputBorder( - borderSide: BorderSide(color: Colors.grey[500]!, width: 1.5), - borderRadius: BorderRadius.circular(8), - ), - contentPadding: EdgeInsets.all(scaleSize(6)), - ), - style: scaledTextStyle( - fontSize: 22, - color: Colors.black, - fontWeight: FontWeight.w600, - ), - ), - ), - if (walletViewProvider.isCommentVisible) const SizedBox(height: 8), - Consumer<WalletsProfilesProvider>( - builder: (context, provider, _) { - return AnimatedCrossFade( - duration: const Duration(milliseconds: 200), - crossFadeState: provider.isCommentVisible ? CrossFadeState.showSecond : CrossFadeState.showFirst, - firstChild: TextButton.icon( - style: TextButton.styleFrom( - padding: EdgeInsets.symmetric( - horizontal: scaleSize(4), - vertical: scaleSize(2), - ), - ), - icon: Icon( - Icons.add_comment_outlined, - size: scaleSize(18), - color: Colors.grey[600], - ), - label: Text( - 'addComment'.tr(), - style: scaledTextStyle( - fontSize: 13, - color: Colors.grey[600], - fontWeight: FontWeight.w500, - ), + ScaledSizedBox(height: 7), + Row( + children: [ + Text( + 'amount'.tr(), + style: scaledTextStyle(fontSize: 15, fontWeight: FontWeight.w500, color: Colors.grey[600]), + ), + const Spacer(), + if (fees > 0) + InkWell( + onTap: () => infoFeesPopup(context), + child: Row( + children: [ + Icon(Icons.info_outlined, color: orangeC, size: scaleSize(21)), + ScaledSizedBox(width: 5), + Text( + 'fees'.tr(args: [fees.toString(), currencyName]), + style: scaledTextStyle( + color: orangeC, + fontSize: 13, + fontWeight: FontWeight.w500, + ), + ), + ], + ), + ), + ScaledSizedBox(width: 10), + ], ), - onPressed: () { - provider.toggleCommentVisibility(); - Future.delayed(const Duration(milliseconds: 250), () { - if (context.mounted) { - amountFocus.unfocus(); - commentFocus.requestFocus(); + ScaledSizedBox(height: 10), + Focus( + onFocusChange: (focused) { + if (!commentFocus.hasFocus) { + setState(() { + FocusScope.of(context).requestFocus(amountFocus); + }); } - }); - }, - ), - secondChild: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - TextField( - controller: provider.payComment, - focusNode: commentFocus, - onChanged: (value) => provider.comment = value, - inputFormatters: [ - Utf8LengthLimitingTextInputFormatter(146), - ], + }, + child: TextField( textInputAction: TextInputAction.done, onEditingComplete: () async { - if (canValidate) await executeTransfert(); + if (walletViewProvider.isCommentVisible) { + commentFocus.requestFocus(); + } else if (canValidate) { + await executeTransfert(); + } }, + key: keyAmountField, + controller: walletViewProvider.payAmount, + autofocus: true, + focusNode: amountFocus, maxLines: 1, - style: scaledTextStyle( - fontSize: 13, - color: Colors.black87, - ), + textAlign: TextAlign.center, + autocorrect: false, + keyboardType: const TextInputType.numberWithOptions(decimal: true), + onChanged: (_) async { + fees = await sub.txFees( + defaultWallet.address, + toAddress, + double.parse(walletViewProvider.payAmount.text == '' ? '0' : walletViewProvider.payAmount.text), + ); + setState(() {}); + }, + inputFormatters: <TextInputFormatter>[ + FilteringTextInputFormatter.deny(',', replacementString: '.'), + FilteringTextInputFormatter.allow(RegExp(r'(^\d+\.?\d{0,2})')), + ], decoration: InputDecoration( - hintText: 'optionalComment'.tr(), - hintStyle: TextStyle(color: Colors.grey[400]), + hintText: '0.00', + suffix: Text( + isUdUnit ? 'ud'.tr(args: ['']) : currencyName, + style: const TextStyle(fontSize: 14), + ), filled: true, - fillColor: Colors.white.withValues(alpha: 0.5), - contentPadding: EdgeInsets.symmetric( - horizontal: scaleSize(8), - vertical: scaleSize(4), + fillColor: Colors.transparent, + focusedBorder: OutlineInputBorder( + borderSide: BorderSide(color: Colors.grey[500]!, width: 1.5), + borderRadius: BorderRadius.circular(8), ), - counterText: '', - suffixIcon: IconButton( - padding: EdgeInsets.zero, - constraints: const BoxConstraints(), + contentPadding: EdgeInsets.all(scaleSize(6)), + ), + style: scaledTextStyle(fontSize: 22, color: Colors.black, fontWeight: FontWeight.w600), + ), + ), + if (walletViewProvider.isCommentVisible) const SizedBox(height: 8), + Consumer<WalletsProfilesProvider>( + builder: (context, provider, _) { + return AnimatedCrossFade( + duration: const Duration(milliseconds: 200), + crossFadeState: provider.isCommentVisible ? CrossFadeState.showSecond : CrossFadeState.showFirst, + firstChild: TextButton.icon( + style: TextButton.styleFrom( + padding: EdgeInsets.symmetric( + horizontal: scaleSize(4), + vertical: scaleSize(2), + ), + ), icon: Icon( - Icons.close, - size: scaleSize(16), + Icons.add_comment_outlined, + size: scaleSize(18), color: Colors.grey[600], ), + label: Text( + 'addComment'.tr(), + style: scaledTextStyle(fontSize: 13, color: Colors.grey[600], fontWeight: FontWeight.w500), + ), onPressed: () { - provider.comment = ''; provider.toggleCommentVisibility(); - commentFocus.unfocus(); - amountFocus.requestFocus(); + Future.delayed(const Duration(milliseconds: 250), () { + if (context.mounted) { + amountFocus.unfocus(); + commentFocus.requestFocus(); + } + }); }, ), - border: OutlineInputBorder( - borderRadius: BorderRadius.circular(8), - borderSide: BorderSide( - color: Colors.grey[300]!, - width: 1, - ), - ), - focusedBorder: OutlineInputBorder( - borderRadius: BorderRadius.circular(8), - borderSide: BorderSide( - color: Colors.grey[400]!, - width: 1.5, - ), + secondChild: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + TextField( + controller: provider.payComment, + focusNode: commentFocus, + onChanged: (value) => provider.comment = value, + inputFormatters: [ + Utf8LengthLimitingTextInputFormatter(146), + ], + textInputAction: TextInputAction.done, + onEditingComplete: () async { + if (canValidate) await executeTransfert(); + }, + maxLines: 1, + style: scaledTextStyle(fontSize: 13, color: Colors.black87), + decoration: InputDecoration( + hintText: 'optionalComment'.tr(), + hintStyle: TextStyle(color: Colors.grey[400]), + filled: true, + fillColor: Colors.white.withAlpha(128), + contentPadding: EdgeInsets.symmetric( + horizontal: scaleSize(8), + vertical: scaleSize(4), + ), + counterText: '', + suffixIcon: IconButton( + padding: EdgeInsets.zero, + constraints: const BoxConstraints(), + icon: Icon( + Icons.close, + size: scaleSize(16), + color: Colors.grey[600], + ), + onPressed: () { + provider.comment = ''; + provider.toggleCommentVisibility(); + commentFocus.unfocus(); + amountFocus.requestFocus(); + }, + ), + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(8), + borderSide: BorderSide( + color: Colors.grey[300]!, + width: 1, + ), + ), + focusedBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(8), + borderSide: BorderSide( + color: Colors.grey[400]!, + width: 1.5, + ), + ), + ), + ), + ], ), + ); + }, + ), + const Spacer(), + SizedBox( + width: double.infinity, + height: 50, + child: ElevatedButton( + key: keyConfirmPayment, + style: ElevatedButton.styleFrom( + foregroundColor: Colors.white, + elevation: 4, + backgroundColor: orangeC, + ), + onPressed: canValidate + ? () async { + await executeTransfert(); + } + : null, + child: Text( + 'executeTheTransfer'.tr(), + style: scaledTextStyle(fontSize: 16, fontWeight: FontWeight.w600), ), ), - ], - ), - ); - }, - ), - const Spacer(), - ScaledSizedBox( - width: double.infinity, - height: 50, - child: ElevatedButton( - key: keyConfirmPayment, - style: ElevatedButton.styleFrom( - foregroundColor: Colors.white, - elevation: 4, - backgroundColor: orangeC, - ), - onPressed: canValidate - ? () async { - await executeTransfert(); - } - : null, - child: Text( - 'executeTheTransfer'.tr(), - style: scaledTextStyle(fontSize: 16, fontWeight: FontWeight.w600), + ), + const Spacer(), + ], ), ), ), - const Spacer(), - ]), + ), ), ), ); - }); - }); + }, + ); + }, + ); } Future<void> infoFeesPopup(BuildContext context) async { @@ -474,15 +504,15 @@ Future<void> infoFeesPopup(BuildContext context) async { InkWell( onTap: () async => await _launchUrl('https://duniter.org'), child: Container( - padding: const EdgeInsets.only( - bottom: 2, - ), + padding: const EdgeInsets.only(bottom: 2), decoration: const BoxDecoration( - border: Border( - bottom: BorderSide( - color: Colors.blueAccent, - width: 1, - ))), + border: Border( + bottom: BorderSide( + color: Colors.blueAccent, + width: 1, + ), + ), + ), child: Text( 'moreInfo'.tr(), textAlign: TextAlign.center, @@ -490,7 +520,6 @@ Future<void> infoFeesPopup(BuildContext context) async { fontSize: 17, fontWeight: FontWeight.w300, color: Colors.blueAccent, - // decoration: TextDecoration.underline, ), ), ), @@ -507,10 +536,7 @@ Future<void> infoFeesPopup(BuildContext context) async { padding: const EdgeInsets.all(8), child: Text( 'gotit'.tr(), - style: scaledTextStyle( - fontSize: 20, - color: const Color(0xffD80000), - ), + style: scaledTextStyle(fontSize: 20, color: const Color(0xffD80000)), ), ), onPressed: () { diff --git a/lib/widgets/wallet_header.dart b/lib/widgets/wallet_header.dart index d9ee51003453f7f59cef867caa1422a898bf8c2e..86e523ec2a163615e2e73050b26ab215e5c676c3 100644 --- a/lib/widgets/wallet_header.dart +++ b/lib/widgets/wallet_header.dart @@ -259,12 +259,17 @@ class _WalletHeaderState extends State<WalletHeader> { }, child: Row( children: [ - Text( - getShortPubkey(widget.address), - style: scaledTextStyle( - fontSize: 20, - fontFamily: 'Monospace', - fontWeight: FontWeight.w600, + Flexible( + child: FittedBox( + fit: BoxFit.scaleDown, + child: Text( + getShortPubkey(widget.address), + style: scaledTextStyle( + fontSize: 20, + fontFamily: 'Monospace', + fontWeight: FontWeight.w600, + ), + ), ), ), SizedBox(width: scaleSize(14)), @@ -308,24 +313,27 @@ class _WalletHeaderState extends State<WalletHeader> { borderRadius: BorderRadius.circular(8), color: Colors.transparent, ), - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - IdentityStatus( - address: widget.address, - color: orangeC, - ), - SizedBox(width: scaleSize(8)), - Certifications( - address: widget.address, - size: 13, - ), - Icon( - Icons.chevron_right, - size: scaleSize(15), - color: orangeC.withValues(alpha: 0.5), - ), - ], + child: FittedBox( + fit: BoxFit.scaleDown, + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + IdentityStatus( + address: widget.address, + color: orangeC, + ), + SizedBox(width: scaleSize(8)), + Certifications( + address: widget.address, + size: 13, + ), + Icon( + Icons.chevron_right, + size: scaleSize(15), + color: orangeC.withValues(alpha: 0.5), + ), + ], + ), ), ), ), diff --git a/lib/widgets/wallet_name.dart b/lib/widgets/wallet_name.dart index 57db6032ab29521da9fd154c54bfb8983a05203a..735c1fc40bbc33ecd43e405022660cb814e1612c 100644 --- a/lib/widgets/wallet_name.dart +++ b/lib/widgets/wallet_name.dart @@ -1,28 +1,38 @@ import 'package:flutter/material.dart'; import 'package:gecko/models/scale_functions.dart'; import 'package:gecko/models/wallet_data.dart'; -import 'package:truncate/truncate.dart'; class WalletName extends StatelessWidget { - const WalletName({super.key, required this.wallet, this.size = 20, this.color = Colors.black}); + const WalletName({ + super.key, + required this.wallet, + this.size = 20, + this.color = Colors.black, + this.maxWidth, + }); + final WalletData wallet; final double size; final Color color; + final double? maxWidth; @override Widget build(BuildContext context) { - return Row(mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ - Text( - truncate(wallet.name ?? '', 19), + return Container( + constraints: BoxConstraints( + maxWidth: maxWidth ?? MediaQuery.of(context).size.width * 0.3, + ), + child: Text( + wallet.name ?? '', + maxLines: 1, textAlign: TextAlign.center, style: scaledTextStyle( fontSize: size, color: color, fontWeight: FontWeight.w400, ), - softWrap: false, overflow: TextOverflow.ellipsis, ), - ]); + ); } }