@@ -295,6 +295,9 @@ class _NameCard extends ConsumerWidget {
295295 ? STextStyles .w500_16 (context)
296296 : STextStyles .w500_12 (context));
297297
298+ final _isViewOnlyWallet =
299+ (ref.read (pWallets).getWallet (walletId) as SparkInterface ).isViewOnly;
300+
298301 return RoundedWhiteContainer (
299302 padding: EdgeInsets .all (Util .isDesktop ? 24 : 16 ),
300303 child: IntrinsicHeight (
@@ -318,59 +321,63 @@ class _NameCard extends ConsumerWidget {
318321 children: [
319322 PrimaryButton (
320323 label: "Buy name" ,
321- enabled: isAvailable,
324+ enabled: ! _isViewOnlyWallet && isAvailable,
322325 buttonHeight: Util .isDesktop
323326 ? ButtonHeight .m
324327 : ButtonHeight .l,
325328 width: Util .isDesktop ? 140 : 120 ,
326- onPressed: () async {
327- if (context.mounted) {
328- if (Util .isDesktop) {
329- await showDialog <void >(
330- context: context,
331- builder: (context) => SDialog (
332- child: SizedBox (
333- width: 580 ,
334- child: Column (
335- children: [
336- Row (
337- mainAxisAlignment:
338- MainAxisAlignment .spaceBetween,
339- children: [
340- Padding (
341- padding: const EdgeInsets .only (
342- left: 32 ,
329+ onPressed: _isViewOnlyWallet
330+ ? null
331+ : () async {
332+ if (context.mounted) {
333+ if (Util .isDesktop) {
334+ await showDialog <void >(
335+ context: context,
336+ builder: (context) => SDialog (
337+ child: SizedBox (
338+ width: 580 ,
339+ child: Column (
340+ children: [
341+ Row (
342+ mainAxisAlignment:
343+ MainAxisAlignment .spaceBetween,
344+ children: [
345+ Padding (
346+ padding: const EdgeInsets .only (
347+ left: 32 ,
348+ ),
349+ child: Text (
350+ "Buy name" ,
351+ style: STextStyles .desktopH3 (
352+ context,
353+ ),
354+ ),
355+ ),
356+ const DesktopDialogCloseButton (),
357+ ],
343358 ),
344- child: Text (
345- "Buy name" ,
346- style: STextStyles .desktopH3 (context),
359+ Padding (
360+ padding: const EdgeInsets .symmetric (
361+ horizontal: 32 ,
362+ ),
363+ child: BuySparkNameView (
364+ walletId: walletId,
365+ name: name,
366+ ),
347367 ),
348- ),
349- const DesktopDialogCloseButton (),
350- ],
351- ),
352- Padding (
353- padding: const EdgeInsets .symmetric (
354- horizontal: 32 ,
355- ),
356- child: BuySparkNameView (
357- walletId: walletId,
358- name: name,
368+ ],
359369 ),
360370 ),
361- ],
362- ),
363- ),
364- ),
365- );
366- } else {
367- await Navigator .of (context).pushNamed (
368- BuySparkNameView .routeName,
369- arguments: (walletId: walletId, name: name),
370- );
371- }
372- }
373- },
371+ ),
372+ );
373+ } else {
374+ await Navigator .of (context).pushNamed (
375+ BuySparkNameView .routeName,
376+ arguments: (walletId: walletId, name: name),
377+ );
378+ }
379+ }
380+ },
374381 ),
375382 ],
376383 ),
0 commit comments