diff --git a/lib/features/nft/presentation/screens/nft_details.dart b/lib/features/nft/presentation/screens/nft_details.dart index 688dc02d..eb113953 100644 --- a/lib/features/nft/presentation/screens/nft_details.dart +++ b/lib/features/nft/presentation/screens/nft_details.dart @@ -60,6 +60,7 @@ class NftDetails extends ConsumerWidget { ref.invalidate(lastProcessedNftProvider); ref.invalidate(nftsProvider); + ref.invalidate(nftProvider); ref.invalidate(ownedComicsProvider); ref.invalidate(ownedIssuesAsyncProvider); ref.invalidate(comicIssuePagesProvider); @@ -116,73 +117,59 @@ class NftDetails extends ConsumerWidget { children: [ Expanded( child: Button( - onPressed: ref.watch(privateLoadingProvider) - ? () async {} - : () async { - if (nft.isListed) { - return await ref - .read(nftControllerProvider - .notifier) - .delist( - nftAddress: nft.address, - callback: () { - showSnackBar( - context: context, - text: - 'Successfully delisted', - backgroundColor: - ColorPalette - .dReaderGreen, - ); - }, - onException: (exception) { - triggerLowPowerOrNoWallet( - context, - exception, - ); - }, - ); - } - showModalBottomSheet( - context: context, - backgroundColor: Colors.transparent, - isScrollControlled: true, - builder: (context) { - return Padding( - padding: EdgeInsets.only( - bottom: MediaQuery.viewInsetsOf( - context) - .bottom, - ), - child: - NftModalBottomSheet(nft: nft), + isLoading: ref.watch(privateLoadingProvider), + loadingColor: ColorPalette.greyscale200, + onPressed: () async { + if (nft.isListed) { + return await ref + .read(nftControllerProvider.notifier) + .delist( + nftAddress: nft.address, + callback: () { + showSnackBar( + context: context, + text: 'Successfully delisted', + backgroundColor: + ColorPalette.dReaderGreen, + ); + }, + onException: (exception) { + triggerLowPowerOrNoWallet( + context, + exception, ); }, ); - }, - child: ref.watch(privateLoadingProvider) - ? const SizedBox( - height: 24, - width: 24, - child: CircularProgressIndicator( + } + showModalBottomSheet( + context: context, + backgroundColor: Colors.transparent, + isScrollControlled: true, + builder: (context) { + return Padding( + padding: EdgeInsets.only( + bottom: + MediaQuery.viewInsetsOf(context) + .bottom, + ), + child: NftModalBottomSheet(nft: nft), + ); + }, + ); + }, + child: nft.isListed + ? Text( + 'Delist', + style: textTheme.titleMedium?.copyWith( color: ColorPalette.greyscale200, ), ) - : nft.isListed - ? Text( - 'Delist', - style: - textTheme.titleMedium?.copyWith( - color: ColorPalette.greyscale200, - ), - ) - : Text( - 'List', - style: - textTheme.titleMedium?.copyWith( - color: ColorPalette.greyscale200, - ), - ), + : Text( + 'List', + style: textTheme.titleMedium?.copyWith( + color: ColorPalette.greyscale200, + ), + ), ), ), const SizedBox( @@ -193,6 +180,7 @@ class NftDetails extends ConsumerWidget { borderColor: ColorPalette.dReaderGreen, isLoading: ref.watch(globalNotifierProvider).isLoading, + loadingColor: ColorPalette.dReaderGreen, onPressed: () async { if (nft.isUsed) { return nextScreenPush( @@ -482,7 +470,7 @@ class Button extends ConsumerWidget { final Widget child; final bool isLoading; final Future Function() onPressed; - final Color backgroundColor, borderColor; + final Color backgroundColor, borderColor, loadingColor; const Button({ super.key, required this.child, @@ -490,6 +478,7 @@ class Button extends ConsumerWidget { this.isLoading = false, this.backgroundColor = Colors.transparent, this.borderColor = ColorPalette.greyscale200, + this.loadingColor = ColorPalette.appBackgroundColor, }); @override @@ -506,6 +495,7 @@ class Button extends ConsumerWidget { backgroundColor: backgroundColor, isLoading: isLoading, onPressed: ref.watch(isOpeningSessionProvider) ? null : onPressed, + loadingColor: loadingColor, child: child, ); } diff --git a/lib/shared/widgets/buttons/custom_text_button.dart b/lib/shared/widgets/buttons/custom_text_button.dart index 8a91ebf1..78aa521d 100644 --- a/lib/shared/widgets/buttons/custom_text_button.dart +++ b/lib/shared/widgets/buttons/custom_text_button.dart @@ -3,15 +3,13 @@ import 'package:flutter/material.dart'; class CustomTextButton extends StatelessWidget { final Widget child; - final Color backgroundColor; - final Color textColor; + final Color backgroundColor, borderColor, loadingColor, textColor; final void Function()? onPressed; final Size size; final double fontSize; final bool isLoading; final BorderRadiusGeometry borderRadius; final EdgeInsetsGeometry padding; - final Color borderColor; const CustomTextButton({ super.key, @@ -29,6 +27,7 @@ class CustomTextButton extends StatelessWidget { ), this.padding = const EdgeInsets.all(8), this.borderColor = Colors.transparent, + this.loadingColor = ColorPalette.appBackgroundColor, }); @override @@ -63,12 +62,10 @@ class CustomTextButton extends StatelessWidget { ), ), child: isLoading - ? const SizedBox( + ? SizedBox( height: 24, width: 24, - child: CircularProgressIndicator( - color: ColorPalette.appBackgroundColor, - ), + child: CircularProgressIndicator(color: loadingColor), ) : child, ),