refactor: center ConnectDevicePage (#2555)

Konstantin Ullrich committed Oct 1, 2025 at 22:26 UTC 5c21b596a213d2632ed1c8d5c3200ef6ea3faf02
1 file changed +98 -98
lib/src/screens/connect_device/connect_device_page.dart
+98 -98
@@ -186,121 +186,121 @@ class ConnectDevicePageBodyState extends State<ConnectDevicePageBody> {
186 }
187
188 @override
189 - Widget build(BuildContext context) {
190 - return Container(
191 - width: ResponsiveLayoutUtilBase.kDesktopMaxWidthConstraint,
192 - padding: EdgeInsets.symmetric(vertical: 24, horizontal: 24),
193 - child: Column(
194 - children: [
195 - Expanded(
196 - child: SingleChildScrollView(
197 - child: Column(
198 - children: [
199 - Padding(
200 - padding: EdgeInsets.only(left: 20, right: 20, bottom: 20),
201 - child: Text(
202 - description,
203 - style: Theme.of(context).textTheme.titleMedium,
204 - textAlign: TextAlign.center,
205 - ),
206 - ),
207 - Offstage(
208 - offstage: !longWait,
209 - child: Padding(
210 - padding: EdgeInsets.only(left: 20, right: 20, bottom: 20),
211 - child: Text(
212 - S.of(context).if_you_dont_see_your_device,
213 - style: Theme.of(context).textTheme.titleMedium,
214 - textAlign: TextAlign.center,
215 - ),
216 - ),
217 - ),
218 - Observer(
219 - builder: (_) => Offstage(
220 - offstage: widget.hardwareWalletVM.isBleEnabled ||
221 - !widget.hardwareWalletVM.hasBluetooth,
222 - child: Padding(
189 + Widget build(BuildContext context) => Center(
190 + child: Container(
191 + width: ResponsiveLayoutUtilBase.kDesktopMaxWidthConstraint,
192 + padding: EdgeInsets.symmetric(vertical: 24, horizontal: 24),
193 + child: Column(
194 + children: [
195 + Expanded(
196 + child: SingleChildScrollView(
197 + child: Column(
198 + children: [
199 + Padding(
200 padding: EdgeInsets.only(left: 20, right: 20, bottom: 20),
201 child: Text(
225 - S.of(context).ledger_please_enable_bluetooth,
202 + description,
203 style: Theme.of(context).textTheme.titleMedium,
204 textAlign: TextAlign.center,
205 ),
206 ),
230 - ),
231 - ),
232 - if (bleDevices.length > 0) ...[
233 - Padding(
234 - padding: EdgeInsets.only(left: 20, right: 20, bottom: 20),
235 - child: Container(
236 - width: double.infinity,
237 - child: Text(
238 - S.of(context).bluetooth,
239 - style: Theme.of(context).textTheme.bodyMedium,
207 + Offstage(
208 + offstage: !longWait,
209 + child: Padding(
210 + padding: EdgeInsets.only(left: 20, right: 20, bottom: 20),
211 + child: Text(
212 + S.of(context).if_you_dont_see_your_device,
213 + style: Theme.of(context).textTheme.titleMedium,
214 + textAlign: TextAlign.center,
215 + ),
216 ),
217 ),
242 - ),
243 - ...bleDevices
244 - .map(
245 - (device) => Padding(
246 - padding: EdgeInsets.only(bottom: 20),
247 - child: DeviceTile(
248 - onPressed: () => _connectToDevice(device),
249 - title: device.name,
250 - leading: _getDeviceTileLeading(device.type),
251 - connectionType: device.connectionType,
218 + Observer(
219 + builder: (_) => Offstage(
220 + offstage: widget.hardwareWalletVM.isBleEnabled ||
221 + !widget.hardwareWalletVM.hasBluetooth,
222 + child: Padding(
223 + padding: EdgeInsets.only(left: 20, right: 20, bottom: 20),
224 + child: Text(
225 + S.of(context).ledger_please_enable_bluetooth,
226 + style: Theme.of(context).textTheme.titleMedium,
227 + textAlign: TextAlign.center,
228 ),
229 ),
254 - )
255 - .toList()
256 - ],
257 - if (usbDevices.length > 0) ...[
258 - Padding(
259 - padding: EdgeInsets.only(left: 20, right: 20, bottom: 20),
260 - child: Container(
261 - width: double.infinity,
262 - child: Text(
263 - S.of(context).usb,
264 - style: Theme.of(context).textTheme.bodyMedium,
230 ),
231 ),
267 - ),
268 - ...usbDevices
269 - .map(
270 - (device) => Padding(
271 - padding: EdgeInsets.only(bottom: 20),
272 - child: DeviceTile(
273 - onPressed: () => _connectToDevice(device),
274 - title: device.name,
275 - leading: _getDeviceTileLeading(device.type),
276 - connectionType: device.connectionType,
232 + if (bleDevices.length > 0) ...[
233 + Padding(
234 + padding: EdgeInsets.only(left: 20, right: 20, bottom: 20),
235 + child: Container(
236 + width: double.infinity,
237 + child: Text(
238 + S.of(context).bluetooth,
239 + style: Theme.of(context).textTheme.bodyMedium,
240 ),
241 ),
242 + ),
243 + ...bleDevices
244 + .map(
245 + (device) => Padding(
246 + padding: EdgeInsets.only(bottom: 20),
247 + child: DeviceTile(
248 + onPressed: () => _connectToDevice(device),
249 + title: device.name,
250 + leading: _getDeviceTileLeading(device.type),
251 + connectionType: device.connectionType,
252 + ),
253 + ),
254 + )
255 + .toList()
256 + ],
257 + if (usbDevices.length > 0) ...[
258 + Padding(
259 + padding: EdgeInsets.only(left: 20, right: 20, bottom: 20),
260 + child: Container(
261 + width: double.infinity,
262 + child: Text(
263 + S.of(context).usb,
264 + style: Theme.of(context).textTheme.bodyMedium,
265 + ),
266 + ),
267 + ),
268 + ...usbDevices
269 + .map(
270 + (device) => Padding(
271 + padding: EdgeInsets.only(bottom: 20),
272 + child: DeviceTile(
273 + onPressed: () => _connectToDevice(device),
274 + title: device.name,
275 + leading: _getDeviceTileLeading(device.type),
276 + connectionType: device.connectionType,
277 + ),
278 + ),
279 + )
280 + .toList(),
281 + ],
282 + if (widget.allowChangeWallet) ...[
283 + PrimaryButton(
284 + text: S.of(context).wallets,
285 + color: Theme.of(context).colorScheme.primary,
286 + textColor: Theme.of(context).colorScheme.onPrimary,
287 + onPressed: _onChangeWallet,
288 )
280 - .toList(),
281 - ],
282 - if (widget.allowChangeWallet) ...[
283 - PrimaryButton(
284 - text: S.of(context).wallets,
285 - color: Theme.of(context).colorScheme.primary,
286 - textColor: Theme.of(context).colorScheme.onPrimary,
287 - onPressed: _onChangeWallet,
288 - )
289 - ],
290 - ],
289 + ],
290 + ],
291 + ),
292 + ),
293 ),
292 - ),
294 + PrimaryButton(
295 + text: S.of(context).how_to_connect,
296 + color: Theme.of(context).colorScheme.surfaceContainer,
297 + textColor: Theme.of(context).colorScheme.onSecondaryContainer,
298 + onPressed: () => _onHowToConnect(context),
299 + )
300 + ],
301 ),
294 - PrimaryButton(
295 - text: S.of(context).how_to_connect,
296 - color: Theme.of(context).colorScheme.surfaceContainer,
297 - textColor: Theme.of(context).colorScheme.onSecondaryContainer,
298 - onPressed: () => _onHowToConnect(context),
299 - )
300 - ],
301 - ),
302 - );
303 - }
302 + ),
303 + );
304
305 void _onChangeWallet() {
306 Navigator.of(context).pushNamed(