feat: Disable Camera Action in Wallet Restore for Desktop (#2263)
David Adegoke committed
May 13, 2025 at 13:00 UTC
ca2c953cf4520072a2dc39771ad3b6abfd0908b9
1 file changed
+20
-20
lib/src/screens/restore/restore_options_page.dart
+20
-20
@@ -64,7 +64,8 @@ class _RestoreOptionsBodyState extends State<_RestoreOptionsBody> {
64
final mainImageColor = Theme.of(context).extension<DashboardPageTheme>()!.pageTitleTextColor;
65
final brightImageColor = Theme.of(context).extension<InfoTheme>()!.textColor;
66
final imageColor = widget.themeType == ThemeType.bright ? brightImageColor : mainImageColor;
67
- final imageLedger = Image.asset('assets/images/hardware_wallet/ledger_nano_x.png', width: 40, color: imageColor);
67
+ final imageLedger = Image.asset('assets/images/hardware_wallet/ledger_nano_x.png',
68
+ width: 40, color: imageColor);
69
final imageSeedKeys = Image.asset('assets/images/restore_wallet_image.png', color: imageColor);
70
final imageBackup = Image.asset('assets/images/backup.png', color: imageColor);
71
@@ -78,9 +79,7 @@ class _RestoreOptionsBodyState extends State<_RestoreOptionsBody> {
79
children: <Widget>[
80
OptionTile(
81
key: ValueKey('restore_options_from_seeds_or_keys_button_key'),
81
- onPressed: () => Navigator.pushNamed(
82
- context,
83
- Routes.restoreWalletFromSeedKeys),
82
+ onPressed: () => Navigator.pushNamed(context, Routes.restoreWalletFromSeedKeys),
83
image: imageSeedKeys,
84
title: S.of(context).restore_title_from_seed_keys,
85
description: S.of(context).restore_description_from_seed_keys,
@@ -101,26 +100,27 @@ class _RestoreOptionsBodyState extends State<_RestoreOptionsBody> {
100
padding: EdgeInsets.only(top: 24),
101
child: OptionTile(
102
key: ValueKey('restore_options_from_hardware_wallet_button_key'),
104
- onPressed: () => Navigator.pushNamed(
105
- context, Routes.restoreWalletFromHardwareWallet),
103
+ onPressed: () =>
104
+ Navigator.pushNamed(context, Routes.restoreWalletFromHardwareWallet),
105
image: imageLedger,
106
title: S.of(context).restore_title_from_hardware_wallet,
107
description: S.of(context).restore_description_from_hardware_wallet,
108
),
109
),
111
- Padding(
112
- padding: EdgeInsets.only(top: 24),
113
- child: OptionTile(
114
- key: ValueKey('restore_options_from_qr_button_key'),
115
- onPressed: () => _onScanQRCode(context),
116
- icon: Icon(
117
- Icons.qr_code_rounded,
118
- color: imageColor,
119
- size: 50,
120
- ),
121
- title: S.of(context).scan_qr_code,
122
- description: S.of(context).cold_or_recover_wallet),
123
- )
110
+ if (DeviceInfo.instance.isMobile)
111
+ Padding(
112
+ padding: EdgeInsets.only(top: 24),
113
+ child: OptionTile(
114
+ key: ValueKey('restore_options_from_qr_button_key'),
115
+ onPressed: () => _onScanQRCode(context),
116
+ icon: Icon(
117
+ Icons.qr_code_rounded,
118
+ color: imageColor,
119
+ size: 50,
120
+ ),
121
+ title: S.of(context).scan_qr_code,
122
+ description: S.of(context).cold_or_recover_wallet),
123
+ )
124
],
125
),
126
)),
@@ -145,7 +145,7 @@ class _RestoreOptionsBodyState extends State<_RestoreOptionsBody> {
145
146
Future<void> _onScanQRCode(BuildContext context) async {
147
final isCameraPermissionGranted =
148
- await PermissionHandler.checkPermission(Permission.camera, context);
148
+ await PermissionHandler.checkPermission(Permission.camera, context);
149
150
if (!isCameraPermissionGranted) return;
151
try {