mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-03-21 22:58:49 +00:00
medium desktop buttons
This commit is contained in:
parent
d365614533
commit
51b6a95390
4 changed files with 62 additions and 30 deletions
|
@ -191,7 +191,7 @@ class _DesktopReceiveState extends ConsumerState<DesktopReceive> {
|
||||||
),
|
),
|
||||||
if (coin != Coin.epicCash)
|
if (coin != Coin.epicCash)
|
||||||
SecondaryButton(
|
SecondaryButton(
|
||||||
height: 56,
|
desktopMed: true,
|
||||||
onPressed: generateNewAddress,
|
onPressed: generateNewAddress,
|
||||||
label: "Generate new address",
|
label: "Generate new address",
|
||||||
),
|
),
|
||||||
|
|
|
@ -1173,7 +1173,7 @@ class _DesktopSendState extends ConsumerState<DesktopSend> {
|
||||||
height: 36,
|
height: 36,
|
||||||
),
|
),
|
||||||
PrimaryButton(
|
PrimaryButton(
|
||||||
height: 56,
|
desktopMed: true,
|
||||||
label: "Preview send",
|
label: "Preview send",
|
||||||
enabled: ref.watch(previewTxButtonStateProvider.state).state,
|
enabled: ref.watch(previewTxButtonStateProvider.state).state,
|
||||||
onPressed: ref.watch(previewTxButtonStateProvider.state).state
|
onPressed: ref.watch(previewTxButtonStateProvider.state).state
|
||||||
|
|
|
@ -13,6 +13,7 @@ class PrimaryButton extends StatelessWidget {
|
||||||
this.icon,
|
this.icon,
|
||||||
this.onPressed,
|
this.onPressed,
|
||||||
this.enabled = true,
|
this.enabled = true,
|
||||||
|
this.desktopMed = false,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
final double? width;
|
final double? width;
|
||||||
|
@ -21,13 +22,40 @@ class PrimaryButton extends StatelessWidget {
|
||||||
final VoidCallback? onPressed;
|
final VoidCallback? onPressed;
|
||||||
final bool enabled;
|
final bool enabled;
|
||||||
final Widget? icon;
|
final Widget? icon;
|
||||||
|
final bool desktopMed;
|
||||||
|
|
||||||
|
TextStyle getStyle(bool isDesktop, BuildContext context) {
|
||||||
|
if (isDesktop) {
|
||||||
|
if (desktopMed) {
|
||||||
|
return STextStyles.desktopTextExtraSmall(context).copyWith(
|
||||||
|
color: enabled
|
||||||
|
? Theme.of(context).extension<StackColors>()!.buttonTextPrimary
|
||||||
|
: Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.buttonTextPrimaryDisabled,
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return enabled
|
||||||
|
? STextStyles.desktopButtonEnabled(context)
|
||||||
|
: STextStyles.desktopButtonDisabled(context);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return STextStyles.button(context).copyWith(
|
||||||
|
color: enabled
|
||||||
|
? Theme.of(context).extension<StackColors>()!.buttonTextPrimary
|
||||||
|
: Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.buttonTextPrimaryDisabled,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final isDesktop = Util.isDesktop;
|
final isDesktop = Util.isDesktop;
|
||||||
|
|
||||||
return CustomTextButtonBase(
|
return CustomTextButtonBase(
|
||||||
height: height,
|
height: desktopMed ? 56 : height,
|
||||||
width: width,
|
width: width,
|
||||||
textButton: TextButton(
|
textButton: TextButton(
|
||||||
onPressed: enabled ? onPressed : null,
|
onPressed: enabled ? onPressed : null,
|
||||||
|
@ -49,19 +77,7 @@ class PrimaryButton extends StatelessWidget {
|
||||||
if (label != null)
|
if (label != null)
|
||||||
Text(
|
Text(
|
||||||
label!,
|
label!,
|
||||||
style: isDesktop
|
style: getStyle(isDesktop, context),
|
||||||
? enabled
|
|
||||||
? STextStyles.desktopButtonEnabled(context)
|
|
||||||
: STextStyles.desktopButtonDisabled(context)
|
|
||||||
: STextStyles.button(context).copyWith(
|
|
||||||
color: enabled
|
|
||||||
? Theme.of(context)
|
|
||||||
.extension<StackColors>()!
|
|
||||||
.buttonTextPrimary
|
|
||||||
: Theme.of(context)
|
|
||||||
.extension<StackColors>()!
|
|
||||||
.buttonTextPrimaryDisabled,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
|
@ -13,6 +13,7 @@ class SecondaryButton extends StatelessWidget {
|
||||||
this.icon,
|
this.icon,
|
||||||
this.onPressed,
|
this.onPressed,
|
||||||
this.enabled = true,
|
this.enabled = true,
|
||||||
|
this.desktopMed = false,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
final double? width;
|
final double? width;
|
||||||
|
@ -21,13 +22,40 @@ class SecondaryButton extends StatelessWidget {
|
||||||
final VoidCallback? onPressed;
|
final VoidCallback? onPressed;
|
||||||
final bool enabled;
|
final bool enabled;
|
||||||
final Widget? icon;
|
final Widget? icon;
|
||||||
|
final bool desktopMed;
|
||||||
|
|
||||||
|
TextStyle getStyle(bool isDesktop, BuildContext context) {
|
||||||
|
if (isDesktop) {
|
||||||
|
if (desktopMed) {
|
||||||
|
return STextStyles.desktopTextExtraSmall(context).copyWith(
|
||||||
|
color: enabled
|
||||||
|
? Theme.of(context).extension<StackColors>()!.buttonTextSecondary
|
||||||
|
: Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.buttonTextSecondaryDisabled,
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return enabled
|
||||||
|
? STextStyles.desktopButtonSecondaryEnabled(context)
|
||||||
|
: STextStyles.desktopButtonSecondaryDisabled(context);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return STextStyles.button(context).copyWith(
|
||||||
|
color: enabled
|
||||||
|
? Theme.of(context).extension<StackColors>()!.buttonTextSecondary
|
||||||
|
: Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.buttonTextSecondaryDisabled,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final isDesktop = Util.isDesktop;
|
final isDesktop = Util.isDesktop;
|
||||||
|
|
||||||
return CustomTextButtonBase(
|
return CustomTextButtonBase(
|
||||||
height: height,
|
height: desktopMed ? 56 : height,
|
||||||
width: width,
|
width: width,
|
||||||
textButton: TextButton(
|
textButton: TextButton(
|
||||||
onPressed: enabled ? onPressed : null,
|
onPressed: enabled ? onPressed : null,
|
||||||
|
@ -49,19 +77,7 @@ class SecondaryButton extends StatelessWidget {
|
||||||
if (label != null)
|
if (label != null)
|
||||||
Text(
|
Text(
|
||||||
label!,
|
label!,
|
||||||
style: isDesktop
|
style: getStyle(isDesktop, context),
|
||||||
? enabled
|
|
||||||
? STextStyles.desktopButtonSecondaryEnabled(context)
|
|
||||||
: STextStyles.desktopButtonSecondaryDisabled(context)
|
|
||||||
: STextStyles.button(context).copyWith(
|
|
||||||
color: enabled
|
|
||||||
? Theme.of(context)
|
|
||||||
.extension<StackColors>()!
|
|
||||||
.buttonTextSecondary
|
|
||||||
: Theme.of(context)
|
|
||||||
.extension<StackColors>()!
|
|
||||||
.buttonTextSecondaryDisabled,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
Loading…
Reference in a new issue