diff --git a/lib/_ui/toast.dart b/lib/_ui/toast.dart new file mode 100644 index 00000000..6230fecc --- /dev/null +++ b/lib/_ui/toast.dart @@ -0,0 +1,13 @@ +import 'package:bb_mobile/_ui/components/text.dart'; +import 'package:bb_mobile/styles.dart'; +import 'package:flutter/material.dart'; + +extension Xontext on BuildContext { + SnackBar showToast(String text) { + final bgColor = colour.onBackground; + return SnackBar( + content: Center(child: BBText.titleLarge(text, onSurface: true)), + backgroundColor: bgColor, + ); + } +} diff --git a/lib/auth/page.dart b/lib/auth/page.dart index 8550ab44..c856ca2f 100644 --- a/lib/auth/page.dart +++ b/lib/auth/page.dart @@ -3,6 +3,7 @@ import 'package:bb_mobile/_pkg/storage.dart'; import 'package:bb_mobile/_ui/app_bar.dart'; import 'package:bb_mobile/_ui/components/button.dart'; import 'package:bb_mobile/_ui/components/text.dart'; +import 'package:bb_mobile/_ui/toast.dart'; import 'package:bb_mobile/auth/bloc/cubit.dart'; import 'package:bb_mobile/auth/bloc/state.dart'; import 'package:bb_mobile/home/bloc/home_cubit.dart'; @@ -39,9 +40,7 @@ class AuthPage extends StatelessWidget { context.go('/home'); } else { ScaffoldMessenger.of(context).showSnackBar( - const SnackBar( - content: BBText.body('Pin Changed'), - ), + context.showToast('Pin Changed'), ); context.pop(); } diff --git a/lib/import/bloc/import_cubit.dart b/lib/import/bloc/import_cubit.dart index a35fddbc..e1cf5576 100644 --- a/lib/import/bloc/import_cubit.dart +++ b/lib/import/bloc/import_cubit.dart @@ -78,7 +78,7 @@ class ImportWalletCubit extends Cubit { ); emit(state.copyWith(errSavingWallet: '')); - nfc.stopSession(); + stopScanningNFC(); default: break; diff --git a/lib/import/wallet_type_selection.dart b/lib/import/wallet_type_selection.dart index 2ebb4c1d..323f9bef 100644 --- a/lib/import/wallet_type_selection.dart +++ b/lib/import/wallet_type_selection.dart @@ -209,92 +209,119 @@ class _ImportWalletTypeButton extends StatelessWidget { Row( children: [ Expanded( - child: Container( - margin: const EdgeInsets.only(right: 40), - padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 16), - decoration: BoxDecoration( - borderRadius: const BorderRadius.all(Radius.circular(32.0)), - border: Border.all( - width: selected ? 4 : 1, - color: selected ? context.colour.primary : context.colour.onBackground, - ), - ), + child: Padding( + padding: const EdgeInsets.only(right: 40), child: InkWell( onTap: () { context.read().walletTypeChanged(walletType); }, - child: Column( - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - Row( - children: [ - BBText.body( - name, - ), - const Spacer(), - SizedBox( - width: 16, - height: 16, - child: syncing - ? CircularProgressIndicator( - color: context.colour.primary, - strokeWidth: 2, - ) - : const SizedBox.shrink(), - ), - ], + radius: 32, + child: Container( + constraints: const BoxConstraints(minHeight: 100), + padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 16), + decoration: BoxDecoration( + borderRadius: const BorderRadius.all(Radius.circular(32.0)), + border: Border.all( + width: selected ? 4 : 1, + color: selected ? context.colour.primary : context.colour.onBackground, ), - const Gap(4), - if (address.isNotEmpty) - BBText.body( - address, + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + Row( + children: [ + BBText.body( + name, + ), + const Spacer(), + SizedBox( + width: 16, + height: 16, + child: syncing + ? CircularProgressIndicator( + color: context.colour.primary, + strokeWidth: 2, + ) + : const SizedBox.shrink(), + ), + ], ), - const Gap(4), - if (fingerprint.isNotEmpty) - RichText( - text: TextSpan( - children: [ - TextSpan( - text: 'Wallet fingerprint (XFP): ', - style: TextStyle( - fontSize: 12, - color: context.colour.onBackground, + const Gap(4), + if (syncing) ...[ + const BBText.bodySmall( + 'Scanning wallet ...', + ), + ], + if (address.isNotEmpty) + RichText( + text: TextSpan( + children: [ + TextSpan( + text: 'First Address: ', + style: TextStyle( + fontSize: 12, + color: context.colour.onBackground, + ), ), - ), - TextSpan( - text: fingerprint, - style: TextStyle( - fontSize: 12, - fontWeight: FontWeight.bold, - color: context.colour.onBackground, + TextSpan( + text: address, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.bold, + color: context.colour.onBackground, + ), ), - ), - ], + ], + ), ), - ), - if (balance != null) - RichText( - text: TextSpan( - children: [ - TextSpan( - text: 'Balance: ', - style: TextStyle( - fontSize: 12, - color: context.colour.onBackground, + const Gap(4), + if (fingerprint.isNotEmpty) + RichText( + text: TextSpan( + children: [ + TextSpan( + text: 'Wallet fingerprint (XFP): ', + style: TextStyle( + fontSize: 12, + color: context.colour.onBackground, + ), ), - ), - TextSpan( - text: balance.total.toString(), - style: TextStyle( - fontSize: 12, - fontWeight: FontWeight.bold, - color: context.colour.onBackground, + TextSpan( + text: fingerprint, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.bold, + color: context.colour.onBackground, + ), ), - ), - ], + ], + ), ), - ), - ], + if (balance != null) + RichText( + text: TextSpan( + children: [ + TextSpan( + text: 'Balance: ', + style: TextStyle( + fontSize: 12, + color: context.colour.onBackground, + ), + ), + TextSpan( + text: balance.total.toString(), + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.bold, + color: context.colour.onBackground, + ), + ), + ], + ), + ), + ], + ), ), ), ), diff --git a/lib/import/xpub.dart b/lib/import/xpub.dart index 8eca2ccf..5e7cf996 100644 --- a/lib/import/xpub.dart +++ b/lib/import/xpub.dart @@ -4,6 +4,7 @@ import 'package:bb_mobile/_ui/components/text.dart'; import 'package:bb_mobile/_ui/components/text_input.dart'; import 'package:bb_mobile/_ui/popup_border.dart'; import 'package:bb_mobile/_ui/templates/headers.dart'; +import 'package:bb_mobile/_ui/toast.dart'; import 'package:bb_mobile/import/bloc/import_cubit.dart'; import 'package:bb_mobile/import/bloc/import_state.dart'; import 'package:bb_mobile/styles.dart'; @@ -172,7 +173,12 @@ class _ImportButtons extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ - BBButton.text(label: 'Hardware wallet instruction', onPressed: () {}), + BBButton.text( + label: 'Hardware wallet instruction', + onPressed: () { + ScaffoldMessenger.of(context).showSnackBar(context.showToast('Coming soon')); + }, + ), BBButton.text( label: 'Advanced Options', onPressed: () { @@ -320,7 +326,7 @@ class ImportScanning extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.center, children: [ if (isColdCard) ...[ - const ColdCardLogo(), + const ColdCardLogo(isLeft: false), // const BBText.title( // 'ColdCard', // isRed: true, @@ -329,7 +335,7 @@ class ImportScanning extends StatelessWidget { const Gap(16), ], const BBText.title( - 'Scanning for wallets', + "Please scan via device's NFC", isRed: true, ), const Gap(16), @@ -340,11 +346,18 @@ class ImportScanning extends StatelessWidget { } class ColdCardLogo extends StatelessWidget { - const ColdCardLogo({super.key}); + const ColdCardLogo({super.key, this.isLeft = true}); + + final bool isLeft; @override Widget build(BuildContext context) { - return CenterLeft( + if (isLeft) { + return CenterLeft( + child: Image.asset('assets/cc-logo.png'), + ); + } + return Center( child: Image.asset('assets/cc-logo.png'), ); } diff --git a/lib/receive/receive_popup.dart b/lib/receive/receive_popup.dart index 65c344e4..b902a792 100644 --- a/lib/receive/receive_popup.dart +++ b/lib/receive/receive_popup.dart @@ -5,6 +5,7 @@ import 'package:bb_mobile/_ui/components/button.dart'; import 'package:bb_mobile/_ui/components/text.dart'; import 'package:bb_mobile/_ui/components/text_input.dart'; import 'package:bb_mobile/_ui/popup_border.dart'; +import 'package:bb_mobile/_ui/toast.dart'; import 'package:bb_mobile/home/bloc/home_cubit.dart'; import 'package:bb_mobile/locator.dart'; import 'package:bb_mobile/receive/bloc/receive_cubit.dart'; @@ -200,9 +201,7 @@ class InvoiceAddress extends StatelessWidget { SystemSound.play(SystemSoundType.click); HapticFeedback.selectionClick(); ScaffoldMessenger.of(context).showSnackBar( - const SnackBar( - content: BBText.body('Copied'), - ), + context.showToast('Copied'), ); }, iconSize: 16,