Skip to content

Commit f7f00e3

Browse files
Merge pull request #1171 from cypherstack/ux-tweaks
Ux tweaks and various bug fixes
2 parents 9ab15d2 + 7b7eaa8 commit f7f00e3

File tree

38 files changed

+1863
-566
lines changed

38 files changed

+1863
-566
lines changed

asset_sources/svg/campfire/socials/twitter-brands.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Loading

asset_sources/svg/stack_duo/socials/twitter-brands.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Loading

asset_sources/svg/stack_wallet/socials/twitter-brands.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Loading

lib/models/isar/models/blockchain_data/v2/transaction_v2.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,10 @@ class TransactionV2 {
329329
bool isCoinbase() =>
330330
type == TransactionType.incoming && inputs.any((e) => e.coinbase != null);
331331

332+
@ignore
333+
bool get isInstantLock =>
334+
_getFromOtherData(key: TxV2OdKeys.isInstantLock) == true;
335+
332336
@override
333337
String toString() {
334338
return 'TransactionV2(\n'
@@ -362,4 +366,5 @@ abstract final class TxV2OdKeys {
362366
static const moneroAmount = "moneroAmount";
363367
static const moneroAccountIndex = "moneroAccountIndex";
364368
static const isMoneroTransaction = "isMoneroTransaction";
369+
static const isInstantLock = "isInstantLock";
365370
}

lib/pages/add_wallet_views/add_token_view/sub_widgets/add_token_list_element.dart

Lines changed: 33 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -46,21 +46,40 @@ class AddTokenListElement extends ConsumerStatefulWidget {
4646
class _AddTokenListElementState extends ConsumerState<AddTokenListElement> {
4747
final bool isDesktop = Util.isDesktop;
4848

49+
Currency? currency;
50+
4951
@override
50-
Widget build(BuildContext context) {
51-
final currency =
52-
ExchangeDataLoadingService.instance.isar.currencies
53-
.where()
54-
.exchangeNameEqualTo(ChangeNowExchange.exchangeName)
55-
.filter()
56-
.tokenContractEqualTo(
57-
widget.data.token.address,
58-
caseSensitive: false,
59-
)
60-
.and()
61-
.imageIsNotEmpty()
62-
.findFirstSync();
52+
void initState() {
53+
super.initState();
54+
55+
ExchangeDataLoadingService.instance.isar.then((isar) async {
56+
final currency =
57+
await isar.currencies
58+
.where()
59+
.exchangeNameEqualTo(ChangeNowExchange.exchangeName)
60+
.filter()
61+
.tokenContractEqualTo(
62+
widget.data.token.address,
63+
caseSensitive: false,
64+
)
65+
.and()
66+
.imageIsNotEmpty()
67+
.findFirst();
6368

69+
if (mounted) {
70+
WidgetsBinding.instance.addPostFrameCallback((_) {
71+
if (mounted) {
72+
setState(() {
73+
this.currency = currency;
74+
});
75+
}
76+
});
77+
}
78+
});
79+
}
80+
81+
@override
82+
Widget build(BuildContext context) {
6483
final String mainLabel = widget.data.token.name;
6584
final double iconSize = isDesktop ? 32 : 24;
6685

@@ -77,7 +96,7 @@ class _AddTokenListElementState extends ConsumerState<AddTokenListElement> {
7796
children: [
7897
currency != null
7998
? SvgPicture.network(
80-
currency.image,
99+
currency!.image,
81100
width: iconSize,
82101
height: iconSize,
83102
placeholderBuilder:

lib/pages/add_wallet_views/add_wallet_view/sub_widgets/coin_select_item.dart

Lines changed: 55 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -28,47 +28,71 @@ import '../../../../utilities/constants.dart';
2828
import '../../../../utilities/text_styles.dart';
2929
import '../../../../utilities/util.dart';
3030

31-
class CoinSelectItem extends ConsumerWidget {
31+
class CoinSelectItem extends ConsumerStatefulWidget {
3232
const CoinSelectItem({super.key, required this.entity});
3333

3434
final AddWalletListEntity entity;
3535

3636
@override
37-
Widget build(BuildContext context, WidgetRef ref) {
38-
debugPrint("BUILD: CoinSelectItem for ${entity.name}");
39-
final selectedEntity = ref.watch(addWalletSelectedEntityStateProvider);
37+
ConsumerState<CoinSelectItem> createState() => _CoinSelectItemState();
38+
}
4039

41-
final isDesktop = Util.isDesktop;
40+
class _CoinSelectItemState extends ConsumerState<CoinSelectItem> {
41+
String? tokenImageUri;
4242

43-
String? tokenImageUri;
44-
if (entity is EthTokenEntity) {
45-
final currency =
46-
ExchangeDataLoadingService.instance.isar.currencies
47-
.where()
48-
.exchangeNameEqualTo(ChangeNowExchange.exchangeName)
49-
.filter()
50-
.tokenContractEqualTo(
51-
(entity as EthTokenEntity).token.address,
52-
caseSensitive: false,
53-
)
54-
.and()
55-
.imageIsNotEmpty()
56-
.findFirstSync();
57-
tokenImageUri = currency?.image;
43+
@override
44+
void initState() {
45+
super.initState();
46+
47+
if (widget.entity is EthTokenEntity) {
48+
ExchangeDataLoadingService.instance.isar.then((isar) async {
49+
final currency =
50+
await isar.currencies
51+
.where()
52+
.exchangeNameEqualTo(ChangeNowExchange.exchangeName)
53+
.filter()
54+
.tokenContractEqualTo(
55+
(widget.entity as EthTokenEntity).token.address,
56+
caseSensitive: false,
57+
)
58+
.and()
59+
.imageIsNotEmpty()
60+
.findFirst();
61+
62+
if (mounted) {
63+
WidgetsBinding.instance.addPostFrameCallback((_) {
64+
if (mounted) {
65+
setState(() {
66+
tokenImageUri = currency?.image;
67+
});
68+
}
69+
});
70+
}
71+
});
5872
}
73+
}
74+
75+
@override
76+
Widget build(BuildContext context) {
77+
debugPrint("BUILD: CoinSelectItem for ${widget.entity.name}");
78+
final selectedEntity = ref.watch(addWalletSelectedEntityStateProvider);
79+
80+
final isDesktop = Util.isDesktop;
5981

6082
return Container(
6183
decoration: BoxDecoration(
6284
color:
63-
selectedEntity == entity
85+
selectedEntity == widget.entity
6486
? Theme.of(context).extension<StackColors>()!.textFieldActiveBG
6587
: Theme.of(context).extension<StackColors>()!.popupBG,
6688
borderRadius: BorderRadius.circular(
6789
Constants.size.circularBorderRadius,
6890
),
6991
),
7092
child: MaterialButton(
71-
key: Key("coinSelectItemButtonKey_${entity.name}${entity.ticker}"),
93+
key: Key(
94+
"coinSelectItemButtonKey_${widget.entity.name}${widget.entity.ticker}",
95+
),
7296
padding:
7397
isDesktop
7498
? const EdgeInsets.only(left: 24)
@@ -84,24 +108,26 @@ class CoinSelectItem extends ConsumerWidget {
84108
child: Row(
85109
children: [
86110
tokenImageUri != null
87-
? SvgPicture.network(tokenImageUri, width: 26, height: 26)
111+
? SvgPicture.network(tokenImageUri!, width: 26, height: 26)
88112
: SvgPicture.file(
89-
File(ref.watch(coinIconProvider(entity.cryptoCurrency))),
113+
File(
114+
ref.watch(coinIconProvider(widget.entity.cryptoCurrency)),
115+
),
90116
width: 26,
91117
height: 26,
92118
),
93119
SizedBox(width: isDesktop ? 12 : 10),
94120
Text(
95-
"${entity.name} (${entity.ticker})",
121+
"${widget.entity.name} (${widget.entity.ticker})",
96122
style:
97123
isDesktop
98124
? STextStyles.desktopTextMedium(context)
99125
: STextStyles.subtitle600(
100126
context,
101127
).copyWith(fontSize: 14),
102128
),
103-
if (isDesktop && selectedEntity == entity) const Spacer(),
104-
if (isDesktop && selectedEntity == entity)
129+
if (isDesktop && selectedEntity == widget.entity) const Spacer(),
130+
if (isDesktop && selectedEntity == widget.entity)
105131
Padding(
106132
padding: const EdgeInsets.only(right: 18),
107133
child: SizedBox(
@@ -120,7 +146,8 @@ class CoinSelectItem extends ConsumerWidget {
120146
),
121147
),
122148
onPressed: () {
123-
ref.read(addWalletSelectedEntityStateProvider.state).state = entity;
149+
ref.read(addWalletSelectedEntityStateProvider.state).state =
150+
widget.entity;
124151
},
125152
),
126153
);

lib/pages/add_wallet_views/add_wallet_view/sub_widgets/expanding_sub_list_item.dart

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class ExpandingSubListItem extends StatefulWidget {
3030
double? animationDurationMultiplier,
3131
this.curve = Curves.easeInOutCubicEmphasized,
3232
}) : animationDurationMultiplier =
33-
animationDurationMultiplier ?? entities.length * 0.11;
33+
animationDurationMultiplier ?? entities.length * 0.11;
3434

3535
final String title;
3636
final List<AddWalletListEntity> entities;
@@ -85,33 +85,32 @@ class _ExpandingSubListItemState extends State<ExpandingSubListItem> {
8585
header: Container(
8686
color: Colors.transparent,
8787
child: Padding(
88-
padding: const EdgeInsets.only(
89-
top: 8.0,
90-
bottom: 8.0,
91-
right: 10,
92-
),
88+
padding: const EdgeInsets.only(top: 8.0, bottom: 8.0, right: 10),
9389
child: Row(
9490
mainAxisAlignment: MainAxisAlignment.spaceBetween,
9591
children: [
9692
Text(
9793
widget.title,
98-
style: isDesktop
99-
? STextStyles.desktopTextMedium(context).copyWith(
100-
color: Theme.of(context)
101-
.extension<StackColors>()!
102-
.textDark3,
103-
)
104-
: STextStyles.smallMed12(context),
94+
style:
95+
isDesktop
96+
? STextStyles.desktopTextMedium(context).copyWith(
97+
color:
98+
Theme.of(
99+
context,
100+
).extension<StackColors>()!.textDark3,
101+
)
102+
: STextStyles.smallMed12(context),
105103
textAlign: TextAlign.left,
106104
),
107105
RotateIcon(
108106
icon: SvgPicture.asset(
109107
Assets.svg.chevronDown,
110108
width: isDesktop ? 20 : 12,
111109
height: isDesktop ? 10 : 6,
112-
color: Theme.of(context)
113-
.extension<StackColors>()!
114-
.textFieldActiveSearchIconRight,
110+
color:
111+
Theme.of(context)
112+
.extension<StackColors>()!
113+
.textFieldActiveSearchIconRight,
115114
),
116115
curve: widget.curve,
117116
animationDurationMultiplier: widget.animationDurationMultiplier,

0 commit comments

Comments
 (0)