Skip to content

Commit a8d9f3b

Browse files
committed
feat: add ordinal send dialogs with desktop variants
1 parent 8a22e31 commit a8d9f3b

1 file changed

Lines changed: 269 additions & 0 deletions

File tree

lib/pages/ordinals/widgets/dialogs.dart

Lines changed: 269 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
import 'package:flutter/material.dart';
2+
import 'package:flutter/services.dart';
23
import 'package:flutter_svg/flutter_svg.dart';
4+
35
import '../../../themes/stack_colors.dart';
46
import '../../../utilities/assets.dart';
7+
import '../../../utilities/text_styles.dart';
8+
import '../../../utilities/util.dart';
9+
import '../../../widgets/desktop/desktop_dialog.dart';
510
import '../../../widgets/desktop/primary_button.dart';
611
import '../../../widgets/desktop/secondary_button.dart';
712
import '../../../widgets/stack_dialog.dart';
@@ -11,6 +16,63 @@ class SendOrdinalUnfreezeDialog extends StatelessWidget {
1116

1217
@override
1318
Widget build(BuildContext context) {
19+
if (Util.isDesktop) {
20+
return DesktopDialog(
21+
maxWidth: 450,
22+
maxHeight: 220,
23+
child: Padding(
24+
padding: const EdgeInsets.all(24),
25+
child: Column(
26+
crossAxisAlignment: CrossAxisAlignment.start,
27+
children: [
28+
Row(
29+
mainAxisAlignment: MainAxisAlignment.spaceBetween,
30+
children: [
31+
Text(
32+
"This ordinal is frozen",
33+
style: STextStyles.desktopH3(context),
34+
),
35+
SvgPicture.asset(
36+
Assets.svg.coinControl.blocked,
37+
width: 24,
38+
height: 24,
39+
color: Theme.of(
40+
context,
41+
).extension<StackColors>()!.textDark,
42+
),
43+
],
44+
),
45+
const SizedBox(height: 12),
46+
Text(
47+
"To send this ordinal, you must unfreeze it first.",
48+
style: STextStyles.desktopTextMedium(context),
49+
),
50+
const Spacer(),
51+
Row(
52+
children: [
53+
Expanded(
54+
child: SecondaryButton(
55+
label: "Cancel",
56+
onPressed: Navigator.of(context).pop,
57+
),
58+
),
59+
const SizedBox(width: 16),
60+
Expanded(
61+
child: PrimaryButton(
62+
label: "Unfreeze",
63+
onPressed: () {
64+
Navigator.of(context).pop("unfreeze");
65+
},
66+
),
67+
),
68+
],
69+
),
70+
],
71+
),
72+
),
73+
);
74+
}
75+
1476
return StackDialog(
1577
title: "This ordinal is frozen",
1678
icon: SvgPicture.asset(
@@ -39,6 +101,58 @@ class UnfreezeOrdinalDialog extends StatelessWidget {
39101

40102
@override
41103
Widget build(BuildContext context) {
104+
if (Util.isDesktop) {
105+
return DesktopDialog(
106+
maxWidth: 450,
107+
maxHeight: 200,
108+
child: Padding(
109+
padding: const EdgeInsets.all(24),
110+
child: Column(
111+
crossAxisAlignment: CrossAxisAlignment.start,
112+
children: [
113+
Row(
114+
mainAxisAlignment: MainAxisAlignment.spaceBetween,
115+
children: [
116+
Text(
117+
"Unfreeze ordinal?",
118+
style: STextStyles.desktopH3(context),
119+
),
120+
SvgPicture.asset(
121+
Assets.svg.coinControl.blocked,
122+
width: 24,
123+
height: 24,
124+
color: Theme.of(
125+
context,
126+
).extension<StackColors>()!.textDark,
127+
),
128+
],
129+
),
130+
const Spacer(),
131+
Row(
132+
children: [
133+
Expanded(
134+
child: SecondaryButton(
135+
label: "Cancel",
136+
onPressed: Navigator.of(context).pop,
137+
),
138+
),
139+
const SizedBox(width: 16),
140+
Expanded(
141+
child: PrimaryButton(
142+
label: "Unfreeze",
143+
onPressed: () {
144+
Navigator.of(context).pop("unfreeze");
145+
},
146+
),
147+
),
148+
],
149+
),
150+
],
151+
),
152+
),
153+
);
154+
}
155+
42156
return StackDialog(
43157
title: "Are you sure you want to unfreeze this ordinal?",
44158
icon: SvgPicture.asset(
@@ -60,3 +174,158 @@ class UnfreezeOrdinalDialog extends StatelessWidget {
60174
);
61175
}
62176
}
177+
178+
class OrdinalRecipientAddressDialog extends StatefulWidget {
179+
const OrdinalRecipientAddressDialog({
180+
super.key,
181+
required this.inscriptionNumber,
182+
});
183+
184+
final int inscriptionNumber;
185+
186+
@override
187+
State<OrdinalRecipientAddressDialog> createState() =>
188+
_OrdinalRecipientAddressDialogState();
189+
}
190+
191+
class _OrdinalRecipientAddressDialogState
192+
extends State<OrdinalRecipientAddressDialog> {
193+
late final TextEditingController _controller;
194+
195+
@override
196+
void initState() {
197+
_controller = TextEditingController();
198+
super.initState();
199+
}
200+
201+
@override
202+
void dispose() {
203+
_controller.dispose();
204+
super.dispose();
205+
}
206+
207+
Widget _buildTextField(BuildContext context) {
208+
return TextField(
209+
controller: _controller,
210+
decoration: InputDecoration(
211+
hintText: "Paste address",
212+
hintStyle: STextStyles.fieldLabel(context),
213+
suffixIcon: IconButton(
214+
icon: SvgPicture.asset(
215+
Assets.svg.clipboard,
216+
width: 20,
217+
height: 20,
218+
color: Theme.of(
219+
context,
220+
).extension<StackColors>()!.textFieldDefaultSearchIconLeft,
221+
),
222+
onPressed: () async {
223+
final data = await Clipboard.getData("text/plain");
224+
if (data?.text != null) {
225+
_controller.text = data!.text!;
226+
setState(() {});
227+
}
228+
},
229+
),
230+
),
231+
style: STextStyles.field(context),
232+
autofocus: true,
233+
);
234+
}
235+
236+
@override
237+
Widget build(BuildContext context) {
238+
if (Util.isDesktop) {
239+
return DesktopDialog(
240+
maxWidth: 500,
241+
maxHeight: 300,
242+
child: Padding(
243+
padding: const EdgeInsets.all(24),
244+
child: Column(
245+
mainAxisSize: MainAxisSize.min,
246+
crossAxisAlignment: CrossAxisAlignment.start,
247+
children: [
248+
Text(
249+
"Send ordinal #${widget.inscriptionNumber}",
250+
style: STextStyles.desktopH3(context),
251+
),
252+
const SizedBox(height: 12),
253+
Text(
254+
"Enter the recipient address",
255+
style: STextStyles.desktopTextMedium(context),
256+
),
257+
const SizedBox(height: 8),
258+
_buildTextField(context),
259+
const SizedBox(height: 16),
260+
Row(
261+
children: [
262+
Expanded(
263+
child: SecondaryButton(
264+
label: "Cancel",
265+
onPressed: Navigator.of(context).pop,
266+
),
267+
),
268+
const SizedBox(width: 16),
269+
Expanded(
270+
child: PrimaryButton(
271+
label: "Continue",
272+
onPressed: () {
273+
final address = _controller.text.trim();
274+
if (address.isNotEmpty) {
275+
Navigator.of(context).pop(address);
276+
}
277+
},
278+
),
279+
),
280+
],
281+
),
282+
],
283+
),
284+
),
285+
);
286+
}
287+
288+
return StackDialogBase(
289+
child: Column(
290+
mainAxisSize: MainAxisSize.min,
291+
crossAxisAlignment: CrossAxisAlignment.start,
292+
children: [
293+
Text(
294+
"Send ordinal #${widget.inscriptionNumber}",
295+
style: STextStyles.pageTitleH2(context),
296+
),
297+
const SizedBox(height: 12),
298+
Text(
299+
"Enter the recipient address",
300+
style: STextStyles.smallMed12(context),
301+
),
302+
const SizedBox(height: 8),
303+
_buildTextField(context),
304+
const SizedBox(height: 16),
305+
Row(
306+
children: [
307+
Expanded(
308+
child: SecondaryButton(
309+
label: "Cancel",
310+
onPressed: Navigator.of(context).pop,
311+
),
312+
),
313+
const SizedBox(width: 16),
314+
Expanded(
315+
child: PrimaryButton(
316+
label: "Continue",
317+
onPressed: () {
318+
final address = _controller.text.trim();
319+
if (address.isNotEmpty) {
320+
Navigator.of(context).pop(address);
321+
}
322+
},
323+
),
324+
),
325+
],
326+
),
327+
],
328+
),
329+
);
330+
}
331+
}

0 commit comments

Comments
 (0)