2020-12-18 14:42:53 +02:00
|
|
|
import 'dart:async';
|
2023-10-25 22:58:25 +02:00
|
|
|
|
2020-12-18 14:42:53 +02:00
|
|
|
import 'package:cake_wallet/exchange/exchange_provider_description.dart';
|
2025-01-24 20:17:37 +02:00
|
|
|
import 'package:cake_wallet/exchange/provider/chainflip_exchange_provider.dart';
|
2023-10-25 22:58:25 +02:00
|
|
|
import 'package:cake_wallet/exchange/provider/changenow_exchange_provider.dart';
|
|
|
|
import 'package:cake_wallet/exchange/provider/exchange_provider.dart';
|
|
|
|
import 'package:cake_wallet/exchange/provider/exolix_exchange_provider.dart';
|
2024-09-11 05:14:17 +03:00
|
|
|
import 'package:cake_wallet/exchange/provider/letsexchange_exchange_provider.dart';
|
2025-01-30 23:45:30 +02:00
|
|
|
import 'package:cake_wallet/exchange/provider/swaptrade_exchange_provider.dart';
|
2023-10-25 22:58:25 +02:00
|
|
|
import 'package:cake_wallet/exchange/provider/sideshift_exchange_provider.dart';
|
|
|
|
import 'package:cake_wallet/exchange/provider/simpleswap_exchange_provider.dart';
|
2024-09-06 16:03:18 +03:00
|
|
|
import 'package:cake_wallet/exchange/provider/stealth_ex_exchange_provider.dart';
|
2024-03-28 14:41:11 +02:00
|
|
|
import 'package:cake_wallet/exchange/provider/thorchain_exchange.provider.dart';
|
2023-10-25 22:58:25 +02:00
|
|
|
import 'package:cake_wallet/exchange/provider/trocador_exchange_provider.dart';
|
2025-03-14 03:02:39 +02:00
|
|
|
import 'package:cake_wallet/exchange/provider/xoswap_exchange_provider.dart';
|
2020-12-18 14:42:53 +02:00
|
|
|
import 'package:cake_wallet/exchange/trade.dart';
|
2023-10-25 22:58:25 +02:00
|
|
|
import 'package:cake_wallet/generated/i18n.dart';
|
|
|
|
import 'package:cake_wallet/src/screens/trade_details/track_trade_list_item.dart';
|
|
|
|
import 'package:cake_wallet/src/screens/trade_details/trade_details_list_card.dart';
|
|
|
|
import 'package:cake_wallet/src/screens/trade_details/trade_details_status_item.dart';
|
|
|
|
import 'package:cake_wallet/src/screens/trade_details/trade_provider_unsupported_item.dart';
|
|
|
|
import 'package:cake_wallet/src/screens/transaction_details/standart_list_item.dart';
|
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
|
|
|
import 'package:cake_wallet/store/app_store.dart';
|
2020-12-18 14:42:53 +02:00
|
|
|
import 'package:cake_wallet/utils/date_formatter.dart';
|
2022-09-02 16:10:54 +03:00
|
|
|
import 'package:cake_wallet/utils/show_bar.dart';
|
2023-10-25 22:58:25 +02:00
|
|
|
import 'package:collection/collection.dart';
|
2024-12-09 12:23:59 -06:00
|
|
|
import 'package:cw_core/utils/print_verbose.dart';
|
2022-09-02 16:10:54 +03:00
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
import 'package:flutter/services.dart';
|
2020-12-18 14:42:53 +02:00
|
|
|
import 'package:hive/hive.dart';
|
|
|
|
import 'package:mobx/mobx.dart';
|
2021-02-01 19:36:36 -06:00
|
|
|
import 'package:url_launcher/url_launcher.dart';
|
2023-03-31 21:14:22 +02:00
|
|
|
|
2020-12-18 14:42:53 +02:00
|
|
|
part 'trade_details_view_model.g.dart';
|
|
|
|
|
2023-02-07 19:39:39 +02:00
|
|
|
class TradeDetailsViewModel = TradeDetailsViewModelBase with _$TradeDetailsViewModel;
|
2020-12-18 14:42:53 +02:00
|
|
|
|
|
|
|
abstract class TradeDetailsViewModelBase with Store {
|
2022-10-12 13:09:57 -04:00
|
|
|
TradeDetailsViewModelBase({
|
|
|
|
required Trade tradeForDetails,
|
|
|
|
required this.trades,
|
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
|
|
|
required this.appStore,
|
2023-02-07 19:39:39 +02:00
|
|
|
}) : items = ObservableList<StandartListItem>(),
|
2023-06-14 23:55:49 +03:00
|
|
|
trade = trades.values.firstWhereOrNull((element) => element.id == tradeForDetails.id) ??
|
|
|
|
tradeForDetails {
|
2020-12-18 14:42:53 +02:00
|
|
|
switch (trade.provider) {
|
|
|
|
case ExchangeProviderDescription.changeNow:
|
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
|
|
|
_provider = ChangeNowExchangeProvider(settingsStore: appStore.settingsStore);
|
2020-12-18 14:42:53 +02:00
|
|
|
break;
|
2022-04-13 14:28:21 +01:00
|
|
|
case ExchangeProviderDescription.sideShift:
|
|
|
|
_provider = SideShiftExchangeProvider();
|
|
|
|
break;
|
2023-02-07 19:39:39 +02:00
|
|
|
case ExchangeProviderDescription.simpleSwap:
|
2022-08-31 18:34:07 +03:00
|
|
|
_provider = SimpleSwapExchangeProvider();
|
|
|
|
break;
|
2023-02-06 21:20:43 +02:00
|
|
|
case ExchangeProviderDescription.trocador:
|
|
|
|
_provider = TrocadorExchangeProvider();
|
|
|
|
break;
|
2023-10-12 03:20:19 +03:00
|
|
|
case ExchangeProviderDescription.exolix:
|
|
|
|
_provider = ExolixExchangeProvider();
|
|
|
|
break;
|
2024-03-28 14:41:11 +02:00
|
|
|
case ExchangeProviderDescription.thorChain:
|
|
|
|
_provider = ThorChainExchangeProvider(tradesStore: trades);
|
|
|
|
break;
|
2025-01-30 23:45:30 +02:00
|
|
|
case ExchangeProviderDescription.swapTrade:
|
|
|
|
_provider = SwapTradeExchangeProvider();
|
2024-09-11 05:14:17 +03:00
|
|
|
case ExchangeProviderDescription.letsExchange:
|
|
|
|
_provider = LetsExchangeExchangeProvider();
|
2024-05-13 19:07:16 -07:00
|
|
|
break;
|
2024-09-06 16:03:18 +03:00
|
|
|
case ExchangeProviderDescription.stealthEx:
|
|
|
|
_provider = StealthExExchangeProvider();
|
|
|
|
break;
|
2025-01-24 20:17:37 +02:00
|
|
|
case ExchangeProviderDescription.chainflip:
|
|
|
|
_provider = ChainflipExchangeProvider(tradesStore: trades);
|
|
|
|
break;
|
2025-03-14 03:02:39 +02:00
|
|
|
case ExchangeProviderDescription.xoSwap:
|
|
|
|
_provider = XOSwapExchangeProvider();
|
|
|
|
break;
|
2020-12-18 14:42:53 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
_updateItems();
|
|
|
|
|
2023-10-25 22:58:25 +02:00
|
|
|
if (_provider != null) {
|
|
|
|
_updateTrade();
|
|
|
|
timer = Timer.periodic(Duration(seconds: 20), (_) async => _updateTrade());
|
|
|
|
}
|
2020-12-18 14:42:53 +02:00
|
|
|
}
|
|
|
|
|
2024-03-28 14:41:11 +02:00
|
|
|
static String? getTrackUrl(ExchangeProviderDescription provider, Trade trade) {
|
|
|
|
switch (provider) {
|
|
|
|
case ExchangeProviderDescription.changeNow:
|
|
|
|
return 'https://changenow.io/exchange/txs/${trade.id}';
|
|
|
|
case ExchangeProviderDescription.sideShift:
|
|
|
|
return 'https://sideshift.ai/orders/${trade.id}';
|
|
|
|
case ExchangeProviderDescription.simpleSwap:
|
|
|
|
return 'https://simpleswap.io/exchange?id=${trade.id}';
|
|
|
|
case ExchangeProviderDescription.trocador:
|
|
|
|
return 'https://trocador.app/en/checkout/${trade.id}';
|
|
|
|
case ExchangeProviderDescription.exolix:
|
|
|
|
return 'https://exolix.com/transaction/${trade.id}';
|
|
|
|
case ExchangeProviderDescription.thorChain:
|
|
|
|
return 'https://track.ninerealms.com/${trade.id}';
|
2025-01-30 23:45:30 +02:00
|
|
|
case ExchangeProviderDescription.swapTrade:
|
|
|
|
return 'https://swaptrade.io/send/${trade.id}';
|
2024-09-11 05:14:17 +03:00
|
|
|
case ExchangeProviderDescription.letsExchange:
|
|
|
|
return 'https://letsexchange.io/?transactionId=${trade.id}';
|
2024-09-06 16:03:18 +03:00
|
|
|
case ExchangeProviderDescription.stealthEx:
|
|
|
|
return 'https://stealthex.io/exchange/?id=${trade.id}';
|
2025-01-24 20:17:37 +02:00
|
|
|
case ExchangeProviderDescription.chainflip:
|
|
|
|
return 'https://scan.chainflip.io/channels/${trade.id}';
|
2025-03-14 03:02:39 +02:00
|
|
|
case ExchangeProviderDescription.xoSwap:
|
|
|
|
return 'https://orders.xoswap.com/${trade.id}';
|
2024-03-28 14:41:11 +02:00
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2020-12-18 14:42:53 +02:00
|
|
|
final Box<Trade> trades;
|
|
|
|
|
|
|
|
@observable
|
|
|
|
Trade trade;
|
|
|
|
|
|
|
|
@observable
|
|
|
|
ObservableList<StandartListItem> items;
|
|
|
|
|
2022-10-12 13:09:57 -04:00
|
|
|
ExchangeProvider? _provider;
|
2020-12-18 14:42:53 +02:00
|
|
|
|
2022-10-12 13:09:57 -04:00
|
|
|
Timer? timer;
|
2020-12-18 14:42:53 +02:00
|
|
|
|
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
|
|
|
final AppStore appStore;
|
2022-09-02 16:10:54 +03:00
|
|
|
|
2020-12-18 14:42:53 +02:00
|
|
|
@action
|
|
|
|
Future<void> _updateTrade() async {
|
|
|
|
try {
|
2022-10-12 13:09:57 -04:00
|
|
|
final updatedTrade = await _provider!.findTradeById(id: trade.id);
|
2020-12-18 14:42:53 +02:00
|
|
|
|
2023-10-25 22:58:25 +02:00
|
|
|
if (updatedTrade.createdAt == null && trade.createdAt != null)
|
2020-12-18 14:42:53 +02:00
|
|
|
updatedTrade.createdAt = trade.createdAt;
|
2023-10-25 22:58:25 +02:00
|
|
|
|
2023-06-14 23:55:49 +03:00
|
|
|
Trade? foundElement = trades.values.firstWhereOrNull((element) => element.id == trade.id);
|
|
|
|
if (foundElement != null) {
|
|
|
|
final editedTrade = trades.get(foundElement.key);
|
|
|
|
editedTrade?.stateRaw = updatedTrade.stateRaw;
|
|
|
|
editedTrade?.save();
|
|
|
|
}
|
2020-12-18 14:42:53 +02:00
|
|
|
|
|
|
|
trade = updatedTrade;
|
|
|
|
|
|
|
|
_updateItems();
|
|
|
|
} catch (e) {
|
2024-12-09 12:23:59 -06:00
|
|
|
printV(e.toString());
|
2020-12-18 14:42:53 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void _updateItems() {
|
2022-09-02 16:10:54 +03:00
|
|
|
final dateFormat = DateFormatter.withCurrentLocal(reverse: true);
|
2020-12-18 14:42:53 +02:00
|
|
|
|
2022-10-12 13:09:57 -04:00
|
|
|
items.clear();
|
2020-12-18 14:42:53 +02:00
|
|
|
|
2023-10-25 22:58:25 +02:00
|
|
|
if (_provider == null)
|
|
|
|
items.add(TradeProviderUnsupportedItem(
|
|
|
|
error: S.current.exchange_provider_unsupported(trade.provider.title)));
|
|
|
|
|
2022-09-02 16:10:54 +03:00
|
|
|
items.add(
|
2023-02-07 19:39:39 +02:00
|
|
|
DetailsListStatusItem(title: S.current.trade_details_state, value: trade.state.toString()));
|
2022-09-02 16:10:54 +03:00
|
|
|
|
|
|
|
items.add(TradeDetailsListCardItem.tradeDetails(
|
|
|
|
id: trade.id,
|
2024-12-13 01:24:37 +02:00
|
|
|
extraId: trade.extraId,
|
2022-10-12 13:09:57 -04:00
|
|
|
createdAt: trade.createdAt != null ? dateFormat.format(trade.createdAt!) : '',
|
2022-09-02 16:10:54 +03:00
|
|
|
from: trade.from,
|
|
|
|
to: trade.to,
|
|
|
|
onTap: (BuildContext context) {
|
|
|
|
Clipboard.setData(ClipboardData(text: '${trade.id}'));
|
|
|
|
showBar<void>(context, S.of(context).copied_to_clipboard);
|
|
|
|
},
|
|
|
|
));
|
2020-12-18 14:42:53 +02:00
|
|
|
|
2023-02-07 19:39:39 +02:00
|
|
|
items.add(StandartListItem(
|
|
|
|
title: S.current.trade_details_provider, value: trade.provider.toString()));
|
2020-12-18 14:42:53 +02:00
|
|
|
|
2024-03-28 14:41:11 +02:00
|
|
|
final trackUrl = TradeDetailsViewModelBase.getTrackUrl(trade.provider, trade);
|
|
|
|
if (trackUrl != null) {
|
2021-02-01 19:36:36 -06:00
|
|
|
items.add(TrackTradeListItem(
|
2024-03-28 14:41:11 +02:00
|
|
|
title: S.current.track, value: trackUrl, onTap: () => _launchUrl(trackUrl)));
|
2022-04-13 14:28:21 +01:00
|
|
|
}
|
|
|
|
|
2024-03-28 14:41:11 +02:00
|
|
|
if (trade.isRefund == true) {
|
|
|
|
items.add(StandartListItem(
|
|
|
|
title: 'Refund', value: trade.refundAddress ?? ''));
|
2023-02-07 19:39:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (trade.provider == ExchangeProviderDescription.trocador) {
|
|
|
|
items.add(StandartListItem(
|
|
|
|
title: '${trade.providerName} ${S.current.id.toUpperCase()}',
|
|
|
|
value: trade.providerId ?? ''));
|
|
|
|
|
2024-03-28 14:41:11 +02:00
|
|
|
if (trade.password != null && trade.password!.isNotEmpty) {
|
2023-02-07 19:39:39 +02:00
|
|
|
items.add(StandartListItem(
|
|
|
|
title: '${trade.providerName} ${S.current.password}', value: trade.password ?? ''));
|
2024-03-28 14:41:11 +02:00
|
|
|
}
|
2023-10-12 03:20:19 +03:00
|
|
|
}
|
2020-12-18 14:42:53 +02:00
|
|
|
}
|
2023-03-31 21:14:22 +02:00
|
|
|
|
|
|
|
void _launchUrl(String url) {
|
2023-06-14 23:55:49 +03:00
|
|
|
final uri = Uri.parse(url);
|
2023-03-31 21:14:22 +02:00
|
|
|
try {
|
2024-05-23 14:00:52 +03:00
|
|
|
launchUrl(uri, mode: LaunchMode.externalApplication);
|
2023-03-31 21:14:22 +02:00
|
|
|
} catch (e) {}
|
|
|
|
}
|
2021-02-01 19:36:36 -06:00
|
|
|
}
|