rename and fix text button style update bug

This commit is contained in:
julian 2023-01-30 15:34:21 -06:00
parent 1f7bd41d8e
commit 69435f4807
32 changed files with 81 additions and 54 deletions

View file

@ -584,7 +584,7 @@ class _AddAddressBookEntryViewState
"Address ${i + 1}",
style: STextStyles.smallMed12(context),
),
BlueTextButton(
CustomTextButton(
onTap: () {
_removeForm(forms[i].id);
},
@ -601,7 +601,7 @@ class _AddAddressBookEntryViewState
const SizedBox(
height: 16,
),
BlueTextButton(
CustomTextButton(
onTap: () {
_addForm();
scrollController.animateTo(

View file

@ -311,7 +311,7 @@ class _ContactDetailsViewState extends ConsumerState<ContactDetailsView> {
"Addresses",
style: STextStyles.itemSubtitle(context),
),
BlueTextButton(
CustomTextButton(
text: "Add new",
onTap: () {
Navigator.of(context).pushNamed(

View file

@ -953,7 +953,7 @@ class _BuyFormState extends ConsumerState<BuyForm> {
Theme.of(context).extension<StackColors>()!.textDark3,
),
),
BlueTextButton(
CustomTextButton(
text: buyWithFiat ? "Use crypto amount" : "Use fiat amount",
onTap: () {
setState(() {
@ -1129,7 +1129,7 @@ class _BuyFormState extends ConsumerState<BuyForm> {
),
),
if (isStackCoin(selectedCrypto?.ticker))
BlueTextButton(
CustomTextButton(
text: "Choose from stack",
onTap: () {
try {

View file

@ -189,7 +189,7 @@ class _Step2ViewState extends ConsumerState<Step2View> {
style: STextStyles.smallMed12(context),
),
if (isStackCoin(model.receiveTicker))
BlueTextButton(
CustomTextButton(
text: "Choose from stack",
onTap: () {
try {
@ -448,7 +448,7 @@ class _Step2ViewState extends ConsumerState<Step2View> {
style: STextStyles.smallMed12(context),
),
if (isStackCoin(model.sendTicker))
BlueTextButton(
CustomTextButton(
text: "Choose from stack",
onTap: () {
try {

View file

@ -516,7 +516,7 @@ class _TradeDetailsViewState extends ConsumerState<TradeDetailsView> {
const SizedBox(
height: 10,
),
BlueTextButton(
CustomTextButton(
text: "View transaction",
onTap: () {
final Coin coin =

View file

@ -118,7 +118,7 @@ class PaynymQrPopup extends StatelessWidget {
const SizedBox(
height: 6,
),
BlueTextButton(
CustomTextButton(
text: "Copy",
textSize: isDesktop ? 18 : 10,
onTap: () async {

View file

@ -324,7 +324,7 @@ class _PaynymDetailsPopupState extends ConsumerState<DesktopPaynymDetails> {
const SizedBox(
height: 8,
),
BlueTextButton(
CustomTextButton(
text: "Copy",
onTap: () async {
await Clipboard.setData(

View file

@ -233,7 +233,7 @@ class _ReceiveViewState extends ConsumerState<ReceiveView> {
const SizedBox(
height: 20,
),
BlueTextButton(
CustomTextButton(
text: "Create new QR code",
onTap: () async {
unawaited(Navigator.of(context).push(

View file

@ -1304,7 +1304,7 @@ class _SendViewState extends ConsumerState<SendView> {
style: STextStyles.smallMed12(context),
textAlign: TextAlign.left,
),
BlueTextButton(
CustomTextButton(
text: "Send all ${coin.ticker}",
onTap: () async {
if (coin == Coin.firo ||

View file

@ -484,7 +484,7 @@ class AboutView extends ConsumerWidget {
const SizedBox(
height: 4,
),
BlueTextButton(
CustomTextButton(
text: "https://stackwallet.com",
onTap: () {
launchUrl(

View file

@ -282,7 +282,7 @@ class _DebugViewState extends ConsumerState<DebugView> {
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
BlueTextButton(
CustomTextButton(
text: "Save Debug Info to clipboard",
onTap: () async {
try {
@ -350,7 +350,7 @@ class _DebugViewState extends ConsumerState<DebugView> {
},
),
const Spacer(),
BlueTextButton(
CustomTextButton(
text: "Save logs to file",
onTap: () async {
final systemfile = SWBFileSystem();

View file

@ -92,7 +92,7 @@ class _CoinNodesViewState extends ConsumerState<CoinNodesView> {
),
textAlign: TextAlign.left,
),
BlueTextButton(
CustomTextButton(
text: "Add new node",
onTap: () {
Navigator.of(context).pushNamed(

View file

@ -327,7 +327,7 @@ class _AutoBackupViewState extends ConsumerState<AutoBackupView> {
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
BlueTextButton(
CustomTextButton(
text: "Back up now",
onTap: () {
ref.read(autoSWBServiceProvider).doBackup();
@ -448,7 +448,7 @@ class _AutoBackupViewState extends ConsumerState<AutoBackupView> {
height: 20,
),
Center(
child: BlueTextButton(
child: CustomTextButton(
text: "Edit Auto Backup",
onTap: () async {
Navigator.of(context)

View file

@ -749,7 +749,7 @@ class _WalletNetworkSettingsViewState
? STextStyles.desktopTextExtraExtraSmall(context)
: STextStyles.smallMed12(context),
),
BlueTextButton(
CustomTextButton(
text: "Add new node",
onTap: () {
Navigator.of(context).pushNamed(
@ -880,7 +880,7 @@ class _WalletNetworkSettingsViewState
top: 16,
bottom: 6,
),
child: BlueTextButton(
child: CustomTextButton(
text: "Rescan",
onTap: () async {
await Navigator.of(context).push(

View file

@ -1092,7 +1092,7 @@ class _TransactionDetailsViewState
height: 8,
),
if (coin != Coin.epicCash)
BlueTextButton(
CustomTextButton(
text: "Open in block explorer",
onTap: () async {
final uri =

View file

@ -649,7 +649,7 @@ class _WalletViewState extends ConsumerState<WalletView> {
.textDark3,
),
),
BlueTextButton(
CustomTextButton(
text: "See all",
onTap: () {
Navigator.of(context).pushNamed(

View file

@ -24,7 +24,7 @@ class AllWallets extends StatelessWidget {
color: Theme.of(context).extension<StackColors>()!.textDark,
),
),
BlueTextButton(
CustomTextButton(
text: "Add new",
onTap: () {
Navigator.of(context).pushNamed(AddWalletView.routeName);

View file

@ -66,7 +66,7 @@ class DesktopAddressCard extends StatelessWidget {
),
Row(
children: [
BlueTextButton(
CustomTextButton(
text: "Copy",
onTap: () {
clipboard.setData(
@ -87,7 +87,7 @@ class DesktopAddressCard extends StatelessWidget {
if (contactId != "default")
Consumer(
builder: (context, ref, child) {
return BlueTextButton(
return CustomTextButton(
text: "Edit",
onTap: () async {
ref.refresh(

View file

@ -182,7 +182,7 @@ class _DesktopContactDetailsState extends ConsumerState<DesktopContactDetails> {
style:
STextStyles.desktopTextExtraExtraSmall(context),
),
BlueTextButton(
CustomTextButton(
text: "Add new",
onTap: () async {
ref.refresh(

View file

@ -300,7 +300,7 @@ class _DesktopStep2State extends ConsumerState<DesktopStep2> {
),
if (isStackCoin(ref.watch(desktopExchangeModelProvider
.select((value) => value!.receiveTicker))))
BlueTextButton(
CustomTextButton(
text: "Choose from stack",
onTap: selectRecipientAddressFromStack,
),
@ -432,7 +432,7 @@ class _DesktopStep2State extends ConsumerState<DesktopStep2> {
),
if (isStackCoin(ref.watch(desktopExchangeModelProvider
.select((value) => value!.sendTicker))))
BlueTextButton(
CustomTextButton(
text: "Choose from stack",
onTap: selectRefundAddressFromStack,
),

View file

@ -221,7 +221,7 @@ class _DesktopChooseFromStackState
const SizedBox(
width: 80,
),
BlueTextButton(
CustomTextButton(
text: "Select wallet",
onTap: () async {
final address =

View file

@ -72,7 +72,7 @@ class _DesktopTradeHistoryState extends ConsumerState<DesktopTradeHistory> {
"Recent trades",
style: STextStyles.desktopTextExtraExtraSmall(context),
),
BlueTextButton(
CustomTextButton(
text: "See all",
onTap: () {
Navigator.of(context)

View file

@ -39,7 +39,7 @@ class DesktopFavoriteWallets extends ConsumerWidget {
.textFieldActiveSearchIconRight,
),
),
BlueTextButton(
CustomTextButton(
text: "Edit",
onTap: () {
Navigator.of(context).pushNamed(ManageFavoritesView.routeName);

View file

@ -38,7 +38,7 @@ class _MyWalletsState extends ConsumerState<MyWallets> {
),
),
const Spacer(),
BlueTextButton(
CustomTextButton(
text: "Add new wallet",
onTap: () {
Navigator.of(

View file

@ -133,7 +133,7 @@ class _ContactListItemState extends ConsumerState<ContactListItem> {
],
),
),
BlueTextButton(
CustomTextButton(
text: "Select wallet",
onTap: () {
Navigator.of(context).pop(e);

View file

@ -987,7 +987,7 @@ class _DesktopSendState extends ConsumerState<DesktopSend> {
),
textAlign: TextAlign.left,
),
BlueTextButton(
CustomTextButton(
text: "Send all ${coin.ticker}",
onTap: sendAllTapped,
),

View file

@ -37,7 +37,7 @@ class _RecentDesktopTransactionsState
.textFieldActiveSearchIconLeft,
),
),
BlueTextButton(
CustomTextButton(
text: "See all",
onTap: () {
Navigator.of(context).pushNamed(

View file

@ -261,7 +261,7 @@ class _DesktopLoginViewState extends ConsumerState<DesktopLoginView> {
const SizedBox(
height: 60,
),
BlueTextButton(
CustomTextButton(
text: "Forgot password?",
textSize: 20,
onTap: () {

View file

@ -450,7 +450,7 @@ class _BackupRestoreSettings extends ConsumerState<BackupRestoreSettings> {
STextStyles.itemSubtitle(
context),
),
BlueTextButton(
CustomTextButton(
text: "Back up now",
onTap: () {
ref

View file

@ -678,7 +678,7 @@ class DesktopAboutView extends ConsumerWidget {
const SizedBox(
height: 2,
),
BlueTextButton(
CustomTextButton(
text:
"https://stackwallet.com",
onTap: () {

View file

@ -1,17 +1,17 @@
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:stackwallet/providers/ui/color_theme_provider.dart';
import 'package:stackwallet/utilities/text_styles.dart';
import 'package:stackwallet/utilities/theme/stack_colors.dart';
import 'package:stackwallet/utilities/util.dart';
import 'package:stackwallet/widgets/conditional_parent.dart';
import 'package:stackwallet/widgets/rounded_container.dart';
class BlueTextButton extends ConsumerStatefulWidget {
const BlueTextButton({
class _CustomTextButton extends StatefulWidget {
const _CustomTextButton({
Key? key,
required this.text,
required this.enabledColor,
required this.disabledColor,
this.onTap,
this.enabled = true,
this.textSize,
@ -21,12 +21,14 @@ class BlueTextButton extends ConsumerStatefulWidget {
final VoidCallback? onTap;
final bool enabled;
final double? textSize;
final Color enabledColor;
final Color disabledColor;
@override
ConsumerState<BlueTextButton> createState() => _BlueTextButtonState();
State<_CustomTextButton> createState() => _CustomTextButtonState();
}
class _BlueTextButtonState extends ConsumerState<BlueTextButton>
class _CustomTextButtonState extends State<_CustomTextButton>
with SingleTickerProviderStateMixin {
AnimationController? controller;
Animation<dynamic>? animation;
@ -37,18 +39,14 @@ class _BlueTextButtonState extends ConsumerState<BlueTextButton>
@override
void initState() {
if (widget.enabled) {
color = ref.read(colorThemeProvider.state).state.buttonTextBorderless;
color = widget.enabledColor;
controller = AnimationController(
vsync: this,
duration: const Duration(milliseconds: 100),
);
animation = ColorTween(
begin: ref.read(colorThemeProvider.state).state.buttonTextBorderless,
end: ref
.read(colorThemeProvider.state)
.state
.buttonTextBorderless
.withOpacity(0.4),
begin: widget.enabledColor,
end: widget.enabledColor.withOpacity(0.4),
).animate(controller!);
animation!.addListener(() {
@ -57,7 +55,7 @@ class _BlueTextButtonState extends ConsumerState<BlueTextButton>
});
});
} else {
color = ref.read(colorThemeProvider.state).state.textSubtitle1;
color = widget.disabledColor;
}
super.initState();
@ -116,3 +114,32 @@ class _BlueTextButtonState extends ConsumerState<BlueTextButton>
);
}
}
class CustomTextButton extends StatelessWidget {
const CustomTextButton({
Key? key,
required this.text,
this.onTap,
this.enabled = true,
this.textSize,
}) : super(key: key);
final String text;
final VoidCallback? onTap;
final bool enabled;
final double? textSize;
@override
Widget build(BuildContext context) {
return _CustomTextButton(
key: UniqueKey(),
text: text,
enabledColor:
Theme.of(context).extension<StackColors>()!.buttonTextBorderless,
disabledColor: Theme.of(context).extension<StackColors>()!.textSubtitle1,
enabled: enabled,
textSize: textSize,
onTap: onTap,
);
}
}

View file

@ -261,7 +261,7 @@ class _NodeCardState extends ConsumerState<NodeCard> {
const SizedBox(
width: 66,
),
BlueTextButton(
CustomTextButton(
text: "Connect",
enabled: _status == "Disconnected",
onTap: () async {
@ -285,7 +285,7 @@ class _NodeCardState extends ConsumerState<NodeCard> {
const SizedBox(
width: 48,
),
BlueTextButton(
CustomTextButton(
text: "Details",
onTap: () {
Navigator.of(context).pushNamed(