@@ -48,18 +48,17 @@ class _CoinSelectItemState extends ConsumerState<CoinSelectItem> {
4848
4949 if (widget.entity is EthTokenEntity ) {
5050 ExchangeDataLoadingService .instance.isar.then ((isar) async {
51- final currency =
52- await isar.currencies
53- .where ()
54- .exchangeNameEqualTo (ChangeNowExchange .exchangeName)
55- .filter ()
56- .tokenContractEqualTo (
57- (widget.entity as EthTokenEntity ).token.address,
58- caseSensitive: false ,
59- )
60- .and ()
61- .imageIsNotEmpty ()
62- .findFirst ();
51+ final currency = await isar.currencies
52+ .where ()
53+ .exchangeNameEqualTo (ChangeNowExchange .exchangeName)
54+ .filter ()
55+ .tokenContractEqualTo (
56+ (widget.entity as EthTokenEntity ).token.address,
57+ caseSensitive: false ,
58+ )
59+ .and ()
60+ .imageIsNotEmpty ()
61+ .findFirst ();
6362
6463 if (mounted) {
6564 WidgetsBinding .instance.addPostFrameCallback ((_) {
@@ -75,24 +74,21 @@ class _CoinSelectItemState extends ConsumerState<CoinSelectItem> {
7574 final solToken = (widget.entity as SolTokenEntity ).token;
7675
7776 ExchangeDataLoadingService .instance.isar.then ((isar) async {
78- final currency =
79- await isar.currencies
80- .where ()
81- .exchangeNameEqualTo (ChangeNowExchange .exchangeName)
82- .filter ()
83- .tokenContractEqualTo (
84- solToken.address,
85- caseSensitive: false ,
86- )
87- .and ()
88- .imageIsNotEmpty ()
89- .findFirst ();
77+ final currency = await isar.currencies
78+ .where ()
79+ .exchangeNameEqualTo (ChangeNowExchange .exchangeName)
80+ .filter ()
81+ .tokenContractEqualTo (solToken.address, caseSensitive: false )
82+ .and ()
83+ .imageIsNotEmpty ()
84+ .findFirst ();
9085
9186 if (mounted) {
9287 WidgetsBinding .instance.addPostFrameCallback ((_) {
9388 if (mounted) {
9489 setState (() {
95- // Use exchange cache image if available, otherwise use logoUri if it's a PNG.
90+ // Use exchange cache image if available,
91+ // otherwise use logoUri if it's a PNG.
9692 String ? fallbackUri;
9793 if (solToken.logoUri != null &&
9894 solToken.logoUri! .endsWith ('.png' )) {
@@ -116,22 +112,21 @@ class _CoinSelectItemState extends ConsumerState<CoinSelectItem> {
116112
117113 return Container (
118114 decoration: BoxDecoration (
119- color:
120- selectedEntity == widget.entity
121- ? Theme .of (context).extension < StackColors > ()! .textFieldActiveBG
122- : Theme .of (context).extension < StackColors > ()! .popupBG,
115+ color: selectedEntity == widget.entity
116+ ? Theme .of (context).extension < StackColors > ()! .textFieldActiveBG
117+ : Theme .of (context).extension < StackColors > ()! .popupBG,
123118 borderRadius: BorderRadius .circular (
124119 Constants .size.circularBorderRadius,
125120 ),
126121 ),
127122 child: MaterialButton (
128123 key: Key (
129- "coinSelectItemButtonKey_${widget .entity .name }${widget .entity .ticker }" ,
124+ "coinSelectItemButtonKey_"
125+ "${widget .entity .name }${widget .entity .ticker }" ,
130126 ),
131- padding:
132- isDesktop
133- ? const EdgeInsets .only (left: 24 )
134- : const EdgeInsets .all (12 ),
127+ padding: isDesktop
128+ ? const EdgeInsets .only (left: 24 )
129+ : const EdgeInsets .all (12 ),
135130 materialTapTargetSize: MaterialTapTargetSize .shrinkWrap,
136131 shape: RoundedRectangleBorder (
137132 borderRadius: BorderRadius .circular (
@@ -143,28 +138,45 @@ class _CoinSelectItemState extends ConsumerState<CoinSelectItem> {
143138 child: Row (
144139 children: [
145140 tokenImageUri != null
146- ? SvgPicture .network (
147- tokenImageUri! ,
148- width: 26 ,
149- height: 26 ,
150- placeholderBuilder: (_) => AppIcon (width: 26 , height: 26 ),
151- )
141+ ? tokenImageUri! .toLowerCase ().endsWith (".svg" )
142+ ? SvgPicture .network (
143+ tokenImageUri! ,
144+ width: 26 ,
145+ height: 26 ,
146+ placeholderBuilder: (_) =>
147+ const AppIcon (width: 26 , height: 26 ),
148+ )
149+ : Image .network (
150+ tokenImageUri! ,
151+ width: 26 ,
152+ height: 26 ,
153+ errorBuilder: (_, _, _) => SvgPicture .file (
154+ File (
155+ ref.watch (
156+ coinIconProvider (
157+ widget.entity.cryptoCurrency,
158+ ),
159+ ),
160+ ),
161+ width: 26 ,
162+ height: 26 ,
163+ ),
164+ )
152165 : SvgPicture .file (
153- File (
154- ref.watch (coinIconProvider (widget.entity.cryptoCurrency)),
166+ File (
167+ ref.watch (
168+ coinIconProvider (widget.entity.cryptoCurrency),
169+ ),
170+ ),
171+ width: 26 ,
172+ height: 26 ,
155173 ),
156- width: 26 ,
157- height: 26 ,
158- ),
159174 SizedBox (width: isDesktop ? 12 : 10 ),
160175 Text (
161176 "${widget .entity .name } (${widget .entity .ticker })" ,
162- style:
163- isDesktop
164- ? STextStyles .desktopTextMedium (context)
165- : STextStyles .subtitle600 (
166- context,
167- ).copyWith (fontSize: 14 ),
177+ style: isDesktop
178+ ? STextStyles .desktopTextMedium (context)
179+ : STextStyles .subtitle600 (context).copyWith (fontSize: 14 ),
168180 ),
169181 if (isDesktop && selectedEntity == widget.entity) const Spacer (),
170182 if (isDesktop && selectedEntity == widget.entity)
@@ -175,10 +187,9 @@ class _CoinSelectItemState extends ConsumerState<CoinSelectItem> {
175187 height: 24 ,
176188 child: SvgPicture .asset (
177189 Assets .svg.check,
178- color:
179- Theme .of (
180- context,
181- ).extension < StackColors > ()! .accentColorDark,
190+ color: Theme .of (
191+ context,
192+ ).extension < StackColors > ()! .accentColorDark,
182193 ),
183194 ),
184195 ),
0 commit comments