@@ -5,8 +5,8 @@ import 'package:flutter/material.dart';
5
5
import 'package:flutter/services.dart' ;
6
6
import 'package:flutter_riverpod/flutter_riverpod.dart' ;
7
7
import 'package:flutter_svg/flutter_svg.dart' ;
8
+ import 'package:path/path.dart' as path;
8
9
import 'package:path_provider/path_provider.dart' ;
9
- import 'package:permission_handler/permission_handler.dart' ;
10
10
11
11
import '../../models/isar/models/blockchain_data/utxo.dart' ;
12
12
import '../../models/isar/ordinal.dart' ;
@@ -21,6 +21,7 @@ import '../../utilities/amount/amount_formatter.dart';
21
21
import '../../utilities/assets.dart' ;
22
22
import '../../utilities/constants.dart' ;
23
23
import '../../utilities/show_loading.dart' ;
24
+ import '../../utilities/stack_file_system.dart' ;
24
25
import '../../utilities/text_styles.dart' ;
25
26
import '../../wallets/isar/providers/wallet_info_provider.dart' ;
26
27
import '../../widgets/background.dart' ;
@@ -92,9 +93,7 @@ class _OrdinalDetailsViewState extends ConsumerState<OrdinalDetailsView> {
92
93
title: "Inscription number" ,
93
94
data: widget.ordinal.inscriptionNumber.toString (),
94
95
),
95
- const SizedBox (
96
- height: _spacing,
97
- ),
96
+ const SizedBox (height: _spacing),
98
97
_DetailsItemWCopy (
99
98
title: "Inscription ID" ,
100
99
data: widget.ordinal.inscriptionId,
@@ -103,37 +102,32 @@ class _OrdinalDetailsViewState extends ConsumerState<OrdinalDetailsView> {
103
102
// height: _spacing,
104
103
// ),
105
104
// // todo: add utxo status
106
- const SizedBox (
107
- height: _spacing,
108
- ),
105
+ const SizedBox (height: _spacing),
109
106
_DetailsItemWCopy (
110
107
title: "Amount" ,
111
- data: utxo == null
112
- ? "ERROR"
113
- : ref. watch ( pAmountFormatter (coin)). format (
114
- Amount (
115
- rawValue : BigInt . from (utxo ! .value),
116
- fractionDigits : coin.fractionDigits,
117
- ),
118
- ),
119
- ) ,
120
- const SizedBox (
121
- height : _spacing ,
108
+ data:
109
+ utxo == null
110
+ ? "ERROR"
111
+ : ref
112
+ . watch ( pAmountFormatter (coin))
113
+ . format (
114
+ Amount (
115
+ rawValue : BigInt . from (utxo ! .value ),
116
+ fractionDigits : coin.fractionDigits ,
117
+ ),
118
+ ) ,
122
119
),
120
+ const SizedBox (height: _spacing),
123
121
_DetailsItemWCopy (
124
122
title: "Owner address" ,
125
123
data: utxo? .address ?? "ERROR" ,
126
124
),
127
- const SizedBox (
128
- height: _spacing,
129
- ),
125
+ const SizedBox (height: _spacing),
130
126
_DetailsItemWCopy (
131
127
title: "Transaction ID" ,
132
128
data: widget.ordinal.utxoTXID,
133
129
),
134
- const SizedBox (
135
- height: _spacing,
136
- ),
130
+ const SizedBox (height: _spacing),
137
131
],
138
132
),
139
133
),
@@ -145,11 +139,7 @@ class _OrdinalDetailsViewState extends ConsumerState<OrdinalDetailsView> {
145
139
}
146
140
147
141
class _DetailsItemWCopy extends StatelessWidget {
148
- const _DetailsItemWCopy ({
149
- super .key,
150
- required this .title,
151
- required this .data,
152
- });
142
+ const _DetailsItemWCopy ({super .key, required this .title, required this .data});
153
143
154
144
final String title;
155
145
final String data;
@@ -163,10 +153,7 @@ class _DetailsItemWCopy extends StatelessWidget {
163
153
Row (
164
154
mainAxisAlignment: MainAxisAlignment .spaceBetween,
165
155
children: [
166
- Text (
167
- title,
168
- style: STextStyles .itemSubtitle (context),
169
- ),
156
+ Text (title, style: STextStyles .itemSubtitle (context)),
170
157
GestureDetector (
171
158
onTap: () async {
172
159
await Clipboard .setData (ClipboardData (text: data));
@@ -184,34 +171,29 @@ class _DetailsItemWCopy extends StatelessWidget {
184
171
children: [
185
172
SvgPicture .asset (
186
173
Assets .svg.copy,
187
- color: Theme .of (context)
188
- .extension < StackColors > ()!
189
- .infoItemIcons,
174
+ color:
175
+ Theme .of (
176
+ context,
177
+ ).extension < StackColors > ()! .infoItemIcons,
190
178
width: 12 ,
191
179
),
192
- const SizedBox (
193
- width: 6 ,
194
- ),
180
+ const SizedBox (width: 6 ),
195
181
Text (
196
182
"Copy" ,
197
183
style: STextStyles .infoSmall (context).copyWith (
198
- color: Theme .of (context)
199
- .extension < StackColors > ()!
200
- .infoItemIcons,
184
+ color:
185
+ Theme .of (
186
+ context,
187
+ ).extension < StackColors > ()! .infoItemIcons,
201
188
),
202
189
),
203
190
],
204
191
),
205
192
),
206
193
],
207
194
),
208
- const SizedBox (
209
- height: 4 ,
210
- ),
211
- SelectableText (
212
- data,
213
- style: STextStyles .itemSubtitle12 (context),
214
- ),
195
+ const SizedBox (height: 4 ),
196
+ SelectableText (data, style: STextStyles .itemSubtitle12 (context)),
215
197
],
216
198
),
217
199
);
@@ -235,9 +217,10 @@ class _OrdinalImageGroup extends ConsumerWidget {
235
217
236
218
final response = await client.get (
237
219
url: Uri .parse (ordinal.content),
238
- proxyInfo: ref.read (prefsChangeNotifierProvider).useTor
239
- ? ref.read (pTorService).getProxyInfo ()
240
- : null ,
220
+ proxyInfo:
221
+ ref.read (prefsChangeNotifierProvider).useTor
222
+ ? ref.read (pTorService).getProxyInfo ()
223
+ : null ,
241
224
);
242
225
243
226
if (response.code != 200 ) {
@@ -248,16 +231,14 @@ class _OrdinalImageGroup extends ConsumerWidget {
248
231
249
232
final bytes = response.bodyBytes;
250
233
251
- if (Platform .isAndroid) {
252
- await Permission .storage.request ();
253
- }
254
-
255
- final dir = Platform .isAndroid
256
- ? Directory ("/storage/emulated/0/Documents" )
257
- : await getApplicationDocumentsDirectory ();
258
-
259
- final docPath = dir.path;
260
- final filePath = "$docPath /ordinal_${ordinal .inscriptionNumber }.png" ;
234
+ final dir =
235
+ Platform .isAndroid
236
+ ? await StackFileSystem .wtfAndroidDocumentsPath ()
237
+ : await getApplicationDocumentsDirectory ();
238
+ final filePath = path.join (
239
+ dir.path,
240
+ "ordinal_${ordinal .inscriptionNumber }.png" ,
241
+ );
261
242
262
243
final File imgFile = File (filePath);
263
244
@@ -299,9 +280,7 @@ class _OrdinalImageGroup extends ConsumerWidget {
299
280
),
300
281
),
301
282
),
302
- const SizedBox (
303
- height: _spacing,
304
- ),
283
+ const SizedBox (height: _spacing),
305
284
Row (
306
285
children: [
307
286
Expanded (
@@ -311,9 +290,10 @@ class _OrdinalImageGroup extends ConsumerWidget {
311
290
Assets .svg.arrowDown,
312
291
width: 10 ,
313
292
height: 12 ,
314
- color: Theme .of (context)
315
- .extension < StackColors > ()!
316
- .buttonTextSecondary,
293
+ color:
294
+ Theme .of (
295
+ context,
296
+ ).extension < StackColors > ()! .buttonTextSecondary,
317
297
),
318
298
buttonHeight: ButtonHeight .l,
319
299
iconSpacing: 4 ,
0 commit comments