mouse cursor for desktop favorites card

This commit is contained in:
julian 2022-11-16 12:27:57 -06:00
parent 2c88b017f3
commit be70d75d75

View file

@ -13,6 +13,7 @@ import 'package:stackwallet/utilities/format.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:tuple/tuple.dart';
class FavoriteCard extends ConsumerStatefulWidget {
@ -54,190 +55,198 @@ class _FavoriteCardState extends ConsumerState<FavoriteCard> {
final externalCalls = ref.watch(
prefsChangeNotifierProvider.select((value) => value.externalCalls));
return GestureDetector(
onTap: () {
if (Util.isDesktop) {
Navigator.of(context).pushNamed(
DesktopWalletView.routeName,
arguments: walletId,
);
} else {
Navigator.of(context).pushNamed(
WalletView.routeName,
arguments: Tuple2(
walletId,
managerProvider,
),
);
}
},
child: SizedBox(
width: widget.width,
height: widget.height,
child: CardOverlayStack(
background: Stack(
children: [
Container(
width: widget.width,
height: widget.height,
decoration: BoxDecoration(
color: Theme.of(context)
.extension<StackColors>()!
.colorForCoin(coin),
borderRadius: BorderRadius.circular(
Constants.size.circularBorderRadius,
),
),
return ConditionalParent(
condition: Util.isDesktop,
builder: (child) => MouseRegion(
cursor: SystemMouseCursors.click,
child: child,
),
child: GestureDetector(
onTap: () {
if (Util.isDesktop) {
Navigator.of(context).pushNamed(
DesktopWalletView.routeName,
arguments: walletId,
);
} else {
Navigator.of(context).pushNamed(
WalletView.routeName,
arguments: Tuple2(
walletId,
managerProvider,
),
Column(
children: [
const Spacer(),
SizedBox(
height: widget.width * 0.3,
child: Row(
children: [
const Spacer(
flex: 9,
),
SvgPicture.asset(
Assets.svg.ellipse2,
height: widget.width * 0.3,
),
// ),
const Spacer(
flex: 2,
),
],
),
),
],
),
Row(
children: [
const Spacer(
flex: 5,
),
SizedBox(
width: widget.width * 0.45,
child: Column(
children: [
SvgPicture.asset(
Assets.svg.ellipse1,
width: widget.width * 0.45,
),
const Spacer(),
],
),
),
const Spacer(
flex: 1,
),
],
),
],
),
child: Padding(
padding: const EdgeInsets.all(12.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
);
}
},
child: SizedBox(
width: widget.width,
height: widget.height,
child: CardOverlayStack(
background: Stack(
children: [
Expanded(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: Text(
ref.watch(managerProvider
.select((value) => value.walletName)),
style: STextStyles.itemSubtitle12(context).copyWith(
color: Theme.of(context)
.extension<StackColors>()!
.textFavoriteCard,
),
overflow: TextOverflow.fade,
),
),
SvgPicture.asset(
Assets.svg.iconFor(coin: coin),
width: 24,
height: 24,
),
],
Container(
width: widget.width,
height: widget.height,
decoration: BoxDecoration(
color: Theme.of(context)
.extension<StackColors>()!
.colorForCoin(coin),
borderRadius: BorderRadius.circular(
Constants.size.circularBorderRadius,
),
),
),
FutureBuilder(
future: ref.watch(
managerProvider.select((value) => value.totalBalance)),
builder: (builderContext, AsyncSnapshot<Decimal> snapshot) {
if (snapshot.connectionState == ConnectionState.done &&
snapshot.hasData) {
if (snapshot.data != null) {
_cachedBalance = snapshot.data!;
if (externalCalls) {
_cachedFiatValue = _cachedBalance *
ref
.watch(
priceAnd24hChangeNotifierProvider.select(
(value) => value.getPrice(coin),
),
)
.item1;
}
}
}
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
FittedBox(
fit: BoxFit.scaleDown,
child: Text(
"${Format.localizedStringAsFixed(
decimalPlaces: 8,
value: _cachedBalance,
locale: ref.watch(
localeServiceChangeNotifierProvider
.select((value) => value.locale),
),
)} ${coin.ticker}",
style: STextStyles.titleBold12(context).copyWith(
fontSize: 16,
color: Theme.of(context)
.extension<StackColors>()!
.textFavoriteCard,
),
Column(
children: [
const Spacer(),
SizedBox(
height: widget.width * 0.3,
child: Row(
children: [
const Spacer(
flex: 9,
),
),
if (externalCalls)
const SizedBox(
height: 4,
SvgPicture.asset(
Assets.svg.ellipse2,
height: widget.width * 0.3,
),
if (externalCalls)
Text(
"${Format.localizedStringAsFixed(
decimalPlaces: 2,
value: _cachedFiatValue,
locale: ref.watch(
localeServiceChangeNotifierProvider
.select((value) => value.locale),
),
)} ${ref.watch(
prefsChangeNotifierProvider
.select((value) => value.currency),
)}",
style: STextStyles.itemSubtitle12(context).copyWith(
fontSize: 10,
color: Theme.of(context)
.extension<StackColors>()!
.textFavoriteCard,
),
// ),
const Spacer(
flex: 2,
),
],
);
},
],
),
),
],
),
Row(
children: [
const Spacer(
flex: 5,
),
SizedBox(
width: widget.width * 0.45,
child: Column(
children: [
SvgPicture.asset(
Assets.svg.ellipse1,
width: widget.width * 0.45,
),
const Spacer(),
],
),
),
const Spacer(
flex: 1,
),
],
),
],
),
child: Padding(
padding: const EdgeInsets.all(12.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: Text(
ref.watch(managerProvider
.select((value) => value.walletName)),
style: STextStyles.itemSubtitle12(context).copyWith(
color: Theme.of(context)
.extension<StackColors>()!
.textFavoriteCard,
),
overflow: TextOverflow.fade,
),
),
SvgPicture.asset(
Assets.svg.iconFor(coin: coin),
width: 24,
height: 24,
),
],
),
),
FutureBuilder(
future: ref.watch(
managerProvider.select((value) => value.totalBalance)),
builder: (builderContext, AsyncSnapshot<Decimal> snapshot) {
if (snapshot.connectionState == ConnectionState.done &&
snapshot.hasData) {
if (snapshot.data != null) {
_cachedBalance = snapshot.data!;
if (externalCalls) {
_cachedFiatValue = _cachedBalance *
ref
.watch(
priceAnd24hChangeNotifierProvider.select(
(value) => value.getPrice(coin),
),
)
.item1;
}
}
}
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
FittedBox(
fit: BoxFit.scaleDown,
child: Text(
"${Format.localizedStringAsFixed(
decimalPlaces: 8,
value: _cachedBalance,
locale: ref.watch(
localeServiceChangeNotifierProvider
.select((value) => value.locale),
),
)} ${coin.ticker}",
style: STextStyles.titleBold12(context).copyWith(
fontSize: 16,
color: Theme.of(context)
.extension<StackColors>()!
.textFavoriteCard,
),
),
),
if (externalCalls)
const SizedBox(
height: 4,
),
if (externalCalls)
Text(
"${Format.localizedStringAsFixed(
decimalPlaces: 2,
value: _cachedFiatValue,
locale: ref.watch(
localeServiceChangeNotifierProvider
.select((value) => value.locale),
),
)} ${ref.watch(
prefsChangeNotifierProvider
.select((value) => value.currency),
)}",
style:
STextStyles.itemSubtitle12(context).copyWith(
fontSize: 10,
color: Theme.of(context)
.extension<StackColors>()!
.textFavoriteCard,
),
),
],
);
},
),
],
),
),
),
),
),