2024-05-04 20:44:50 -05:00
|
|
|
import 'dart:async';
|
|
|
|
import 'dart:io';
|
|
|
|
|
|
|
|
import 'package:cake_wallet/generated/i18n.dart';
|
2024-11-12 04:26:09 +01:00
|
|
|
import 'package:cake_wallet/routes.dart';
|
2024-05-04 20:44:50 -05:00
|
|
|
import 'package:cake_wallet/src/screens/base_page.dart';
|
|
|
|
import 'package:cake_wallet/src/screens/connect_device/widgets/device_tile.dart';
|
2024-11-12 04:26:09 +01:00
|
|
|
import 'package:cake_wallet/src/widgets/primary_button.dart';
|
2024-05-04 20:44:50 -05:00
|
|
|
import 'package:cake_wallet/utils/responsive_layout_util.dart';
|
|
|
|
import 'package:cake_wallet/view_model/hardware_wallet/ledger_view_model.dart';
|
2024-12-09 12:23:59 -06:00
|
|
|
import 'package:cw_core/utils/print_verbose.dart';
|
2024-05-04 20:44:50 -05:00
|
|
|
import 'package:cw_core/wallet_type.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
2024-10-23 17:38:31 +02:00
|
|
|
import 'package:flutter_mobx/flutter_mobx.dart';
|
|
|
|
import 'package:ledger_flutter_plus/ledger_flutter_plus.dart';
|
2024-05-04 20:44:50 -05:00
|
|
|
|
|
|
|
typedef OnConnectDevice = void Function(BuildContext, LedgerViewModel);
|
|
|
|
|
|
|
|
class ConnectDevicePageParams {
|
|
|
|
final WalletType walletType;
|
|
|
|
final OnConnectDevice onConnectDevice;
|
2024-11-12 04:26:09 +01:00
|
|
|
final bool allowChangeWallet;
|
2024-12-14 00:32:36 +01:00
|
|
|
final bool isReconnect;
|
2024-05-04 20:44:50 -05:00
|
|
|
|
2024-11-12 04:26:09 +01:00
|
|
|
ConnectDevicePageParams({
|
|
|
|
required this.walletType,
|
|
|
|
required this.onConnectDevice,
|
|
|
|
this.allowChangeWallet = false,
|
2025-04-03 00:20:13 +02:00
|
|
|
this.isReconnect = true,
|
2024-11-12 04:26:09 +01:00
|
|
|
});
|
2024-05-04 20:44:50 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
class ConnectDevicePage extends BasePage {
|
|
|
|
final WalletType walletType;
|
|
|
|
final OnConnectDevice onConnectDevice;
|
2024-11-12 04:26:09 +01:00
|
|
|
final bool allowChangeWallet;
|
2024-12-14 00:32:36 +01:00
|
|
|
final bool isReconnect;
|
2024-05-04 20:44:50 -05:00
|
|
|
final LedgerViewModel ledgerVM;
|
|
|
|
|
|
|
|
ConnectDevicePage(ConnectDevicePageParams params, this.ledgerVM)
|
|
|
|
: walletType = params.walletType,
|
2024-11-12 04:26:09 +01:00
|
|
|
onConnectDevice = params.onConnectDevice,
|
2024-12-14 00:32:36 +01:00
|
|
|
allowChangeWallet = params.allowChangeWallet,
|
|
|
|
isReconnect = params.isReconnect;
|
2024-05-04 20:44:50 -05:00
|
|
|
|
|
|
|
@override
|
2024-12-14 00:32:36 +01:00
|
|
|
String get title => isReconnect
|
|
|
|
? S.current.reconnect_your_hardware_wallet
|
|
|
|
: S.current.restore_title_from_hardware_wallet;
|
2024-05-04 20:44:50 -05:00
|
|
|
|
|
|
|
@override
|
2024-12-14 00:32:36 +01:00
|
|
|
Widget? leading(BuildContext context) =>
|
|
|
|
!isReconnect ? super.leading(context) : null;
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget body(BuildContext context) => PopScope(
|
|
|
|
canPop: !isReconnect,
|
|
|
|
child: ConnectDevicePageBody(
|
|
|
|
walletType,
|
|
|
|
onConnectDevice,
|
|
|
|
allowChangeWallet,
|
|
|
|
ledgerVM,
|
|
|
|
));
|
2024-05-04 20:44:50 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
class ConnectDevicePageBody extends StatefulWidget {
|
|
|
|
final WalletType walletType;
|
|
|
|
final OnConnectDevice onConnectDevice;
|
2024-11-12 04:26:09 +01:00
|
|
|
final bool allowChangeWallet;
|
2024-05-04 20:44:50 -05:00
|
|
|
final LedgerViewModel ledgerVM;
|
|
|
|
|
2024-10-23 17:38:31 +02:00
|
|
|
const ConnectDevicePageBody(
|
2024-11-12 04:26:09 +01:00
|
|
|
this.walletType,
|
|
|
|
this.onConnectDevice,
|
|
|
|
this.allowChangeWallet,
|
|
|
|
this.ledgerVM,
|
|
|
|
);
|
2024-05-04 20:44:50 -05:00
|
|
|
|
|
|
|
@override
|
|
|
|
ConnectDevicePageBodyState createState() => ConnectDevicePageBodyState();
|
|
|
|
}
|
|
|
|
|
|
|
|
class ConnectDevicePageBodyState extends State<ConnectDevicePageBody> {
|
|
|
|
var bleDevices = <LedgerDevice>[];
|
|
|
|
var usbDevices = <LedgerDevice>[];
|
|
|
|
|
|
|
|
late Timer? _usbRefreshTimer = null;
|
|
|
|
late Timer? _bleRefreshTimer = null;
|
2024-10-23 17:38:31 +02:00
|
|
|
late Timer? _bleStateTimer = null;
|
2024-05-04 20:44:50 -05:00
|
|
|
late StreamSubscription<LedgerDevice>? _bleRefresh = null;
|
|
|
|
|
2024-12-14 00:32:36 +01:00
|
|
|
bool longWait = false;
|
2024-12-17 19:57:57 +01:00
|
|
|
Timer? _longWaitTimer;
|
2024-12-14 00:32:36 +01:00
|
|
|
|
2024-05-04 20:44:50 -05:00
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
super.initState();
|
2024-05-17 08:15:19 -05:00
|
|
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
2024-10-23 17:38:31 +02:00
|
|
|
_bleStateTimer = Timer.periodic(
|
|
|
|
Duration(seconds: 1), (_) => widget.ledgerVM.updateBleState());
|
|
|
|
|
|
|
|
_bleRefreshTimer =
|
|
|
|
Timer.periodic(Duration(seconds: 1), (_) => _refreshBleDevices());
|
2024-05-17 08:15:19 -05:00
|
|
|
|
|
|
|
if (Platform.isAndroid) {
|
2024-10-23 17:38:31 +02:00
|
|
|
_usbRefreshTimer =
|
|
|
|
Timer.periodic(Duration(seconds: 1), (_) => _refreshUsbDevices());
|
2024-05-17 08:15:19 -05:00
|
|
|
}
|
2024-12-14 00:32:36 +01:00
|
|
|
|
2024-12-17 19:57:57 +01:00
|
|
|
_longWaitTimer = Timer(Duration(seconds: 10), () {
|
2024-12-14 00:32:36 +01:00
|
|
|
if (widget.ledgerVM.bleIsEnabled && bleDevices.isEmpty)
|
|
|
|
setState(() => longWait = true);
|
|
|
|
});
|
2024-05-17 08:15:19 -05:00
|
|
|
});
|
2024-05-04 20:44:50 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
void dispose() {
|
|
|
|
_bleRefreshTimer?.cancel();
|
2024-10-23 17:38:31 +02:00
|
|
|
_bleStateTimer?.cancel();
|
2024-05-04 20:44:50 -05:00
|
|
|
_usbRefreshTimer?.cancel();
|
|
|
|
_bleRefresh?.cancel();
|
2024-12-17 19:57:57 +01:00
|
|
|
_longWaitTimer?.cancel();
|
2024-12-14 00:32:36 +01:00
|
|
|
|
|
|
|
widget.ledgerVM.stopScanning();
|
2024-05-04 20:44:50 -05:00
|
|
|
super.dispose();
|
|
|
|
}
|
|
|
|
|
|
|
|
Future<void> _refreshUsbDevices() async {
|
2024-10-23 17:38:31 +02:00
|
|
|
final dev = await widget.ledgerVM.ledgerPlusUSB.devices;
|
2024-05-04 20:44:50 -05:00
|
|
|
if (usbDevices.length != dev.length) setState(() => usbDevices = dev);
|
2024-10-23 17:38:31 +02:00
|
|
|
// _usbRefresh = widget.ledgerVM
|
|
|
|
// .scanForUsbDevices()
|
|
|
|
// .listen((device) => setState(() => usbDevices.add(device)))
|
|
|
|
// ..onError((e) {
|
|
|
|
// throw e.toString();
|
|
|
|
// });
|
|
|
|
// Keep polling until the lfp lib gets updated
|
|
|
|
// _usbRefreshTimer?.cancel();
|
|
|
|
// _usbRefreshTimer = null;
|
2024-05-04 20:44:50 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
Future<void> _refreshBleDevices() async {
|
2024-05-17 08:15:19 -05:00
|
|
|
try {
|
2024-11-12 04:26:09 +01:00
|
|
|
if (widget.ledgerVM.bleIsEnabled) {
|
2024-12-14 00:32:36 +01:00
|
|
|
_bleRefresh =
|
|
|
|
widget.ledgerVM.scanForBleDevices().listen((device) => setState(() {
|
|
|
|
bleDevices.add(device);
|
|
|
|
if (longWait) longWait = false;
|
|
|
|
}))
|
|
|
|
..onError((e) {
|
|
|
|
throw e.toString();
|
|
|
|
});
|
2024-11-12 04:26:09 +01:00
|
|
|
_bleRefreshTimer?.cancel();
|
|
|
|
_bleRefreshTimer = null;
|
|
|
|
}
|
2024-05-17 08:15:19 -05:00
|
|
|
} catch (e) {
|
2024-12-09 12:23:59 -06:00
|
|
|
printV(e);
|
2024-05-04 20:44:50 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Future<void> _connectToDevice(LedgerDevice device) async {
|
2024-10-23 17:38:31 +02:00
|
|
|
await widget.ledgerVM.connectLedger(device, widget.walletType);
|
2024-05-04 20:44:50 -05:00
|
|
|
widget.onConnectDevice(context, widget.ledgerVM);
|
|
|
|
}
|
|
|
|
|
2024-10-23 17:38:31 +02:00
|
|
|
String _getDeviceTileLeading(LedgerDeviceType deviceInfo) {
|
|
|
|
switch (deviceInfo) {
|
|
|
|
case LedgerDeviceType.nanoX:
|
|
|
|
return 'assets/images/hardware_wallet/ledger_nano_x.png';
|
|
|
|
case LedgerDeviceType.stax:
|
|
|
|
return 'assets/images/hardware_wallet/ledger_stax.png';
|
|
|
|
case LedgerDeviceType.flex:
|
|
|
|
return 'assets/images/hardware_wallet/ledger_flex.png';
|
|
|
|
default:
|
|
|
|
return 'assets/images/hardware_wallet/ledger_nano_x.png';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-05-04 20:44:50 -05:00
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Center(
|
|
|
|
child: Container(
|
|
|
|
width: ResponsiveLayoutUtilBase.kDesktopMaxWidthConstraint,
|
|
|
|
height: double.infinity,
|
|
|
|
padding: EdgeInsets.symmetric(vertical: 24, horizontal: 24),
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.only(left: 20, right: 20, bottom: 20),
|
|
|
|
child: Text(
|
|
|
|
Platform.isIOS
|
|
|
|
? S.of(context).connect_your_hardware_wallet_ios
|
|
|
|
: S.of(context).connect_your_hardware_wallet,
|
New themes (#2239)
* Add theme base v2
* Initial new theme base files
* Typos
* Fixes
* Update theme files
* feat: Migrate to Material 3 Theming
Foundation, Theme Data Refactor, and First Extension Cleanup Batch.
This commit completes the first major phase of migrating to Material 3 theming by setting up the foundations for material 3 integration and begins the initial migration, removing custom theme extensions, updating theme data, and refactoring all relevant widget and page theming to use Material 3’s built-in color and typography tokens.
These changes:
- Lays the groundwork for Material 3 theming by restructuring the app’s theme configuration to use Material 3’s ColorScheme and TextTheme as the primary sources of color and typography throughout the app.
- Refactors the core theme config files by removing legacy custom color roles ensuring all color definitions now map directly to Material 3’s role.
- Begins the first batch migration of custom theme extensions (InfoTheme, PlaceholderTheme, KeyboardTheme, PinCodeTheme) and updates all affected widgets and pages to use Material 3 color and typography tokens instead of the custom properties.
- Cleans up the codebase by deleting the files of the initial set of migrated extensions and eliminating all related imports and usages.
* feat: Migrate to Material 3 Theming.
This change:
- Updates the themes README.md file to reflect the current structure and give more information based on the first major phase that was completed.
* feat: Migrate to Material 3 Theming
Deleting previous theme extensions
* feat: Migrate to Material 3 Theming
Another batch of migrations from existing extensions
* feat: Migration to Material 3 Theming
Third Migration batch for theme extensions
* fwat: Migration to Material 3 Theming
Final Migration batch for previous theme extensions
* Update onboarding hero
* Update button radius
* Add surfaceContainer to light theme
* feat(themes): Migrate to Material 3 Theming
This change:
- Adds new set of hero images
- Modifies the core structure for the themes
- Add missing color tokens to the theme classes
- Adds a CustomThemeColor class for custom color tokens
- Modifies the themelist to have a fall back for previous theme implementation
- Adds localization for some texts
- Modifies the flow for loading the theme on app start
- Add a WidgetsBindingObserver that listens for changes in the device theme and updates the app theme when there is a change
- Registers the themeStore as a Singleton for codebase wide use
* feat(themes): Migrate to Material 3 theming
This change:
- Migrates UI flows across the app to the new themes
- Confirms styling and typography of components across the app uses the new themes
- Remove instances of Palette use
- Switch TextStyles across the app to use theme text styles
* feat(themes): Migrate to Material 3 Theming.
This change:
- Adjusts bottomsheets styling and removes duplicate close button
- Removes more themedata extensions from the previous implementation
* - Remove outlines from cards and dock
- Update menu colors
- Update padding/divider size for cards
* - Update PIN screen
- Fix navigation dock shadow
- Update wallet screen colors
* Update border radius --skip-ci
* feat(themes): Migrate to Material 3 Theming.
This change:
- Adds gradient backgrounds to the dashbaord and balance cards.
- Migrates the input fields across the app to BaseTextFormFields.
- Removes dependence of input fields on individual styling, focusing instead on using theme defined InputDecoration styling with adjustments on individual components where needed.
- Applies new theme styling to BaseTextFormField, AddressTextField and CurrencyAmountTextField.
* - Switch some hero images to PNG
- Fix nagivation_dock shadow
- Minor fixes
* feat: Add fallback to previous underline styling in central widgets
This change:
- Adds a fallback to CurrencyAmountTextField, AddressTextField, and BaseTextFormField, allowing them use the previous theme styling.
- Adds localization for new texts
* feat(themes): Update warning box colors for dark and light themes
* feat(themes): Relaod themes when user restores from backup, ensuring the user previous theme preference is used.
* feat(themes): Handle themes logic during restore from backup
This change:
- Refactors theme loading logic to handle backup restore edgecase
- Refreshes the theme based on the user saved preference during restore from backup flow
* Fix card gradients and spacing
* Fix even more radiuses
Test new icons for navigation_dock.dart
* Update onboarding flow backgrounds
Fix swap icon clipping
Fix some text colors
Add more hero images
* Fix incorrect color for light theme
* Fix more hero images and cleanup
* Update text field icons
Fix info box CTA colors
Fix sync indicator colors
* Update toggle colors
Update dark theme colors (minor)
Update crypto_balance_widget.dart icon
* Update page transitions in router.dart
Fix some colors
* feat(themes): Display label by default for filled textfields
* feat(themes): Refactor theme handling across various components
This change:
- Fixes issue with themeMode resetting to system mode when app is restarted causing a UI glitch
- Updates theme checks from `currentTheme.type == ThemeType.dark` to `currentTheme.isDark` for consistency
- Adjusts UI components to use the theme directly from the themeStore
* feat(themes): Add animating tagline to the create pin welcome screen
* Revert text fields label temporarily, fix a couple colors, and cleanup some images
---------
Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>
Co-authored-by: Blazebrain <davidadegoke16@gmail.com>
2025-05-25 20:11:45 +00:00
|
|
|
style: Theme.of(context).textTheme.titleMedium,
|
2024-05-04 20:44:50 -05:00
|
|
|
textAlign: TextAlign.center,
|
|
|
|
),
|
|
|
|
),
|
2024-12-14 00:32:36 +01:00
|
|
|
Offstage(
|
|
|
|
offstage: !longWait,
|
|
|
|
child: Padding(
|
|
|
|
padding: EdgeInsets.only(left: 20, right: 20, bottom: 20),
|
2024-12-17 19:57:57 +01:00
|
|
|
child: Text(
|
|
|
|
S.of(context).if_you_dont_see_your_device,
|
New themes (#2239)
* Add theme base v2
* Initial new theme base files
* Typos
* Fixes
* Update theme files
* feat: Migrate to Material 3 Theming
Foundation, Theme Data Refactor, and First Extension Cleanup Batch.
This commit completes the first major phase of migrating to Material 3 theming by setting up the foundations for material 3 integration and begins the initial migration, removing custom theme extensions, updating theme data, and refactoring all relevant widget and page theming to use Material 3’s built-in color and typography tokens.
These changes:
- Lays the groundwork for Material 3 theming by restructuring the app’s theme configuration to use Material 3’s ColorScheme and TextTheme as the primary sources of color and typography throughout the app.
- Refactors the core theme config files by removing legacy custom color roles ensuring all color definitions now map directly to Material 3’s role.
- Begins the first batch migration of custom theme extensions (InfoTheme, PlaceholderTheme, KeyboardTheme, PinCodeTheme) and updates all affected widgets and pages to use Material 3 color and typography tokens instead of the custom properties.
- Cleans up the codebase by deleting the files of the initial set of migrated extensions and eliminating all related imports and usages.
* feat: Migrate to Material 3 Theming.
This change:
- Updates the themes README.md file to reflect the current structure and give more information based on the first major phase that was completed.
* feat: Migrate to Material 3 Theming
Deleting previous theme extensions
* feat: Migrate to Material 3 Theming
Another batch of migrations from existing extensions
* feat: Migration to Material 3 Theming
Third Migration batch for theme extensions
* fwat: Migration to Material 3 Theming
Final Migration batch for previous theme extensions
* Update onboarding hero
* Update button radius
* Add surfaceContainer to light theme
* feat(themes): Migrate to Material 3 Theming
This change:
- Adds new set of hero images
- Modifies the core structure for the themes
- Add missing color tokens to the theme classes
- Adds a CustomThemeColor class for custom color tokens
- Modifies the themelist to have a fall back for previous theme implementation
- Adds localization for some texts
- Modifies the flow for loading the theme on app start
- Add a WidgetsBindingObserver that listens for changes in the device theme and updates the app theme when there is a change
- Registers the themeStore as a Singleton for codebase wide use
* feat(themes): Migrate to Material 3 theming
This change:
- Migrates UI flows across the app to the new themes
- Confirms styling and typography of components across the app uses the new themes
- Remove instances of Palette use
- Switch TextStyles across the app to use theme text styles
* feat(themes): Migrate to Material 3 Theming.
This change:
- Adjusts bottomsheets styling and removes duplicate close button
- Removes more themedata extensions from the previous implementation
* - Remove outlines from cards and dock
- Update menu colors
- Update padding/divider size for cards
* - Update PIN screen
- Fix navigation dock shadow
- Update wallet screen colors
* Update border radius --skip-ci
* feat(themes): Migrate to Material 3 Theming.
This change:
- Adds gradient backgrounds to the dashbaord and balance cards.
- Migrates the input fields across the app to BaseTextFormFields.
- Removes dependence of input fields on individual styling, focusing instead on using theme defined InputDecoration styling with adjustments on individual components where needed.
- Applies new theme styling to BaseTextFormField, AddressTextField and CurrencyAmountTextField.
* - Switch some hero images to PNG
- Fix nagivation_dock shadow
- Minor fixes
* feat: Add fallback to previous underline styling in central widgets
This change:
- Adds a fallback to CurrencyAmountTextField, AddressTextField, and BaseTextFormField, allowing them use the previous theme styling.
- Adds localization for new texts
* feat(themes): Update warning box colors for dark and light themes
* feat(themes): Relaod themes when user restores from backup, ensuring the user previous theme preference is used.
* feat(themes): Handle themes logic during restore from backup
This change:
- Refactors theme loading logic to handle backup restore edgecase
- Refreshes the theme based on the user saved preference during restore from backup flow
* Fix card gradients and spacing
* Fix even more radiuses
Test new icons for navigation_dock.dart
* Update onboarding flow backgrounds
Fix swap icon clipping
Fix some text colors
Add more hero images
* Fix incorrect color for light theme
* Fix more hero images and cleanup
* Update text field icons
Fix info box CTA colors
Fix sync indicator colors
* Update toggle colors
Update dark theme colors (minor)
Update crypto_balance_widget.dart icon
* Update page transitions in router.dart
Fix some colors
* feat(themes): Display label by default for filled textfields
* feat(themes): Refactor theme handling across various components
This change:
- Fixes issue with themeMode resetting to system mode when app is restarted causing a UI glitch
- Updates theme checks from `currentTheme.type == ThemeType.dark` to `currentTheme.isDark` for consistency
- Adjusts UI components to use the theme directly from the themeStore
* feat(themes): Add animating tagline to the create pin welcome screen
* Revert text fields label temporarily, fix a couple colors, and cleanup some images
---------
Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>
Co-authored-by: Blazebrain <davidadegoke16@gmail.com>
2025-05-25 20:11:45 +00:00
|
|
|
style: Theme.of(context).textTheme.titleMedium,
|
2024-12-14 00:32:36 +01:00
|
|
|
textAlign: TextAlign.center,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
2024-10-23 17:38:31 +02:00
|
|
|
Observer(
|
|
|
|
builder: (_) => Offstage(
|
|
|
|
offstage: widget.ledgerVM.bleIsEnabled,
|
|
|
|
child: Padding(
|
|
|
|
padding: EdgeInsets.only(left: 20, right: 20, bottom: 20),
|
|
|
|
child: Text(
|
|
|
|
S.of(context).ledger_please_enable_bluetooth,
|
New themes (#2239)
* Add theme base v2
* Initial new theme base files
* Typos
* Fixes
* Update theme files
* feat: Migrate to Material 3 Theming
Foundation, Theme Data Refactor, and First Extension Cleanup Batch.
This commit completes the first major phase of migrating to Material 3 theming by setting up the foundations for material 3 integration and begins the initial migration, removing custom theme extensions, updating theme data, and refactoring all relevant widget and page theming to use Material 3’s built-in color and typography tokens.
These changes:
- Lays the groundwork for Material 3 theming by restructuring the app’s theme configuration to use Material 3’s ColorScheme and TextTheme as the primary sources of color and typography throughout the app.
- Refactors the core theme config files by removing legacy custom color roles ensuring all color definitions now map directly to Material 3’s role.
- Begins the first batch migration of custom theme extensions (InfoTheme, PlaceholderTheme, KeyboardTheme, PinCodeTheme) and updates all affected widgets and pages to use Material 3 color and typography tokens instead of the custom properties.
- Cleans up the codebase by deleting the files of the initial set of migrated extensions and eliminating all related imports and usages.
* feat: Migrate to Material 3 Theming.
This change:
- Updates the themes README.md file to reflect the current structure and give more information based on the first major phase that was completed.
* feat: Migrate to Material 3 Theming
Deleting previous theme extensions
* feat: Migrate to Material 3 Theming
Another batch of migrations from existing extensions
* feat: Migration to Material 3 Theming
Third Migration batch for theme extensions
* fwat: Migration to Material 3 Theming
Final Migration batch for previous theme extensions
* Update onboarding hero
* Update button radius
* Add surfaceContainer to light theme
* feat(themes): Migrate to Material 3 Theming
This change:
- Adds new set of hero images
- Modifies the core structure for the themes
- Add missing color tokens to the theme classes
- Adds a CustomThemeColor class for custom color tokens
- Modifies the themelist to have a fall back for previous theme implementation
- Adds localization for some texts
- Modifies the flow for loading the theme on app start
- Add a WidgetsBindingObserver that listens for changes in the device theme and updates the app theme when there is a change
- Registers the themeStore as a Singleton for codebase wide use
* feat(themes): Migrate to Material 3 theming
This change:
- Migrates UI flows across the app to the new themes
- Confirms styling and typography of components across the app uses the new themes
- Remove instances of Palette use
- Switch TextStyles across the app to use theme text styles
* feat(themes): Migrate to Material 3 Theming.
This change:
- Adjusts bottomsheets styling and removes duplicate close button
- Removes more themedata extensions from the previous implementation
* - Remove outlines from cards and dock
- Update menu colors
- Update padding/divider size for cards
* - Update PIN screen
- Fix navigation dock shadow
- Update wallet screen colors
* Update border radius --skip-ci
* feat(themes): Migrate to Material 3 Theming.
This change:
- Adds gradient backgrounds to the dashbaord and balance cards.
- Migrates the input fields across the app to BaseTextFormFields.
- Removes dependence of input fields on individual styling, focusing instead on using theme defined InputDecoration styling with adjustments on individual components where needed.
- Applies new theme styling to BaseTextFormField, AddressTextField and CurrencyAmountTextField.
* - Switch some hero images to PNG
- Fix nagivation_dock shadow
- Minor fixes
* feat: Add fallback to previous underline styling in central widgets
This change:
- Adds a fallback to CurrencyAmountTextField, AddressTextField, and BaseTextFormField, allowing them use the previous theme styling.
- Adds localization for new texts
* feat(themes): Update warning box colors for dark and light themes
* feat(themes): Relaod themes when user restores from backup, ensuring the user previous theme preference is used.
* feat(themes): Handle themes logic during restore from backup
This change:
- Refactors theme loading logic to handle backup restore edgecase
- Refreshes the theme based on the user saved preference during restore from backup flow
* Fix card gradients and spacing
* Fix even more radiuses
Test new icons for navigation_dock.dart
* Update onboarding flow backgrounds
Fix swap icon clipping
Fix some text colors
Add more hero images
* Fix incorrect color for light theme
* Fix more hero images and cleanup
* Update text field icons
Fix info box CTA colors
Fix sync indicator colors
* Update toggle colors
Update dark theme colors (minor)
Update crypto_balance_widget.dart icon
* Update page transitions in router.dart
Fix some colors
* feat(themes): Display label by default for filled textfields
* feat(themes): Refactor theme handling across various components
This change:
- Fixes issue with themeMode resetting to system mode when app is restarted causing a UI glitch
- Updates theme checks from `currentTheme.type == ThemeType.dark` to `currentTheme.isDark` for consistency
- Adjusts UI components to use the theme directly from the themeStore
* feat(themes): Add animating tagline to the create pin welcome screen
* Revert text fields label temporarily, fix a couple colors, and cleanup some images
---------
Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>
Co-authored-by: Blazebrain <davidadegoke16@gmail.com>
2025-05-25 20:11:45 +00:00
|
|
|
style: Theme.of(context).textTheme.titleMedium,
|
2024-10-23 17:38:31 +02:00
|
|
|
textAlign: TextAlign.center,
|
|
|
|
),
|
2024-05-04 20:44:50 -05:00
|
|
|
),
|
|
|
|
),
|
2024-10-23 17:38:31 +02:00
|
|
|
),
|
2024-05-04 20:44:50 -05:00
|
|
|
if (bleDevices.length > 0) ...[
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.only(left: 20, right: 20, bottom: 20),
|
|
|
|
child: Container(
|
|
|
|
width: double.infinity,
|
|
|
|
child: Text(
|
|
|
|
S.of(context).bluetooth,
|
New themes (#2239)
* Add theme base v2
* Initial new theme base files
* Typos
* Fixes
* Update theme files
* feat: Migrate to Material 3 Theming
Foundation, Theme Data Refactor, and First Extension Cleanup Batch.
This commit completes the first major phase of migrating to Material 3 theming by setting up the foundations for material 3 integration and begins the initial migration, removing custom theme extensions, updating theme data, and refactoring all relevant widget and page theming to use Material 3’s built-in color and typography tokens.
These changes:
- Lays the groundwork for Material 3 theming by restructuring the app’s theme configuration to use Material 3’s ColorScheme and TextTheme as the primary sources of color and typography throughout the app.
- Refactors the core theme config files by removing legacy custom color roles ensuring all color definitions now map directly to Material 3’s role.
- Begins the first batch migration of custom theme extensions (InfoTheme, PlaceholderTheme, KeyboardTheme, PinCodeTheme) and updates all affected widgets and pages to use Material 3 color and typography tokens instead of the custom properties.
- Cleans up the codebase by deleting the files of the initial set of migrated extensions and eliminating all related imports and usages.
* feat: Migrate to Material 3 Theming.
This change:
- Updates the themes README.md file to reflect the current structure and give more information based on the first major phase that was completed.
* feat: Migrate to Material 3 Theming
Deleting previous theme extensions
* feat: Migrate to Material 3 Theming
Another batch of migrations from existing extensions
* feat: Migration to Material 3 Theming
Third Migration batch for theme extensions
* fwat: Migration to Material 3 Theming
Final Migration batch for previous theme extensions
* Update onboarding hero
* Update button radius
* Add surfaceContainer to light theme
* feat(themes): Migrate to Material 3 Theming
This change:
- Adds new set of hero images
- Modifies the core structure for the themes
- Add missing color tokens to the theme classes
- Adds a CustomThemeColor class for custom color tokens
- Modifies the themelist to have a fall back for previous theme implementation
- Adds localization for some texts
- Modifies the flow for loading the theme on app start
- Add a WidgetsBindingObserver that listens for changes in the device theme and updates the app theme when there is a change
- Registers the themeStore as a Singleton for codebase wide use
* feat(themes): Migrate to Material 3 theming
This change:
- Migrates UI flows across the app to the new themes
- Confirms styling and typography of components across the app uses the new themes
- Remove instances of Palette use
- Switch TextStyles across the app to use theme text styles
* feat(themes): Migrate to Material 3 Theming.
This change:
- Adjusts bottomsheets styling and removes duplicate close button
- Removes more themedata extensions from the previous implementation
* - Remove outlines from cards and dock
- Update menu colors
- Update padding/divider size for cards
* - Update PIN screen
- Fix navigation dock shadow
- Update wallet screen colors
* Update border radius --skip-ci
* feat(themes): Migrate to Material 3 Theming.
This change:
- Adds gradient backgrounds to the dashbaord and balance cards.
- Migrates the input fields across the app to BaseTextFormFields.
- Removes dependence of input fields on individual styling, focusing instead on using theme defined InputDecoration styling with adjustments on individual components where needed.
- Applies new theme styling to BaseTextFormField, AddressTextField and CurrencyAmountTextField.
* - Switch some hero images to PNG
- Fix nagivation_dock shadow
- Minor fixes
* feat: Add fallback to previous underline styling in central widgets
This change:
- Adds a fallback to CurrencyAmountTextField, AddressTextField, and BaseTextFormField, allowing them use the previous theme styling.
- Adds localization for new texts
* feat(themes): Update warning box colors for dark and light themes
* feat(themes): Relaod themes when user restores from backup, ensuring the user previous theme preference is used.
* feat(themes): Handle themes logic during restore from backup
This change:
- Refactors theme loading logic to handle backup restore edgecase
- Refreshes the theme based on the user saved preference during restore from backup flow
* Fix card gradients and spacing
* Fix even more radiuses
Test new icons for navigation_dock.dart
* Update onboarding flow backgrounds
Fix swap icon clipping
Fix some text colors
Add more hero images
* Fix incorrect color for light theme
* Fix more hero images and cleanup
* Update text field icons
Fix info box CTA colors
Fix sync indicator colors
* Update toggle colors
Update dark theme colors (minor)
Update crypto_balance_widget.dart icon
* Update page transitions in router.dart
Fix some colors
* feat(themes): Display label by default for filled textfields
* feat(themes): Refactor theme handling across various components
This change:
- Fixes issue with themeMode resetting to system mode when app is restarted causing a UI glitch
- Updates theme checks from `currentTheme.type == ThemeType.dark` to `currentTheme.isDark` for consistency
- Adjusts UI components to use the theme directly from the themeStore
* feat(themes): Add animating tagline to the create pin welcome screen
* Revert text fields label temporarily, fix a couple colors, and cleanup some images
---------
Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>
Co-authored-by: Blazebrain <davidadegoke16@gmail.com>
2025-05-25 20:11:45 +00:00
|
|
|
style: Theme.of(context).textTheme.bodyMedium,
|
2024-05-04 20:44:50 -05:00
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
...bleDevices
|
|
|
|
.map(
|
|
|
|
(device) => Padding(
|
|
|
|
padding: EdgeInsets.only(bottom: 20),
|
|
|
|
child: DeviceTile(
|
|
|
|
onPressed: () => _connectToDevice(device),
|
|
|
|
title: device.name,
|
2024-10-23 17:38:31 +02:00
|
|
|
leading: _getDeviceTileLeading(device.deviceInfo),
|
2024-05-04 20:44:50 -05:00
|
|
|
connectionType: device.connectionType,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
.toList()
|
|
|
|
],
|
|
|
|
if (usbDevices.length > 0) ...[
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.only(left: 20, right: 20, bottom: 20),
|
|
|
|
child: Container(
|
|
|
|
width: double.infinity,
|
|
|
|
child: Text(
|
|
|
|
S.of(context).usb,
|
New themes (#2239)
* Add theme base v2
* Initial new theme base files
* Typos
* Fixes
* Update theme files
* feat: Migrate to Material 3 Theming
Foundation, Theme Data Refactor, and First Extension Cleanup Batch.
This commit completes the first major phase of migrating to Material 3 theming by setting up the foundations for material 3 integration and begins the initial migration, removing custom theme extensions, updating theme data, and refactoring all relevant widget and page theming to use Material 3’s built-in color and typography tokens.
These changes:
- Lays the groundwork for Material 3 theming by restructuring the app’s theme configuration to use Material 3’s ColorScheme and TextTheme as the primary sources of color and typography throughout the app.
- Refactors the core theme config files by removing legacy custom color roles ensuring all color definitions now map directly to Material 3’s role.
- Begins the first batch migration of custom theme extensions (InfoTheme, PlaceholderTheme, KeyboardTheme, PinCodeTheme) and updates all affected widgets and pages to use Material 3 color and typography tokens instead of the custom properties.
- Cleans up the codebase by deleting the files of the initial set of migrated extensions and eliminating all related imports and usages.
* feat: Migrate to Material 3 Theming.
This change:
- Updates the themes README.md file to reflect the current structure and give more information based on the first major phase that was completed.
* feat: Migrate to Material 3 Theming
Deleting previous theme extensions
* feat: Migrate to Material 3 Theming
Another batch of migrations from existing extensions
* feat: Migration to Material 3 Theming
Third Migration batch for theme extensions
* fwat: Migration to Material 3 Theming
Final Migration batch for previous theme extensions
* Update onboarding hero
* Update button radius
* Add surfaceContainer to light theme
* feat(themes): Migrate to Material 3 Theming
This change:
- Adds new set of hero images
- Modifies the core structure for the themes
- Add missing color tokens to the theme classes
- Adds a CustomThemeColor class for custom color tokens
- Modifies the themelist to have a fall back for previous theme implementation
- Adds localization for some texts
- Modifies the flow for loading the theme on app start
- Add a WidgetsBindingObserver that listens for changes in the device theme and updates the app theme when there is a change
- Registers the themeStore as a Singleton for codebase wide use
* feat(themes): Migrate to Material 3 theming
This change:
- Migrates UI flows across the app to the new themes
- Confirms styling and typography of components across the app uses the new themes
- Remove instances of Palette use
- Switch TextStyles across the app to use theme text styles
* feat(themes): Migrate to Material 3 Theming.
This change:
- Adjusts bottomsheets styling and removes duplicate close button
- Removes more themedata extensions from the previous implementation
* - Remove outlines from cards and dock
- Update menu colors
- Update padding/divider size for cards
* - Update PIN screen
- Fix navigation dock shadow
- Update wallet screen colors
* Update border radius --skip-ci
* feat(themes): Migrate to Material 3 Theming.
This change:
- Adds gradient backgrounds to the dashbaord and balance cards.
- Migrates the input fields across the app to BaseTextFormFields.
- Removes dependence of input fields on individual styling, focusing instead on using theme defined InputDecoration styling with adjustments on individual components where needed.
- Applies new theme styling to BaseTextFormField, AddressTextField and CurrencyAmountTextField.
* - Switch some hero images to PNG
- Fix nagivation_dock shadow
- Minor fixes
* feat: Add fallback to previous underline styling in central widgets
This change:
- Adds a fallback to CurrencyAmountTextField, AddressTextField, and BaseTextFormField, allowing them use the previous theme styling.
- Adds localization for new texts
* feat(themes): Update warning box colors for dark and light themes
* feat(themes): Relaod themes when user restores from backup, ensuring the user previous theme preference is used.
* feat(themes): Handle themes logic during restore from backup
This change:
- Refactors theme loading logic to handle backup restore edgecase
- Refreshes the theme based on the user saved preference during restore from backup flow
* Fix card gradients and spacing
* Fix even more radiuses
Test new icons for navigation_dock.dart
* Update onboarding flow backgrounds
Fix swap icon clipping
Fix some text colors
Add more hero images
* Fix incorrect color for light theme
* Fix more hero images and cleanup
* Update text field icons
Fix info box CTA colors
Fix sync indicator colors
* Update toggle colors
Update dark theme colors (minor)
Update crypto_balance_widget.dart icon
* Update page transitions in router.dart
Fix some colors
* feat(themes): Display label by default for filled textfields
* feat(themes): Refactor theme handling across various components
This change:
- Fixes issue with themeMode resetting to system mode when app is restarted causing a UI glitch
- Updates theme checks from `currentTheme.type == ThemeType.dark` to `currentTheme.isDark` for consistency
- Adjusts UI components to use the theme directly from the themeStore
* feat(themes): Add animating tagline to the create pin welcome screen
* Revert text fields label temporarily, fix a couple colors, and cleanup some images
---------
Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>
Co-authored-by: Blazebrain <davidadegoke16@gmail.com>
2025-05-25 20:11:45 +00:00
|
|
|
style: Theme.of(context).textTheme.bodyMedium,
|
2024-05-04 20:44:50 -05:00
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
...usbDevices
|
|
|
|
.map(
|
|
|
|
(device) => Padding(
|
|
|
|
padding: EdgeInsets.only(bottom: 20),
|
|
|
|
child: DeviceTile(
|
|
|
|
onPressed: () => _connectToDevice(device),
|
|
|
|
title: device.name,
|
2024-10-23 17:38:31 +02:00
|
|
|
leading: _getDeviceTileLeading(device.deviceInfo),
|
2024-05-04 20:44:50 -05:00
|
|
|
connectionType: device.connectionType,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
.toList(),
|
2024-11-12 04:26:09 +01:00
|
|
|
],
|
|
|
|
if (widget.allowChangeWallet) ...[
|
|
|
|
PrimaryButton(
|
|
|
|
text: S.of(context).wallets,
|
New themes (#2239)
* Add theme base v2
* Initial new theme base files
* Typos
* Fixes
* Update theme files
* feat: Migrate to Material 3 Theming
Foundation, Theme Data Refactor, and First Extension Cleanup Batch.
This commit completes the first major phase of migrating to Material 3 theming by setting up the foundations for material 3 integration and begins the initial migration, removing custom theme extensions, updating theme data, and refactoring all relevant widget and page theming to use Material 3’s built-in color and typography tokens.
These changes:
- Lays the groundwork for Material 3 theming by restructuring the app’s theme configuration to use Material 3’s ColorScheme and TextTheme as the primary sources of color and typography throughout the app.
- Refactors the core theme config files by removing legacy custom color roles ensuring all color definitions now map directly to Material 3’s role.
- Begins the first batch migration of custom theme extensions (InfoTheme, PlaceholderTheme, KeyboardTheme, PinCodeTheme) and updates all affected widgets and pages to use Material 3 color and typography tokens instead of the custom properties.
- Cleans up the codebase by deleting the files of the initial set of migrated extensions and eliminating all related imports and usages.
* feat: Migrate to Material 3 Theming.
This change:
- Updates the themes README.md file to reflect the current structure and give more information based on the first major phase that was completed.
* feat: Migrate to Material 3 Theming
Deleting previous theme extensions
* feat: Migrate to Material 3 Theming
Another batch of migrations from existing extensions
* feat: Migration to Material 3 Theming
Third Migration batch for theme extensions
* fwat: Migration to Material 3 Theming
Final Migration batch for previous theme extensions
* Update onboarding hero
* Update button radius
* Add surfaceContainer to light theme
* feat(themes): Migrate to Material 3 Theming
This change:
- Adds new set of hero images
- Modifies the core structure for the themes
- Add missing color tokens to the theme classes
- Adds a CustomThemeColor class for custom color tokens
- Modifies the themelist to have a fall back for previous theme implementation
- Adds localization for some texts
- Modifies the flow for loading the theme on app start
- Add a WidgetsBindingObserver that listens for changes in the device theme and updates the app theme when there is a change
- Registers the themeStore as a Singleton for codebase wide use
* feat(themes): Migrate to Material 3 theming
This change:
- Migrates UI flows across the app to the new themes
- Confirms styling and typography of components across the app uses the new themes
- Remove instances of Palette use
- Switch TextStyles across the app to use theme text styles
* feat(themes): Migrate to Material 3 Theming.
This change:
- Adjusts bottomsheets styling and removes duplicate close button
- Removes more themedata extensions from the previous implementation
* - Remove outlines from cards and dock
- Update menu colors
- Update padding/divider size for cards
* - Update PIN screen
- Fix navigation dock shadow
- Update wallet screen colors
* Update border radius --skip-ci
* feat(themes): Migrate to Material 3 Theming.
This change:
- Adds gradient backgrounds to the dashbaord and balance cards.
- Migrates the input fields across the app to BaseTextFormFields.
- Removes dependence of input fields on individual styling, focusing instead on using theme defined InputDecoration styling with adjustments on individual components where needed.
- Applies new theme styling to BaseTextFormField, AddressTextField and CurrencyAmountTextField.
* - Switch some hero images to PNG
- Fix nagivation_dock shadow
- Minor fixes
* feat: Add fallback to previous underline styling in central widgets
This change:
- Adds a fallback to CurrencyAmountTextField, AddressTextField, and BaseTextFormField, allowing them use the previous theme styling.
- Adds localization for new texts
* feat(themes): Update warning box colors for dark and light themes
* feat(themes): Relaod themes when user restores from backup, ensuring the user previous theme preference is used.
* feat(themes): Handle themes logic during restore from backup
This change:
- Refactors theme loading logic to handle backup restore edgecase
- Refreshes the theme based on the user saved preference during restore from backup flow
* Fix card gradients and spacing
* Fix even more radiuses
Test new icons for navigation_dock.dart
* Update onboarding flow backgrounds
Fix swap icon clipping
Fix some text colors
Add more hero images
* Fix incorrect color for light theme
* Fix more hero images and cleanup
* Update text field icons
Fix info box CTA colors
Fix sync indicator colors
* Update toggle colors
Update dark theme colors (minor)
Update crypto_balance_widget.dart icon
* Update page transitions in router.dart
Fix some colors
* feat(themes): Display label by default for filled textfields
* feat(themes): Refactor theme handling across various components
This change:
- Fixes issue with themeMode resetting to system mode when app is restarted causing a UI glitch
- Updates theme checks from `currentTheme.type == ThemeType.dark` to `currentTheme.isDark` for consistency
- Adjusts UI components to use the theme directly from the themeStore
* feat(themes): Add animating tagline to the create pin welcome screen
* Revert text fields label temporarily, fix a couple colors, and cleanup some images
---------
Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>
Co-authored-by: Blazebrain <davidadegoke16@gmail.com>
2025-05-25 20:11:45 +00:00
|
|
|
color: Theme.of(context).colorScheme.primary,
|
|
|
|
textColor: Theme.of(context).colorScheme.onPrimary,
|
2024-11-12 04:26:09 +01:00
|
|
|
onPressed: _onChangeWallet,
|
|
|
|
)
|
|
|
|
],
|
2024-05-04 20:44:50 -05:00
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
2024-11-12 04:26:09 +01:00
|
|
|
|
|
|
|
void _onChangeWallet() {
|
|
|
|
Navigator.of(context).pushNamed(
|
|
|
|
Routes.walletList,
|
|
|
|
arguments: (BuildContext context) => Navigator.of(context)
|
|
|
|
.pushNamedAndRemoveUntil(Routes.dashboard, (route) => false),
|
|
|
|
);
|
|
|
|
}
|
2024-05-04 20:44:50 -05:00
|
|
|
}
|