proper AddWalletNextButton styling

This commit is contained in:
julian 2022-09-16 18:03:26 -06:00
parent 95d37c9c28
commit 1f509c53db
2 changed files with 24 additions and 18 deletions

View file

@ -174,7 +174,9 @@ class _AddWalletViewState extends State<AddWalletView> {
const SizedBox( const SizedBox(
height: 70, height: 70,
width: 480, width: 480,
child: AddWalletNextButton(), child: AddWalletNextButton(
isDesktop: true,
),
), ),
const SizedBox( const SizedBox(
height: 32, height: 32,
@ -216,7 +218,9 @@ class _AddWalletViewState extends State<AddWalletView> {
const SizedBox( const SizedBox(
height: 16, height: 16,
), ),
const AddWalletNextButton(), const AddWalletNextButton(
isDesktop: false,
),
], ],
), ),
), ),

View file

@ -6,15 +6,23 @@ import 'package:stackwallet/utilities/cfcolors.dart';
import 'package:stackwallet/utilities/text_styles.dart'; import 'package:stackwallet/utilities/text_styles.dart';
class AddWalletNextButton extends ConsumerWidget { class AddWalletNextButton extends ConsumerWidget {
const AddWalletNextButton({Key? key}) : super(key: key); const AddWalletNextButton({
Key? key,
required this.isDesktop,
}) : super(key: key);
final bool isDesktop;
@override @override
Widget build(BuildContext context, WidgetRef ref) { Widget build(BuildContext context, WidgetRef ref) {
debugPrint("BUILD: NextButton"); debugPrint("BUILD: NextButton");
final selectedCoin = final selectedCoin =
ref.watch(addWalletSelectedCoinStateProvider.state).state; ref.watch(addWalletSelectedCoinStateProvider.state).state;
final enabled = selectedCoin != null;
return TextButton( return TextButton(
onPressed: selectedCoin == null onPressed: !enabled
? null ? null
: () { : () {
final selectedCoin = final selectedCoin =
@ -25,22 +33,16 @@ class AddWalletNextButton extends ConsumerWidget {
arguments: selectedCoin, arguments: selectedCoin,
); );
}, },
style: selectedCoin == null style: enabled
? Theme.of(context).textButtonTheme.style?.copyWith( ? CFColors.getPrimaryEnabledButtonColor(context)
backgroundColor: MaterialStateProperty.all<Color>( : CFColors.getPrimaryDisabledButtonColor(context),
CFColors.stackAccent.withOpacity(
0.25,
),
),
)
: Theme.of(context).textButtonTheme.style?.copyWith(
backgroundColor: MaterialStateProperty.all<Color>(
CFColors.stackAccent,
),
),
child: Text( child: Text(
"Next", "Next",
style: STextStyles.button, style: isDesktop
? enabled
? STextStyles.desktopButtonEnabled
: STextStyles.desktopButtonDisabled
: STextStyles.button,
), ),
); );
} }