mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-06-28 12:29:51 +00: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>
This commit is contained in:
parent
7b8ddf9685
commit
df88914628
412 changed files with 11173 additions and 13192 deletions
|
@ -14,8 +14,8 @@ import 'package:cake_wallet/exchange/trade_state.dart';
|
|||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
import 'package:cake_wallet/palette.dart';
|
||||
import 'package:cake_wallet/src/widgets/alert_with_one_action.dart';
|
||||
import 'package:cake_wallet/store/settings_store.dart';
|
||||
import 'package:cake_wallet/themes/theme_base.dart';
|
||||
import 'package:cake_wallet/store/app_store.dart';
|
||||
import 'package:cake_wallet/themes/core/material_base_theme.dart';
|
||||
import 'package:cw_core/crypto_currency.dart';
|
||||
import 'package:cw_core/wallet_base.dart';
|
||||
import 'package:cw_core/wallet_type.dart';
|
||||
|
@ -26,12 +26,12 @@ import 'package:url_launcher/url_launcher.dart';
|
|||
|
||||
class MoonPayProvider extends BuyProvider {
|
||||
MoonPayProvider({
|
||||
required SettingsStore settingsStore,
|
||||
required AppStore appStore,
|
||||
required WalletBase wallet,
|
||||
bool isTestEnvironment = false,
|
||||
}) : baseSellUrl = isTestEnvironment ? _baseSellTestUrl : _baseSellProductUrl,
|
||||
baseBuyUrl = isTestEnvironment ? _baseBuyTestUrl : _baseBuyProductUrl,
|
||||
this._settingsStore = settingsStore,
|
||||
this._appStore = appStore,
|
||||
super(
|
||||
wallet: wallet,
|
||||
isTestEnvironment: isTestEnvironment,
|
||||
|
@ -41,7 +41,7 @@ class MoonPayProvider extends BuyProvider {
|
|||
supportedFiatList: supportedFiatToCryptoPairs(
|
||||
notSupportedFiat: _notSupportedFiat, notSupportedCrypto: _notSupportedCrypto));
|
||||
|
||||
final SettingsStore _settingsStore;
|
||||
final AppStore _appStore;
|
||||
|
||||
static const _baseSellTestUrl = 'sell-sandbox.moonpay.com';
|
||||
static const _baseSellProductUrl = 'sell.moonpay.com';
|
||||
|
@ -86,15 +86,12 @@ class MoonPayProvider extends BuyProvider {
|
|||
|
||||
static String get _exchangeHelperApiKey => secrets.exchangeHelperApiKey;
|
||||
|
||||
static String themeToMoonPayTheme(ThemeBase theme) {
|
||||
static String themeToMoonPayTheme(MaterialThemeBase theme) {
|
||||
switch (theme.type) {
|
||||
case ThemeType.bright:
|
||||
case ThemeType.light:
|
||||
return 'light';
|
||||
case ThemeType.dark:
|
||||
return 'dark';
|
||||
case ThemeType.oled:
|
||||
return 'dark';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -237,9 +234,9 @@ class MoonPayProvider extends BuyProvider {
|
|||
required String cryptoCurrencyAddress,
|
||||
String? countryCode}) async {
|
||||
final Map<String, String> params = {
|
||||
'theme': themeToMoonPayTheme(_settingsStore.currentTheme),
|
||||
'language': _settingsStore.languageCode,
|
||||
'colorCode': _settingsStore.currentTheme.type == ThemeType.dark
|
||||
'theme': themeToMoonPayTheme(_appStore.themeStore.currentTheme),
|
||||
'language': _appStore.settingsStore.languageCode,
|
||||
'colorCode': _appStore.themeStore.currentTheme.isDark
|
||||
? '#${Palette.blueCraiola.value.toRadixString(16).substring(2, 8)}'
|
||||
: '#${Palette.moderateSlateBlue.value.toRadixString(16).substring(2, 8)}',
|
||||
'baseCurrencyCode': isBuyAction ? quote.fiatCurrency.name : quote.cryptoCurrency.name,
|
||||
|
@ -260,7 +257,6 @@ class MoonPayProvider extends BuyProvider {
|
|||
try {
|
||||
final uri = await requestMoonPayUrl(
|
||||
walletAddress: cryptoCurrencyAddress,
|
||||
settingsStore: _settingsStore,
|
||||
isBuyAction: isBuyAction,
|
||||
amount: amount.toString(),
|
||||
params: params);
|
||||
|
@ -289,7 +285,6 @@ class MoonPayProvider extends BuyProvider {
|
|||
|
||||
Future<Uri> requestMoonPayUrl({
|
||||
required String walletAddress,
|
||||
required SettingsStore settingsStore,
|
||||
required bool isBuyAction,
|
||||
required Map<String, String> params,
|
||||
String? amount,
|
||||
|
|
|
@ -8,8 +8,7 @@ import 'package:cake_wallet/buy/pairs_utils.dart';
|
|||
import 'package:cake_wallet/buy/payment_method.dart';
|
||||
import 'package:cake_wallet/entities/fiat_currency.dart';
|
||||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
import 'package:cake_wallet/store/settings_store.dart';
|
||||
import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
|
||||
import 'package:cake_wallet/themes/core/theme_store.dart';
|
||||
import 'package:cw_core/crypto_currency.dart';
|
||||
import 'package:cw_core/utils/print_verbose.dart';
|
||||
import 'package:cw_core/wallet_base.dart';
|
||||
|
@ -18,7 +17,7 @@ import 'package:http/http.dart' as http;
|
|||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
class OnRamperBuyProvider extends BuyProvider {
|
||||
OnRamperBuyProvider(this._settingsStore,
|
||||
OnRamperBuyProvider(this._themeStore,
|
||||
{required WalletBase wallet, bool isTestEnvironment = false})
|
||||
: super(wallet: wallet,
|
||||
isTestEnvironment: isTestEnvironment,
|
||||
|
@ -39,7 +38,7 @@ class OnRamperBuyProvider extends BuyProvider {
|
|||
static const List<FiatCurrency> _notSupportedFiat = [];
|
||||
static Map<String, dynamic> _onrampMetadata = {};
|
||||
|
||||
final SettingsStore _settingsStore;
|
||||
final ThemeStore _themeStore;
|
||||
|
||||
String? recommendedPaymentType;
|
||||
|
||||
|
@ -246,17 +245,13 @@ class OnRamperBuyProvider extends BuyProvider {
|
|||
String? countryCode}) async {
|
||||
final actionType = isBuyAction ? 'buy' : 'sell';
|
||||
|
||||
final primaryColor = getColorStr(Theme.of(context).primaryColor);
|
||||
final secondaryColor = getColorStr(Theme.of(context).colorScheme.background);
|
||||
final primaryTextColor = getColorStr(Theme.of(context).extension<CakeTextTheme>()!.titleColor);
|
||||
final primaryColor = getColorStr(Theme.of(context).colorScheme.primary,);
|
||||
final secondaryColor = getColorStr(Theme.of(context).colorScheme.surface);
|
||||
final primaryTextColor = getColorStr(Theme.of(context).colorScheme.onSurface);
|
||||
final secondaryTextColor =
|
||||
getColorStr(Theme.of(context).extension<CakeTextTheme>()!.secondaryTextColor);
|
||||
final containerColor = getColorStr(Theme.of(context).colorScheme.background);
|
||||
var cardColor = getColorStr(Theme.of(context).cardColor);
|
||||
|
||||
if (_settingsStore.currentTheme.title == S.current.high_contrast_theme) {
|
||||
cardColor = getColorStr(Colors.white);
|
||||
}
|
||||
getColorStr(Theme.of(context).colorScheme.onSurfaceVariant);
|
||||
final containerColor = getColorStr(Theme.of(context).colorScheme.surface);
|
||||
var cardColor = getColorStr(Theme.of(context).colorScheme.surfaceContainer);
|
||||
|
||||
final defaultCrypto =
|
||||
quote.cryptoCurrency.title + _getNormalizeNetwork(quote.cryptoCurrency).toLowerCase();
|
||||
|
|
|
@ -3,7 +3,7 @@ import 'dart:io';
|
|||
import 'package:cake_wallet/core/secure_storage.dart';
|
||||
import 'package:cake_wallet/entities/get_encryption_key.dart';
|
||||
import 'package:cake_wallet/entities/transaction_description.dart';
|
||||
import 'package:cake_wallet/themes/theme_list.dart';
|
||||
import 'package:cake_wallet/themes/utils/theme_list.dart';
|
||||
import 'package:cw_core/root_dir.dart';
|
||||
import 'package:cake_wallet/utils/device_info.dart';
|
||||
import 'package:cw_core/utils/print_verbose.dart';
|
||||
|
|
29
lib/di.dart
29
lib/di.dart
|
@ -39,6 +39,7 @@ import 'package:cake_wallet/src/screens/settings/background_sync_page.dart';
|
|||
import 'package:cake_wallet/src/screens/wallet_connect/services/bottom_sheet_service.dart';
|
||||
import 'package:cake_wallet/src/screens/wallet_connect/services/key_service/wallet_connect_key_service.dart';
|
||||
import 'package:cake_wallet/src/screens/wallet_connect/services/walletkit_service.dart';
|
||||
import 'package:cake_wallet/themes/core/theme_store.dart';
|
||||
import 'package:cake_wallet/view_model/dev/monero_background_sync.dart';
|
||||
import 'package:cake_wallet/view_model/dev/secure_preferences.dart';
|
||||
import 'package:cake_wallet/view_model/dev/shared_preferences.dart';
|
||||
|
@ -152,11 +153,9 @@ import 'package:cake_wallet/src/screens/wallet/wallet_edit_page.dart';
|
|||
import 'package:cake_wallet/src/screens/wallet_connect/wc_connections_listing_view.dart';
|
||||
import 'package:cake_wallet/src/screens/wallet_unlock/wallet_unlock_arguments.dart';
|
||||
import 'package:cake_wallet/src/screens/wallet_unlock/wallet_unlock_page.dart';
|
||||
import 'package:cake_wallet/themes/theme_list.dart';
|
||||
import 'package:cake_wallet/utils/device_info.dart';
|
||||
import 'package:cake_wallet/store/anonpay/anonpay_transactions_store.dart';
|
||||
import 'package:cake_wallet/utils/payment_request.dart';
|
||||
import 'package:cake_wallet/utils/responsive_layout_util.dart';
|
||||
import 'package:cake_wallet/view_model/buy/buy_sell_view_model.dart';
|
||||
import 'package:cake_wallet/view_model/animated_ur_model.dart';
|
||||
import 'package:cake_wallet/view_model/dashboard/desktop_sidebar_view_model.dart';
|
||||
|
@ -325,6 +324,11 @@ Future<void> setup({
|
|||
if (!_isSetupFinished) {
|
||||
getIt.registerSingletonAsync<SharedPreferences>(() => SharedPreferences.getInstance());
|
||||
getIt.registerSingleton<SecureStorage>(secureStorage);
|
||||
getIt.registerSingletonAsync<ThemeStore>(() async {
|
||||
final store = ThemeStore();
|
||||
await store.loadThemePreferences();
|
||||
return store;
|
||||
});
|
||||
}
|
||||
|
||||
final isBitcoinBuyEnabled = (secrets.wyreSecretKey.isNotEmpty) &&
|
||||
|
@ -335,10 +339,6 @@ Future<void> setup({
|
|||
nodeSource: _nodeSource,
|
||||
powNodeSource: _powNodeSource,
|
||||
isBitcoinBuyEnabled: isBitcoinBuyEnabled,
|
||||
// Enforce darkTheme on platforms other than mobile till the design for other themes is completed
|
||||
initialTheme: responsiveLayoutUtil.shouldRenderMobileUI && DeviceInfo.instance.isMobile
|
||||
? null
|
||||
: ThemeList.darkTheme,
|
||||
);
|
||||
|
||||
if (_isSetupFinished) {
|
||||
|
@ -356,7 +356,8 @@ Future<void> setup({
|
|||
authenticationStore: getIt.get<AuthenticationStore>(),
|
||||
walletList: getIt.get<WalletListStore>(),
|
||||
settingsStore: getIt.get<SettingsStore>(),
|
||||
nodeListStore: getIt.get<NodeListStore>()));
|
||||
nodeListStore: getIt.get<NodeListStore>(),
|
||||
themeStore: getIt.get<ThemeStore>()));
|
||||
getIt.registerSingleton<TradesStore>(
|
||||
TradesStore(tradesSource: _tradesSource, settingsStore: getIt.get<SettingsStore>()));
|
||||
getIt.registerSingleton<OrdersStore>(
|
||||
|
@ -901,7 +902,7 @@ Future<void> setup({
|
|||
getIt.get<NanoAccountEditOrCreateViewModel>(param1: account)));
|
||||
|
||||
getIt.registerFactory(() =>
|
||||
DisplaySettingsViewModel(getIt.get<SettingsStore>()));
|
||||
DisplaySettingsViewModel(getIt.get<SettingsStore>(), getIt.get<ThemeStore>()));
|
||||
|
||||
getIt.registerFactory(() =>
|
||||
SilentPaymentsSettingsViewModel(getIt.get<SettingsStore>(), getIt.get<AppStore>().wallet!));
|
||||
|
@ -1030,13 +1031,13 @@ Future<void> setup({
|
|||
getIt.get<AppStore>().wallet!.isHardwareWallet ? getIt.get<LedgerViewModel>() : null));
|
||||
|
||||
getIt.registerFactory<MoonPayProvider>(() => MoonPayProvider(
|
||||
settingsStore: getIt.get<AppStore>().settingsStore,
|
||||
appStore: getIt.get<AppStore>(),
|
||||
wallet: getIt.get<AppStore>().wallet!,
|
||||
isTestEnvironment: kDebugMode,
|
||||
));
|
||||
|
||||
getIt.registerFactory<OnRamperBuyProvider>(() => OnRamperBuyProvider(
|
||||
getIt.get<AppStore>().settingsStore,
|
||||
getIt.get<ThemeStore>(),
|
||||
wallet: getIt.get<AppStore>().wallet!,
|
||||
));
|
||||
|
||||
|
@ -1056,7 +1057,7 @@ Future<void> setup({
|
|||
_tradesSource,
|
||||
getIt.get<ExchangeTemplateStore>(),
|
||||
getIt.get<TradesStore>(),
|
||||
getIt.get<AppStore>().settingsStore,
|
||||
getIt.get<SettingsStore>(),
|
||||
getIt.get<SharedPreferences>(),
|
||||
getIt.get<ContactListViewModel>(),
|
||||
getIt.get<FeesViewModel>(),
|
||||
|
@ -1236,7 +1237,7 @@ Future<void> setup({
|
|||
TradeDetailsViewModel(
|
||||
tradeForDetails: trade,
|
||||
trades: _tradesSource,
|
||||
settingsStore: getIt.get<SettingsStore>()));
|
||||
appStore: getIt.get<AppStore>()));
|
||||
|
||||
getIt.registerFactory(() => CakeFeaturesViewModel(getIt.get<CakePayService>()));
|
||||
|
||||
|
@ -1431,7 +1432,7 @@ Future<void> setup({
|
|||
(AnonpayInvoiceInfo anonpayInvoiceInfo, _) => AnonpayDetailsViewModel(
|
||||
anonPayApi: getIt.get<AnonPayApi>(),
|
||||
anonpayInvoiceInfo: anonpayInvoiceInfo,
|
||||
settingsStore: getIt.get<SettingsStore>(),
|
||||
themeStore: getIt.get<ThemeStore>(),
|
||||
));
|
||||
|
||||
getIt.registerFactoryParam<PayjoinDetailsViewModel, String, TransactionInfo?>(
|
||||
|
@ -1440,7 +1441,7 @@ Future<void> setup({
|
|||
sessionId,
|
||||
transactionInfo,
|
||||
payjoinSessionSource: _payjoinSessionSource,
|
||||
settingsStore: getIt.get<SettingsStore>(),
|
||||
themeStore: getIt.get<ThemeStore>(),
|
||||
));
|
||||
|
||||
getIt.registerFactoryParam<AnonPayReceivePage, AnonpayInfoBase, void>(
|
||||
|
|
|
@ -29,7 +29,7 @@ class MainActions {
|
|||
|
||||
static MainActions showWalletsAction = MainActions._(
|
||||
name: (context) => S.of(context).wallets,
|
||||
image: 'assets/images/wallet_new.png',
|
||||
image: 'assets/images/wallet_icon.png',
|
||||
onTap: (BuildContext context, DashboardViewModel viewModel) async {
|
||||
Navigator.pushNamed(
|
||||
context,
|
||||
|
@ -42,7 +42,7 @@ class MainActions {
|
|||
|
||||
static MainActions receiveAction = MainActions._(
|
||||
name: (context) => S.of(context).receive,
|
||||
image: 'assets/images/received.png',
|
||||
image: 'assets/images/receive.png',
|
||||
onTap: (BuildContext context, DashboardViewModel viewModel) async {
|
||||
Navigator.pushNamed(context, Routes.addressPage);
|
||||
},
|
||||
|
@ -50,7 +50,7 @@ class MainActions {
|
|||
|
||||
static MainActions swapAction = MainActions._(
|
||||
name: (context) => S.of(context).swap,
|
||||
image: 'assets/images/transfer.png',
|
||||
image: 'assets/images/swap.png',
|
||||
isEnabled: (viewModel) => viewModel.isEnabledSwapAction,
|
||||
canShow: (viewModel) => viewModel.hasSwapAction,
|
||||
onTap: (BuildContext context, DashboardViewModel viewModel) async {
|
||||
|
@ -62,7 +62,7 @@ class MainActions {
|
|||
|
||||
static MainActions sendAction = MainActions._(
|
||||
name: (context) => S.of(context).send,
|
||||
image: 'assets/images/upload.png',
|
||||
image: 'assets/images/send2.png',
|
||||
isEnabled: (viewModel) => viewModel.canSend,
|
||||
onTap: (BuildContext context, DashboardViewModel viewModel) async {
|
||||
Navigator.pushNamed(context, Routes.send);
|
||||
|
@ -71,7 +71,7 @@ class MainActions {
|
|||
|
||||
static MainActions tradeAction = MainActions._(
|
||||
name: (context) => S.of(context).buy,
|
||||
image: 'assets/images/buy_sell.png',
|
||||
image: 'assets/images/buy.png',
|
||||
isEnabled: (viewModel) => viewModel.isEnabledTradeAction,
|
||||
canShow: (viewModel) => viewModel.hasTradeAction,
|
||||
onTap: (BuildContext context, DashboardViewModel viewModel) async {
|
||||
|
|
|
@ -34,6 +34,7 @@ class PreferencesKey {
|
|||
static const disableExchangeKey = 'disable_exchange';
|
||||
static const exchangeStatusKey = 'exchange_status';
|
||||
static const currentTheme = 'current_theme';
|
||||
static const themeMode = 'theme_mode';
|
||||
static const displayActionListModeKey = 'display_list_mode';
|
||||
static const currentPinLength = 'current_pin_length';
|
||||
static const currentLanguageCode = 'language_code';
|
||||
|
|
|
@ -15,7 +15,7 @@ Future<String?> presentQRScanner(BuildContext context) async {
|
|||
try {
|
||||
final result = await Navigator.of(context).push<String>(
|
||||
MaterialPageRoute(
|
||||
builder:(context) {
|
||||
builder: (context) {
|
||||
return BarcodeScannerSimple();
|
||||
},
|
||||
),
|
||||
|
@ -67,7 +67,7 @@ class _BarcodeScannerSimpleState extends State<BarcodeScannerSimple> {
|
|||
void _handleBarcodeInternal(BarcodeCapture barcodes) {
|
||||
for (final barcode in barcodes.barcodes) {
|
||||
// don't handle unknown QR codes
|
||||
if (barcode.rawValue?.trim().isEmpty??false == false) continue;
|
||||
if (barcode.rawValue?.trim().isEmpty ?? false == false) continue;
|
||||
if (barcode.rawValue!.startsWith("ur:")) {
|
||||
if (urCodes.contains(barcode.rawValue)) continue;
|
||||
setState(() {
|
||||
|
@ -81,7 +81,8 @@ class _BarcodeScannerSimpleState extends State<BarcodeScannerSimple> {
|
|||
SchedulerBinding.instance.addPostFrameCallback((_) {
|
||||
Navigator.of(context).pop(ur.inputs.join("\n"));
|
||||
});
|
||||
};
|
||||
}
|
||||
;
|
||||
}
|
||||
}
|
||||
if (urCodes.isNotEmpty) return;
|
||||
|
@ -110,18 +111,21 @@ class _BarcodeScannerSimpleState extends State<BarcodeScannerSimple> {
|
|||
ToggleFlashlightButton(controller: ctrl),
|
||||
],
|
||||
),
|
||||
backgroundColor: Colors.black,
|
||||
backgroundColor: Theme.of(context).colorScheme.surface,
|
||||
body: Stack(
|
||||
children: [
|
||||
MobileScanner(
|
||||
onDetect: _handleBarcode,
|
||||
controller: ctrl,
|
||||
),
|
||||
if (ur.inputs.length != 0)
|
||||
Center(child:
|
||||
Text(
|
||||
if (ur.inputs.length != 0)
|
||||
Center(
|
||||
child: Text(
|
||||
"${ur.inputs.length}/${ur.count}",
|
||||
style: Theme.of(context).textTheme.displayLarge?.copyWith(color: Colors.white)
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.displayLarge
|
||||
?.copyWith(color: Theme.of(context).colorScheme.onSurface),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
|
@ -158,7 +162,6 @@ class _BarcodeScannerSimpleState extends State<BarcodeScannerSimple> {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
class ToggleFlashlightButton extends StatelessWidget {
|
||||
const ToggleFlashlightButton({required this.controller, super.key});
|
||||
|
||||
|
@ -199,9 +202,9 @@ class ToggleFlashlightButton extends StatelessWidget {
|
|||
},
|
||||
);
|
||||
case TorchState.unavailable:
|
||||
return const Icon(
|
||||
return Icon(
|
||||
Icons.no_flash,
|
||||
color: Colors.grey,
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
);
|
||||
}
|
||||
},
|
||||
|
@ -326,16 +329,14 @@ class ProgressPainter extends CustomPainter {
|
|||
const fullAngle = 360.0;
|
||||
var startAngle = 0.0;
|
||||
for (int i = 0; i < urQrProgress.expectedPartCount.toInt(); i++) {
|
||||
var sweepAngle =
|
||||
(1 / urQrProgress.expectedPartCount) * fullAngle * pi / 180.0;
|
||||
drawSector(canvas, urQrProgress.receivedPartIndexes.contains(i), rect,
|
||||
startAngle, sweepAngle);
|
||||
var sweepAngle = (1 / urQrProgress.expectedPartCount) * fullAngle * pi / 180.0;
|
||||
drawSector(
|
||||
canvas, urQrProgress.receivedPartIndexes.contains(i), rect, startAngle, sweepAngle);
|
||||
startAngle += sweepAngle;
|
||||
}
|
||||
}
|
||||
|
||||
void drawSector(Canvas canvas, bool isActive, Rect rect, double startAngle,
|
||||
double sweepAngle) {
|
||||
void drawSector(Canvas canvas, bool isActive, Rect rect, double startAngle, double sweepAngle) {
|
||||
final paint = Paint()
|
||||
..style = PaintingStyle.stroke
|
||||
..strokeWidth = 8
|
||||
|
|
151
lib/main.dart
151
lib/main.dart
|
@ -25,7 +25,8 @@ import 'package:cake_wallet/routes.dart';
|
|||
import 'package:cake_wallet/src/screens/root/root.dart';
|
||||
import 'package:cake_wallet/store/app_store.dart';
|
||||
import 'package:cake_wallet/store/authentication_store.dart';
|
||||
import 'package:cake_wallet/themes/theme_base.dart';
|
||||
import 'package:cake_wallet/themes/core/material_base_theme.dart';
|
||||
import 'package:cake_wallet/themes/utils/theme_provider.dart';
|
||||
import 'package:cake_wallet/utils/device_info.dart';
|
||||
import 'package:cake_wallet/utils/exception_handler.dart';
|
||||
import 'package:cake_wallet/view_model/link_view_model.dart';
|
||||
|
@ -206,8 +207,7 @@ Future<void> initializeAppConfigs({bool loadWallet = true}) async {
|
|||
|
||||
final havenSeedStoreBoxKey =
|
||||
await getEncryptionKey(secureStorage: secureStorage, forKey: HavenSeedStore.boxKey);
|
||||
final havenSeedStore = await CakeHive.openBox<HavenSeedStore>(
|
||||
HavenSeedStore.boxName,
|
||||
final havenSeedStore = await CakeHive.openBox<HavenSeedStore>(HavenSeedStore.boxName,
|
||||
encryptionKey: havenSeedStoreBoxKey);
|
||||
|
||||
await initialSetup(
|
||||
|
@ -232,25 +232,26 @@ Future<void> initializeAppConfigs({bool loadWallet = true}) async {
|
|||
);
|
||||
}
|
||||
|
||||
Future<void> initialSetup(
|
||||
{required bool loadWallet,
|
||||
required SharedPreferences sharedPreferences,
|
||||
required Box<Node> nodes,
|
||||
required Box<Node> powNodes,
|
||||
required Box<WalletInfo> walletInfoSource,
|
||||
required Box<Contact> contactSource,
|
||||
required Box<Trade> tradesSource,
|
||||
required Box<Order> ordersSource,
|
||||
// required FiatConvertationService fiatConvertationService,
|
||||
required Box<Template> templates,
|
||||
required Box<ExchangeTemplate> exchangeTemplates,
|
||||
required Box<TransactionDescription> transactionDescriptions,
|
||||
required SecureStorage secureStorage,
|
||||
required Box<AnonpayInvoiceInfo> anonpayInvoiceInfo,
|
||||
required Box<UnspentCoinsInfo> unspentCoinsInfoSource,
|
||||
required Box<PayjoinSession> payjoinSessionSource,
|
||||
required Box<HavenSeedStore> havenSeedStore,
|
||||
int initialMigrationVersion = 15, }) async {
|
||||
Future<void> initialSetup({
|
||||
required bool loadWallet,
|
||||
required SharedPreferences sharedPreferences,
|
||||
required Box<Node> nodes,
|
||||
required Box<Node> powNodes,
|
||||
required Box<WalletInfo> walletInfoSource,
|
||||
required Box<Contact> contactSource,
|
||||
required Box<Trade> tradesSource,
|
||||
required Box<Order> ordersSource,
|
||||
// required FiatConvertationService fiatConvertationService,
|
||||
required Box<Template> templates,
|
||||
required Box<ExchangeTemplate> exchangeTemplates,
|
||||
required Box<TransactionDescription> transactionDescriptions,
|
||||
required SecureStorage secureStorage,
|
||||
required Box<AnonpayInvoiceInfo> anonpayInvoiceInfo,
|
||||
required Box<UnspentCoinsInfo> unspentCoinsInfoSource,
|
||||
required Box<PayjoinSession> payjoinSessionSource,
|
||||
required Box<HavenSeedStore> havenSeedStore,
|
||||
int initialMigrationVersion = 15,
|
||||
}) async {
|
||||
LanguageService.loadLocaleList();
|
||||
await defaultSettingsMigration(
|
||||
secureStorage: secureStorage,
|
||||
|
@ -289,50 +290,78 @@ class App extends StatefulWidget {
|
|||
AppState createState() => AppState();
|
||||
}
|
||||
|
||||
class AppState extends State<App> with SingleTickerProviderStateMixin {
|
||||
class AppState extends State<App> with SingleTickerProviderStateMixin, WidgetsBindingObserver {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
WidgetsBinding.instance.addObserver(this);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
WidgetsBinding.instance.removeObserver(this);
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
void didChangePlatformBrightness() {
|
||||
final appStore = getIt.get<AppStore>();
|
||||
if (appStore.themeStore.themeMode == ThemeMode.system) {
|
||||
final systemTheme = appStore.themeStore.getThemeFromSystem();
|
||||
if (appStore.themeStore.currentTheme != systemTheme) {
|
||||
appStore.themeStore.setTheme(systemTheme);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Observer(builder: (BuildContext context) {
|
||||
final appStore = getIt.get<AppStore>();
|
||||
final authService = getIt.get<AuthService>();
|
||||
final linkViewModel = getIt.get<LinkViewModel>();
|
||||
final settingsStore = appStore.settingsStore;
|
||||
final statusBarColor = Colors.transparent;
|
||||
final authenticationStore = getIt.get<AuthenticationStore>();
|
||||
final initialRoute = authenticationStore.state == AuthenticationState.uninitialized
|
||||
? Routes.welcome
|
||||
: Routes.login;
|
||||
final currentTheme = settingsStore.currentTheme;
|
||||
final statusBarBrightness =
|
||||
currentTheme.type == ThemeType.dark ? Brightness.light : Brightness.dark;
|
||||
final statusBarIconBrightness =
|
||||
currentTheme.type == ThemeType.dark ? Brightness.light : Brightness.dark;
|
||||
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
|
||||
statusBarColor: statusBarColor,
|
||||
statusBarBrightness: statusBarBrightness,
|
||||
statusBarIconBrightness: statusBarIconBrightness));
|
||||
return Observer(
|
||||
builder: (BuildContext context) {
|
||||
final appStore = getIt.get<AppStore>();
|
||||
final authService = getIt.get<AuthService>();
|
||||
final linkViewModel = getIt.get<LinkViewModel>();
|
||||
final statusBarColor = Colors.transparent;
|
||||
final authenticationStore = getIt.get<AuthenticationStore>();
|
||||
final initialRoute = authenticationStore.state == AuthenticationState.uninitialized
|
||||
? Routes.welcome
|
||||
: Routes.login;
|
||||
final currentTheme = appStore.themeStore.currentTheme;
|
||||
final statusBarBrightness = currentTheme.isDark ? Brightness.light : Brightness.dark;
|
||||
final statusBarIconBrightness = currentTheme.isDark ? Brightness.light : Brightness.dark;
|
||||
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
|
||||
statusBarColor: statusBarColor,
|
||||
statusBarBrightness: statusBarBrightness,
|
||||
statusBarIconBrightness: statusBarIconBrightness));
|
||||
|
||||
return Root(
|
||||
return Root(
|
||||
key: widget.key ?? rootKey,
|
||||
appStore: appStore,
|
||||
authenticationStore: authenticationStore,
|
||||
navigatorKey: navigatorKey,
|
||||
authService: authService,
|
||||
linkViewModel: linkViewModel,
|
||||
child: MaterialApp(
|
||||
navigatorObservers: [routeObserver],
|
||||
navigatorKey: navigatorKey,
|
||||
debugShowCheckedModeBanner: false,
|
||||
theme: settingsStore.theme,
|
||||
localizationsDelegates: localizationDelegates,
|
||||
supportedLocales: S.delegate.supportedLocales,
|
||||
locale: Locale(settingsStore.languageCode),
|
||||
onGenerateRoute: (settings) => Router.createRoute(settings),
|
||||
initialRoute: initialRoute,
|
||||
scrollBehavior: AppScrollBehavior(),
|
||||
home: _Home(),
|
||||
));
|
||||
});
|
||||
child: ThemeProvider(
|
||||
themeStore: appStore.themeStore,
|
||||
materialAppBuilder: (context, theme, darkTheme, themeMode) => MaterialApp(
|
||||
navigatorObservers: [routeObserver],
|
||||
navigatorKey: navigatorKey,
|
||||
debugShowCheckedModeBanner: false,
|
||||
theme: theme,
|
||||
darkTheme: darkTheme,
|
||||
themeMode: themeMode,
|
||||
localizationsDelegates: localizationDelegates,
|
||||
supportedLocales: S.delegate.supportedLocales,
|
||||
locale: Locale(appStore.settingsStore.languageCode),
|
||||
onGenerateRoute: (settings) => Router.createRoute(settings),
|
||||
initialRoute: initialRoute,
|
||||
scrollBehavior: AppScrollBehavior(),
|
||||
home: _Home(),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -392,11 +421,15 @@ class TopLevelErrorWidget extends StatelessWidget {
|
|||
children: [
|
||||
Text(
|
||||
'Error:\n${error.toString()}',
|
||||
style: TextStyle(fontSize: 22),
|
||||
style: Theme.of(context).textTheme.bodyLarge!.copyWith(
|
||||
fontSize: 22,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'Stack trace:\n${stackTrace.toString()}',
|
||||
style: TextStyle(fontSize: 16),
|
||||
style: Theme.of(context).textTheme.bodyMedium!.copyWith(
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
|
312
lib/router.dart
312
lib/router.dart
|
@ -1,3 +1,5 @@
|
|||
import 'dart:io';
|
||||
|
||||
import 'package:cake_wallet/anonpay/anonpay_info_base.dart';
|
||||
import 'package:cake_wallet/anonpay/anonpay_invoice_info.dart';
|
||||
import 'package:cake_wallet/core/new_wallet_arguments.dart';
|
||||
|
@ -160,7 +162,13 @@ Route<dynamic> createRoute(RouteSettings settings) {
|
|||
if (SettingsStoreBase.walletPasswordDirectInput) {
|
||||
return createRoute(RouteSettings(name: Routes.welcomePage));
|
||||
}
|
||||
return CupertinoPageRoute<void>(
|
||||
if (Platform.isIOS) return CupertinoPageRoute<void>(
|
||||
builder: (_) =>
|
||||
getIt.get<SetupPinCodePage>(param1: (PinCodeState<PinCodeWidget> context, dynamic _) {
|
||||
Navigator.of(context.context).pushNamed(Routes.welcomePage);
|
||||
}),
|
||||
fullscreenDialog: true);
|
||||
else return MaterialPageRoute<void>(
|
||||
builder: (_) =>
|
||||
getIt.get<SetupPinCodePage>(param1: (PinCodeState<PinCodeWidget> context, dynamic _) {
|
||||
Navigator.of(context.context).pushNamed(Routes.welcomePage);
|
||||
|
@ -182,26 +190,44 @@ Route<dynamic> createRoute(RouteSettings settings) {
|
|||
return createRoute(RouteSettings(name: Routes.newWalletType));
|
||||
|
||||
case Routes.newWalletType:
|
||||
return CupertinoPageRoute<void>(
|
||||
builder: (_) => getIt.get<NewWalletTypePage>(
|
||||
param1: NewWalletTypeArguments(
|
||||
onTypeSelected: (BuildContext context, WalletType type) =>
|
||||
Navigator.of(context).pushNamed(
|
||||
Routes.newWallet,
|
||||
arguments: NewWalletArguments(type: type),
|
||||
if (Platform.isIOS) {
|
||||
return CupertinoPageRoute<void>(
|
||||
builder: (_) => getIt.get<NewWalletTypePage>(
|
||||
param1: NewWalletTypeArguments(
|
||||
onTypeSelected: (BuildContext context, WalletType type) =>
|
||||
Navigator.of(context).pushNamed(
|
||||
Routes.newWallet,
|
||||
arguments: NewWalletArguments(type: type),
|
||||
),
|
||||
isCreate: true,
|
||||
isHardwareWallet: false,
|
||||
),
|
||||
isCreate: true,
|
||||
isHardwareWallet: false,
|
||||
),
|
||||
),
|
||||
);
|
||||
);
|
||||
} else {
|
||||
return MaterialPageRoute<void>(
|
||||
builder: (_) => getIt.get<NewWalletTypePage>(
|
||||
param1: NewWalletTypeArguments(
|
||||
onTypeSelected: (BuildContext context, WalletType type) =>
|
||||
Navigator.of(context).pushNamed(
|
||||
Routes.newWallet,
|
||||
arguments: NewWalletArguments(type: type),
|
||||
),
|
||||
isCreate: true,
|
||||
isHardwareWallet: false,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
case Routes.walletGroupsDisplayPage:
|
||||
final type = settings.arguments as WalletType;
|
||||
final walletGroupsDisplayVM = getIt.get<WalletGroupsDisplayViewModel>(param1: type);
|
||||
|
||||
return CupertinoPageRoute<void>(
|
||||
builder: (_) => WalletGroupsDisplayPage(walletGroupsDisplayVM));
|
||||
if (Platform.isIOS) return CupertinoPageRoute<void>(builder: (_) => WalletGroupsDisplayPage(walletGroupsDisplayVM));
|
||||
else return MaterialPageRoute<void>(builder: (_) => WalletGroupsDisplayPage(walletGroupsDisplayVM));
|
||||
|
||||
|
||||
case Routes.newWallet:
|
||||
final args = settings.arguments as NewWalletArguments;
|
||||
|
@ -209,7 +235,14 @@ Route<dynamic> createRoute(RouteSettings settings) {
|
|||
final walletNewVM = getIt.get<WalletNewVM>(param1: args);
|
||||
final seedSettingsViewModel = getIt.get<SeedSettingsViewModel>();
|
||||
|
||||
return CupertinoPageRoute<void>(
|
||||
if (Platform.isIOS) return CupertinoPageRoute<void>(
|
||||
builder: (_) => NewWalletPage(
|
||||
walletNewVM,
|
||||
seedSettingsViewModel,
|
||||
isChildWallet: args.isChildWallet,
|
||||
),
|
||||
);
|
||||
else return MaterialPageRoute<void>(
|
||||
builder: (_) => NewWalletPage(
|
||||
walletNewVM,
|
||||
seedSettingsViewModel,
|
||||
|
@ -234,16 +267,27 @@ Route<dynamic> createRoute(RouteSettings settings) {
|
|||
callback = settings.arguments as Function(PinCodeState<PinCodeWidget>, String);
|
||||
}
|
||||
|
||||
return CupertinoPageRoute<void>(
|
||||
builder: (_) => getIt.get<SetupPinCodePage>(param1: callback));
|
||||
if (Platform.isIOS) return CupertinoPageRoute<void>(builder: (_) => getIt.get<SetupPinCodePage>(param1: callback));
|
||||
else return MaterialPageRoute<void>(builder: (_) => getIt.get<SetupPinCodePage>(param1: callback));
|
||||
|
||||
case Routes.restoreWalletType:
|
||||
return CupertinoPageRoute<void>(
|
||||
if (Platform.isIOS) return CupertinoPageRoute<void>(
|
||||
builder: (_) => getIt.get<NewWalletTypePage>(
|
||||
param1: NewWalletTypeArguments(
|
||||
onTypeSelected: (BuildContext context, WalletType type) {
|
||||
final arg = {'walletType': type};
|
||||
Navigator.of(context).pushNamed(Routes.restoreWallet, arguments: arg);},
|
||||
Navigator.of(context).pushNamed(Routes.restoreWallet, arguments: arg);},
|
||||
isCreate: false,
|
||||
isHardwareWallet: false,
|
||||
),
|
||||
),
|
||||
);
|
||||
else return MaterialPageRoute<void>(
|
||||
builder: (_) => getIt.get<NewWalletTypePage>(
|
||||
param1: NewWalletTypeArguments(
|
||||
onTypeSelected: (BuildContext context, WalletType type) {
|
||||
final arg = {'walletType': type};
|
||||
Navigator.of(context).pushNamed(Routes.restoreWallet, arguments: arg);},
|
||||
isCreate: false,
|
||||
isHardwareWallet: false,
|
||||
),
|
||||
|
@ -256,15 +300,21 @@ Route<dynamic> createRoute(RouteSettings settings) {
|
|||
}
|
||||
|
||||
final isNewInstall = settings.arguments as bool;
|
||||
return CupertinoPageRoute<void>(
|
||||
fullscreenDialog: true,
|
||||
builder: (_) => getIt.get<RestoreOptionsPage>(param1: isNewInstall));
|
||||
if (Platform.isIOS) {
|
||||
return CupertinoPageRoute<void>(builder: (context) => getIt.get<RestoreOptionsPage>(param1: isNewInstall));
|
||||
} else {
|
||||
return MaterialPageRoute<void>(builder: (context) => getIt.get<RestoreOptionsPage>(param1: isNewInstall));
|
||||
}
|
||||
|
||||
case Routes.restoreWalletFromSeedKeys:
|
||||
if (isSingleCoin) {
|
||||
return CupertinoPageRoute<void>(
|
||||
builder: (_) => getIt.get<WalletRestorePage>(param1: availableWalletTypes.first));
|
||||
if (Platform.isIOS) {
|
||||
return CupertinoPageRoute<void>(builder: (context) => getIt.get<WalletRestorePage>(param1: availableWalletTypes.first));
|
||||
} else {
|
||||
return MaterialPageRoute<void>(builder: (context) => getIt.get<WalletRestorePage>(param1: availableWalletTypes.first));
|
||||
}
|
||||
}
|
||||
if (Platform.isIOS) {
|
||||
return CupertinoPageRoute<void>(
|
||||
builder: (_) => getIt.get<NewWalletTypePage>(
|
||||
param1: NewWalletTypeArguments(
|
||||
|
@ -276,6 +326,19 @@ Route<dynamic> createRoute(RouteSettings settings) {
|
|||
),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
return MaterialPageRoute<void>(
|
||||
builder: (_) => getIt.get<NewWalletTypePage>(
|
||||
param1: NewWalletTypeArguments(
|
||||
onTypeSelected: (BuildContext context, WalletType type) {
|
||||
final arg = {'walletType': type};
|
||||
Navigator.of(context).pushNamed(Routes.restoreWallet, arguments: arg);},
|
||||
isCreate: false,
|
||||
isHardwareWallet: false,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
case Routes.restoreWalletFromHardwareWallet:
|
||||
if (isSingleCoin) {
|
||||
|
@ -328,9 +391,11 @@ Route<dynamic> createRoute(RouteSettings settings) {
|
|||
);
|
||||
|
||||
case Routes.seed:
|
||||
return MaterialPageRoute<void>(
|
||||
fullscreenDialog: true,
|
||||
builder: (_) => getIt.get<WalletSeedPage>(param1: settings.arguments as bool));
|
||||
if (Platform.isIOS) {
|
||||
return CupertinoPageRoute<void>(builder: (context) => getIt.get<WalletSeedPage>(param1: settings.arguments as bool));
|
||||
} else {
|
||||
return MaterialPageRoute<void>(builder: (context) => getIt.get<WalletSeedPage>(param1: settings.arguments as bool));
|
||||
}
|
||||
|
||||
case Routes.restoreWallet:
|
||||
final args = settings.arguments as Map<String, dynamic>?;
|
||||
|
@ -356,24 +421,29 @@ Route<dynamic> createRoute(RouteSettings settings) {
|
|||
final initialPaymentRequest = args?['paymentRequest'] as PaymentRequest?;
|
||||
final coinTypeToSpendFrom = args?['coinTypeToSpendFrom'] as UnspentCoinType?;
|
||||
|
||||
return CupertinoPageRoute<void>(
|
||||
fullscreenDialog: true,
|
||||
builder: (_) => getIt.get<SendPage>(
|
||||
if (Platform.isIOS) {
|
||||
return CupertinoPageRoute<void>(builder: (context) => getIt.get<SendPage>(
|
||||
param1: initialPaymentRequest,
|
||||
param2: coinTypeToSpendFrom,
|
||||
),
|
||||
);
|
||||
));
|
||||
} else {
|
||||
return MaterialPageRoute<void>(builder: (context) => getIt.get<SendPage>(
|
||||
param1: initialPaymentRequest,
|
||||
param2: coinTypeToSpendFrom,
|
||||
));
|
||||
}
|
||||
|
||||
case Routes.sendTemplate:
|
||||
return CupertinoPageRoute<void>(
|
||||
fullscreenDialog: true, builder: (_) => getIt.get<SendTemplatePage>());
|
||||
|
||||
case Routes.receive:
|
||||
return CupertinoPageRoute<void>(builder: (_) => getIt.get<ReceivePage>());
|
||||
return CupertinoPageRoute<void>(builder: (context) => getIt.get<ReceivePage>());
|
||||
|
||||
case Routes.addressPage:
|
||||
return CupertinoPageRoute<void>(
|
||||
fullscreenDialog: true, builder: (_) => getIt.get<AddressPage>());
|
||||
if (Platform.isIOS) return CupertinoPageRoute<void>(builder: (context) => getIt.get<AddressPage>());
|
||||
else return MaterialPageRoute<void>(builder: (context) => getIt.get<AddressPage>());
|
||||
|
||||
|
||||
case Routes.transactionDetails:
|
||||
return CupertinoPageRoute<void>(
|
||||
|
@ -459,32 +529,41 @@ Route<dynamic> createRoute(RouteSettings settings) {
|
|||
onWillPop: () async => false));
|
||||
|
||||
case Routes.silentPaymentsSettings:
|
||||
return CupertinoPageRoute<void>(
|
||||
fullscreenDialog: true, builder: (_) => getIt.get<SilentPaymentsSettingsPage>());
|
||||
if (Platform.isIOS) return CupertinoPageRoute<void>(builder: (context) => getIt.get<SilentPaymentsSettingsPage>());
|
||||
else return MaterialPageRoute<void>(builder: (context) => getIt.get<SilentPaymentsSettingsPage>());
|
||||
|
||||
case Routes.mwebSettings:
|
||||
return CupertinoPageRoute<void>(
|
||||
fullscreenDialog: true, builder: (_) => getIt.get<MwebSettingsPage>());
|
||||
if (Platform.isIOS) return CupertinoPageRoute<void>(builder: (context) => getIt.get<MwebSettingsPage>());
|
||||
else return MaterialPageRoute<void>(builder: (context) => getIt.get<MwebSettingsPage>());
|
||||
|
||||
case Routes.mwebLogs:
|
||||
return CupertinoPageRoute<void>(
|
||||
fullscreenDialog: true, builder: (_) => getIt.get<MwebLogsPage>());
|
||||
if (Platform.isIOS) return CupertinoPageRoute<void>(builder: (context) => getIt.get<MwebLogsPage>());
|
||||
else return MaterialPageRoute<void>(builder: (context) => getIt.get<MwebLogsPage>());
|
||||
|
||||
case Routes.mwebNode:
|
||||
return CupertinoPageRoute<void>(
|
||||
fullscreenDialog: true, builder: (_) => getIt.get<MwebNodePage>());
|
||||
if (Platform.isIOS) return CupertinoPageRoute<void>(builder: (context) => getIt.get<MwebNodePage>());
|
||||
else return MaterialPageRoute<void>(builder: (context) => getIt.get<MwebNodePage>());
|
||||
|
||||
case Routes.connectionSync:
|
||||
return CupertinoPageRoute<void>(
|
||||
fullscreenDialog: true, builder: (_) => getIt.get<ConnectionSyncPage>());
|
||||
if (Platform.isIOS) {
|
||||
return CupertinoPageRoute<void>(builder: (context) => getIt.get<ConnectionSyncPage>());
|
||||
} else {
|
||||
return MaterialPageRoute<void>(builder: (context) => getIt.get<ConnectionSyncPage>());
|
||||
}
|
||||
|
||||
case Routes.securityBackupPage:
|
||||
return CupertinoPageRoute<void>(
|
||||
fullscreenDialog: true, builder: (_) => getIt.get<SecurityBackupPage>());
|
||||
if (Platform.isIOS) {
|
||||
return CupertinoPageRoute<void>(builder: (context) => getIt.get<SecurityBackupPage>());
|
||||
} else {
|
||||
return MaterialPageRoute<void>(builder: (context) => getIt.get<SecurityBackupPage>());
|
||||
}
|
||||
|
||||
case Routes.privacyPage:
|
||||
return CupertinoPageRoute<void>(
|
||||
fullscreenDialog: true, builder: (_) => getIt.get<PrivacyPage>());
|
||||
if (Platform.isIOS) {
|
||||
return CupertinoPageRoute<void>(builder: (context) => getIt.get<PrivacyPage>());
|
||||
} else {
|
||||
return MaterialPageRoute<void>(builder: (context) => getIt.get<PrivacyPage>());
|
||||
}
|
||||
|
||||
case Routes.trocadorProvidersPage:
|
||||
return CupertinoPageRoute<void>(
|
||||
|
@ -495,12 +574,18 @@ Route<dynamic> createRoute(RouteSettings settings) {
|
|||
fullscreenDialog: true, builder: (_) => getIt.get<DomainLookupsPage>());
|
||||
|
||||
case Routes.displaySettingsPage:
|
||||
return CupertinoPageRoute<void>(
|
||||
fullscreenDialog: true, builder: (_) => getIt.get<DisplaySettingsPage>());
|
||||
if (Platform.isIOS) {
|
||||
return CupertinoPageRoute<void>(builder: (context) => getIt.get<DisplaySettingsPage>());
|
||||
} else {
|
||||
return MaterialPageRoute<void>(builder: (context) => getIt.get<DisplaySettingsPage>());
|
||||
}
|
||||
|
||||
case Routes.otherSettingsPage:
|
||||
return CupertinoPageRoute<void>(
|
||||
fullscreenDialog: true, builder: (_) => getIt.get<OtherSettingsPage>());
|
||||
if (Platform.isIOS) {
|
||||
return CupertinoPageRoute<void>(builder: (context) => getIt.get<OtherSettingsPage>());
|
||||
} else {
|
||||
return MaterialPageRoute<void>(builder: (context) => getIt.get<OtherSettingsPage>());
|
||||
}
|
||||
|
||||
case Routes.newNode:
|
||||
final args = settings.arguments as Map<String, dynamic>?;
|
||||
|
@ -537,8 +622,12 @@ Route<dynamic> createRoute(RouteSettings settings) {
|
|||
getIt.get<NanoAccountEditOrCreatePage>(param1: settings.arguments as NanoAccount?));
|
||||
|
||||
case Routes.addressBook:
|
||||
return MaterialPageRoute<void>(
|
||||
fullscreenDialog: true, builder: (_) => getIt.get<ContactListPage>());
|
||||
if (Platform.isIOS) {
|
||||
return CupertinoPageRoute<void>(builder: (context) => getIt.get<ContactListPage>());
|
||||
} else {
|
||||
return MaterialPageRoute<void>(builder: (context) => getIt.get<ContactListPage>());
|
||||
}
|
||||
|
||||
|
||||
case Routes.pickerAddressBook:
|
||||
final selectedCurrency = settings.arguments as CryptoCurrency?;
|
||||
|
@ -549,12 +638,19 @@ Route<dynamic> createRoute(RouteSettings settings) {
|
|||
return MaterialPageRoute<void>(builder: (_) => getIt.get<AddressListPage>());
|
||||
|
||||
case Routes.addressBookAddContact:
|
||||
return CupertinoPageRoute<void>(
|
||||
builder: (_) => getIt.get<ContactPage>(param1: settings.arguments as ContactRecord?));
|
||||
if (Platform.isIOS) {
|
||||
return CupertinoPageRoute<void>(builder: (context) => getIt.get<ContactPage>(param1: settings.arguments as ContactRecord?));
|
||||
} else {
|
||||
return MaterialPageRoute<void>(builder: (context) => getIt.get<ContactPage>(param1: settings.arguments as ContactRecord?));
|
||||
}
|
||||
|
||||
|
||||
case Routes.showKeys:
|
||||
return MaterialPageRoute<void>(
|
||||
builder: (_) => getIt.get<WalletKeysPage>(), fullscreenDialog: true);
|
||||
if (Platform.isIOS) {
|
||||
return CupertinoPageRoute<void>(builder: (context) => getIt.get<WalletKeysPage>());
|
||||
} else {
|
||||
return MaterialPageRoute<void>(builder: (context) => getIt.get<WalletKeysPage>());
|
||||
}
|
||||
|
||||
case Routes.exchangeTrade:
|
||||
return CupertinoPageRoute<void>(builder: (_) => getIt.get<ExchangeTradePage>());
|
||||
|
@ -573,7 +669,11 @@ Route<dynamic> createRoute(RouteSettings settings) {
|
|||
|
||||
case Routes.buySellPage:
|
||||
final args = settings.arguments as bool;
|
||||
return MaterialPageRoute<void>(builder: (_) => getIt.get<BuySellPage>(param1: args));
|
||||
if (Platform.isIOS) {
|
||||
return CupertinoPageRoute<void>(builder: (context) => getIt.get<BuySellPage>(param1: args));
|
||||
} else {
|
||||
return MaterialPageRoute<void>(builder: (context) => getIt.get<BuySellPage>(param1: args));
|
||||
}
|
||||
|
||||
case Routes.buyOptionsPage:
|
||||
final args = settings.arguments as List;
|
||||
|
@ -590,10 +690,12 @@ Route<dynamic> createRoute(RouteSettings settings) {
|
|||
fullscreenDialog: true, builder: (_) => getIt.get<BuyWebViewPage>(param1: args));
|
||||
|
||||
case Routes.exchange:
|
||||
return CupertinoPageRoute<void>(
|
||||
fullscreenDialog: true,
|
||||
builder: (_) => getIt.get<ExchangePage>(param1: settings.arguments as PaymentRequest?),
|
||||
);
|
||||
if (Platform.isIOS) {
|
||||
return CupertinoPageRoute<void>(builder: (context) => getIt.get<ExchangePage>(param1: settings.arguments as PaymentRequest?));
|
||||
} else {
|
||||
return MaterialPageRoute<void>(builder: (context) => getIt.get<ExchangePage>(param1: settings.arguments as PaymentRequest?));
|
||||
}
|
||||
|
||||
|
||||
case Routes.exchangeTemplate:
|
||||
return CupertinoPageRoute<void>(builder: (_) => getIt.get<ExchangeTemplatePage>());
|
||||
|
@ -615,8 +717,11 @@ Route<dynamic> createRoute(RouteSettings settings) {
|
|||
builder: (_) => getIt.get<TransactionSuccessPage>(param1: settings.arguments as String));
|
||||
|
||||
case Routes.backup:
|
||||
return CupertinoPageRoute<void>(
|
||||
fullscreenDialog: true, builder: (_) => getIt.get<BackupPage>());
|
||||
if (Platform.isIOS) {
|
||||
return CupertinoPageRoute<void>(builder: (context) => getIt.get<BackupPage>());
|
||||
} else {
|
||||
return MaterialPageRoute<void>(builder: (context) => getIt.get<BackupPage>());
|
||||
}
|
||||
|
||||
case Routes.editBackupPassword:
|
||||
return CupertinoPageRoute<void>(builder: (_) => getIt.get<EditBackupPasswordPage>());
|
||||
|
@ -626,15 +731,21 @@ Route<dynamic> createRoute(RouteSettings settings) {
|
|||
fullscreenDialog: true, builder: (_) => getIt.get<RestoreFromBackupPage>());
|
||||
|
||||
case Routes.support:
|
||||
return CupertinoPageRoute<void>(
|
||||
fullscreenDialog: true, builder: (_) => getIt.get<SupportPage>());
|
||||
if (Platform.isIOS) {
|
||||
return CupertinoPageRoute<void>(builder: (context) => getIt.get<SupportPage>());
|
||||
} else {
|
||||
return MaterialPageRoute<void>(builder: (context) => getIt.get<SupportPage>());
|
||||
}
|
||||
|
||||
case Routes.supportLiveChat:
|
||||
return CupertinoPageRoute<void>(builder: (_) => getIt.get<SupportChatPage>());
|
||||
|
||||
case Routes.supportOtherLinks:
|
||||
return CupertinoPageRoute<void>(
|
||||
fullscreenDialog: true, builder: (_) => getIt.get<SupportOtherLinksPage>());
|
||||
if (Platform.isIOS) {
|
||||
return CupertinoPageRoute<void>(builder: (context) => getIt.get<SupportOtherLinksPage>());
|
||||
} else {
|
||||
return MaterialPageRoute<void>(builder: (context) => getIt.get<SupportOtherLinksPage>());
|
||||
}
|
||||
|
||||
case Routes.unspentCoinsList:
|
||||
final coinTypeToSpendFrom = settings.arguments as UnspentCoinType?;
|
||||
|
@ -654,29 +765,32 @@ Route<dynamic> createRoute(RouteSettings settings) {
|
|||
));
|
||||
|
||||
case Routes.cakePayCardsPage:
|
||||
return CupertinoPageRoute<void>(builder: (_) => getIt.get<CakePayCardsPage>());
|
||||
if (Platform.isIOS) return CupertinoPageRoute<void>(builder: (context) => getIt.get<CakePayCardsPage>());
|
||||
else return MaterialPageRoute<void>(builder: (context) => getIt.get<CakePayCardsPage>());
|
||||
|
||||
|
||||
case Routes.cakePayBuyCardPage:
|
||||
final args = settings.arguments as List;
|
||||
return CupertinoPageRoute<void>(builder: (_) => getIt.get<CakePayBuyCardPage>(param1: args));
|
||||
if (Platform.isIOS) return CupertinoPageRoute<void>(builder: (_) => getIt.get<CakePayBuyCardPage>(param1: args));
|
||||
else return MaterialPageRoute<void>(builder: (_) => getIt.get<CakePayBuyCardPage>(param1: args));
|
||||
|
||||
case Routes.cakePayBuyCardDetailPage:
|
||||
final args = settings.arguments as List;
|
||||
return CupertinoPageRoute<void>(
|
||||
builder: (_) => getIt.get<CakePayBuyCardDetailPage>(param1: args));
|
||||
if (Platform.isIOS) return CupertinoPageRoute<void>(builder: (_) => getIt.get<CakePayBuyCardDetailPage>(param1: args));
|
||||
else return MaterialPageRoute<void>(builder: (_) => getIt.get<CakePayBuyCardDetailPage>(param1: args));
|
||||
|
||||
case Routes.cakePayWelcomePage:
|
||||
return CupertinoPageRoute<void>(
|
||||
builder: (_) => getIt.get<CakePayWelcomePage>(),
|
||||
);
|
||||
if (Platform.isIOS) return CupertinoPageRoute<void>(builder: (_) => getIt.get<CakePayWelcomePage>(),);
|
||||
else return MaterialPageRoute<void>(builder: (_) => getIt.get<CakePayWelcomePage>(),);
|
||||
|
||||
case Routes.cakePayVerifyOtpPage:
|
||||
final args = settings.arguments as List;
|
||||
return CupertinoPageRoute<void>(
|
||||
builder: (_) => getIt.get<CakePayVerifyOtpPage>(param1: args));
|
||||
if (Platform.isIOS) return CupertinoPageRoute<void>(builder: (_) => getIt.get<CakePayVerifyOtpPage>(param1: args));
|
||||
else return MaterialPageRoute<void>(builder: (_) => getIt.get<CakePayVerifyOtpPage>(param1: args));
|
||||
|
||||
case Routes.cakePayAccountPage:
|
||||
return CupertinoPageRoute<void>(builder: (_) => getIt.get<CakePayAccountPage>());
|
||||
if (Platform.isIOS) return CupertinoPageRoute<void>(builder: (_) => getIt.get<CakePayAccountPage>());
|
||||
else return MaterialPageRoute<void>(builder: (_) => getIt.get<CakePayAccountPage>());
|
||||
|
||||
case Routes.webViewPage:
|
||||
final args = settings.arguments as List;
|
||||
|
@ -694,17 +808,28 @@ Route<dynamic> createRoute(RouteSettings settings) {
|
|||
final toggleTestnet = args['toggleTestnet'] as Function(bool? val);
|
||||
final restoredWallet = args['restoredWallet'] as RestoredWallet?;
|
||||
|
||||
return CupertinoPageRoute<void>(
|
||||
if (Platform.isIOS) return CupertinoPageRoute<void>(
|
||||
builder: (_) => AdvancedPrivacySettingsPage(
|
||||
isFromRestore: isFromRestore,
|
||||
isChildWallet: isChildWallet,
|
||||
useTestnet: useTestnet,
|
||||
toggleUseTestnet: toggleTestnet,
|
||||
advancedPrivacySettingsViewModel:
|
||||
getIt.get<AdvancedPrivacySettingsViewModel>(param1: type),
|
||||
nodeViewModel: getIt.get<NodeCreateOrEditViewModel>(param1: type, param2: false),
|
||||
seedSettingsViewModel: getIt.get<SeedSettingsViewModel>(),
|
||||
));
|
||||
isFromRestore: isFromRestore,
|
||||
isChildWallet: isChildWallet,
|
||||
useTestnet: useTestnet,
|
||||
toggleUseTestnet: toggleTestnet,
|
||||
advancedPrivacySettingsViewModel:
|
||||
getIt.get<AdvancedPrivacySettingsViewModel>(param1: type),
|
||||
nodeViewModel: getIt.get<NodeCreateOrEditViewModel>(param1: type, param2: false),
|
||||
seedSettingsViewModel: getIt.get<SeedSettingsViewModel>(),
|
||||
));
|
||||
else return MaterialPageRoute<void>(
|
||||
builder: (_) => AdvancedPrivacySettingsPage(
|
||||
isFromRestore: isFromRestore,
|
||||
isChildWallet: isChildWallet,
|
||||
useTestnet: useTestnet,
|
||||
toggleUseTestnet: toggleTestnet,
|
||||
advancedPrivacySettingsViewModel:
|
||||
getIt.get<AdvancedPrivacySettingsViewModel>(param1: type),
|
||||
nodeViewModel: getIt.get<NodeCreateOrEditViewModel>(param1: type, param2: false),
|
||||
seedSettingsViewModel: getIt.get<SeedSettingsViewModel>(),
|
||||
));
|
||||
|
||||
case Routes.anonPayInvoicePage:
|
||||
final args = settings.arguments as List;
|
||||
|
@ -842,8 +967,11 @@ Route<dynamic> createRoute(RouteSettings settings) {
|
|||
return MaterialPageRoute<void>(builder: (_) => getIt.get<ExchangeTradeExternalSendPage>(),);
|
||||
|
||||
case Routes.backgroundSync:
|
||||
return CupertinoPageRoute<void>(
|
||||
fullscreenDialog: true, builder: (_) => getIt.get<BackgroundSyncPage>());
|
||||
if (Platform.isIOS) {
|
||||
return CupertinoPageRoute<void>(builder: (context) => getIt.get<BackgroundSyncPage>());
|
||||
} else {
|
||||
return MaterialPageRoute<void>(builder: (context) => getIt.get<BackgroundSyncPage>());
|
||||
}
|
||||
case Routes.devMoneroBackgroundSync:
|
||||
return MaterialPageRoute<void>(
|
||||
builder: (_) => getIt.get<DevMoneroBackgroundSyncPage>(),
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import 'package:cake_wallet/src/screens/base_page.dart';
|
||||
import 'package:cake_wallet/src/widgets/cake_image_widget.dart';
|
||||
import 'package:cake_wallet/src/widgets/gradient_background.dart';
|
||||
import 'package:cake_wallet/src/widgets/primary_button.dart';
|
||||
import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
|
||||
import 'package:cake_wallet/themes/theme_base.dart';
|
||||
import 'package:cake_wallet/utils/responsive_layout_util.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
|
@ -14,9 +14,6 @@ abstract class InfoPage extends BasePage {
|
|||
final String imageLightPath;
|
||||
final String imageDarkPath;
|
||||
|
||||
Image get imageLight => Image.asset(imageLightPath);
|
||||
Image get imageDark => Image.asset(imageDarkPath);
|
||||
|
||||
bool get onWillPop => true;
|
||||
String get pageTitle;
|
||||
String get pageDescription;
|
||||
|
@ -24,6 +21,13 @@ abstract class InfoPage extends BasePage {
|
|||
Key? get buttonKey;
|
||||
void Function(BuildContext) get onPressed;
|
||||
|
||||
@override
|
||||
bool get gradientBackground => true;
|
||||
|
||||
@override
|
||||
Widget Function(BuildContext, Widget) get rootWrapper =>
|
||||
(BuildContext context, Widget scaffold) => GradientBackground(scaffold: scaffold);
|
||||
|
||||
@override
|
||||
Widget? leading(BuildContext context) => null;
|
||||
|
||||
|
@ -32,10 +36,10 @@ abstract class InfoPage extends BasePage {
|
|||
|
||||
@override
|
||||
Widget body(BuildContext context) {
|
||||
final image = currentTheme.type == ThemeType.dark ? imageDark : imageLight;
|
||||
final image = currentTheme.isDark ? imageDarkPath : imageLightPath;
|
||||
|
||||
return WillPopScope(
|
||||
onWillPop: () async => onWillPop,
|
||||
return PopScope(
|
||||
canPop: onWillPop,
|
||||
child: Container(
|
||||
alignment: Alignment.center,
|
||||
padding: EdgeInsets.all(24),
|
||||
|
@ -47,8 +51,13 @@ abstract class InfoPage extends BasePage {
|
|||
children: <Widget>[
|
||||
Expanded(
|
||||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(maxHeight: MediaQuery.of(context).size.height * 0.3),
|
||||
child: AspectRatio(aspectRatio: 1, child: image),
|
||||
constraints: BoxConstraints(
|
||||
maxHeight: MediaQuery.of(context).size.height * 0.3,
|
||||
),
|
||||
child: AspectRatio(
|
||||
aspectRatio: 0.9,
|
||||
child: CakeImageWidget(imageUrl: image),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
|
@ -57,12 +66,7 @@ abstract class InfoPage extends BasePage {
|
|||
child: Text(
|
||||
pageDescription,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
height: 1.7,
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Theme.of(context).extension<CakeTextTheme>()!.secondaryTextColor,
|
||||
),
|
||||
style: Theme.of(context).textTheme.bodyMedium?.copyWith(height: 1.6),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -70,8 +74,8 @@ abstract class InfoPage extends BasePage {
|
|||
key: buttonKey,
|
||||
onPressed: () => onPressed(context),
|
||||
text: buttonText,
|
||||
color: Theme.of(context).primaryColor,
|
||||
textColor: Colors.white,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
textColor: Theme.of(context).colorScheme.onPrimary,
|
||||
),
|
||||
],
|
||||
),
|
||||
|
|
|
@ -56,7 +56,7 @@ class _AnonpayDetailsPageBodyState extends State<AnonpayDetailsPageBody> {
|
|||
id: item.id,
|
||||
create: item.createdAt,
|
||||
pair: item.pair,
|
||||
currentTheme: widget.anonpayDetailsViewModel.settingsStore.currentTheme.type,
|
||||
currentTheme: widget.anonpayDetailsViewModel.themeStore.currentTheme.type,
|
||||
onTap: item.onTap,
|
||||
);
|
||||
}
|
||||
|
|
|
@ -22,9 +22,7 @@ abstract class AuthPageState<T extends StatefulWidget> extends State<T> {
|
|||
}
|
||||
|
||||
class AuthPage extends StatefulWidget {
|
||||
AuthPage(this.authViewModel,
|
||||
{required this.onAuthenticationFinished,
|
||||
this.closable = true});
|
||||
AuthPage(this.authViewModel, {required this.onAuthenticationFinished, this.closable = true});
|
||||
|
||||
final AuthViewModel authViewModel;
|
||||
final OnAuthenticationFinished onAuthenticationFinished;
|
||||
|
@ -37,16 +35,14 @@ class AuthPage extends StatefulWidget {
|
|||
class AuthPagePinCodeStateImpl extends AuthPageState<AuthPage> {
|
||||
final _key = GlobalKey<ScaffoldState>();
|
||||
final _pinCodeKey = GlobalKey<PinCodeState>();
|
||||
final _backArrowImageDarkTheme =
|
||||
Image.asset('assets/images/close_button.png');
|
||||
final _backArrowImageDarkTheme = Image.asset('assets/images/close_button.png');
|
||||
ReactionDisposer? _reaction;
|
||||
Flushbar<void>? _authBar;
|
||||
Flushbar<void>? _progressBar;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
_reaction ??=
|
||||
reaction((_) => widget.authViewModel.state, (ExecutionState state) {
|
||||
_reaction ??= reaction((_) => widget.authViewModel.state, (ExecutionState state) {
|
||||
if (state is ExecutedSuccessfullyState) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
widget.onAuthenticationFinished(true, this);
|
||||
|
@ -55,20 +51,20 @@ class AuthPagePinCodeStateImpl extends AuthPageState<AuthPage> {
|
|||
}
|
||||
|
||||
if (state is IsExecutingState) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
// null duration to make it indefinite until its disposed
|
||||
_authBar =
|
||||
createBar<void>(S.of(context).authentication, duration: null)
|
||||
..show(context);
|
||||
});
|
||||
WidgetsBinding.instance.addPostFrameCallback(
|
||||
(_) {
|
||||
// null duration to make it indefinite until its disposed
|
||||
_authBar = createBar<void>(S.of(context).authentication, context, duration: null)
|
||||
..show(context);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
if (state is FailureState) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
||||
_pinCodeKey.currentState?.clear();
|
||||
dismissFlushBar(_authBar);
|
||||
showBar<void>(
|
||||
context, S.of(context).failed_authentication(state.error));
|
||||
showBar<void>(context, S.of(context).failed_authentication(state.error));
|
||||
widget.onAuthenticationFinished(false, this);
|
||||
});
|
||||
}
|
||||
|
@ -77,14 +73,12 @@ class AuthPagePinCodeStateImpl extends AuthPageState<AuthPage> {
|
|||
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
||||
_pinCodeKey.currentState?.clear();
|
||||
dismissFlushBar(_authBar);
|
||||
showBar<void>(
|
||||
context, S.of(context).failed_authentication(state.error));
|
||||
showBar<void>(context, S.of(context).failed_authentication(state.error));
|
||||
widget.onAuthenticationFinished(false, this);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
if (widget.authViewModel.isBiometricalAuthenticationAllowed) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
||||
await Future<void>.delayed(Duration(milliseconds: 100));
|
||||
|
@ -95,8 +89,8 @@ class AuthPagePinCodeStateImpl extends AuthPageState<AuthPage> {
|
|||
super.initState();
|
||||
}
|
||||
|
||||
Future<void> _showSeedsPopup(BuildContext context, String message) async {
|
||||
await showPopUp<void>(
|
||||
Future<void> _showSeedsPopup(BuildContext context, String message) async {
|
||||
await showPopUp<void>(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertWithTwoActions(
|
||||
|
@ -109,8 +103,8 @@ class AuthPagePinCodeStateImpl extends AuthPageState<AuthPage> {
|
|||
},
|
||||
actionRightButton: () => Navigator.of(context).pop(),
|
||||
);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
|
@ -121,8 +115,7 @@ class AuthPagePinCodeStateImpl extends AuthPageState<AuthPage> {
|
|||
@override
|
||||
void changeProcessText(String text) {
|
||||
dismissFlushBar(_authBar);
|
||||
_progressBar = createBar<void>(text, duration: null)
|
||||
..show(_key.currentContext!);
|
||||
_progressBar = createBar<void>(text,context, duration: null)..show(_key.currentContext!);
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -163,15 +156,15 @@ class AuthPagePinCodeStateImpl extends AuthPageState<AuthPage> {
|
|||
width: 37,
|
||||
child: InkWell(
|
||||
onTap: () => Navigator.of(context).pop(),
|
||||
child: _backArrowImageDarkTheme,
|
||||
child: _backArrowImageDarkTheme,
|
||||
),
|
||||
))
|
||||
: Container(),
|
||||
backgroundColor: Theme.of(context).colorScheme.background,
|
||||
backgroundColor: Theme.of(context).colorScheme.surface,
|
||||
border: null),
|
||||
resizeToAvoidBottomInset: false,
|
||||
body: PinCode((pin, _) => widget.authViewModel.auth(password: pin),
|
||||
(_) => null, widget.authViewModel.pinLength, false, _pinCodeKey));
|
||||
body: PinCode((pin, _) => widget.authViewModel.auth(password: pin), (_) => null,
|
||||
widget.authViewModel.pinLength, false, _pinCodeKey));
|
||||
}
|
||||
|
||||
void dismissFlushBar(Flushbar<dynamic>? bar) {
|
||||
|
|
|
@ -5,7 +5,6 @@ import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart';
|
|||
import 'package:cake_wallet/src/widgets/primary_button.dart';
|
||||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
import 'package:cake_wallet/routes.dart';
|
||||
import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
|
||||
import 'package:cake_wallet/utils/clipboard_util.dart';
|
||||
import 'package:cake_wallet/utils/exception_handler.dart';
|
||||
import 'package:cake_wallet/utils/share_util.dart';
|
||||
|
@ -31,65 +30,72 @@ class BackupPage extends BasePage {
|
|||
fit: StackFit.expand,
|
||||
children: [
|
||||
Center(
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(left: 24, right: 24),
|
||||
height: 300,
|
||||
child: Column(children: [
|
||||
Text(
|
||||
S.of(context).backup_password + ':',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(fontSize: 30),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 20, bottom: 10),
|
||||
child: Observer(
|
||||
builder: (_) => GestureDetector(
|
||||
onTap: () {
|
||||
ClipboardUtil.setSensitiveDataToClipboard(
|
||||
ClipboardData(
|
||||
text: backupViewModelBase
|
||||
.backupPassword));
|
||||
showBar<void>(
|
||||
context,
|
||||
S.of(context).transaction_details_copied(
|
||||
S.of(context).backup_password));
|
||||
},
|
||||
child: Text(
|
||||
backupViewModelBase.backupPassword,
|
||||
style: TextStyle(fontSize: 26),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
))),
|
||||
Padding(
|
||||
padding: EdgeInsets.all(20),
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(left: 24, right: 24),
|
||||
height: 300,
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
S.of(context).backup_password + ':',
|
||||
textAlign: TextAlign.center,
|
||||
style: Theme.of(context).textTheme.headlineMedium,
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 20, bottom: 10),
|
||||
child: Observer(
|
||||
builder: (_) => GestureDetector(
|
||||
onTap: () {
|
||||
ClipboardUtil.setSensitiveDataToClipboard(
|
||||
ClipboardData(text: backupViewModelBase.backupPassword),
|
||||
);
|
||||
showBar<void>(
|
||||
context,
|
||||
S.of(context).transaction_details_copied(S.of(context).backup_password),
|
||||
);
|
||||
},
|
||||
child: Text(
|
||||
S.of(context).write_down_backup_password,
|
||||
style: TextStyle(fontSize: 14, color: Colors.grey),
|
||||
backupViewModelBase.backupPassword,
|
||||
style: Theme.of(context).textTheme.titleLarge,
|
||||
textAlign: TextAlign.center,
|
||||
))
|
||||
]))),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.all(20),
|
||||
child: Text(
|
||||
S.of(context).write_down_backup_password,
|
||||
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
child: Column(children: [
|
||||
PrimaryButton(
|
||||
onPressed: () =>
|
||||
Navigator.of(context).pushNamed(Routes.editBackupPassword),
|
||||
text: S.of(context).change_password,
|
||||
color: Theme.of(context).cardColor,
|
||||
textColor: Theme.of(context)
|
||||
.extension<CakeTextTheme>()!
|
||||
.buttonTextColor,
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
Observer(
|
||||
builder: (_) => LoadingPrimaryButton(
|
||||
isLoading: backupViewModelBase.state is IsExecutingState,
|
||||
onPressed: () => onExportBackup(context),
|
||||
text: S.of(context).export_backup,
|
||||
color: Theme.of(context).primaryColor,
|
||||
textColor: Colors.white,
|
||||
child: Column(
|
||||
children: [
|
||||
PrimaryButton(
|
||||
onPressed: () => Navigator.of(context).pushNamed(Routes.editBackupPassword),
|
||||
text: S.of(context).change_password,
|
||||
color: Theme.of(context).colorScheme.surfaceContainer,
|
||||
textColor: Theme.of(context).colorScheme.onSecondaryContainer,
|
||||
),
|
||||
),
|
||||
]),
|
||||
const SizedBox(height: 10),
|
||||
Observer(
|
||||
builder: (_) => LoadingPrimaryButton(
|
||||
isLoading: backupViewModelBase.state is IsExecutingState,
|
||||
onPressed: () => onExportBackup(context),
|
||||
text: S.of(context).export_backup,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
textColor: Theme.of(context).colorScheme.onPrimary,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
bottom: 24,
|
||||
left: 24,
|
||||
right: 24,
|
||||
|
@ -100,31 +106,33 @@ class BackupPage extends BasePage {
|
|||
|
||||
void onExportBackup(BuildContext context) {
|
||||
showPopUp<void>(
|
||||
context: context,
|
||||
builder: (dialogContext) {
|
||||
return AlertWithTwoActions(
|
||||
alertTitle: S.of(context).export_backup,
|
||||
alertContent: S.of(context).save_backup_password,
|
||||
rightButtonText: S.of(context).seed_alert_yes,
|
||||
leftButtonText: S.of(context).seed_alert_back,
|
||||
actionRightButton: () async {
|
||||
Navigator.of(dialogContext).pop();
|
||||
final backup = await backupViewModelBase.exportBackup();
|
||||
context: context,
|
||||
builder: (dialogContext) {
|
||||
return AlertWithTwoActions(
|
||||
alertTitle: S.of(context).export_backup,
|
||||
alertContent: S.of(context).save_backup_password,
|
||||
rightButtonText: S.of(context).seed_alert_yes,
|
||||
leftButtonText: S.of(context).seed_alert_back,
|
||||
actionRightButton: () async {
|
||||
Navigator.of(dialogContext).pop();
|
||||
final backup = await backupViewModelBase.exportBackup();
|
||||
|
||||
if (backup == null) {
|
||||
return;
|
||||
}
|
||||
if (backup == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (Platform.isAndroid) {
|
||||
onExportAndroid(context, backup);
|
||||
} else if (Platform.isIOS) {
|
||||
await share(backup, context);
|
||||
} else {
|
||||
await _saveFile(backup);
|
||||
}
|
||||
},
|
||||
actionLeftButton: () => Navigator.of(dialogContext).pop());
|
||||
});
|
||||
if (Platform.isAndroid) {
|
||||
onExportAndroid(context, backup);
|
||||
} else if (Platform.isIOS) {
|
||||
await share(backup, context);
|
||||
} else {
|
||||
await _saveFile(backup);
|
||||
}
|
||||
},
|
||||
actionLeftButton: () => Navigator.of(dialogContext).pop(),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
void onExportAndroid(BuildContext context, BackupExportFile backup) {
|
||||
|
@ -137,8 +145,7 @@ class BackupPage extends BasePage {
|
|||
rightButtonText: S.of(context).save_to_downloads,
|
||||
leftButtonText: S.of(context).share,
|
||||
actionRightButton: () async {
|
||||
await backupViewModelBase.saveToDownload(
|
||||
backup.name, backup.file);
|
||||
await backupViewModelBase.saveToDownload(backup.name, backup.file);
|
||||
Navigator.of(dialogContext).pop();
|
||||
await showBar<void>(context, S.of(context).file_saved);
|
||||
},
|
||||
|
@ -151,15 +158,13 @@ class BackupPage extends BasePage {
|
|||
|
||||
Future<void> share(BackupExportFile backup, BuildContext context) async {
|
||||
final path = await backupViewModelBase.saveBackupFileLocally(backup);
|
||||
await ShareUtil.shareFile(
|
||||
filePath: path, fileName: backup.name, context: context);
|
||||
await ShareUtil.shareFile(filePath: path, fileName: backup.name, context: context);
|
||||
await backupViewModelBase.removeBackupFileLocally(backup);
|
||||
}
|
||||
|
||||
Future<void> _saveFile(BackupExportFile backup) async {
|
||||
String? outputFile = await FilePicker.platform.saveFile(
|
||||
dialogTitle: 'Save Your File to desired location',
|
||||
fileName: backup.name);
|
||||
String? outputFile = await FilePicker.platform
|
||||
.saveFile(dialogTitle: 'Save Your File to desired location', fileName: backup.name);
|
||||
|
||||
try {
|
||||
await backup.file.copy(outputFile!);
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import 'package:cake_wallet/src/widgets/base_text_form_field.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_mobx/flutter_mobx.dart';
|
||||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
|
@ -6,14 +7,13 @@ import 'package:cake_wallet/src/screens/base_page.dart';
|
|||
import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart';
|
||||
import 'package:cake_wallet/src/widgets/primary_button.dart';
|
||||
import 'package:cake_wallet/view_model/edit_backup_password_view_model.dart';
|
||||
import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
|
||||
|
||||
class EditBackupPasswordPage extends BasePage {
|
||||
EditBackupPasswordPage(this.editBackupPasswordViewModel)
|
||||
: textEditingController = TextEditingController() {
|
||||
textEditingController.text = editBackupPasswordViewModel.backupPassword;
|
||||
textEditingController.addListener(() => editBackupPasswordViewModel
|
||||
.backupPassword = textEditingController.text);
|
||||
textEditingController
|
||||
.addListener(() => editBackupPasswordViewModel.backupPassword = textEditingController.text);
|
||||
}
|
||||
|
||||
final EditBackupPasswordViewModel editBackupPasswordViewModel;
|
||||
|
@ -25,34 +25,41 @@ class EditBackupPasswordPage extends BasePage {
|
|||
@override
|
||||
Widget body(BuildContext context) {
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(left: 24, right: 24),
|
||||
child: Stack(
|
||||
fit: StackFit.expand,
|
||||
children: [
|
||||
Center(
|
||||
child: Observer(
|
||||
builder: (_) => TextFormField(
|
||||
autofocus: true,
|
||||
enableSuggestions: false,
|
||||
autocorrect: false,
|
||||
keyboardType: TextInputType.visiblePassword,
|
||||
controller: textEditingController,
|
||||
style: TextStyle(
|
||||
fontSize: 26,
|
||||
color: Theme.of(context).extension<CakeTextTheme>()!.titleColor)))),
|
||||
Positioned(
|
||||
child: Observer(
|
||||
builder: (_) => PrimaryButton(
|
||||
onPressed: () => onSave(context),
|
||||
text: S.of(context).save,
|
||||
color: Theme.of(context).primaryColor,
|
||||
textColor: Colors.white,
|
||||
isDisabled: !editBackupPasswordViewModel.canSave)),
|
||||
bottom: 24,
|
||||
left: 0,
|
||||
right: 0)
|
||||
],
|
||||
));
|
||||
padding: EdgeInsets.only(left: 24, right: 24),
|
||||
child: Stack(
|
||||
fit: StackFit.expand,
|
||||
children: [
|
||||
Center(
|
||||
child: Observer(
|
||||
builder: (_) => BaseTextFormField(
|
||||
autofocus: true,
|
||||
enableSuggestions: false,
|
||||
autocorrect: false,
|
||||
keyboardType: TextInputType.visiblePassword,
|
||||
controller: textEditingController,
|
||||
textStyle: Theme.of(context).textTheme.titleLarge?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
child: Observer(
|
||||
builder: (_) => PrimaryButton(
|
||||
onPressed: () => onSave(context),
|
||||
text: S.of(context).save,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
textColor: Theme.of(context).colorScheme.onPrimary,
|
||||
isDisabled: !editBackupPasswordViewModel.canSave,
|
||||
),
|
||||
),
|
||||
bottom: 24,
|
||||
left: 0,
|
||||
right: 0,
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void onSave(BuildContext context) {
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import 'package:cake_wallet/themes/theme_base.dart';
|
||||
import 'package:cake_wallet/themes/core/material_base_theme.dart';
|
||||
import 'package:cake_wallet/themes/core/theme_store.dart';
|
||||
import 'package:cake_wallet/utils/route_aware.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:cake_wallet/di.dart';
|
||||
import 'package:cake_wallet/store/settings_store.dart';
|
||||
import 'package:cake_wallet/src/widgets/nav_bar.dart';
|
||||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
|
||||
|
@ -14,8 +14,7 @@ abstract class BasePage extends StatelessWidget {
|
|||
final GlobalKey<ScaffoldState> _scaffoldKey;
|
||||
|
||||
final Image closeButtonImage = Image.asset('assets/images/close_button.png');
|
||||
final Image closeButtonImageDarkTheme =
|
||||
Image.asset('assets/images/close_button_dark_theme.png');
|
||||
final Image closeButtonImageDarkTheme = Image.asset('assets/images/close_button_dark_theme.png');
|
||||
|
||||
String? get title => null;
|
||||
|
||||
|
@ -45,30 +44,22 @@ abstract class BasePage extends StatelessWidget {
|
|||
|
||||
Widget Function(BuildContext, Widget)? get rootWrapper => null;
|
||||
|
||||
ThemeBase get currentTheme => getIt.get<SettingsStore>().currentTheme;
|
||||
MaterialThemeBase get currentTheme => getIt.get<ThemeStore>().currentTheme;
|
||||
|
||||
void onOpenEndDrawer() => _scaffoldKey.currentState!.openEndDrawer();
|
||||
|
||||
void onClose(BuildContext context) => Navigator.of(context).pop();
|
||||
|
||||
Color pageBackgroundColor(BuildContext context) =>
|
||||
(currentTheme.type == ThemeType.dark
|
||||
? backgroundDarkColor
|
||||
: backgroundLightColor) ??
|
||||
(gradientBackground && currentTheme.type == ThemeType.bright
|
||||
? Colors.transparent
|
||||
: Theme.of(context).colorScheme.background);
|
||||
(currentTheme.isDark ? backgroundDarkColor : backgroundLightColor) ??
|
||||
(gradientBackground ? Colors.transparent : Theme.of(context).colorScheme.surface);
|
||||
|
||||
Color titleColor(BuildContext context) =>
|
||||
(gradientBackground && currentTheme.type == ThemeType.bright) ||
|
||||
(gradientAll && currentTheme.brightness == Brightness.light)
|
||||
? Colors.white
|
||||
: Theme.of(context).appBarTheme.titleTextStyle!.color!;
|
||||
Color titleColor(BuildContext context) => Theme.of(context).colorScheme.onSurface;
|
||||
|
||||
Color? pageIconColor(BuildContext context) => titleColor(context);
|
||||
|
||||
Widget closeButton(BuildContext context) => Image.asset(
|
||||
currentTheme.type == ThemeType.dark
|
||||
currentTheme.isDark
|
||||
? 'assets/images/close_button_dark_theme.png'
|
||||
: 'assets/images/close_button.png',
|
||||
color: pageIconColor(context),
|
||||
|
@ -95,9 +86,9 @@ abstract class BasePage extends StatelessWidget {
|
|||
child: Semantics(
|
||||
label: S.of(context).seed_alert_back,
|
||||
child: TextButton(
|
||||
style: ButtonStyle(
|
||||
overlayColor: MaterialStateColor.resolveWith(
|
||||
(states) => Colors.transparent),
|
||||
style: TextButton.styleFrom(
|
||||
foregroundColor: Theme.of(context).colorScheme.onSurface,
|
||||
overlayColor: WidgetStateColor.resolveWith((states) => Colors.transparent),
|
||||
),
|
||||
onPressed: () => onClose(context),
|
||||
child: backButton(context),
|
||||
|
@ -113,11 +104,11 @@ abstract class BasePage extends StatelessWidget {
|
|||
? null
|
||||
: Text(
|
||||
title!,
|
||||
style: TextStyle(
|
||||
fontSize: 18.0,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontFamily: 'Lato',
|
||||
color: titleColor(context)),
|
||||
style: Theme.of(context).textTheme.titleLarge?.copyWith(
|
||||
fontSize: 18.0,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: titleColor(context),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -14,12 +14,6 @@ import 'package:cake_wallet/src/widgets/primary_button.dart';
|
|||
import 'package:cake_wallet/src/widgets/provider_optoin_tile.dart';
|
||||
import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart';
|
||||
import 'package:cake_wallet/src/widgets/trail_button.dart';
|
||||
import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
|
||||
import 'package:cake_wallet/themes/extensions/exchange_page_theme.dart';
|
||||
import 'package:cake_wallet/themes/extensions/keyboard_theme.dart';
|
||||
import 'package:cake_wallet/themes/extensions/send_page_theme.dart';
|
||||
import 'package:cake_wallet/themes/theme_base.dart';
|
||||
import 'package:cake_wallet/typography.dart';
|
||||
import 'package:cake_wallet/src/screens/send/widgets/extract_address_from_parsed.dart';
|
||||
import 'package:cake_wallet/utils/responsive_layout_util.dart';
|
||||
import 'package:cake_wallet/view_model/buy/buy_sell_view_model.dart';
|
||||
|
@ -43,17 +37,6 @@ class BuySellPage extends BasePage {
|
|||
final _cryptoAddressFocus = FocusNode();
|
||||
var _isReactionsSet = false;
|
||||
|
||||
final arrowBottomPurple = Image.asset(
|
||||
'assets/images/arrow_bottom_purple_icon.png',
|
||||
color: Colors.white,
|
||||
height: 8,
|
||||
);
|
||||
final arrowBottomCakeGreen = Image.asset(
|
||||
'assets/images/arrow_bottom_cake_green.png',
|
||||
color: Colors.white,
|
||||
height: 8,
|
||||
);
|
||||
|
||||
late final String? depositWalletName;
|
||||
late final String? receiveWalletName;
|
||||
|
||||
|
@ -95,11 +78,11 @@ class BuySellPage extends BasePage {
|
|||
Widget? leading(BuildContext context) {
|
||||
final _backButton = Icon(
|
||||
Icons.arrow_back_ios,
|
||||
color: titleColor(context),
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
size: 16,
|
||||
);
|
||||
final _closeButton =
|
||||
currentTheme.type == ThemeType.dark ? closeButtonImageDarkTheme : closeButtonImage;
|
||||
buySellViewModel.isDarkTheme ? closeButtonImageDarkTheme : closeButtonImage;
|
||||
|
||||
bool isMobileView = responsiveLayoutUtil.shouldRenderMobileUI;
|
||||
|
||||
|
@ -113,7 +96,7 @@ class BuySellPage extends BasePage {
|
|||
label: !isMobileView ? S.of(context).close : S.of(context).seed_alert_back,
|
||||
child: TextButton(
|
||||
style: ButtonStyle(
|
||||
overlayColor: MaterialStateColor.resolveWith((states) => Colors.transparent),
|
||||
overlayColor: WidgetStateColor.resolveWith((states) => Colors.transparent),
|
||||
),
|
||||
onPressed: () => onClose(context),
|
||||
child: !isMobileView ? _closeButton : _backButton,
|
||||
|
@ -129,89 +112,94 @@ class BuySellPage extends BasePage {
|
|||
WidgetsBinding.instance.addPostFrameCallback((_) => _setReactions(context, buySellViewModel));
|
||||
|
||||
return KeyboardActions(
|
||||
disableScroll: true,
|
||||
config: KeyboardActionsConfig(
|
||||
keyboardActionsPlatform: KeyboardActionsPlatform.IOS,
|
||||
keyboardBarColor: Theme.of(context).extension<KeyboardTheme>()!.keyboardBarColor,
|
||||
nextFocus: false,
|
||||
actions: [
|
||||
KeyboardActionsItem(
|
||||
focusNode: _fiatAmountFocus, toolbarButtons: [(_) => KeyboardDoneButton()]),
|
||||
KeyboardActionsItem(
|
||||
focusNode: _cryptoAmountFocus, toolbarButtons: [(_) => KeyboardDoneButton()])
|
||||
]),
|
||||
child: Container(
|
||||
color: Theme.of(context).colorScheme.background,
|
||||
child: Form(
|
||||
key: _formKey,
|
||||
child: ScrollableWithBottomSection(
|
||||
contentPadding: EdgeInsets.only(bottom: 24),
|
||||
content: Observer(
|
||||
builder: (_) => Column(children: [
|
||||
_exchangeCardsSection(context),
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 24),
|
||||
child: Column(
|
||||
children: [
|
||||
SizedBox(height: 12),
|
||||
_buildPaymentMethodTile(context),
|
||||
],
|
||||
disableScroll: true,
|
||||
config: KeyboardActionsConfig(
|
||||
keyboardActionsPlatform: KeyboardActionsPlatform.IOS,
|
||||
keyboardBarColor: Theme.of(context).colorScheme.surface,
|
||||
nextFocus: false,
|
||||
actions: [
|
||||
KeyboardActionsItem(
|
||||
focusNode: _fiatAmountFocus, toolbarButtons: [(_) => KeyboardDoneButton()]),
|
||||
KeyboardActionsItem(
|
||||
focusNode: _cryptoAmountFocus, toolbarButtons: [(_) => KeyboardDoneButton()])
|
||||
]),
|
||||
child: Container(
|
||||
color: Theme.of(context).colorScheme.surface,
|
||||
child: Form(
|
||||
key: _formKey,
|
||||
child: ScrollableWithBottomSection(
|
||||
contentPadding: EdgeInsets.only(bottom: 24),
|
||||
content: Observer(
|
||||
builder: (_) => Column(
|
||||
children: [
|
||||
_exchangeCardsSection(context),
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 24),
|
||||
child: Column(
|
||||
children: [
|
||||
SizedBox(height: 12),
|
||||
_buildPaymentMethodTile(context),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
bottomSectionPadding: EdgeInsets.only(left: 24, right: 24, bottom: 24),
|
||||
bottomSection: Observer(
|
||||
builder: (_) => Column(
|
||||
children: [
|
||||
if (buySellViewModel.isBuySellQuotFailed)
|
||||
Padding(
|
||||
padding: EdgeInsets.only(bottom: 15),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Container(
|
||||
alignment: Alignment.centerRight,
|
||||
child: Icon(
|
||||
Icons.warning_amber_rounded,
|
||||
color: Theme.of(context).colorScheme.error,
|
||||
size: 26,
|
||||
),
|
||||
),
|
||||
),
|
||||
])),
|
||||
bottomSectionPadding: EdgeInsets.only(left: 24, right: 24, bottom: 24),
|
||||
bottomSection: Observer(
|
||||
builder: (_) => Column(children: [
|
||||
buySellViewModel.isBuySellQuotFailed
|
||||
? Padding(
|
||||
padding: EdgeInsets.only(bottom: 15),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Container(
|
||||
alignment: Alignment.centerRight,
|
||||
child: Icon(Icons.warning_amber_rounded,
|
||||
color: Theme.of(context)
|
||||
.extension<ExchangePageTheme>()!
|
||||
.receiveAmountColor,
|
||||
size: 26),
|
||||
),
|
||||
Expanded(
|
||||
flex: 8,
|
||||
child: Text(
|
||||
S.of(context).buy_sell_pair_is_not_supported_warning,
|
||||
textAlign: TextAlign.center,
|
||||
softWrap: true,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
maxLines: 3,
|
||||
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||
color: Theme.of(context).colorScheme.error,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 8,
|
||||
child: Text(
|
||||
S.of(context).buy_sell_pair_is_not_supported_warning,
|
||||
textAlign: TextAlign.center,
|
||||
softWrap: true,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
maxLines: 3,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context)
|
||||
.extension<ExchangePageTheme>()!
|
||||
.receiveAmountColor,
|
||||
fontWeight: FontWeight.w500,
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
: Container(),
|
||||
LoadingPrimaryButton(
|
||||
text: S.current.choose_a_provider,
|
||||
onPressed: () async {
|
||||
if(!_formKey.currentState!.validate()) return;
|
||||
buySellViewModel.onTapChoseProvider(context);
|
||||
},
|
||||
color: Theme.of(context).primaryColor,
|
||||
textColor: Colors.white,
|
||||
isDisabled: buySellViewModel.isBuySellQuotFailed,
|
||||
isLoading: !buySellViewModel.isReadyToTrade &&
|
||||
!buySellViewModel.isBuySellQuotFailed),
|
||||
])),
|
||||
)),
|
||||
));
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
LoadingPrimaryButton(
|
||||
text: S.current.choose_a_provider,
|
||||
onPressed: () async {
|
||||
if (!_formKey.currentState!.validate()) return;
|
||||
buySellViewModel.onTapChoseProvider(context);
|
||||
},
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
textColor: Theme.of(context).colorScheme.onPrimary,
|
||||
isDisabled: buySellViewModel.isBuySellQuotFailed,
|
||||
isLoading:
|
||||
!buySellViewModel.isReadyToTrade && !buySellViewModel.isBuySellQuotFailed,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildPaymentMethodTile(BuildContext context) {
|
||||
|
@ -230,21 +218,21 @@ class BuySellPage extends BasePage {
|
|||
}
|
||||
if (buySellViewModel.paymentMethodState is PaymentMethodLoaded &&
|
||||
buySellViewModel.selectedPaymentMethod != null) {
|
||||
return Observer(builder: (_) {
|
||||
final selectedPaymentMethod = buySellViewModel.selectedPaymentMethod!;
|
||||
return ProviderOptionTile(
|
||||
lightImagePath: selectedPaymentMethod.lightIconPath,
|
||||
darkImagePath: selectedPaymentMethod.darkIconPath,
|
||||
title: selectedPaymentMethod.title,
|
||||
onPressed: () => _pickPaymentMethod(context),
|
||||
leadingIcon: Icons.arrow_forward_ios,
|
||||
isLightMode: !buySellViewModel.isDarkTheme,
|
||||
borderRadius: 30,
|
||||
padding: EdgeInsets.symmetric(horizontal: 24, vertical: 8),
|
||||
titleTextStyle:
|
||||
textLargeBold(color: Theme.of(context).extension<CakeTextTheme>()!.titleColor),
|
||||
);
|
||||
});
|
||||
final selectedPaymentMethod = buySellViewModel.selectedPaymentMethod!;
|
||||
return ProviderOptionTile(
|
||||
lightImagePath: selectedPaymentMethod.lightIconPath,
|
||||
darkImagePath: selectedPaymentMethod.darkIconPath,
|
||||
title: selectedPaymentMethod.title,
|
||||
onPressed: () => _pickPaymentMethod(context),
|
||||
leadingIcon: Icons.arrow_forward_ios,
|
||||
isLightMode: !buySellViewModel.isDarkTheme,
|
||||
borderRadius: 30,
|
||||
padding: EdgeInsets.symmetric(horizontal: 24, vertical: 8),
|
||||
titleTextStyle: Theme.of(context).textTheme.titleMedium?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
);
|
||||
}
|
||||
return OptionTilePlaceholder(errorText: 'No payment methods available', borderRadius: 30);
|
||||
}
|
||||
|
@ -280,19 +268,17 @@ class BuySellPage extends BasePage {
|
|||
_onCurrencyChange(buySellViewModel.fiatCurrency, buySellViewModel, fiatCurrencyKey);
|
||||
|
||||
reaction(
|
||||
(_) => buySellViewModel.wallet.name,
|
||||
(String _) =>
|
||||
_onWalletNameChange(buySellViewModel, buySellViewModel.cryptoCurrency, cryptoCurrencyKey));
|
||||
(_) => buySellViewModel.wallet.name,
|
||||
(String _) => _onWalletNameChange(
|
||||
buySellViewModel, buySellViewModel.cryptoCurrency, cryptoCurrencyKey));
|
||||
|
||||
reaction(
|
||||
(_) => buySellViewModel.cryptoCurrency,
|
||||
(CryptoCurrency currency) =>
|
||||
_onCurrencyChange(currency, buySellViewModel, cryptoCurrencyKey));
|
||||
|
||||
reaction(
|
||||
(_) => buySellViewModel.fiatCurrency,
|
||||
(FiatCurrency currency) =>
|
||||
_onCurrencyChange(currency, buySellViewModel, fiatCurrencyKey));
|
||||
reaction((_) => buySellViewModel.fiatCurrency,
|
||||
(FiatCurrency currency) => _onCurrencyChange(currency, buySellViewModel, fiatCurrencyKey));
|
||||
|
||||
reaction((_) => buySellViewModel.fiatAmount, (String amount) {
|
||||
if (fiatCurrencyKey.currentState!.amountController.text != amount) {
|
||||
|
@ -318,13 +304,13 @@ class BuySellPage extends BasePage {
|
|||
|
||||
fiatAmountController.addListener(() {
|
||||
if (fiatAmountController.text != buySellViewModel.fiatAmount) {
|
||||
buySellViewModel.changeFiatAmount(amount: fiatAmountController.text);
|
||||
buySellViewModel.changeFiatAmount(amount: fiatAmountController.text);
|
||||
}
|
||||
});
|
||||
|
||||
cryptoAmountController.addListener(() {
|
||||
if (cryptoAmountController.text != buySellViewModel.cryptoAmount) {
|
||||
buySellViewModel.changeCryptoAmount(amount: cryptoAmountController.text);
|
||||
buySellViewModel.changeCryptoAmount(amount: cryptoAmountController.text);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -336,7 +322,7 @@ class BuySellPage extends BasePage {
|
|||
if (!_cryptoAddressFocus.hasFocus && cryptoAddressController.text.isNotEmpty) {
|
||||
final domain = cryptoAddressController.text;
|
||||
buySellViewModel.cryptoCurrencyAddress =
|
||||
await fetchParsedAddress(context, domain, buySellViewModel.cryptoCurrency);
|
||||
await fetchParsedAddress(context, domain, buySellViewModel.cryptoCurrency);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -365,15 +351,16 @@ class BuySellPage extends BasePage {
|
|||
_isReactionsSet = true;
|
||||
}
|
||||
|
||||
void _onCurrencyChange(Currency currency, BuySellViewModel buySellViewModel,
|
||||
GlobalKey<ExchangeCardState> key) {
|
||||
void _onCurrencyChange(
|
||||
Currency currency, BuySellViewModel buySellViewModel, GlobalKey<ExchangeCardState> key) {
|
||||
final isCurrentTypeWallet = currency == buySellViewModel.wallet.currency;
|
||||
|
||||
key.currentState!.changeSelectedCurrency(currency);
|
||||
key.currentState!.changeWalletName(isCurrentTypeWallet ? buySellViewModel.wallet.name : '');
|
||||
|
||||
key.currentState!.changeAddress(
|
||||
address: isCurrentTypeWallet ? buySellViewModel.wallet.walletAddresses.addressForExchange : '');
|
||||
address:
|
||||
isCurrentTypeWallet ? buySellViewModel.wallet.walletAddresses.addressForExchange : '');
|
||||
|
||||
key.currentState!.changeAmount(amount: '');
|
||||
}
|
||||
|
@ -384,7 +371,8 @@ class BuySellPage extends BasePage {
|
|||
|
||||
if (isCurrentTypeWallet) {
|
||||
key.currentState!.changeWalletName(buySellViewModel.wallet.name);
|
||||
key.currentState!.addressController.text = buySellViewModel.wallet.walletAddresses.addressForExchange;
|
||||
key.currentState!.addressController.text =
|
||||
buySellViewModel.wallet.walletAddresses.addressForExchange;
|
||||
} else if (key.currentState!.addressController.text ==
|
||||
buySellViewModel.wallet.walletAddresses.addressForExchange) {
|
||||
key.currentState!.changeWalletName('');
|
||||
|
@ -396,67 +384,77 @@ class BuySellPage extends BasePage {
|
|||
|
||||
Widget _exchangeCardsSection(BuildContext context) {
|
||||
final fiatExchangeCard = Observer(
|
||||
builder: (_) => ExchangeCard(
|
||||
cardInstanceName: 'fiat_currency_trade_card',
|
||||
onDispose: disposeBestRateSync,
|
||||
amountFocusNode: _fiatAmountFocus,
|
||||
key: fiatCurrencyKey,
|
||||
title: 'FIAT ${S.of(context).amount}',
|
||||
initialCurrency: buySellViewModel.fiatCurrency,
|
||||
initialWalletName: '',
|
||||
initialAddress: '',
|
||||
initialIsAmountEditable: true,
|
||||
isAmountEstimated: false,
|
||||
currencyRowPadding: EdgeInsets.zero,
|
||||
addressRowPadding: EdgeInsets.zero,
|
||||
isMoneroWallet: buySellViewModel.wallet == WalletType.monero,
|
||||
showAddressField: false,
|
||||
showLimitsField: false,
|
||||
currencies: buySellViewModel.fiatCurrencies,
|
||||
onCurrencySelected: (currency) =>
|
||||
buySellViewModel.changeFiatCurrency(currency: currency),
|
||||
imageArrow: arrowBottomPurple,
|
||||
currencyButtonColor: Colors.transparent,
|
||||
addressButtonsColor:
|
||||
Theme.of(context).extension<SendPageTheme>()!.textFieldButtonColor,
|
||||
borderColor:
|
||||
Theme.of(context).extension<ExchangePageTheme>()!.textFieldBorderTopPanelColor,
|
||||
onPushPasteButton: (context) async {},
|
||||
onPushAddressBookButton: (context) async {},
|
||||
));
|
||||
builder: (_) => ExchangeCard(
|
||||
cardInstanceName: 'fiat_currency_trade_card',
|
||||
onDispose: disposeBestRateSync,
|
||||
amountFocusNode: _fiatAmountFocus,
|
||||
key: fiatCurrencyKey,
|
||||
title: 'FIAT ${S.of(context).amount}',
|
||||
initialCurrency: buySellViewModel.fiatCurrency,
|
||||
initialWalletName: '',
|
||||
initialAddress: '',
|
||||
initialIsAmountEditable: true,
|
||||
isAmountEstimated: false,
|
||||
currencyRowPadding: EdgeInsets.zero,
|
||||
addressRowPadding: EdgeInsets.zero,
|
||||
isMoneroWallet: buySellViewModel.wallet == WalletType.monero,
|
||||
showAddressField: false,
|
||||
showLimitsField: false,
|
||||
currencies: buySellViewModel.fiatCurrencies,
|
||||
onCurrencySelected: (currency) => buySellViewModel.changeFiatCurrency(currency: currency),
|
||||
imageArrow: Image.asset(
|
||||
'assets/images/arrow_bottom_purple_icon.png',
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
height: 8,
|
||||
),
|
||||
currencyButtonColor: Colors.transparent,
|
||||
addressButtonsColor: Theme.of(context).colorScheme.surfaceContainerHighest,
|
||||
borderColor: Theme.of(context).colorScheme.outlineVariant,
|
||||
onPushPasteButton: (context) async {},
|
||||
onPushAddressBookButton: (context) async {},
|
||||
fillColor: buySellViewModel.isBuyAction
|
||||
? Theme.of(context).colorScheme.surfaceContainer
|
||||
: Theme.of(context).colorScheme.surfaceContainerLow,
|
||||
),
|
||||
);
|
||||
|
||||
final cryptoExchangeCard = Observer(
|
||||
builder: (_) => ExchangeCard(
|
||||
cardInstanceName: 'crypto_currency_trade_card',
|
||||
onDispose: disposeBestRateSync,
|
||||
amountFocusNode: _cryptoAmountFocus,
|
||||
addressFocusNode: _cryptoAddressFocus,
|
||||
key: cryptoCurrencyKey,
|
||||
title: 'Crypto ${S.of(context).amount}',
|
||||
initialCurrency: buySellViewModel.cryptoCurrency,
|
||||
initialWalletName: '',
|
||||
initialAddress: buySellViewModel.cryptoCurrency == buySellViewModel.wallet.currency
|
||||
? buySellViewModel.wallet.walletAddresses.addressForExchange
|
||||
: buySellViewModel.cryptoCurrencyAddress,
|
||||
initialIsAmountEditable: true,
|
||||
isAmountEstimated: true,
|
||||
showLimitsField: false,
|
||||
currencyRowPadding: EdgeInsets.zero,
|
||||
addressRowPadding: EdgeInsets.zero,
|
||||
isMoneroWallet: buySellViewModel.wallet == WalletType.monero,
|
||||
currencies: buySellViewModel.cryptoCurrencies,
|
||||
onCurrencySelected: (currency) =>
|
||||
buySellViewModel.changeCryptoCurrency(currency: currency),
|
||||
imageArrow: arrowBottomCakeGreen,
|
||||
currencyButtonColor: Colors.transparent,
|
||||
addressButtonsColor:
|
||||
Theme.of(context).extension<SendPageTheme>()!.textFieldButtonColor,
|
||||
borderColor:
|
||||
Theme.of(context).extension<ExchangePageTheme>()!.textFieldBorderBottomPanelColor,
|
||||
addressTextFieldValidator: AddressValidator(type: buySellViewModel.cryptoCurrency),
|
||||
onPushPasteButton: (context) async {},
|
||||
onPushAddressBookButton: (context) async {},
|
||||
));
|
||||
builder: (_) => ExchangeCard(
|
||||
cardInstanceName: 'crypto_currency_trade_card',
|
||||
onDispose: disposeBestRateSync,
|
||||
amountFocusNode: _cryptoAmountFocus,
|
||||
addressFocusNode: _cryptoAddressFocus,
|
||||
key: cryptoCurrencyKey,
|
||||
title: 'Crypto ${S.of(context).amount}',
|
||||
initialCurrency: buySellViewModel.cryptoCurrency,
|
||||
initialWalletName: '',
|
||||
initialAddress: buySellViewModel.cryptoCurrency == buySellViewModel.wallet.currency
|
||||
? buySellViewModel.wallet.walletAddresses.addressForExchange
|
||||
: buySellViewModel.cryptoCurrencyAddress,
|
||||
initialIsAmountEditable: true,
|
||||
isAmountEstimated: true,
|
||||
showLimitsField: false,
|
||||
currencyRowPadding: EdgeInsets.zero,
|
||||
addressRowPadding: EdgeInsets.zero,
|
||||
isMoneroWallet: buySellViewModel.wallet == WalletType.monero,
|
||||
currencies: buySellViewModel.cryptoCurrencies,
|
||||
onCurrencySelected: (currency) => buySellViewModel.changeCryptoCurrency(currency: currency),
|
||||
imageArrow: Image.asset(
|
||||
'assets/images/arrow_bottom_cake_green.png',
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
height: 8,
|
||||
),
|
||||
currencyButtonColor: Colors.transparent,
|
||||
addressButtonsColor: Theme.of(context).colorScheme.surfaceContainerHighest,
|
||||
borderColor: Theme.of(context).colorScheme.outlineVariant,
|
||||
addressTextFieldValidator: AddressValidator(type: buySellViewModel.cryptoCurrency),
|
||||
onPushPasteButton: (context) async {},
|
||||
onPushAddressBookButton: (context) async {},
|
||||
fillColor: buySellViewModel.isBuyAction
|
||||
? Theme.of(context).colorScheme.surfaceContainerLow
|
||||
: Theme.of(context).colorScheme.surfaceContainer,
|
||||
),
|
||||
);
|
||||
|
||||
if (responsiveLayoutUtil.shouldRenderMobileUI) {
|
||||
return Observer(
|
||||
|
|
|
@ -19,9 +19,6 @@ class BuyWebViewPage extends BasePage {
|
|||
@override
|
||||
String get title => S.current.buy;
|
||||
|
||||
@override
|
||||
Color get backgroundDarkColor => Colors.white;
|
||||
|
||||
@override
|
||||
Widget body(BuildContext context) =>
|
||||
BuyWebViewPageBody(buyViewModel, ordersStore: ordersStore, url: url);
|
||||
|
|
|
@ -1,148 +0,0 @@
|
|||
import 'package:cake_wallet/buy/buy_provider.dart';
|
||||
import 'package:cw_core/crypto_currency.dart';
|
||||
import 'package:cake_wallet/entities/fiat_currency.dart';
|
||||
import 'package:cake_wallet/palette.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class BuyListItem extends StatelessWidget {
|
||||
BuyListItem({
|
||||
required this.selectedProvider,
|
||||
required this.provider,
|
||||
required this.sourceAmount,
|
||||
required this.sourceCurrency,
|
||||
required this.destAmount,
|
||||
required this.destCurrency,
|
||||
required this.achSourceAmount,
|
||||
this.onTap
|
||||
});
|
||||
|
||||
final BuyProvider? selectedProvider;
|
||||
final BuyProvider provider;
|
||||
final double sourceAmount;
|
||||
final FiatCurrency sourceCurrency;
|
||||
final double destAmount;
|
||||
final CryptoCurrency destCurrency;
|
||||
final double achSourceAmount;
|
||||
final VoidCallback? onTap;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final isSelected = selectedProvider?.providerDescription == provider.providerDescription;
|
||||
final iconColor = isSelected ? Colors.white : Colors.black;
|
||||
|
||||
final providerIcon = Image.asset('assets/images/wyre-icon.png', width: 36, height: 36);
|
||||
|
||||
final backgroundColor = isSelected
|
||||
? Palette.greyBlueCraiola
|
||||
: Palette.shadowWhite;
|
||||
|
||||
final primaryTextColor = isSelected
|
||||
? Colors.white
|
||||
: Palette.darkGray;
|
||||
|
||||
final secondaryTextColor = isSelected
|
||||
? Colors.white
|
||||
: Palette.darkBlueCraiola;
|
||||
|
||||
return GestureDetector(
|
||||
onTap: onTap,
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(
|
||||
left: 20,
|
||||
top: 28,
|
||||
bottom: 28,
|
||||
right: 20
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.all(Radius.circular(25)),
|
||||
color: backgroundColor
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
if (providerIcon != null)
|
||||
Padding(
|
||||
padding: EdgeInsets.only(right: 10),
|
||||
child: providerIcon),
|
||||
Text(
|
||||
provider.title,
|
||||
style: TextStyle(
|
||||
color: secondaryTextColor,
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold),
|
||||
)
|
||||
],
|
||||
),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
if(achSourceAmount != null)...[
|
||||
Text(
|
||||
'${destAmount?.toString()} ${destCurrency.title}',
|
||||
style: TextStyle(
|
||||
color: secondaryTextColor,
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold),
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.account_balance_outlined,
|
||||
size: 12,
|
||||
color: primaryTextColor,
|
||||
),
|
||||
SizedBox(width: 5),
|
||||
Text(
|
||||
'${achSourceAmount?.toString()} ${sourceCurrency.title}',
|
||||
style: TextStyle(
|
||||
color: primaryTextColor,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
],
|
||||
Text(
|
||||
'${destAmount?.toString()} ${destCurrency.title}',
|
||||
style: TextStyle(
|
||||
color: secondaryTextColor,
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold),
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
CupertinoIcons.creditcard,
|
||||
size: 12,
|
||||
color: primaryTextColor,
|
||||
),
|
||||
SizedBox(width: 5),
|
||||
Text(
|
||||
'${sourceAmount?.toString()} ${sourceCurrency.title}',
|
||||
style: TextStyle(
|
||||
color: primaryTextColor,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
|
@ -1,11 +1,9 @@
|
|||
import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
|
||||
import 'package:cake_wallet/routes.dart';
|
||||
import 'package:cake_wallet/src/screens/base_page.dart';
|
||||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
import 'package:cake_wallet/src/screens/cake_pay/widgets/cake_pay_tile.dart';
|
||||
import 'package:cake_wallet/src/widgets/primary_button.dart';
|
||||
import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart';
|
||||
import 'package:cake_wallet/typography.dart';
|
||||
import 'package:cake_wallet/view_model/cake_pay/cake_pay_account_view_model.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_mobx/flutter_mobx.dart';
|
||||
|
@ -15,8 +13,6 @@ class CakePayAccountPage extends BasePage {
|
|||
|
||||
final CakePayAccountViewModel cakePayAccountViewModel;
|
||||
|
||||
|
||||
|
||||
@override
|
||||
Widget leading(BuildContext context) {
|
||||
return MergeSemantics(
|
||||
|
@ -29,7 +25,7 @@ class CakePayAccountPage extends BasePage {
|
|||
label: S.of(context).seed_alert_back,
|
||||
child: TextButton(
|
||||
style: ButtonStyle(
|
||||
overlayColor: MaterialStateColor.resolveWith(
|
||||
overlayColor: WidgetStateColor.resolveWith(
|
||||
(states) => Colors.transparent),
|
||||
),
|
||||
onPressed: () => Navigator.pop(context),
|
||||
|
@ -45,8 +41,9 @@ class CakePayAccountPage extends BasePage {
|
|||
Widget middle(BuildContext context) {
|
||||
return Text(
|
||||
S.current.account,
|
||||
style: textMediumSemiBold(
|
||||
color: Theme.of(context).extension<CakeTextTheme>()!.titleColor,
|
||||
style: Theme.of(context).textTheme.titleMedium?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
@ -59,15 +56,20 @@ class CakePayAccountPage extends BasePage {
|
|||
children: [
|
||||
SizedBox(height: 20),
|
||||
Observer(
|
||||
builder: (_) => Container(decoration: BoxDecoration(
|
||||
border: Border(
|
||||
bottom: BorderSide(
|
||||
builder: (_) => Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border(
|
||||
bottom: BorderSide(
|
||||
width: 1.0,
|
||||
color:
|
||||
Theme.of(context).extension<CakeTextTheme>()!.secondaryTextColor),
|
||||
color: Theme.of(context).colorScheme.outlineVariant,
|
||||
),
|
||||
),
|
||||
),
|
||||
child: CakePayTile(
|
||||
title: S.of(context).email_address,
|
||||
subTitle: cakePayAccountViewModel.email
|
||||
),
|
||||
),
|
||||
child: CakePayTile(title: S.of(context).email_address, subTitle: cakePayAccountViewModel.email)),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
@ -75,8 +77,8 @@ class CakePayAccountPage extends BasePage {
|
|||
bottomSection: Column(
|
||||
children: [
|
||||
PrimaryButton(
|
||||
color: Theme.of(context).primaryColor,
|
||||
textColor: Colors.white,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
textColor: Theme.of(context).colorScheme.onPrimary,
|
||||
text: S.of(context).logout,
|
||||
onPressed: () {
|
||||
cakePayAccountViewModel.logout();
|
||||
|
|
|
@ -1,14 +1,11 @@
|
|||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
import 'package:cake_wallet/cake_pay/cake_pay_states.dart';
|
||||
import 'package:cake_wallet/palette.dart';
|
||||
import 'package:cake_wallet/src/screens/base_page.dart';
|
||||
import 'package:cake_wallet/src/widgets/alert_with_one_action.dart';
|
||||
import 'package:cake_wallet/src/widgets/base_text_form_field.dart';
|
||||
import 'package:cake_wallet/src/widgets/keyboard_done_button.dart';
|
||||
import 'package:cake_wallet/src/widgets/primary_button.dart';
|
||||
import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart';
|
||||
import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
|
||||
import 'package:cake_wallet/themes/extensions/keyboard_theme.dart';
|
||||
import 'package:cake_wallet/typography.dart';
|
||||
import 'package:cake_wallet/utils/show_pop_up.dart';
|
||||
import 'package:cake_wallet/view_model/cake_pay/cake_pay_auth_view_model.dart';
|
||||
|
@ -42,7 +39,7 @@ class CakePayVerifyOtpPage extends BasePage {
|
|||
return Text(
|
||||
S.current.verification,
|
||||
style: textMediumSemiBold(
|
||||
color: Theme.of(context).extension<CakeTextTheme>()!.titleColor,
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
@ -63,7 +60,7 @@ class CakePayVerifyOtpPage extends BasePage {
|
|||
return KeyboardActions(
|
||||
config: KeyboardActionsConfig(
|
||||
keyboardActionsPlatform: KeyboardActionsPlatform.IOS,
|
||||
keyboardBarColor: Theme.of(context).extension<KeyboardTheme>()!.keyboardBarColor,
|
||||
keyboardBarColor: Theme.of(context).colorScheme.surface,
|
||||
nextFocus: false,
|
||||
actions: [
|
||||
KeyboardActionsItem(
|
||||
|
@ -73,7 +70,7 @@ class CakePayVerifyOtpPage extends BasePage {
|
|||
]),
|
||||
child: Container(
|
||||
height: 0,
|
||||
color: Theme.of(context).colorScheme.background,
|
||||
color: Theme.of(context).colorScheme.surface,
|
||||
child: ScrollableWithBottomSection(
|
||||
contentPadding: EdgeInsets.all(24),
|
||||
content: Column(
|
||||
|
@ -88,7 +85,9 @@ class CakePayVerifyOtpPage extends BasePage {
|
|||
SizedBox(height: 14),
|
||||
Text(
|
||||
S.of(context).fill_code,
|
||||
style: TextStyle(color: Color(0xff7A93BA), fontSize: 12),
|
||||
style: Theme.of(context).textTheme.bodySmall!.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 34),
|
||||
Row(
|
||||
|
@ -100,7 +99,9 @@ class CakePayVerifyOtpPage extends BasePage {
|
|||
onTap: () => _authViewModel.logIn(_email),
|
||||
child: Text(
|
||||
S.of(context).resend_code,
|
||||
style: textSmallSemiBold(color: Palette.blueCraiola),
|
||||
style: Theme.of(context).textTheme.bodyMedium!.copyWith(
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
@ -119,8 +120,8 @@ class CakePayVerifyOtpPage extends BasePage {
|
|||
onPressed: _verify,
|
||||
isDisabled: _authViewModel.otpState is CakePayOtpSendDisabled,
|
||||
isLoading: _authViewModel.otpState is CakePayOtpValidating,
|
||||
color: Theme.of(context).primaryColor,
|
||||
textColor: Colors.white,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
textColor: Theme.of(context).colorScheme.onPrimary,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 20),
|
||||
|
@ -145,8 +146,7 @@ class CakePayVerifyOtpPage extends BasePage {
|
|||
});
|
||||
}
|
||||
|
||||
void _onOtpSuccessful(BuildContext context) =>
|
||||
Navigator.pop(context);
|
||||
void _onOtpSuccessful(BuildContext context) => Navigator.pop(context);
|
||||
|
||||
void _verify() async => await _authViewModel.verifyEmail(_codeController.text);
|
||||
}
|
||||
|
|
|
@ -7,7 +7,6 @@ import 'package:cake_wallet/src/widgets/alert_with_one_action.dart';
|
|||
import 'package:cake_wallet/src/widgets/base_text_form_field.dart';
|
||||
import 'package:cake_wallet/src/widgets/primary_button.dart';
|
||||
import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart';
|
||||
import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
|
||||
import 'package:cake_wallet/typography.dart';
|
||||
import 'package:cake_wallet/utils/show_pop_up.dart';
|
||||
import 'package:cake_wallet/view_model/cake_pay/cake_pay_auth_view_model.dart';
|
||||
|
@ -34,7 +33,7 @@ class CakePayWelcomePage extends BasePage {
|
|||
return Text(
|
||||
S.current.welcome_to_cakepay,
|
||||
style: textMediumSemiBold(
|
||||
color: Theme.of(context).extension<CakeTextTheme>()!.titleColor,
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
@ -68,12 +67,12 @@ class CakePayWelcomePage extends BasePage {
|
|||
Text(
|
||||
S.of(context).about_cake_pay,
|
||||
style: textLarge(
|
||||
color: Theme.of(context).extension<CakeTextTheme>()!.titleColor,
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 20),
|
||||
Text(S.of(context).cake_pay_account_note,
|
||||
style: textLarge(color: Theme.of(context).extension<CakeTextTheme>()!.titleColor)),
|
||||
style: textLarge(color: Theme.of(context).colorScheme.onSurface)),
|
||||
],
|
||||
),
|
||||
bottomSectionPadding: EdgeInsets.symmetric(vertical: 36, horizontal: 24),
|
||||
|
@ -88,8 +87,8 @@ class CakePayWelcomePage extends BasePage {
|
|||
onPressed: _login,
|
||||
isLoading:
|
||||
_authViewModel.userVerificationState is CakePayUserVerificationStateLoading,
|
||||
color: Theme.of(context).primaryColor,
|
||||
textColor: Colors.white,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
textColor: Theme.of(context).colorScheme.onPrimary,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
|
|
|
@ -15,9 +15,6 @@ import 'package:cake_wallet/src/widgets/keyboard_done_button.dart';
|
|||
import 'package:cake_wallet/src/widgets/number_text_fild_widget.dart';
|
||||
import 'package:cake_wallet/src/widgets/primary_button.dart';
|
||||
import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart';
|
||||
import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
|
||||
import 'package:cake_wallet/themes/extensions/keyboard_theme.dart';
|
||||
import 'package:cake_wallet/themes/extensions/send_page_theme.dart';
|
||||
import 'package:cake_wallet/typography.dart';
|
||||
import 'package:cake_wallet/utils/responsive_layout_util.dart';
|
||||
import 'package:cake_wallet/utils/show_pop_up.dart';
|
||||
|
@ -60,11 +57,10 @@ class CakePayBuyCardPage extends BasePage {
|
|||
title,
|
||||
textAlign: TextAlign.center,
|
||||
maxLines: 2,
|
||||
style: TextStyle(
|
||||
fontSize: 18.0,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontFamily: 'Lato',
|
||||
color: titleColor(context)),
|
||||
style: Theme.of(context).textTheme.titleLarge?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -82,7 +78,7 @@ class CakePayBuyCardPage extends BasePage {
|
|||
disableScroll: true,
|
||||
config: KeyboardActionsConfig(
|
||||
keyboardActionsPlatform: KeyboardActionsPlatform.IOS,
|
||||
keyboardBarColor: Theme.of(context).extension<KeyboardTheme>()!.keyboardBarColor,
|
||||
keyboardBarColor: Theme.of(context).colorScheme.surface,
|
||||
nextFocus: false,
|
||||
actions: [
|
||||
KeyboardActionsItem(
|
||||
|
@ -91,7 +87,7 @@ class CakePayBuyCardPage extends BasePage {
|
|||
),
|
||||
]),
|
||||
child: Container(
|
||||
color: Theme.of(context).colorScheme.background,
|
||||
color: Theme.of(context).colorScheme.surface,
|
||||
child: ScrollableWithBottomSection(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
content: Column(
|
||||
|
@ -103,8 +99,8 @@ class CakePayBuyCardPage extends BasePage {
|
|||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [
|
||||
Theme.of(context).extension<SendPageTheme>()!.firstGradientColor,
|
||||
Theme.of(context).extension<SendPageTheme>()!.secondGradientColor,
|
||||
Theme.of(context).colorScheme.primary,
|
||||
Theme.of(context).colorScheme.secondary,
|
||||
],
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
|
@ -145,12 +141,13 @@ class CakePayBuyCardPage extends BasePage {
|
|||
children: [
|
||||
SizedBox(height: 24),
|
||||
Expanded(
|
||||
child: Text(S.of(context).enter_amount,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).extension<CakeTextTheme>()!.titleColor,
|
||||
fontSize: 24,
|
||||
fontWeight: FontWeight.w600,
|
||||
)),
|
||||
child: Text(
|
||||
S.of(context).enter_amount,
|
||||
style: Theme.of(context).textTheme.bodyLarge!.copyWith(
|
||||
fontSize: 24,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
),
|
||||
card.denominations.isNotEmpty
|
||||
? Expanded(
|
||||
|
@ -187,16 +184,22 @@ class CakePayBuyCardPage extends BasePage {
|
|||
padding: const EdgeInsets.only(bottom: 8.0),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).primaryColor,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
border: Border.all(color: Colors.white.withOpacity(0.20)),
|
||||
border: Border.all(
|
||||
color:
|
||||
Theme.of(context).colorScheme.onPrimary.withOpacity(0.20),
|
||||
),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Text(
|
||||
vendor.cakeWarnings!,
|
||||
textAlign: TextAlign.center,
|
||||
style: textSmallSemiBold(color: Colors.white),
|
||||
style: Theme.of(context).textTheme.bodySmall?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onPrimary,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -205,13 +208,10 @@ class CakePayBuyCardPage extends BasePage {
|
|||
child: SingleChildScrollView(
|
||||
child: ClickableLinksText(
|
||||
text: card.description ?? '',
|
||||
textStyle: TextStyle(
|
||||
color: Theme.of(context)
|
||||
.extension<CakeTextTheme>()!
|
||||
.secondaryTextColor,
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
textStyle: Theme.of(context).textTheme.bodyMedium!.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
fontSize: 18,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -235,8 +235,8 @@ class CakePayBuyCardPage extends BasePage {
|
|||
: navigateToCakePayBuyCardDetailPage(context, card),
|
||||
text: S.of(context).buy_now,
|
||||
isDisabled: !cakePayBuyCardViewModel.isEnablePurchase,
|
||||
color: Theme.of(context).primaryColor,
|
||||
textColor: Colors.white,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
textColor: Theme.of(context).colorScheme.onPrimary,
|
||||
),
|
||||
);
|
||||
}),
|
||||
|
@ -358,8 +358,7 @@ class _DenominationsAmountWidget extends StatelessWidget {
|
|||
items: denominations,
|
||||
itemPrefix: fiatCurrency,
|
||||
selectedItem: denominations.first,
|
||||
textStyle: textMediumSemiBold(
|
||||
color: Theme.of(context).extension<CakeTextTheme>()!.titleColor),
|
||||
textStyle: textMediumSemiBold(color: Theme.of(context).colorScheme.onSurface),
|
||||
onItemSelected: (value) {
|
||||
amountController.text = value;
|
||||
onAmountChanged(value);
|
||||
|
@ -374,14 +373,12 @@ class _DenominationsAmountWidget extends StatelessWidget {
|
|||
decoration: BoxDecoration(
|
||||
border: Border(
|
||||
top: BorderSide(
|
||||
width: 1.0,
|
||||
color: Theme.of(context).extension<CakeTextTheme>()!.secondaryTextColor),
|
||||
width: 1.0, color: Theme.of(context).colorScheme.onSurfaceVariant),
|
||||
),
|
||||
),
|
||||
child: Text(S.of(context).choose_card_value + ':',
|
||||
maxLines: 2,
|
||||
style: textSmall(
|
||||
color: Theme.of(context).extension<CakeTextTheme>()!.secondaryTextColor)),
|
||||
style: textSmall(color: Theme.of(context).colorScheme.onSurfaceVariant)),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
@ -408,14 +405,12 @@ class _DenominationsAmountWidget extends StatelessWidget {
|
|||
decoration: BoxDecoration(
|
||||
border: Border(
|
||||
top: BorderSide(
|
||||
width: 1.0,
|
||||
color: Theme.of(context).extension<CakeTextTheme>()!.secondaryTextColor),
|
||||
width: 1.0, color: Theme.of(context).colorScheme.onSurfaceVariant),
|
||||
),
|
||||
),
|
||||
child: Text(S.of(context).quantity + ':',
|
||||
maxLines: 1,
|
||||
style: textSmall(
|
||||
color: Theme.of(context).extension<CakeTextTheme>()!.secondaryTextColor)),
|
||||
style: textSmall(color: Theme.of(context).colorScheme.onSurfaceVariant)),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
@ -434,8 +429,7 @@ class _DenominationsAmountWidget extends StatelessWidget {
|
|||
'$fiatCurrency ${cakePayBuyCardViewModel.totalAmount}',
|
||||
maxLines: 1,
|
||||
style: textMediumSemiBold(
|
||||
color:
|
||||
Theme.of(context).extension<CakeTextTheme>()!.titleColor)))),
|
||||
color: Theme.of(context).colorScheme.onSurface)))),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Expanded(
|
||||
|
@ -444,16 +438,12 @@ class _DenominationsAmountWidget extends StatelessWidget {
|
|||
decoration: BoxDecoration(
|
||||
border: Border(
|
||||
top: BorderSide(
|
||||
width: 1.0,
|
||||
color:
|
||||
Theme.of(context).extension<CakeTextTheme>()!.secondaryTextColor),
|
||||
width: 1.0, color: Theme.of(context).colorScheme.onSurfaceVariant),
|
||||
),
|
||||
),
|
||||
child: Text(S.of(context).total + ':',
|
||||
maxLines: 1,
|
||||
style: textSmall(
|
||||
color:
|
||||
Theme.of(context).extension<CakeTextTheme>()!.secondaryTextColor)),
|
||||
style: textSmall(color: Theme.of(context).colorScheme.onSurfaceVariant)),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
@ -487,9 +477,7 @@ class _EnterAmountWidget extends StatelessWidget {
|
|||
Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border(
|
||||
bottom: BorderSide(
|
||||
width: 1.0,
|
||||
color: Theme.of(context).extension<CakeTextTheme>()!.secondaryTextColor),
|
||||
bottom: BorderSide(width: 1.0, color: Theme.of(context).colorScheme.onSurfaceVariant),
|
||||
),
|
||||
),
|
||||
child: BaseTextFormField(
|
||||
|
@ -497,19 +485,16 @@ class _EnterAmountWidget extends StatelessWidget {
|
|||
keyboardType: TextInputType.numberWithOptions(signed: false, decimal: true),
|
||||
hintText: '0.00',
|
||||
maxLines: null,
|
||||
borderColor: Colors.transparent,
|
||||
prefixIcon: Padding(
|
||||
padding: const EdgeInsets.only(top: 12),
|
||||
child: Text(
|
||||
'$fiatCurrency: ',
|
||||
style: textMediumSemiBold(
|
||||
color: Theme.of(context).extension<CakeTextTheme>()!.titleColor),
|
||||
style: textMediumSemiBold(color: Theme.of(context).colorScheme.onSurface),
|
||||
),
|
||||
),
|
||||
textStyle:
|
||||
textMediumSemiBold(color: Theme.of(context).extension<CakeTextTheme>()!.titleColor),
|
||||
placeholderTextStyle: textMediumSemiBold(
|
||||
color: Theme.of(context).extension<CakeTextTheme>()!.secondaryTextColor),
|
||||
textStyle: textMediumSemiBold(color: Theme.of(context).colorScheme.onSurface),
|
||||
placeholderTextStyle:
|
||||
textMediumSemiBold(color: Theme.of(context).colorScheme.onSurfaceVariant),
|
||||
inputFormatters: [
|
||||
FilteringTextInputFormatter.deny(RegExp('[\-|\ ]')),
|
||||
FilteringTextInputFormatter.allow(
|
||||
|
@ -523,11 +508,9 @@ class _EnterAmountWidget extends StatelessWidget {
|
|||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(S.of(context).min_amount(minValue) + ' $fiatCurrency',
|
||||
style: textSmall(
|
||||
color: Theme.of(context).extension<CakeTextTheme>()!.secondaryTextColor)),
|
||||
style: textSmall(color: Theme.of(context).colorScheme.onSurfaceVariant)),
|
||||
Text(S.of(context).max_amount(maxValue) + ' $fiatCurrency',
|
||||
style: textSmall(
|
||||
color: Theme.of(context).extension<CakeTextTheme>()!.secondaryTextColor)),
|
||||
style: textSmall(color: Theme.of(context).colorScheme.onSurfaceVariant)),
|
||||
],
|
||||
),
|
||||
],
|
||||
|
|
|
@ -7,14 +7,10 @@ import 'package:cake_wallet/src/screens/base_page.dart';
|
|||
import 'package:cake_wallet/src/screens/cake_pay/widgets/card_item.dart';
|
||||
import 'package:cake_wallet/src/screens/cake_pay/widgets/card_menu.dart';
|
||||
import 'package:cake_wallet/src/screens/dashboard/widgets/filter_widget.dart';
|
||||
import 'package:cake_wallet/src/widgets/base_text_form_field.dart';
|
||||
import 'package:cake_wallet/src/widgets/cake_scrollbar.dart';
|
||||
import 'package:cake_wallet/src/widgets/gradient_background.dart';
|
||||
import 'package:cake_wallet/src/widgets/picker.dart';
|
||||
import 'package:cake_wallet/themes/extensions/balance_page_theme.dart';
|
||||
import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart';
|
||||
import 'package:cake_wallet/themes/extensions/exchange_page_theme.dart';
|
||||
import 'package:cake_wallet/themes/extensions/filter_theme.dart';
|
||||
import 'package:cake_wallet/themes/extensions/sync_indicator_theme.dart';
|
||||
import 'package:cake_wallet/typography.dart';
|
||||
import 'package:cake_wallet/utils/debounce.dart';
|
||||
import 'package:cake_wallet/utils/responsive_layout_util.dart';
|
||||
|
@ -60,7 +56,7 @@ class CakePayCardsPage extends BasePage {
|
|||
return Text(
|
||||
'Cake Pay',
|
||||
style: textMediumSemiBold(
|
||||
color: Theme.of(context).extension<DashboardPageTheme>()!.textColor,
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
@ -68,66 +64,70 @@ class CakePayCardsPage extends BasePage {
|
|||
@override
|
||||
Widget trailing(BuildContext context) {
|
||||
return _TrailingIcon(
|
||||
asset: 'assets/images/profile.png',
|
||||
iconColor: pageIconColor(context) ?? Colors.white,
|
||||
onPressed: () {
|
||||
_cardsListViewModel.isCakePayUserAuthenticated().then((value) {
|
||||
asset: 'assets/images/profile.png',
|
||||
iconColor: Theme.of(context).colorScheme.onSurface,
|
||||
onPressed: () {
|
||||
_cardsListViewModel.isCakePayUserAuthenticated().then(
|
||||
(value) {
|
||||
if (value) {
|
||||
Navigator.pushNamed(context, Routes.cakePayAccountPage);
|
||||
return;
|
||||
}
|
||||
Navigator.pushNamed(context, Routes.cakePayWelcomePage);
|
||||
});
|
||||
});
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget body(BuildContext context) {
|
||||
|
||||
if (_cardsListViewModel.settingsStore.selectedCakePayCountry == null) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
reaction((_) => _cardsListViewModel.shouldShowCountryPicker, (bool shouldShowCountryPicker) async {
|
||||
if (shouldShowCountryPicker) {
|
||||
_cardsListViewModel.storeInitialFilterStates();
|
||||
await showCountryPicker(context, _cardsListViewModel);
|
||||
if (_cardsListViewModel.hasFiltersChanged) {
|
||||
_cardsListViewModel.resetLoadingNextPageState();
|
||||
_cardsListViewModel.getVendors();
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
reaction((_) => _cardsListViewModel.shouldShowCountryPicker,
|
||||
(bool shouldShowCountryPicker) async {
|
||||
if (shouldShowCountryPicker) {
|
||||
_cardsListViewModel.storeInitialFilterStates();
|
||||
await showCountryPicker(context, _cardsListViewModel);
|
||||
if (_cardsListViewModel.hasFiltersChanged) {
|
||||
_cardsListViewModel.resetLoadingNextPageState();
|
||||
_cardsListViewModel.getVendors();
|
||||
}
|
||||
|
||||
_cardsListViewModel.settingsStore.selectedCakePayCountry =
|
||||
_cardsListViewModel.selectedCountry;
|
||||
}
|
||||
|
||||
_cardsListViewModel.settingsStore.selectedCakePayCountry =
|
||||
_cardsListViewModel.selectedCountry;
|
||||
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
final filterButton = Semantics(
|
||||
label: S.of(context).filter_by,
|
||||
child: GestureDetector(
|
||||
onTap: () async {
|
||||
_cardsListViewModel.storeInitialFilterStates();
|
||||
await showFilterWidget(context);
|
||||
if (_cardsListViewModel.hasFiltersChanged) {
|
||||
_cardsListViewModel.resetLoadingNextPageState();
|
||||
_cardsListViewModel.getVendors();
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
width: 32,
|
||||
padding: EdgeInsets.only(top: 7, bottom: 7),
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).extension<SyncIndicatorTheme>()!.syncedBackgroundColor,
|
||||
border: Border.all(
|
||||
color: Colors.transparent,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Image.asset(
|
||||
'assets/images/filter_icon.png',
|
||||
color: Theme.of(context).extension<FilterTheme>()!.iconColor,
|
||||
))),
|
||||
onTap: () async {
|
||||
_cardsListViewModel.storeInitialFilterStates();
|
||||
await showFilterWidget(context);
|
||||
if (_cardsListViewModel.hasFiltersChanged) {
|
||||
_cardsListViewModel.resetLoadingNextPageState();
|
||||
_cardsListViewModel.getVendors();
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
width: 32,
|
||||
padding: EdgeInsets.only(top: 7, bottom: 7),
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).colorScheme.surface,
|
||||
border: Border.all(
|
||||
color: Colors.transparent,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Image.asset(
|
||||
'assets/images/filter_icon.png',
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
final _countryPicker = Semantics(
|
||||
label: S.of(context).filter_by,
|
||||
|
@ -143,7 +143,7 @@ class CakePayCardsPage extends BasePage {
|
|||
child: Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 8),
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).extension<SyncIndicatorTheme>()!.syncedBackgroundColor,
|
||||
color: Theme.of(context).colorScheme.surface,
|
||||
border: Border.all(color: Colors.transparent),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
|
@ -163,11 +163,10 @@ class CakePayCardsPage extends BasePage {
|
|||
SizedBox(width: 6),
|
||||
Text(
|
||||
_cardsListViewModel.selectedCountry.countryCode,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).extension<DashboardPageTheme>()!.textColor,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
style: Theme.of(context).textTheme.bodyMedium!.copyWith(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
@ -177,25 +176,32 @@ class CakePayCardsPage extends BasePage {
|
|||
);
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(14.0),
|
||||
child: Column(children: [
|
||||
padding: const EdgeInsets.all(14.0),
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 2, right: 22),
|
||||
height: 32,
|
||||
child: Row(children: [
|
||||
padding: EdgeInsets.only(left: 2, right: 22),
|
||||
height: 32,
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: _SearchWidget(
|
||||
controller: _searchController,
|
||||
focusNode: searchFocusNode,
|
||||
)),
|
||||
child: _SearchWidget(
|
||||
controller: _searchController,
|
||||
focusNode: searchFocusNode,
|
||||
),
|
||||
),
|
||||
SizedBox(width: 5),
|
||||
filterButton,
|
||||
SizedBox(width: 5),
|
||||
_countryPicker
|
||||
])),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
Expanded(child: CakePayCardsPageBody(cardsListViewModel: _cardsListViewModel))
|
||||
]));
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> showFilterWidget(BuildContext context) async {
|
||||
|
@ -208,26 +214,25 @@ class CakePayCardsPage extends BasePage {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
Future<void> showCountryPicker(BuildContext context, CakePayCardsListViewModel cardsListViewModel) async {
|
||||
Future<void> showCountryPicker(
|
||||
BuildContext context, CakePayCardsListViewModel cardsListViewModel) async {
|
||||
await showPopUp<void>(
|
||||
context: context,
|
||||
builder: (_) => Picker(
|
||||
title: S.of(context).select_your_country,
|
||||
title: S.of(context).select_your_country,
|
||||
items: cardsListViewModel.availableCountries,
|
||||
images: cardsListViewModel.availableCountries
|
||||
.map((e) => Image.asset(
|
||||
e.iconPath,
|
||||
errorBuilder: (context, error, stackTrace) => Container(
|
||||
width: 58,
|
||||
height: 58,
|
||||
),
|
||||
))
|
||||
e.iconPath,
|
||||
errorBuilder: (context, error, stackTrace) => Container(
|
||||
width: 58,
|
||||
height: 58,
|
||||
),
|
||||
))
|
||||
.toList(),
|
||||
selectedAtIndex: cardsListViewModel.availableCountries
|
||||
.indexOf(cardsListViewModel.selectedCountry),
|
||||
onItemSelected: (Country country) =>
|
||||
cardsListViewModel.setSelectedCountry(country),
|
||||
selectedAtIndex:
|
||||
cardsListViewModel.availableCountries.indexOf(cardsListViewModel.selectedCountry),
|
||||
onItemSelected: (Country country) => cardsListViewModel.setSelectedCountry(country),
|
||||
isSeparated: false,
|
||||
hintText: S.of(context).search,
|
||||
matchingCriteria: (Country country, String searchText) =>
|
||||
|
@ -310,10 +315,9 @@ class _CakePayCardsPageBodyState extends State<CakePayCardsPageBody> {
|
|||
},
|
||||
title: vendor.name,
|
||||
subTitle: vendor.card?.description ?? '',
|
||||
backgroundColor:
|
||||
Theme.of(context).extension<SyncIndicatorTheme>()!.syncedBackgroundColor,
|
||||
titleColor: Theme.of(context).extension<DashboardPageTheme>()!.textColor,
|
||||
subtitleColor: Theme.of(context).extension<BalancePageTheme>()!.labelTextColor,
|
||||
backgroundColor: Theme.of(context).colorScheme.surface,
|
||||
titleColor: Theme.of(context).colorScheme.onSurface,
|
||||
subtitleColor: Theme.of(context).colorScheme.onSecondary,
|
||||
discount: 0.0,
|
||||
);
|
||||
},
|
||||
|
@ -324,10 +328,8 @@ class _CakePayCardsPageBodyState extends State<CakePayCardsPageBody> {
|
|||
thumbHeight: thumbHeight,
|
||||
rightOffset: 1,
|
||||
width: 3,
|
||||
backgroundColor:
|
||||
Theme.of(context).extension<FilterTheme>()!.iconColor.withOpacity(0.05),
|
||||
thumbColor:
|
||||
Theme.of(context).extension<FilterTheme>()!.iconColor.withOpacity(0.5),
|
||||
backgroundColor: Theme.of(context).colorScheme.onSurfaceVariant.withOpacity(0.05),
|
||||
thumbColor: Theme.of(context).colorScheme.onSurfaceVariant.withOpacity(0.5),
|
||||
fromTop: widget.cardsListViewModel.scrollOffsetFromTop,
|
||||
)
|
||||
: Offstage()
|
||||
|
@ -343,9 +345,8 @@ class _VendorLoadedIndicator extends StatelessWidget {
|
|||
Widget build(BuildContext context) {
|
||||
return Center(
|
||||
child: CircularProgressIndicator(
|
||||
backgroundColor: Theme.of(context).extension<DashboardPageTheme>()!.textColor,
|
||||
valueColor: AlwaysStoppedAnimation<Color>(
|
||||
Theme.of(context).extension<ExchangePageTheme>()!.firstGradientBottomPanelColor),
|
||||
backgroundColor: Theme.of(context).colorScheme.onSurface,
|
||||
valueColor: AlwaysStoppedAnimation<Color>(Theme.of(context).colorScheme.primary),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
@ -362,41 +363,23 @@ class _SearchWidget extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final searchIcon = ExcludeSemantics(
|
||||
child: Icon( Icons.search,
|
||||
color: Theme.of(context).extension<FilterTheme>()!.iconColor,
|
||||
//size: 24
|
||||
),
|
||||
);
|
||||
|
||||
return TextField(
|
||||
return BaseTextFormField(
|
||||
focusNode: focusNode,
|
||||
style: TextStyle(color: Theme.of(context).extension<DashboardPageTheme>()!.textColor),
|
||||
textStyle: Theme.of(context).textTheme.bodyMedium,
|
||||
controller: controller,
|
||||
decoration: InputDecoration(
|
||||
filled: true,
|
||||
contentPadding: EdgeInsets.only(
|
||||
top: 8,
|
||||
left: 8,
|
||||
contentPadding: EdgeInsets.only(top: 8, left: 8),
|
||||
hintText: S.of(context).search,
|
||||
placeholderTextStyle: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
),
|
||||
fillColor: Theme.of(context).extension<SyncIndicatorTheme>()!.syncedBackgroundColor,
|
||||
hintText: S.of(context).search,
|
||||
hintStyle: TextStyle(
|
||||
color: Theme.of(context).extension<BalancePageTheme>()!.labelTextColor,
|
||||
),
|
||||
alignLabelWithHint: true,
|
||||
floatingLabelBehavior: FloatingLabelBehavior.never,
|
||||
suffixIcon: searchIcon,
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Colors.transparent,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.white.withOpacity(0.2)),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
)),
|
||||
alignLabelWithHint: true,
|
||||
floatingLabelBehavior: FloatingLabelBehavior.never,
|
||||
suffixIcon: ExcludeSemantics(
|
||||
child: Icon(
|
||||
Icons.search,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import 'package:cake_wallet/cake_pay/cake_pay_card.dart';
|
||||
import 'package:cake_wallet/core/execution_state.dart';
|
||||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
import 'package:cake_wallet/cake_pay/cake_pay_card.dart';
|
||||
import 'package:cake_wallet/routes.dart';
|
||||
import 'package:cake_wallet/src/screens/base_page.dart';
|
||||
import 'package:cake_wallet/src/screens/cake_pay/widgets/cake_pay_alert_modal.dart';
|
||||
|
@ -15,10 +15,6 @@ import 'package:cake_wallet/src/widgets/bottom_sheet/info_bottom_sheet_widget.da
|
|||
import 'package:cake_wallet/src/widgets/primary_button.dart';
|
||||
import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart';
|
||||
import 'package:cake_wallet/src/widgets/standard_checkbox.dart';
|
||||
import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
|
||||
import 'package:cake_wallet/themes/extensions/picker_theme.dart';
|
||||
import 'package:cake_wallet/themes/extensions/receive_page_theme.dart';
|
||||
import 'package:cake_wallet/typography.dart';
|
||||
import 'package:cake_wallet/utils/show_pop_up.dart';
|
||||
import 'package:cake_wallet/view_model/cake_pay/cake_pay_purchase_view_model.dart';
|
||||
import 'package:cake_wallet/view_model/send/send_view_model_state.dart';
|
||||
|
@ -42,11 +38,10 @@ class CakePayBuyCardDetailPage extends BasePage {
|
|||
title,
|
||||
textAlign: TextAlign.center,
|
||||
maxLines: 2,
|
||||
style: TextStyle(
|
||||
fontSize: 18.0,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontFamily: 'Lato',
|
||||
color: titleColor(context)),
|
||||
style: Theme.of(context).textTheme.titleLarge?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -72,9 +67,11 @@ class CakePayBuyCardDetailPage extends BasePage {
|
|||
BorderRadius.horizontal(left: Radius.circular(20), right: Radius.circular(20)),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).extension<PickerTheme>()!.searchBackgroundFillColor,
|
||||
color: Theme.of(context).colorScheme.surfaceContainerLowest,
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
border: Border.all(color: Colors.white.withOpacity(0.20)),
|
||||
border: Border.all(
|
||||
color: Theme.of(context).colorScheme.outline.withOpacity(0.20),
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
|
@ -104,16 +101,16 @@ class CakePayBuyCardDetailPage extends BasePage {
|
|||
children: [
|
||||
Text(
|
||||
S.of(context).value + ':',
|
||||
style: textLarge(
|
||||
color:
|
||||
Theme.of(context).extension<CakeTextTheme>()!.titleColor),
|
||||
style: Theme.of(context).textTheme.titleLarge?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
SizedBox(width: 8),
|
||||
Text(
|
||||
'${cakePayPurchaseViewModel.amount.toStringAsFixed(2)} ${cakePayPurchaseViewModel.fiatCurrency}',
|
||||
style: textLarge(
|
||||
color:
|
||||
Theme.of(context).extension<CakeTextTheme>()!.titleColor),
|
||||
style: Theme.of(context).textTheme.titleLarge?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
@ -122,16 +119,16 @@ class CakePayBuyCardDetailPage extends BasePage {
|
|||
children: [
|
||||
Text(
|
||||
S.of(context).quantity + ':',
|
||||
style: textLarge(
|
||||
color:
|
||||
Theme.of(context).extension<CakeTextTheme>()!.titleColor),
|
||||
style: Theme.of(context).textTheme.titleLarge?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
SizedBox(width: 8),
|
||||
Text(
|
||||
'${cakePayPurchaseViewModel.quantity}',
|
||||
style: textLarge(
|
||||
color:
|
||||
Theme.of(context).extension<CakeTextTheme>()!.titleColor),
|
||||
style: Theme.of(context).textTheme.titleLarge?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
@ -140,16 +137,16 @@ class CakePayBuyCardDetailPage extends BasePage {
|
|||
children: [
|
||||
Text(
|
||||
S.of(context).total + ':',
|
||||
style: textLarge(
|
||||
color:
|
||||
Theme.of(context).extension<CakeTextTheme>()!.titleColor),
|
||||
style: Theme.of(context).textTheme.titleLarge?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
SizedBox(width: 8),
|
||||
Text(
|
||||
'${cakePayPurchaseViewModel.totalAmount.toStringAsFixed(2)} ${cakePayPurchaseViewModel.fiatCurrency}',
|
||||
style: textLarge(
|
||||
color:
|
||||
Theme.of(context).extension<CakeTextTheme>()!.titleColor),
|
||||
style: Theme.of(context).textTheme.titleLarge?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
@ -176,15 +173,17 @@ class CakePayBuyCardDetailPage extends BasePage {
|
|||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(S.of(context).expiry_and_validity + ':',
|
||||
style: textMediumSemiBold(
|
||||
color: Theme.of(context).extension<CakeTextTheme>()!.titleColor)),
|
||||
style: Theme.of(context).textTheme.titleLarge?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
fontWeight: FontWeight.w600,
|
||||
)),
|
||||
SizedBox(height: 10),
|
||||
Container(
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
border: Border(
|
||||
bottom: BorderSide(
|
||||
color: Theme.of(context).extension<CakeTextTheme>()!.secondaryTextColor,
|
||||
color: Theme.of(context).colorScheme.outline.withOpacity(0.20),
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
|
@ -193,9 +192,9 @@ class CakePayBuyCardDetailPage extends BasePage {
|
|||
padding: const EdgeInsets.only(bottom: 8.0),
|
||||
child: Text(
|
||||
card.expiryAndValidity ?? '',
|
||||
style: textMedium(
|
||||
color: Theme.of(context).extension<CakeTextTheme>()!.secondaryTextColor,
|
||||
),
|
||||
style: Theme.of(context).textTheme.bodyLarge?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -216,18 +215,21 @@ class CakePayBuyCardDetailPage extends BasePage {
|
|||
cakePayPurchaseViewModel.sendViewModel.state is IsExecutingState,
|
||||
onPressed: () => confirmPurchaseFirst(context),
|
||||
text: S.of(context).purchase_gift_card,
|
||||
color: Theme.of(context).primaryColor,
|
||||
textColor: Colors.white,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
textColor: Theme.of(context).colorScheme.onPrimary,
|
||||
);
|
||||
}),
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
InkWell(
|
||||
onTap: () => _showTermsAndCondition(context, card.termsAndConditions),
|
||||
child: Text(S.of(context).settings_terms_and_conditions,
|
||||
style: textMediumSemiBold(
|
||||
color: Theme.of(context).primaryColor,
|
||||
).copyWith(fontSize: 12)),
|
||||
child: Text(
|
||||
S.of(context).settings_terms_and_conditions,
|
||||
style: Theme.of(context).textTheme.bodySmall?.copyWith(
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 16)
|
||||
],
|
||||
|
@ -245,11 +247,14 @@ class CakePayBuyCardDetailPage extends BasePage {
|
|||
alignment: Alignment.bottomLeft,
|
||||
child: ClickableLinksText(
|
||||
text: termsAndConditions ?? '',
|
||||
textStyle: TextStyle(
|
||||
color: Theme.of(context).extension<CakeTextTheme>()!.secondaryTextColor,
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
textStyle: Theme.of(context).textTheme.bodyLarge?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
fontSize: 18,
|
||||
) ??
|
||||
Theme.of(context).textTheme.bodyMedium!.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
fontSize: 18,
|
||||
),
|
||||
),
|
||||
),
|
||||
actionTitle: S.of(context).agree,
|
||||
|
@ -311,9 +316,8 @@ class CakePayBuyCardDetailPage extends BasePage {
|
|||
} catch (_) {
|
||||
await cakePayPurchaseViewModel.cakePayService.logout();
|
||||
}
|
||||
|
||||
}
|
||||
cakePayPurchaseViewModel.isPurchasing = false;
|
||||
}
|
||||
cakePayPurchaseViewModel.isPurchasing = false;
|
||||
}
|
||||
|
||||
void _showHowToUseCard(
|
||||
|
@ -330,23 +334,27 @@ class CakePayBuyCardDetailPage extends BasePage {
|
|||
padding: EdgeInsets.all(10),
|
||||
child: Text(
|
||||
card.name,
|
||||
style: textLargeSemiBold(
|
||||
color: Theme.of(context).extension<ReceivePageTheme>()!.tilesTextColor,
|
||||
),
|
||||
style: Theme.of(context).textTheme.titleLarge?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
)),
|
||||
ClickableLinksText(
|
||||
text: card.howToUse ?? '',
|
||||
textStyle: TextStyle(
|
||||
color: Theme.of(context).extension<CakeTextTheme>()!.secondaryTextColor,
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
linkStyle: TextStyle(
|
||||
color: Theme.of(context).extension<CakeTextTheme>()!.titleColor,
|
||||
fontSize: 18,
|
||||
fontStyle: FontStyle.italic,
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
textStyle: Theme.of(context).textTheme.bodyLarge?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
) ??
|
||||
Theme.of(context).textTheme.bodyMedium!.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
linkStyle: Theme.of(context).textTheme.bodyLarge?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
fontStyle: FontStyle.italic,
|
||||
) ??
|
||||
Theme.of(context).textTheme.bodyMedium!.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
fontStyle: FontStyle.italic,
|
||||
),
|
||||
),
|
||||
]),
|
||||
actionTitle: S.current.got_it,
|
||||
|
@ -390,10 +398,12 @@ class CakePayBuyCardDetailPage extends BasePage {
|
|||
currency: cakePayPurchaseViewModel.sendViewModel.selectedCryptoCurrency,
|
||||
amount: S.of(popupContext).send_amount,
|
||||
amountValue: cakePayPurchaseViewModel.sendViewModel.pendingTransaction!.amountFormatted,
|
||||
fiatAmountValue: cakePayPurchaseViewModel.sendViewModel.pendingTransactionFiatAmountFormatted,
|
||||
fiatAmountValue:
|
||||
cakePayPurchaseViewModel.sendViewModel.pendingTransactionFiatAmountFormatted,
|
||||
fee: S.of(popupContext).send_fee,
|
||||
feeValue: cakePayPurchaseViewModel.sendViewModel.pendingTransaction!.feeFormatted,
|
||||
feeFiatAmount: cakePayPurchaseViewModel.sendViewModel.pendingTransactionFeeFiatAmountFormatted,
|
||||
feeFiatAmount:
|
||||
cakePayPurchaseViewModel.sendViewModel.pendingTransactionFeeFiatAmountFormatted,
|
||||
outputs: cakePayPurchaseViewModel.sendViewModel.outputs,
|
||||
onSlideComplete: () async {
|
||||
Navigator.of(popupContext).pop();
|
||||
|
@ -532,19 +542,15 @@ class ThreeCheckboxAlert extends BaseAlertDialog {
|
|||
|
||||
@override
|
||||
String get titleText => alertTitle;
|
||||
|
||||
@override
|
||||
bool get isDividerExists => true;
|
||||
|
||||
@override
|
||||
String get leftActionButtonText => leftButtonText;
|
||||
|
||||
@override
|
||||
String get rightActionButtonText => rightButtonText;
|
||||
|
||||
@override
|
||||
VoidCallback get actionLeft => actionLeftButton;
|
||||
|
||||
@override
|
||||
VoidCallback get actionRight => () {
|
||||
actionRightButton(checkbox1, checkbox2, checkbox3);
|
||||
|
@ -669,14 +675,12 @@ class _ThreeCheckboxAlertContentState extends State<ThreeCheckboxAlertContent> {
|
|||
padding: const EdgeInsets.only(top: 8.0),
|
||||
child: Text(
|
||||
S.of(context).settings_terms_and_conditions,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontFamily: 'Lato',
|
||||
fontWeight: FontWeight.w400,
|
||||
color: Theme.of(context).primaryColor,
|
||||
decoration: TextDecoration.none,
|
||||
height: 1,
|
||||
),
|
||||
style: Theme.of(context).textTheme.bodyMedium!.copyWith(
|
||||
fontSize: 16,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
decoration: TextDecoration.none,
|
||||
height: 1,
|
||||
),
|
||||
softWrap: true,
|
||||
),
|
||||
),
|
||||
|
@ -686,13 +690,10 @@ class _ThreeCheckboxAlertContentState extends State<ThreeCheckboxAlertContent> {
|
|||
padding: const EdgeInsets.only(top: 8.0),
|
||||
child: Text(
|
||||
'Please confirm all checkboxes',
|
||||
style: TextStyle(
|
||||
color: Colors.red,
|
||||
fontSize: 14,
|
||||
fontFamily: 'Lato',
|
||||
fontWeight: FontWeight.w400,
|
||||
decoration: TextDecoration.none,
|
||||
),
|
||||
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||
color: Theme.of(context).colorScheme.errorContainer,
|
||||
decoration: TextDecoration.none,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
import 'package:cake_wallet/src/widgets/alert_background.dart';
|
||||
import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
|
||||
import 'package:cake_wallet/src/widgets/primary_button.dart';
|
||||
import 'package:cake_wallet/themes/extensions/cake_scrollbar_theme.dart';
|
||||
import 'package:cake_wallet/typography.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class CakePayAlertModal extends StatelessWidget {
|
||||
|
@ -34,7 +31,7 @@ class CakePayAlertModal extends StatelessWidget {
|
|||
padding: EdgeInsets.only(top: 24, left: 24, right: 24),
|
||||
margin: EdgeInsets.all(24),
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).colorScheme.background,
|
||||
color: Theme.of(context).colorScheme.surface,
|
||||
borderRadius: BorderRadius.circular(30),
|
||||
),
|
||||
child: Column(
|
||||
|
@ -42,8 +39,9 @@ class CakePayAlertModal extends StatelessWidget {
|
|||
if (title.isNotEmpty)
|
||||
Text(
|
||||
title,
|
||||
style: textLargeSemiBold(
|
||||
color: Theme.of(context).extension<CakeScrollbarTheme>()!.thumbColor,
|
||||
style: Theme.of(context).textTheme.titleLarge?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
Container(
|
||||
|
@ -58,9 +56,8 @@ class CakePayAlertModal extends StatelessWidget {
|
|||
PrimaryButton(
|
||||
onPressed: () => Navigator.pop(context),
|
||||
text: actionTitle,
|
||||
color: Theme.of(context).cardColor,
|
||||
textColor:
|
||||
Theme.of(context).extension<CakeTextTheme>()!.titleColor,
|
||||
color: Theme.of(context).colorScheme.surfaceContainer,
|
||||
textColor: Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
SizedBox(height: 21),
|
||||
],
|
||||
|
@ -75,9 +72,9 @@ class CakePayAlertModal extends StatelessWidget {
|
|||
child: CircleAvatar(
|
||||
child: Icon(
|
||||
Icons.close,
|
||||
color: Colors.black,
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
),
|
||||
backgroundColor: Colors.white,
|
||||
backgroundColor: Theme.of(context).colorScheme.surfaceContainer,
|
||||
),
|
||||
),
|
||||
)
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
import 'package:cake_wallet/typography.dart';
|
||||
import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:cake_wallet/themes/extensions/transaction_trade_theme.dart';
|
||||
|
||||
class CakePayTile extends StatelessWidget {
|
||||
const CakePayTile({
|
||||
|
@ -17,30 +14,34 @@ class CakePayTile extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
|
||||
return GestureDetector(
|
||||
onTap: onTap,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
title,
|
||||
style: textXSmall(
|
||||
color: Theme.of(context).extension<TransactionTradeTheme>()!.detailsTitlesColor,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
title,
|
||||
style: Theme.of(context).textTheme.bodySmall?.copyWith(
|
||||
color: colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
Text(
|
||||
subTitle,
|
||||
style: textMediumBold(
|
||||
color: Theme.of(context).extension<CakeTextTheme>()!.titleColor,
|
||||
SizedBox(height: 8),
|
||||
Text(
|
||||
subTitle,
|
||||
style: Theme.of(context).textTheme.titleMedium?.copyWith(
|
||||
color: colorScheme.onSurface,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
));
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,7 +44,9 @@ class CardItem extends StatelessWidget {
|
|||
borderRadius: BorderRadius.circular(10),
|
||||
border: hideBorder
|
||||
? Border.all(color: Colors.transparent)
|
||||
: Border.all(color: Colors.white.withOpacity(0.20)),
|
||||
: Border.all(
|
||||
color: Theme.of(context).colorScheme.outlineVariant.withOpacity(0.20),
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
|
@ -75,7 +77,7 @@ class CardItem extends StatelessWidget {
|
|||
title,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
style: Theme.of(context).textTheme.bodyMedium!.copyWith(
|
||||
color: titleColor,
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w700,
|
||||
|
@ -85,7 +87,7 @@ class CardItem extends StatelessWidget {
|
|||
subTitle,
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
style: Theme.of(context).textTheme.bodySmall!.copyWith(
|
||||
color: titleColor,
|
||||
fontSize: 10,
|
||||
fontWeight: FontWeight.w700,
|
||||
|
|
|
@ -13,15 +13,14 @@ class CakePayCardImagePlaceholder extends StatelessWidget {
|
|||
child: Center(
|
||||
child: Text(
|
||||
text ?? 'Image not found!',
|
||||
style: TextStyle(
|
||||
color: Colors.black,
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w900,
|
||||
),
|
||||
style: Theme.of(context).textTheme.bodySmall?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
fontWeight: FontWeight.w900,
|
||||
),
|
||||
),
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
color: Theme.of(context).colorScheme.surfaceContainer,
|
||||
),
|
||||
),
|
||||
);
|
||||
|
|
|
@ -29,11 +29,10 @@ class ClickableLinksText extends StatelessWidget {
|
|||
spans.add(
|
||||
TextSpan(
|
||||
text: url,
|
||||
style: TextStyle(
|
||||
color: Colors.blue,
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
fontSize: 18,
|
||||
),
|
||||
recognizer: TapGestureRecognizer()
|
||||
..onTap = () async {
|
||||
if (await canLaunchUrl(Uri.parse(url))) {
|
||||
|
|
|
@ -15,11 +15,11 @@ class RoundedCheckbox extends StatelessWidget {
|
|||
width: 20.0,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.all(Radius.circular(50.0)),
|
||||
color: Theme.of(context).primaryColor,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
child: Icon(
|
||||
Icons.check,
|
||||
color: Theme.of(context).colorScheme.background,
|
||||
color: Theme.of(context).colorScheme.surface,
|
||||
size: 14.0,
|
||||
))
|
||||
: Offstage();
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
import 'package:cake_wallet/typography.dart';
|
||||
import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class TextIconButton extends StatelessWidget {
|
||||
|
@ -14,24 +12,24 @@ class TextIconButton extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return
|
||||
InkWell(
|
||||
onTap: onTap,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
label,
|
||||
style: textMediumSemiBold(
|
||||
color: Theme.of(context).extension<CakeTextTheme>()!.titleColor,
|
||||
),
|
||||
),
|
||||
Icon(
|
||||
Icons.chevron_right_rounded,
|
||||
color: Theme.of(context).extension<CakeTextTheme>()!.titleColor,
|
||||
),
|
||||
],
|
||||
),
|
||||
return InkWell(
|
||||
onTap: onTap,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
label,
|
||||
style: Theme.of(context).textTheme.titleMedium?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
Icon(
|
||||
Icons.chevron_right_rounded,
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,8 +6,6 @@ import 'package:cake_wallet/routes.dart';
|
|||
import 'package:cake_wallet/src/screens/base_page.dart';
|
||||
import 'package:cake_wallet/src/screens/connect_device/widgets/device_tile.dart';
|
||||
import 'package:cake_wallet/src/widgets/primary_button.dart';
|
||||
import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
|
||||
import 'package:cake_wallet/themes/extensions/wallet_list_theme.dart';
|
||||
import 'package:cake_wallet/utils/responsive_layout_util.dart';
|
||||
import 'package:cake_wallet/view_model/hardware_wallet/ledger_view_model.dart';
|
||||
import 'package:cw_core/utils/print_verbose.dart';
|
||||
|
@ -195,12 +193,7 @@ class ConnectDevicePageBodyState extends State<ConnectDevicePageBody> {
|
|||
Platform.isIOS
|
||||
? S.of(context).connect_your_hardware_wallet_ios
|
||||
: S.of(context).connect_your_hardware_wallet,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Theme.of(context)
|
||||
.extension<CakeTextTheme>()!
|
||||
.titleColor),
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
|
@ -210,12 +203,7 @@ class ConnectDevicePageBodyState extends State<ConnectDevicePageBody> {
|
|||
padding: EdgeInsets.only(left: 20, right: 20, bottom: 20),
|
||||
child: Text(
|
||||
S.of(context).if_you_dont_see_your_device,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Theme.of(context)
|
||||
.extension<CakeTextTheme>()!
|
||||
.titleColor),
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
|
@ -227,12 +215,7 @@ class ConnectDevicePageBodyState extends State<ConnectDevicePageBody> {
|
|||
padding: EdgeInsets.only(left: 20, right: 20, bottom: 20),
|
||||
child: Text(
|
||||
S.of(context).ledger_please_enable_bluetooth,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Theme.of(context)
|
||||
.extension<CakeTextTheme>()!
|
||||
.titleColor),
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
|
@ -245,13 +228,7 @@ class ConnectDevicePageBodyState extends State<ConnectDevicePageBody> {
|
|||
width: double.infinity,
|
||||
child: Text(
|
||||
S.of(context).bluetooth,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: Theme.of(context)
|
||||
.extension<CakeTextTheme>()!
|
||||
.titleColor,
|
||||
),
|
||||
style: Theme.of(context).textTheme.bodyMedium,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -276,13 +253,7 @@ class ConnectDevicePageBodyState extends State<ConnectDevicePageBody> {
|
|||
width: double.infinity,
|
||||
child: Text(
|
||||
S.of(context).usb,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: Theme.of(context)
|
||||
.extension<CakeTextTheme>()!
|
||||
.titleColor,
|
||||
),
|
||||
style: Theme.of(context).textTheme.bodyMedium,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -303,12 +274,8 @@ class ConnectDevicePageBodyState extends State<ConnectDevicePageBody> {
|
|||
if (widget.allowChangeWallet) ...[
|
||||
PrimaryButton(
|
||||
text: S.of(context).wallets,
|
||||
color: Theme.of(context)
|
||||
.extension<WalletListTheme>()!
|
||||
.createNewWalletButtonBackgroundColor,
|
||||
textColor: Theme.of(context)
|
||||
.extension<WalletListTheme>()!
|
||||
.restoreWalletButtonTextColor,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
textColor: Theme.of(context).colorScheme.onPrimary,
|
||||
onPressed: _onChangeWallet,
|
||||
)
|
||||
],
|
||||
|
|
|
@ -127,8 +127,8 @@
|
|||
// child: PrimaryButton(
|
||||
// text: "Disconnect",
|
||||
// onPressed: () => disconnectCurrentDevice(),
|
||||
// color: Theme.of(context).primaryColor,
|
||||
// textColor: Colors.white),
|
||||
// color: Theme.of(context).colorScheme.primary,
|
||||
// textColor: Theme.of(context).colorScheme.onPrimary),
|
||||
// ),
|
||||
// ],
|
||||
// if (selectedDevice == null) ...[
|
||||
|
@ -156,8 +156,8 @@
|
|||
// devices.add(device);
|
||||
// }));
|
||||
// },
|
||||
// color: Theme.of(context).primaryColor,
|
||||
// textColor: Colors.white),
|
||||
// color: Theme.of(context).colorScheme.primary,
|
||||
// textColor: Theme.of(context).colorScheme.onPrimary),
|
||||
// Padding(
|
||||
// padding: EdgeInsets.only(top: 20),
|
||||
// child: PrimaryButton(
|
||||
|
@ -166,8 +166,8 @@
|
|||
// final dev = await ledger.listUsbDevices();
|
||||
// setState(() => devices = dev);
|
||||
// },
|
||||
// color: Theme.of(context).primaryColor,
|
||||
// textColor: Colors.white),
|
||||
// color: Theme.of(context).colorScheme.primary,
|
||||
// textColor: Theme.of(context).colorScheme.onPrimary),
|
||||
// ),
|
||||
// ],
|
||||
// ],
|
||||
|
@ -229,8 +229,8 @@
|
|||
// printV("${ex.errorCode.toRadixString(16)} ${ex.message}");
|
||||
// }
|
||||
// },
|
||||
// color: Theme.of(context).primaryColor,
|
||||
// textColor: Colors.white),
|
||||
// color: Theme.of(context).colorScheme.primary,
|
||||
// textColor: Theme.of(context).colorScheme.onPrimary),
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
|
|
|
@ -3,12 +3,10 @@ import 'package:cake_wallet/entities/generate_name.dart';
|
|||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
import 'package:cake_wallet/src/screens/base_page.dart';
|
||||
import 'package:cake_wallet/src/widgets/alert_with_one_action.dart';
|
||||
import 'package:cake_wallet/src/widgets/base_text_form_field.dart';
|
||||
import 'package:cake_wallet/src/widgets/blockchain_height_widget.dart';
|
||||
import 'package:cake_wallet/src/widgets/primary_button.dart';
|
||||
import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart';
|
||||
import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
|
||||
import 'package:cake_wallet/themes/extensions/new_wallet_theme.dart';
|
||||
import 'package:cake_wallet/themes/extensions/send_page_theme.dart';
|
||||
import 'package:cake_wallet/utils/responsive_layout_util.dart';
|
||||
import 'package:cake_wallet/utils/show_pop_up.dart';
|
||||
import 'package:cake_wallet/view_model/wallet_hardware_restore_view_model.dart';
|
||||
|
@ -26,8 +24,7 @@ class MoneroHardwareWalletOptionsPage extends BasePage {
|
|||
String get title => S.current.restore_title_from_hardware_wallet;
|
||||
|
||||
@override
|
||||
Widget body(BuildContext context) =>
|
||||
_MoneroHardwareWalletOptionsForm(_walletHardwareRestoreVM);
|
||||
Widget body(BuildContext context) => _MoneroHardwareWalletOptionsForm(_walletHardwareRestoreVM);
|
||||
}
|
||||
|
||||
class _MoneroHardwareWalletOptionsForm extends StatefulWidget {
|
||||
|
@ -40,8 +37,7 @@ class _MoneroHardwareWalletOptionsForm extends StatefulWidget {
|
|||
_MoneroHardwareWalletOptionsFormState(_walletHardwareRestoreVM);
|
||||
}
|
||||
|
||||
class _MoneroHardwareWalletOptionsFormState
|
||||
extends State<_MoneroHardwareWalletOptionsForm> {
|
||||
class _MoneroHardwareWalletOptionsFormState extends State<_MoneroHardwareWalletOptionsForm> {
|
||||
_MoneroHardwareWalletOptionsFormState(this._walletHardwareRestoreVM)
|
||||
: _formKey = GlobalKey<FormState>(),
|
||||
_blockchainHeightKey = GlobalKey<BlockchainHeightState>(),
|
||||
|
@ -68,8 +64,8 @@ class _MoneroHardwareWalletOptionsFormState
|
|||
contentPadding: EdgeInsets.only(left: 24, right: 24, bottom: 24),
|
||||
content: Center(
|
||||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(
|
||||
maxWidth: ResponsiveLayoutUtilBase.kDesktopMaxWidthConstraint),
|
||||
constraints:
|
||||
BoxConstraints(maxWidth: ResponsiveLayoutUtilBase.kDesktopMaxWidthConstraint),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
|
@ -80,60 +76,34 @@ class _MoneroHardwareWalletOptionsFormState
|
|||
child: Stack(
|
||||
alignment: Alignment.centerRight,
|
||||
children: [
|
||||
TextFormField(
|
||||
onChanged: (value) =>
|
||||
_walletHardwareRestoreVM.name = value,
|
||||
BaseTextFormField(
|
||||
onChanged: (value) => _walletHardwareRestoreVM.name = value,
|
||||
controller: _controller,
|
||||
style: TextStyle(
|
||||
fontSize: 20.0,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Theme.of(context)
|
||||
.extension<CakeTextTheme>()!
|
||||
.titleColor,
|
||||
),
|
||||
decoration: InputDecoration(
|
||||
hintStyle: TextStyle(
|
||||
fontSize: 18.0,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Theme.of(context)
|
||||
.extension<NewWalletTheme>()!
|
||||
.hintTextColor,
|
||||
),
|
||||
hintText: S.of(context).wallet_name,
|
||||
focusedBorder: UnderlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Theme.of(context)
|
||||
.extension<NewWalletTheme>()!
|
||||
.underlineColor,
|
||||
width: 1.0,
|
||||
textStyle: Theme.of(context).textTheme.bodyMedium!.copyWith(
|
||||
fontSize: 20.0,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
enabledBorder: UnderlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Theme.of(context)
|
||||
.extension<NewWalletTheme>()!
|
||||
.underlineColor,
|
||||
width: 1.0,
|
||||
placeholderTextStyle: Theme.of(context).textTheme.bodyMedium!.copyWith(
|
||||
fontSize: 18.0,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
suffixIcon: Semantics(
|
||||
label: S.of(context).generate_name,
|
||||
child: IconButton(
|
||||
onPressed: _onGenerateName,
|
||||
icon: Container(
|
||||
padding: const EdgeInsets.all(8),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(6.0),
|
||||
color: Theme.of(context).hintColor,
|
||||
),
|
||||
width: 34,
|
||||
height: 34,
|
||||
child: Image.asset(
|
||||
'assets/images/refresh_icon.png',
|
||||
color: Theme.of(context)
|
||||
.extension<SendPageTheme>()!
|
||||
.textFieldButtonIconColor,
|
||||
),
|
||||
hintText: S.of(context).wallet_name,
|
||||
suffixIcon: Semantics(
|
||||
label: S.of(context).generate_name,
|
||||
child: IconButton(
|
||||
onPressed: _onGenerateName,
|
||||
icon: Container(
|
||||
padding: const EdgeInsets.all(8),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(6.0),
|
||||
color: Theme.of(context).colorScheme.surfaceContainerHighest,
|
||||
),
|
||||
width: 34,
|
||||
height: 34,
|
||||
child: Image.asset(
|
||||
'assets/images/refresh_icon.png',
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -162,8 +132,8 @@ class _MoneroHardwareWalletOptionsFormState
|
|||
builder: (context) => LoadingPrimaryButton(
|
||||
onPressed: _confirmForm,
|
||||
text: S.of(context).seed_language_next,
|
||||
color: Colors.green,
|
||||
textColor: Colors.white,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
textColor: Theme.of(context).colorScheme.onPrimary,
|
||||
isDisabled: _walletHardwareRestoreVM.name.isEmpty,
|
||||
),
|
||||
),
|
||||
|
@ -178,8 +148,8 @@ class _MoneroHardwareWalletOptionsFormState
|
|||
setState(() {
|
||||
_controller.text = rName;
|
||||
_walletHardwareRestoreVM.name = rName;
|
||||
_controller.selection = TextSelection.fromPosition(
|
||||
TextPosition(offset: _controller.text.length));
|
||||
_controller.selection =
|
||||
TextSelection.fromPosition(TextPosition(offset: _controller.text.length));
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -206,8 +176,7 @@ class _MoneroHardwareWalletOptionsFormState
|
|||
|
||||
reaction((_) => _walletHardwareRestoreVM.error, (String? error) {
|
||||
if (error != null) {
|
||||
if (error == S.current.ledger_connection_error)
|
||||
Navigator.of(context).pop();
|
||||
if (error == S.current.ledger_connection_error) Navigator.of(context).pop();
|
||||
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
showPopUp<void>(
|
||||
|
|
|
@ -4,11 +4,9 @@ import 'package:cake_wallet/generated/i18n.dart';
|
|||
import 'package:cake_wallet/src/screens/base_page.dart';
|
||||
import 'package:cake_wallet/src/screens/new_wallet/widgets/select_button.dart';
|
||||
import 'package:cake_wallet/src/widgets/alert_with_one_action.dart';
|
||||
import 'package:cake_wallet/src/widgets/base_text_form_field.dart';
|
||||
import 'package:cake_wallet/src/widgets/primary_button.dart';
|
||||
import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart';
|
||||
import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
|
||||
import 'package:cake_wallet/themes/extensions/new_wallet_theme.dart';
|
||||
import 'package:cake_wallet/themes/extensions/send_page_theme.dart';
|
||||
import 'package:cake_wallet/utils/responsive_layout_util.dart';
|
||||
import 'package:cake_wallet/utils/show_pop_up.dart';
|
||||
import 'package:cake_wallet/view_model/wallet_hardware_restore_view_model.dart';
|
||||
|
@ -75,63 +73,50 @@ class _SelectHardwareWalletAccountFormState extends State<SelectHardwareWalletAc
|
|||
child: Stack(
|
||||
alignment: Alignment.centerRight,
|
||||
children: [
|
||||
TextFormField(
|
||||
BaseTextFormField(
|
||||
onChanged: (value) => _walletHardwareRestoreVM.name = value,
|
||||
controller: _controller,
|
||||
style: TextStyle(
|
||||
fontSize: 20.0,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Theme.of(context).extension<CakeTextTheme>()!.titleColor,
|
||||
),
|
||||
decoration: InputDecoration(
|
||||
hintStyle: TextStyle(
|
||||
fontSize: 18.0,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Theme.of(context).extension<NewWalletTheme>()!.hintTextColor,
|
||||
),
|
||||
hintText: S.of(context).wallet_name,
|
||||
focusedBorder: UnderlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color:
|
||||
Theme.of(context).extension<NewWalletTheme>()!.underlineColor,
|
||||
width: 1.0,
|
||||
textStyle: Theme.of(context).textTheme.bodyMedium!.copyWith(
|
||||
fontSize: 20.0,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
enabledBorder: UnderlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color:
|
||||
Theme.of(context).extension<NewWalletTheme>()!.underlineColor,
|
||||
width: 1.0,
|
||||
placeholderTextStyle: Theme.of(context).textTheme.bodyMedium!.copyWith(
|
||||
fontSize: 18.0,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
suffixIcon: Semantics(
|
||||
label: S.of(context).generate_name,
|
||||
child: IconButton(
|
||||
onPressed: () async {
|
||||
final rName = await generateName();
|
||||
FocusManager.instance.primaryFocus?.unfocus();
|
||||
hintText: S.of(context).wallet_name,
|
||||
// enabledBorder: UnderlineInputBorder(
|
||||
// borderSide: BorderSide(
|
||||
// color: Theme.of(context).colorScheme.outline,
|
||||
// width: 100,
|
||||
// ),
|
||||
// ),
|
||||
suffixIcon: Semantics(
|
||||
label: S.of(context).generate_name,
|
||||
child: IconButton(
|
||||
onPressed: () async {
|
||||
final rName = await generateName();
|
||||
FocusManager.instance.primaryFocus?.unfocus();
|
||||
|
||||
setState(() {
|
||||
_controller.text = rName;
|
||||
_walletHardwareRestoreVM.name = rName;
|
||||
_controller.selection = TextSelection.fromPosition(
|
||||
TextPosition(offset: _controller.text.length));
|
||||
});
|
||||
},
|
||||
icon: Container(
|
||||
padding: const EdgeInsets.all(8),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(6.0),
|
||||
color: Theme.of(context).hintColor,
|
||||
),
|
||||
width: 34,
|
||||
height: 34,
|
||||
child: Image.asset(
|
||||
'assets/images/refresh_icon.png',
|
||||
color: Theme.of(context)
|
||||
.extension<SendPageTheme>()!
|
||||
.textFieldButtonIconColor,
|
||||
),
|
||||
setState(() {
|
||||
_controller.text = rName;
|
||||
_walletHardwareRestoreVM.name = rName;
|
||||
_controller.selection = TextSelection.fromPosition(
|
||||
TextPosition(offset: _controller.text.length));
|
||||
});
|
||||
},
|
||||
icon: Container(
|
||||
padding: const EdgeInsets.all(8),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(6.0),
|
||||
color: Theme.of(context).colorScheme.surfaceContainerHighest,
|
||||
),
|
||||
width: 34,
|
||||
height: 34,
|
||||
child: Image.asset(
|
||||
'assets/images/refresh_icon.png',
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -148,18 +133,16 @@ class _SelectHardwareWalletAccountFormState extends State<SelectHardwareWalletAc
|
|||
width: double.infinity,
|
||||
child: Text(
|
||||
S.of(context).select_hw_account_below,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Theme.of(context).extension<CakeTextTheme>()!.titleColor,
|
||||
),
|
||||
style: Theme.of(context).textTheme.bodyMedium!.copyWith(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Observer(
|
||||
builder: (context) => Column(
|
||||
children: _walletHardwareRestoreVM.availableAccounts.map((acc) {
|
||||
|
||||
final address = acc.address;
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(top: 10),
|
||||
|
@ -171,7 +154,7 @@ class _SelectHardwareWalletAccountFormState extends State<SelectHardwareWalletAc
|
|||
width: 24,
|
||||
),
|
||||
text:
|
||||
"${acc.accountIndex} - ${address.substring(0, 6)}...${address.substring(address.length - 6)}",
|
||||
"${acc.accountIndex} - ${address.substring(0, 6)}...${address.substring(address.length - 6)}",
|
||||
showTrailingIcon: false,
|
||||
height: 54,
|
||||
isSelected: _walletHardwareRestoreVM.selectedAccount == acc,
|
||||
|
@ -184,15 +167,17 @@ class _SelectHardwareWalletAccountFormState extends State<SelectHardwareWalletAc
|
|||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 10),
|
||||
child: Observer(builder: (context) {
|
||||
return LoadingPrimaryButton(
|
||||
onPressed: _loadMoreAccounts,
|
||||
text: S.of(context).load_more,
|
||||
color: Theme.of(context).primaryColor,
|
||||
textColor: Colors.white,
|
||||
isLoading: _walletHardwareRestoreVM.isLoadingMoreAccounts,
|
||||
);
|
||||
}),
|
||||
child: Observer(
|
||||
builder: (context) {
|
||||
return LoadingPrimaryButton(
|
||||
onPressed: _loadMoreAccounts,
|
||||
text: S.of(context).load_more,
|
||||
color: Theme.of(context).colorScheme.surfaceContainer,
|
||||
textColor: Theme.of(context).colorScheme.onSecondaryContainer,
|
||||
isLoading: _walletHardwareRestoreVM.isLoadingMoreAccounts,
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
@ -204,8 +189,8 @@ class _SelectHardwareWalletAccountFormState extends State<SelectHardwareWalletAc
|
|||
return LoadingPrimaryButton(
|
||||
onPressed: _confirmForm,
|
||||
text: S.of(context).seed_language_next,
|
||||
color: Colors.green,
|
||||
textColor: Colors.white,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
textColor: Theme.of(context).colorScheme.onPrimary,
|
||||
isDisabled: _walletHardwareRestoreVM.name.isEmpty,
|
||||
);
|
||||
},
|
||||
|
@ -229,11 +214,8 @@ class _SelectHardwareWalletAccountFormState extends State<SelectHardwareWalletAc
|
|||
if (_effectsInstalled) return;
|
||||
|
||||
reaction((_) => _walletHardwareRestoreVM.error, (String? error) {
|
||||
|
||||
if (error != null) {
|
||||
|
||||
if (error == S.current.ledger_connection_error)
|
||||
Navigator.of(context).pop();
|
||||
if (error == S.current.ledger_connection_error) Navigator.of(context).pop();
|
||||
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
showPopUp<void>(
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import 'package:cake_wallet/themes/extensions/option_tile_theme.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:ledger_flutter_plus/ledger_flutter_plus.dart';
|
||||
|
||||
|
@ -36,7 +35,7 @@ class DeviceTile extends StatelessWidget {
|
|||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.all(Radius.circular(12)),
|
||||
color: Theme.of(context).cardColor,
|
||||
color: Theme.of(context).colorScheme.surfaceContainer,
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
|
@ -47,17 +46,16 @@ class DeviceTile extends StatelessWidget {
|
|||
Image.asset(
|
||||
leading!,
|
||||
height: 30,
|
||||
color: Theme.of(context).extension<OptionTileTheme>()!.titleColor,
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
),
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(left: 16),
|
||||
child: Text(
|
||||
title,
|
||||
style: TextStyle(
|
||||
style: Theme.of(context).textTheme.bodyMedium!.copyWith(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Theme.of(context).extension<OptionTileTheme>()!.titleColor,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -67,7 +65,7 @@ class DeviceTile extends StatelessWidget {
|
|||
child: Image.asset(
|
||||
connectionTypeIcon!,
|
||||
height: 25,
|
||||
color: Theme.of(context).extension<OptionTileTheme>()!.titleColor,
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
),
|
||||
)
|
||||
],
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import 'package:cake_wallet/core/auth_service.dart';
|
||||
import 'package:cake_wallet/entities/contact.dart';
|
||||
import 'package:cake_wallet/entities/contact_base.dart';
|
||||
import 'package:cake_wallet/entities/contact_record.dart';
|
||||
import 'package:cake_wallet/entities/wallet_list_order_types.dart';
|
||||
|
@ -10,8 +9,6 @@ import 'package:cake_wallet/src/screens/dashboard/widgets/filter_list_widget.dar
|
|||
import 'package:cake_wallet/src/screens/wallet_list/filtered_list.dart';
|
||||
import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart';
|
||||
import 'package:cake_wallet/src/widgets/standard_list.dart';
|
||||
import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
|
||||
import 'package:cake_wallet/themes/extensions/exchange_page_theme.dart';
|
||||
import 'package:cake_wallet/utils/address_formatter.dart';
|
||||
import 'package:cake_wallet/utils/show_bar.dart';
|
||||
import 'package:cake_wallet/utils/show_pop_up.dart';
|
||||
|
@ -38,8 +35,9 @@ class ContactListPage extends BasePage {
|
|||
width: 32.0,
|
||||
height: 32.0,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Theme.of(context).extension<ExchangePageTheme>()!.buttonBackgroundColor),
|
||||
shape: BoxShape.circle,
|
||||
color: Theme.of(context).colorScheme.surfaceContainerHighest,
|
||||
),
|
||||
child: Semantics(
|
||||
label: S.of(context).add_contact,
|
||||
button: true,
|
||||
|
@ -48,28 +46,29 @@ class ContactListPage extends BasePage {
|
|||
children: <Widget>[
|
||||
Icon(
|
||||
Icons.add,
|
||||
color: Theme.of(context).appBarTheme.titleTextStyle!.color,
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
size: 22.0,
|
||||
),
|
||||
ButtonTheme(
|
||||
minWidth: 32.0,
|
||||
height: 32.0,
|
||||
child: TextButton(
|
||||
// FIX-ME: Style
|
||||
//shape: CircleBorder(),
|
||||
onPressed: () async {
|
||||
if (contactListViewModel.shouldRequireTOTP2FAForAddingContacts) {
|
||||
authService.authenticateAction(
|
||||
context,
|
||||
route: Routes.addressBookAddContact,
|
||||
conditionToDetermineIfToUse2FA:
|
||||
contactListViewModel.shouldRequireTOTP2FAForAddingContacts,
|
||||
);
|
||||
} else {
|
||||
await Navigator.of(context).pushNamed(Routes.addressBookAddContact);
|
||||
}
|
||||
},
|
||||
child: Offstage()),
|
||||
// FIX-ME: Style
|
||||
//shape: CircleBorder(),
|
||||
onPressed: () async {
|
||||
if (contactListViewModel.shouldRequireTOTP2FAForAddingContacts) {
|
||||
authService.authenticateAction(
|
||||
context,
|
||||
route: Routes.addressBookAddContact,
|
||||
conditionToDetermineIfToUse2FA:
|
||||
contactListViewModel.shouldRequireTOTP2FAForAddingContacts,
|
||||
);
|
||||
} else {
|
||||
await Navigator.of(context).pushNamed(Routes.addressBookAddContact);
|
||||
}
|
||||
},
|
||||
child: Offstage(),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
|
@ -117,46 +116,45 @@ class _ContactPageBodyState extends State<ContactPageBody> with SingleTickerProv
|
|||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 24, right: 24, bottom: 8),
|
||||
child: Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: TabBar(
|
||||
controller: _tabController,
|
||||
splashFactory: NoSplash.splashFactory,
|
||||
indicatorSize: TabBarIndicatorSize.label,
|
||||
isScrollable: true,
|
||||
labelStyle: TextStyle(
|
||||
fontSize: 18,
|
||||
fontFamily: 'Lato',
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Theme.of(context).appBarTheme.titleTextStyle!.color,
|
||||
child: Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: TabBar(
|
||||
controller: _tabController,
|
||||
splashFactory: NoSplash.splashFactory,
|
||||
indicatorSize: TabBarIndicatorSize.label,
|
||||
isScrollable: true,
|
||||
labelStyle: Theme.of(context).textTheme.bodyLarge!.copyWith(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
unselectedLabelStyle: Theme.of(context).textTheme.bodyLarge!.copyWith(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
indicatorColor: Theme.of(context).colorScheme.primary,
|
||||
indicatorPadding: EdgeInsets.zero,
|
||||
labelPadding: EdgeInsets.only(right: 24),
|
||||
tabAlignment: TabAlignment.start,
|
||||
dividerColor: Colors.transparent,
|
||||
padding: EdgeInsets.zero,
|
||||
tabs: [
|
||||
Tab(text: S.of(context).wallets),
|
||||
Tab(text: S.of(context).contact_list_contacts),
|
||||
],
|
||||
),
|
||||
unselectedLabelStyle: TextStyle(
|
||||
fontSize: 18,
|
||||
fontFamily: 'Lato',
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Theme.of(context).appBarTheme.titleTextStyle!.color?.withOpacity(0.5)),
|
||||
labelColor: Theme.of(context).appBarTheme.titleTextStyle!.color,
|
||||
indicatorColor: Theme.of(context).appBarTheme.titleTextStyle!.color,
|
||||
indicatorPadding: EdgeInsets.zero,
|
||||
labelPadding: EdgeInsets.only(right: 24),
|
||||
tabAlignment: TabAlignment.start,
|
||||
dividerColor: Colors.transparent,
|
||||
padding: EdgeInsets.zero,
|
||||
tabs: [
|
||||
Tab(text: S.of(context).wallets),
|
||||
Tab(text: S.of(context).contact_list_contacts),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: TabBarView(
|
||||
controller: _tabController,
|
||||
children: [
|
||||
_buildWalletContacts(context),
|
||||
ContactListBody(
|
||||
contactListViewModel: widget.contactListViewModel,
|
||||
tabController: _tabController),
|
||||
contactListViewModel: widget.contactListViewModel,
|
||||
tabController: _tabController,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
@ -195,26 +193,22 @@ class _ContactPageBodyState extends State<ContactPageBody> with SingleTickerProv
|
|||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(left: 16, right: 16, top: 4, bottom: 4),
|
||||
child: ExpansionTile(
|
||||
title: Text(
|
||||
groupName,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Theme.of(context).extension<CakeTextTheme>()!.titleColor,
|
||||
child: ExpansionTile(
|
||||
title: Text(
|
||||
groupName,
|
||||
style: Theme.of(context).textTheme.bodyMedium!,
|
||||
),
|
||||
leading: _buildCurrencyIcon(activeContact),
|
||||
tilePadding: const EdgeInsets.only(left: 16, right: 16),
|
||||
childrenPadding: const EdgeInsets.only(left: 16),
|
||||
expandedCrossAxisAlignment: CrossAxisAlignment.start,
|
||||
expandedAlignment: Alignment.topLeft,
|
||||
backgroundColor: Theme.of(context).colorScheme.surfaceContainer,
|
||||
collapsedBackgroundColor: Theme.of(context).colorScheme.surfaceContainer,
|
||||
collapsedShape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
|
||||
children: groupContacts.map((contact) => generateRaw(context, contact)).toList(),
|
||||
),
|
||||
leading: _buildCurrencyIcon(activeContact),
|
||||
tilePadding: const EdgeInsets.only(left: 16, right: 16),
|
||||
childrenPadding: const EdgeInsets.only(left: 16),
|
||||
expandedCrossAxisAlignment: CrossAxisAlignment.start,
|
||||
expandedAlignment: Alignment.topLeft,
|
||||
backgroundColor: Theme.of(context).cardColor,
|
||||
collapsedBackgroundColor: Theme.of(context).cardColor,
|
||||
collapsedShape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
|
||||
children: groupContacts.map((contact) => generateRaw(context, contact)).toList(),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -246,10 +240,10 @@ class _ContactPageBodyState extends State<ContactPageBody> with SingleTickerProv
|
|||
},
|
||||
behavior: HitTestBehavior.opaque,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.all(Radius.circular(10)),
|
||||
color: Theme.of(context).cardColor,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.all(Radius.circular(10)),
|
||||
color: Theme.of(context).colorScheme.surfaceContainer,
|
||||
),
|
||||
margin: const EdgeInsets.only(top: 4, bottom: 4, left: 16, right: 16),
|
||||
padding: const EdgeInsets.only(top: 16, bottom: 16, right: 16, left: 16),
|
||||
child: Row(
|
||||
|
@ -262,11 +256,7 @@ class _ContactPageBodyState extends State<ContactPageBody> with SingleTickerProv
|
|||
padding: EdgeInsets.only(left: 12),
|
||||
child: Text(
|
||||
contact.name,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Theme.of(context).extension<CakeTextTheme>()!.titleColor,
|
||||
),
|
||||
style: Theme.of(context).textTheme.bodyMedium!,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -324,7 +314,7 @@ class _ContactListBodyState extends State<ContactListBody> {
|
|||
? widget.contactListViewModel.contacts
|
||||
: widget.contactListViewModel.contactsToShow;
|
||||
return Scaffold(
|
||||
backgroundColor: Theme.of(context).colorScheme.background,
|
||||
backgroundColor: Theme.of(context).colorScheme.surface,
|
||||
body: Container(
|
||||
child: FilteredList(
|
||||
list: contacts,
|
||||
|
@ -343,8 +333,7 @@ class _ContactListBodyState extends State<ContactListBody> {
|
|||
return;
|
||||
}
|
||||
|
||||
final isCopied =
|
||||
await DialogService.showNameAndAddressDialog(context, contact);
|
||||
final isCopied = await DialogService.showNameAndAddressDialog(context, contact);
|
||||
|
||||
if (isCopied) {
|
||||
await Clipboard.setData(ClipboardData(text: contact.address));
|
||||
|
@ -356,7 +345,8 @@ class _ContactListBodyState extends State<ContactListBody> {
|
|||
? Slidable(
|
||||
key: Key('${contact.key}'),
|
||||
endActionPane: _actionPane(context, contact),
|
||||
child: contactContent)
|
||||
child: contactContent,
|
||||
)
|
||||
: contactContent,
|
||||
);
|
||||
},
|
||||
|
@ -379,7 +369,7 @@ class _ContactListBodyState extends State<ContactListBody> {
|
|||
key: Key('${contact.name}'),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.all(Radius.circular(8)),
|
||||
color: Theme.of(context).cardColor,
|
||||
color: Theme.of(context).colorScheme.surfaceContainer,
|
||||
),
|
||||
margin: const EdgeInsets.only(top: 4, bottom: 4, left: 16, right: 16),
|
||||
padding: const EdgeInsets.only(top: 16, bottom: 16, right: 16, left: 16),
|
||||
|
@ -393,11 +383,7 @@ class _ContactListBodyState extends State<ContactListBody> {
|
|||
padding: EdgeInsets.only(left: 12),
|
||||
child: Text(
|
||||
contact.name,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Theme.of(context).extension<CakeTextTheme>()!.titleColor,
|
||||
),
|
||||
style: Theme.of(context).textTheme.bodyMedium!,
|
||||
),
|
||||
))
|
||||
],
|
||||
|
@ -407,37 +393,41 @@ class _ContactListBodyState extends State<ContactListBody> {
|
|||
);
|
||||
}
|
||||
|
||||
ActionPane _actionPane(BuildContext context, ContactRecord contact) => ActionPane(
|
||||
ActionPane _actionPane(BuildContext context, ContactRecord contact) {
|
||||
return ActionPane(
|
||||
motion: const ScrollMotion(),
|
||||
extentRatio: 0.4,
|
||||
children: [
|
||||
SlidableAction(
|
||||
onPressed: (_) async => await Navigator.of(context)
|
||||
.pushNamed(Routes.addressBookAddContact, arguments: contact),
|
||||
backgroundColor: Colors.blue,
|
||||
foregroundColor: Colors.white,
|
||||
backgroundColor: Theme.of(context).colorScheme.primary,
|
||||
foregroundColor: Theme.of(context).colorScheme.onSurface,
|
||||
icon: Icons.edit,
|
||||
label: S.of(context).edit,
|
||||
),
|
||||
SlidableAction(
|
||||
onPressed: (_) async {
|
||||
final isDelete = await DialogService.showAlertDialog(context);
|
||||
|
||||
|
||||
if (isDelete) {
|
||||
await widget.contactListViewModel.delete(contact);
|
||||
}
|
||||
},
|
||||
backgroundColor: Colors.red,
|
||||
foregroundColor: Colors.white,
|
||||
backgroundColor: Theme.of(context).colorScheme.error,
|
||||
foregroundColor: Theme.of(context).colorScheme.onSurface,
|
||||
icon: CupertinoIcons.delete,
|
||||
label: S.of(context).delete,
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget filterButtonWidget(BuildContext context, ContactListViewModel contactListViewModel) {
|
||||
final filterIcon = Image.asset('assets/images/filter_icon.png',
|
||||
color: Theme.of(context).appBarTheme.titleTextStyle!.color);
|
||||
final filterIcon = Image.asset(
|
||||
'assets/images/filter_icon.png',
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
);
|
||||
return MergeSemantics(
|
||||
child: SizedBox(
|
||||
height: 58,
|
||||
|
@ -469,7 +459,7 @@ class _ContactListBodyState extends State<ContactListBody> {
|
|||
width: 36,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Theme.of(context).extension<ExchangePageTheme>()!.buttonBackgroundColor,
|
||||
color: Theme.of(context).colorScheme.surfaceContainer,
|
||||
),
|
||||
child: filterIcon,
|
||||
),
|
||||
|
@ -480,50 +470,45 @@ class _ContactListBodyState extends State<ContactListBody> {
|
|||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class DialogService {
|
||||
static Future<bool> showAlertDialog(BuildContext context) async {
|
||||
return await showPopUp<bool>(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertWithTwoActions(
|
||||
alertTitle: S.of(context).address_remove_contact,
|
||||
alertContent: S.of(context).address_remove_content,
|
||||
rightButtonText: S.of(context).remove,
|
||||
leftButtonText: S.of(context).cancel,
|
||||
actionRightButton: () => Navigator.of(context).pop(true),
|
||||
actionLeftButton: () => Navigator.of(context).pop(false));
|
||||
}) ??
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertWithTwoActions(
|
||||
alertTitle: S.of(context).address_remove_contact,
|
||||
alertContent: S.of(context).address_remove_content,
|
||||
rightButtonText: S.of(context).remove,
|
||||
leftButtonText: S.of(context).cancel,
|
||||
actionRightButton: () => Navigator.of(context).pop(true),
|
||||
actionLeftButton: () => Navigator.of(context).pop(false));
|
||||
}) ??
|
||||
false;
|
||||
}
|
||||
|
||||
static Future<bool> showNameAndAddressDialog(BuildContext context,ContactBase contact) async {
|
||||
static Future<bool> showNameAndAddressDialog(BuildContext context, ContactBase contact) async {
|
||||
return await showPopUp<bool>(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertWithTwoActions(
|
||||
alertTitle: contact.name,
|
||||
alertContent: contact.address,
|
||||
alertContentTextWidget: AddressFormatter.buildSegmentedAddress(
|
||||
address: contact.address,
|
||||
textAlign: TextAlign.center,
|
||||
walletType: cryptoCurrencyToWalletType(contact.type),
|
||||
evenTextStyle: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.normal,
|
||||
fontFamily: 'Lato',
|
||||
color: Theme.of(context).extension<CakeTextTheme>()!.titleColor,
|
||||
decoration: TextDecoration.none,
|
||||
),
|
||||
),
|
||||
rightButtonText: S.of(context).copy,
|
||||
leftButtonText: S.of(context).cancel,
|
||||
actionRightButton: () => Navigator.of(context).pop(true),
|
||||
actionLeftButton: () => Navigator.of(context).pop(false));
|
||||
}) ??
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertWithTwoActions(
|
||||
alertTitle: contact.name,
|
||||
alertContent: contact.address,
|
||||
alertContentTextWidget: AddressFormatter.buildSegmentedAddress(
|
||||
address: contact.address,
|
||||
textAlign: TextAlign.center,
|
||||
walletType: cryptoCurrencyToWalletType(contact.type),
|
||||
evenTextStyle: Theme.of(context).textTheme.bodyMedium!.copyWith(
|
||||
fontSize: 16,
|
||||
decoration: TextDecoration.none,
|
||||
),
|
||||
),
|
||||
rightButtonText: S.of(context).copy,
|
||||
leftButtonText: S.of(context).cancel,
|
||||
actionRightButton: () => Navigator.of(context).pop(true),
|
||||
actionLeftButton: () => Navigator.of(context).pop(false));
|
||||
}) ??
|
||||
false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
import 'package:cake_wallet/core/address_validator.dart';
|
||||
import 'package:cake_wallet/palette.dart';
|
||||
import 'package:cake_wallet/themes/extensions/transaction_trade_theme.dart';
|
||||
import 'package:cake_wallet/utils/show_pop_up.dart';
|
||||
import 'package:cw_core/currency.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
@ -18,8 +16,6 @@ import 'package:cake_wallet/src/widgets/address_text_field.dart';
|
|||
import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart';
|
||||
import 'package:cake_wallet/src/widgets/base_text_form_field.dart';
|
||||
import 'package:cake_wallet/src/screens/exchange/widgets/currency_picker.dart';
|
||||
import 'package:cake_wallet/themes/extensions/address_theme.dart';
|
||||
import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
|
||||
|
||||
class ContactPage extends BasePage {
|
||||
ContactPage(this.contactViewModel)
|
||||
|
@ -29,13 +25,10 @@ class ContactPage extends BasePage {
|
|||
_currencyTypeController = TextEditingController() {
|
||||
_nameController.text = contactViewModel.name;
|
||||
_addressController.text = contactViewModel.address;
|
||||
_nameController
|
||||
.addListener(() => contactViewModel.name = _nameController.text);
|
||||
_addressController
|
||||
.addListener(() => contactViewModel.address = _addressController.text);
|
||||
_nameController.addListener(() => contactViewModel.name = _nameController.text);
|
||||
_addressController.addListener(() => contactViewModel.address = _addressController.text);
|
||||
|
||||
autorun((_) => _currencyTypeController.text =
|
||||
contactViewModel.currency?.toString() ?? '');
|
||||
autorun((_) => _currencyTypeController.text = contactViewModel.currency?.toString() ?? '');
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -50,9 +43,11 @@ class ContactPage extends BasePage {
|
|||
|
||||
@override
|
||||
Widget body(BuildContext context) {
|
||||
final downArrow = Image.asset('assets/images/arrow_bottom_purple_icon.png',
|
||||
color: Theme.of(context).extension<TransactionTradeTheme>()!.detailsTitlesColor,
|
||||
height: 8);
|
||||
final downArrow = Image.asset(
|
||||
'assets/images/arrow_bottom_purple_icon.png',
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
height: 8,
|
||||
);
|
||||
|
||||
_setEffects(context);
|
||||
|
||||
|
@ -65,24 +60,29 @@ class ContactPage extends BasePage {
|
|||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
BaseTextFormField(
|
||||
controller: _nameController,
|
||||
hintText: S.of(context).contact_name,
|
||||
validator: ContactNameValidator()),
|
||||
controller: _nameController,
|
||||
hintText: S.of(context).contact_name,
|
||||
validator: ContactNameValidator(),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 20),
|
||||
child: Container(
|
||||
child: InkWell(
|
||||
onTap: () => _presentCurrencyPicker(context),
|
||||
child: IgnorePointer(
|
||||
child: BaseTextFormField(
|
||||
controller: _currencyTypeController,
|
||||
hintText: S.of(context).settings_currency,
|
||||
suffixIcon: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: <Widget>[downArrow],
|
||||
child: BaseTextFormField(
|
||||
controller: _currencyTypeController,
|
||||
hintText: S.of(context).settings_currency,
|
||||
suffixIcon: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
downArrow,
|
||||
SizedBox(width: 16),
|
||||
],
|
||||
),
|
||||
),
|
||||
)),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -95,47 +95,47 @@ class ContactPage extends BasePage {
|
|||
AddressTextFieldOption.paste,
|
||||
AddressTextFieldOption.qrCode,
|
||||
],
|
||||
buttonColor: Theme.of(context).extension<AddressTheme>()!.actionButtonColor,
|
||||
iconColor: PaletteDark.gray,
|
||||
borderColor: Theme.of(context).extension<CakeTextTheme>()!.textfieldUnderlineColor,
|
||||
validator:
|
||||
AddressValidator(type: contactViewModel.currency!),
|
||||
buttonColor: Theme.of(context).colorScheme.surfaceContainerHighest,
|
||||
iconColor: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
validator: AddressValidator(type: contactViewModel.currency!),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
bottomSectionPadding:
|
||||
EdgeInsets.only(left: 24, right: 24, bottom: 24),
|
||||
bottomSectionPadding: EdgeInsets.only(left: 24, right: 24, bottom: 24),
|
||||
bottomSection: Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: PrimaryButton(
|
||||
onPressed: () {
|
||||
contactViewModel.reset();
|
||||
_nameController.text = '';
|
||||
_addressController.text = '';
|
||||
},
|
||||
text: S.of(context).reset,
|
||||
color: Colors.orange,
|
||||
textColor: Colors.white),
|
||||
onPressed: () {
|
||||
contactViewModel.reset();
|
||||
_nameController.text = '';
|
||||
_addressController.text = '';
|
||||
},
|
||||
text: S.of(context).reset,
|
||||
color: Theme.of(context).colorScheme.surfaceContainer,
|
||||
textColor: Theme.of(context).colorScheme.onSecondaryContainer,
|
||||
),
|
||||
),
|
||||
SizedBox(width: 20),
|
||||
Expanded(
|
||||
child: Observer(
|
||||
builder: (_) => PrimaryButton(
|
||||
onPressed: () async {
|
||||
if (_formKey.currentState != null &&
|
||||
!_formKey.currentState!.validate()) {
|
||||
return;
|
||||
}
|
||||
child: Observer(
|
||||
builder: (_) => PrimaryButton(
|
||||
onPressed: () async {
|
||||
if (_formKey.currentState != null && !_formKey.currentState!.validate()) {
|
||||
return;
|
||||
}
|
||||
|
||||
await contactViewModel.save();
|
||||
},
|
||||
text: S.of(context).save,
|
||||
color: Theme.of(context).primaryColor,
|
||||
textColor: Colors.white,
|
||||
isDisabled: !contactViewModel.isReady)))
|
||||
await contactViewModel.save();
|
||||
},
|
||||
text: S.of(context).save,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
textColor: Theme.of(context).colorScheme.onPrimary,
|
||||
isDisabled: !contactViewModel.isReady,
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
)),
|
||||
);
|
||||
|
@ -143,17 +143,16 @@ class ContactPage extends BasePage {
|
|||
|
||||
void _presentCurrencyPicker(BuildContext context) {
|
||||
showPopUp<void>(
|
||||
builder: (_) => CurrencyPicker(
|
||||
selectedAtIndex: contactViewModel.currency != null
|
||||
? contactViewModel.currencies
|
||||
.indexOf(contactViewModel.currency!)
|
||||
: -1,
|
||||
items: contactViewModel.currencies,
|
||||
title: S.of(context).please_select,
|
||||
hintText: S.of(context).search_currency,
|
||||
onItemSelected: (Currency item) =>
|
||||
contactViewModel.currency = item as CryptoCurrency),
|
||||
context: context);
|
||||
builder: (_) => CurrencyPicker(
|
||||
selectedAtIndex: contactViewModel.currency != null
|
||||
? contactViewModel.currencies.indexOf(contactViewModel.currency!)
|
||||
: -1,
|
||||
items: contactViewModel.currencies,
|
||||
title: S.of(context).please_select,
|
||||
hintText: S.of(context).search_currency,
|
||||
onItemSelected: (Currency item) => contactViewModel.currency = item as CryptoCurrency),
|
||||
context: context,
|
||||
);
|
||||
}
|
||||
|
||||
void _onContactSavingFailure(BuildContext context, String error) {
|
||||
|
@ -161,15 +160,15 @@ class ContactPage extends BasePage {
|
|||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertWithOneAction(
|
||||
alertTitle: S.current.contact,
|
||||
alertContent: error,
|
||||
buttonText: S.of(context).ok,
|
||||
buttonAction: () => Navigator.of(context).pop());
|
||||
alertTitle: S.current.contact,
|
||||
alertContent: error,
|
||||
buttonText: S.of(context).ok,
|
||||
buttonAction: () => Navigator.of(context).pop(),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
void _onContactSavedSuccessfully(BuildContext context) =>
|
||||
Navigator.of(context).pop();
|
||||
void _onContactSavedSuccessfully(BuildContext context) => Navigator.of(context).pop();
|
||||
|
||||
void _setEffects(BuildContext context) {
|
||||
if (_isEffectsApplied) {
|
||||
|
|
|
@ -27,12 +27,12 @@ import 'package:cake_wallet/src/screens/dashboard/pages/transactions_page.dart';
|
|||
import 'package:cake_wallet/src/screens/dashboard/widgets/sync_indicator.dart';
|
||||
import 'package:cake_wallet/view_model/wallet_address_list/wallet_address_list_view_model.dart';
|
||||
import 'package:flutter_mobx/flutter_mobx.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:mobx/mobx.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:smooth_page_indicator/smooth_page_indicator.dart';
|
||||
import 'package:cake_wallet/main.dart';
|
||||
import 'package:cake_wallet/src/screens/release_notes/release_notes_screen.dart';
|
||||
import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart';
|
||||
|
||||
class DashboardPage extends StatefulWidget {
|
||||
DashboardPage({
|
||||
|
@ -164,18 +164,19 @@ class _DashboardPageView extends BasePage {
|
|||
|
||||
@override
|
||||
Widget trailing(BuildContext context) {
|
||||
final menuButton = Image.asset(
|
||||
'assets/images/menu.png',
|
||||
color: Theme.of(context).extension<DashboardPageTheme>()!.pageTitleTextColor,
|
||||
);
|
||||
|
||||
return Container(
|
||||
alignment: Alignment.centerRight,
|
||||
width: 40,
|
||||
width: 42,
|
||||
child: TextButton(
|
||||
key: ValueKey('dashboard_page_wallet_menu_button_key'),
|
||||
onPressed: () => onOpenEndDrawer(),
|
||||
child: Semantics(label: S.of(context).wallet_menu, child: menuButton),
|
||||
child: Semantics(
|
||||
label: S.of(context).wallet_menu,
|
||||
child: SvgPicture.asset(
|
||||
'assets/images/menu.svg',
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
@ -250,14 +251,8 @@ class _DashboardPageView extends BasePage {
|
|||
radius: 6.0,
|
||||
dotWidth: 6.0,
|
||||
dotHeight: 6.0,
|
||||
dotColor: Theme.of(context)
|
||||
.extension<DashboardPageTheme>()!
|
||||
.indicatorDotTheme
|
||||
.indicatorColor,
|
||||
activeDotColor: Theme.of(context)
|
||||
.extension<DashboardPageTheme>()!
|
||||
.indicatorDotTheme
|
||||
.activeIndicatorColor,
|
||||
dotColor: Theme.of(context).colorScheme.primary.withOpacity(0.4),
|
||||
activeDotColor: Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
),
|
||||
);
|
||||
|
@ -265,7 +260,10 @@ class _DashboardPageView extends BasePage {
|
|||
),
|
||||
),
|
||||
),
|
||||
NavigationDock(dashboardViewModel: dashboardViewModel)
|
||||
NavigationDock(
|
||||
dashboardViewModel: dashboardViewModel,
|
||||
currentTheme: currentTheme,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
|
@ -307,7 +305,6 @@ class _DashboardPageView extends BasePage {
|
|||
|
||||
rootKey.currentState?.isInactive.listen(
|
||||
(inactive) {
|
||||
|
||||
if (needToPresentYat) {
|
||||
Future<void>.delayed(Duration(milliseconds: 500)).then(
|
||||
(_) {
|
||||
|
|
|
@ -35,7 +35,7 @@ class DesktopDashboardPage extends StatelessWidget {
|
|||
_setEffects(context);
|
||||
|
||||
return Container(
|
||||
color: Theme.of(context).colorScheme.background,
|
||||
color: Theme.of(context).colorScheme.surface,
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
|
|
|
@ -1,10 +1,4 @@
|
|||
import 'package:auto_size_text/auto_size_text.dart';
|
||||
import 'package:cake_wallet/themes/extensions/balance_page_theme.dart';
|
||||
import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart';
|
||||
import 'package:cake_wallet/themes/extensions/sync_indicator_theme.dart';
|
||||
import 'package:cake_wallet/themes/extensions/balance_page_theme.dart';
|
||||
import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart';
|
||||
import 'package:cake_wallet/themes/extensions/sync_indicator_theme.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class DesktopActionButton extends StatelessWidget {
|
||||
|
@ -38,7 +32,7 @@ class DesktopActionButton extends StatelessWidget {
|
|||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(15.0),
|
||||
color: Theme.of(context).extension<SyncIndicatorTheme>()!.syncedBackgroundColor,
|
||||
color: Theme.of(context).colorScheme.surfaceContainer,
|
||||
),
|
||||
child: Center(
|
||||
child: Row(
|
||||
|
@ -49,19 +43,18 @@ class DesktopActionButton extends StatelessWidget {
|
|||
height: 30,
|
||||
width: 30,
|
||||
color: isEnabled
|
||||
? Theme.of(context).extension<DashboardPageTheme>()!.textColor
|
||||
: Theme.of(context).extension<BalancePageTheme>()!.labelTextColor,
|
||||
? Theme.of(context).colorScheme.onPrimaryContainer
|
||||
: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
AutoSizeText(
|
||||
title,
|
||||
style: TextStyle(
|
||||
style: Theme.of(context).textTheme.bodyMedium!.copyWith(
|
||||
fontSize: 24,
|
||||
fontFamily: 'Lato',
|
||||
fontWeight: FontWeight.bold,
|
||||
color: isEnabled
|
||||
? Theme.of(context).extension<DashboardPageTheme>()!.textColor
|
||||
: null,
|
||||
? Theme.of(context).colorScheme.onPrimaryContainer
|
||||
: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
height: 1,
|
||||
),
|
||||
maxLines: 1,
|
||||
|
|
|
@ -15,7 +15,7 @@ class DesktopDashboardActions extends StatelessWidget {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
color: Theme.of(context).colorScheme.background,
|
||||
color: Theme.of(context).colorScheme.surface,
|
||||
child: Observer(
|
||||
builder: (_) {
|
||||
return Column(
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import 'package:cake_wallet/di.dart';
|
||||
import 'package:cake_wallet/store/settings_store.dart';
|
||||
import 'package:cake_wallet/themes/theme_base.dart';
|
||||
import 'package:cake_wallet/themes/core/material_base_theme.dart';
|
||||
import 'package:cake_wallet/themes/core/theme_store.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
|
@ -16,16 +16,14 @@ class DesktopDashboardNavbar extends StatelessWidget implements ObstructingPrefe
|
|||
required this.trailing,
|
||||
});
|
||||
|
||||
ThemeBase get currentTheme => getIt.get<SettingsStore>().currentTheme;
|
||||
MaterialThemeBase get currentTheme => getIt.get<ThemeStore>().currentTheme;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final appBarColor =
|
||||
currentTheme.type == ThemeType.dark ? Colors.black.withOpacity(0.1) : Colors.white;
|
||||
|
||||
return Container(
|
||||
padding: const EdgeInsetsDirectional.only(end: 24),
|
||||
color: appBarColor,
|
||||
color: Theme.of(context).colorScheme.surfaceContainerLowest.withOpacity(0.1),
|
||||
child: Center(
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
|
|
|
@ -16,7 +16,7 @@ class SideMenu extends StatelessWidget {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
color: Colors.black.withOpacity(0.1),
|
||||
color: Theme.of(context).colorScheme.surfaceContainerLowest.withOpacity(0.1),
|
||||
width: width,
|
||||
height: MediaQuery.of(context).size.height,
|
||||
child: Column(
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
|
||||
|
||||
class SideMenuItem extends StatelessWidget {
|
||||
const SideMenuItem({
|
||||
|
@ -19,9 +18,9 @@ class SideMenuItem extends StatelessWidget {
|
|||
|
||||
Color _setColor(BuildContext context) {
|
||||
if (isSelected) {
|
||||
return Theme.of(context).extension<CakeTextTheme>()!.titleColor;
|
||||
return Theme.of(context).colorScheme.primary;
|
||||
} else {
|
||||
return Theme.of(context).highlightColor;
|
||||
return Theme.of(context).colorScheme.onSurfaceVariant;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -137,7 +137,7 @@ class DesktopSidebarWrapper extends BasePage {
|
|||
children: [
|
||||
child,
|
||||
Container(
|
||||
color: Theme.of(context).colorScheme.background,
|
||||
color: Theme.of(context).colorScheme.surface,
|
||||
padding: EdgeInsets.all(20),
|
||||
child: Navigator(
|
||||
initialRoute: Routes.support,
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import 'package:another_flushbar/flushbar.dart';
|
||||
import 'package:cake_wallet/core/new_wallet_arguments.dart';
|
||||
import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
|
||||
import 'package:cake_wallet/core/auth_service.dart';
|
||||
import 'package:cake_wallet/entities/desktop_dropdown_item.dart';
|
||||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
|
@ -10,8 +9,6 @@ import 'package:cake_wallet/src/screens/dashboard/desktop_widgets/dropdown_item_
|
|||
import 'package:cake_wallet/src/screens/wallet_unlock/wallet_unlock_arguments.dart';
|
||||
import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart';
|
||||
import 'package:cake_wallet/store/settings_store.dart';
|
||||
import 'package:cake_wallet/themes/extensions/menu_theme.dart';
|
||||
import 'package:cake_wallet/utils/exception_handler.dart';
|
||||
import 'package:cake_wallet/utils/show_bar.dart';
|
||||
import 'package:cake_wallet/utils/show_pop_up.dart';
|
||||
import 'package:cake_wallet/view_model/wallet_list/wallet_list_item.dart';
|
||||
|
@ -54,14 +51,14 @@ class _DesktopWalletSelectionDropDownState extends State<DesktopWalletSelectionD
|
|||
'assets/images/new_wallet.png',
|
||||
height: 12,
|
||||
width: 12,
|
||||
color: Theme.of(context).extension<CakeTextTheme>()!.titleColor,
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
);
|
||||
|
||||
Image _restoreWalletImage(BuildContext context) => Image.asset(
|
||||
'assets/images/restore_wallet.png',
|
||||
height: 12,
|
||||
width: 12,
|
||||
color: Theme.of(context).extension<CakeTextTheme>()!.titleColor,
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
);
|
||||
|
||||
Flushbar<void>? _progressBar;
|
||||
|
@ -119,8 +116,8 @@ class _DesktopWalletSelectionDropDownState extends State<DesktopWalletSelectionD
|
|||
onChanged: (item) {
|
||||
item?.onSelected();
|
||||
},
|
||||
dropdownColor: themeData.extension<CakeMenuTheme>()!.backgroundColor,
|
||||
style: TextStyle(color: themeData.extension<CakeTextTheme>()!.titleColor),
|
||||
dropdownColor: themeData.colorScheme.surface,
|
||||
style: themeData.textTheme.bodyMedium,
|
||||
selectedItemBuilder: (context) => dropDownItems.map((item) => item.child).toList(),
|
||||
value: selectedItem,
|
||||
underline: const SizedBox(),
|
||||
|
@ -256,7 +253,7 @@ class _DesktopWalletSelectionDropDownState extends State<DesktopWalletSelectionD
|
|||
}
|
||||
|
||||
void changeProcessText(String text) {
|
||||
_progressBar = createBar<void>(text, duration: null)..show(context);
|
||||
_progressBar = createBar<void>(text,context, duration: null)..show(context);
|
||||
}
|
||||
|
||||
void hideProgressText() {
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class DropDownItemWidget extends StatelessWidget {
|
||||
|
@ -21,11 +20,7 @@ class DropDownItemWidget extends StatelessWidget {
|
|||
Flexible(
|
||||
child: Text(
|
||||
title,
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Theme.of(context).extension<CakeTextTheme>()!.titleColor,
|
||||
),
|
||||
style: Theme.of(context).textTheme.bodyMedium,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
maxLines: 1,
|
||||
),
|
||||
|
|
|
@ -8,8 +8,6 @@ import 'package:cake_wallet/src/widgets/base_text_form_field.dart';
|
|||
import 'package:cake_wallet/src/widgets/checkbox_widget.dart';
|
||||
import 'package:cake_wallet/src/widgets/primary_button.dart';
|
||||
import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart';
|
||||
import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
|
||||
import 'package:cake_wallet/themes/extensions/transaction_trade_theme.dart';
|
||||
import 'package:cake_wallet/utils/show_pop_up.dart';
|
||||
import 'package:cake_wallet/view_model/dashboard/home_settings_view_model.dart';
|
||||
import 'package:cw_core/crypto_currency.dart';
|
||||
|
@ -124,7 +122,7 @@ class _EditTokenPageBodyState extends State<EditTokenPageBody> {
|
|||
Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 16, horizontal: 28),
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).cardColor,
|
||||
color: Theme.of(context).colorScheme.surfaceContainerHighest,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Row(
|
||||
|
@ -138,23 +136,18 @@ class _EditTokenPageBodyState extends State<EditTokenPageBody> {
|
|||
children: [
|
||||
Text(
|
||||
S.of(context).warning,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Theme.of(context).extension<CakeTextTheme>()!.titleColor,
|
||||
),
|
||||
style: Theme.of(context).textTheme.bodyLarge?.copyWith(
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 5),
|
||||
child: Text(
|
||||
S.of(context).add_token_warning,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Theme.of(context)
|
||||
.extension<TransactionTradeTheme>()!
|
||||
.detailsTitlesColor,
|
||||
),
|
||||
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
height: 1.6,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
@ -195,8 +188,8 @@ class _EditTokenPageBodyState extends State<EditTokenPageBody> {
|
|||
Navigator.pop(context);
|
||||
},
|
||||
text: widget.token != null ? S.of(context).delete : S.of(context).cancel,
|
||||
color: Colors.red,
|
||||
textColor: Colors.white,
|
||||
color: Theme.of(context).colorScheme.errorContainer,
|
||||
textColor: Theme.of(context).colorScheme.onErrorContainer,
|
||||
),
|
||||
),
|
||||
SizedBox(width: 20),
|
||||
|
@ -210,10 +203,11 @@ class _EditTokenPageBodyState extends State<EditTokenPageBody> {
|
|||
final isWhitelisted = await widget.homeSettingsViewModel
|
||||
.checkIfTokenIsWhitelisted(_contractAddressController.text);
|
||||
|
||||
final hasPotentialError = !isWhitelisted && await widget.homeSettingsViewModel
|
||||
.checkIfERC20TokenContractAddressIsAPotentialScamAddress(
|
||||
_contractAddressController.text,
|
||||
);
|
||||
final hasPotentialError = !isWhitelisted &&
|
||||
await widget.homeSettingsViewModel
|
||||
.checkIfERC20TokenContractAddressIsAPotentialScamAddress(
|
||||
_contractAddressController.text,
|
||||
);
|
||||
|
||||
bool isPotentialScam = hasPotentialError && !isWhitelisted;
|
||||
final tokenSymbol = _tokenSymbolController.text.toUpperCase();
|
||||
|
@ -298,8 +292,8 @@ class _EditTokenPageBodyState extends State<EditTokenPageBody> {
|
|||
}
|
||||
},
|
||||
text: S.of(context).save,
|
||||
color: Theme.of(context).primaryColor,
|
||||
textColor: Colors.white,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
textColor: Theme.of(context).colorScheme.onPrimary,
|
||||
),
|
||||
),
|
||||
],
|
||||
|
@ -354,7 +348,6 @@ class _EditTokenPageBodyState extends State<EditTokenPageBody> {
|
|||
focusNode: _contractAddressFocusNode,
|
||||
placeholder: S.of(context).token_contract_address,
|
||||
options: [AddressTextFieldOption.paste],
|
||||
buttonColor: Theme.of(context).hintColor,
|
||||
validator: widget.homeSettingsViewModel.walletType == WalletType.zano
|
||||
? null
|
||||
: AddressValidator(type: widget.homeSettingsViewModel.nativeToken).call,
|
||||
|
|
|
@ -5,16 +5,13 @@ import 'package:cake_wallet/entities/sort_balance_types.dart';
|
|||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
import 'package:cake_wallet/routes.dart';
|
||||
import 'package:cake_wallet/src/screens/base_page.dart';
|
||||
import 'package:cake_wallet/src/widgets/base_text_form_field.dart';
|
||||
import 'package:cake_wallet/src/widgets/cake_image_widget.dart';
|
||||
import 'package:cake_wallet/src/screens/settings/widgets/settings_picker_cell.dart';
|
||||
import 'package:cake_wallet/src/screens/settings/widgets/settings_switcher_cell.dart';
|
||||
import 'package:cake_wallet/themes/extensions/address_theme.dart';
|
||||
import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
|
||||
import 'package:cake_wallet/themes/extensions/menu_theme.dart';
|
||||
import 'package:cake_wallet/themes/extensions/picker_theme.dart';
|
||||
import 'package:cake_wallet/view_model/dashboard/home_settings_view_model.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_mobx/flutter_mobx.dart';
|
||||
import 'package:cake_wallet/view_model/dashboard/home_settings_view_model.dart';
|
||||
|
||||
class HomeSettingsPage extends BasePage {
|
||||
HomeSettingsPage(this._homeSettingsViewModel);
|
||||
|
@ -39,7 +36,7 @@ class HomeSettingsPage extends BasePage {
|
|||
onItemSelected: _homeSettingsViewModel.setSortBalanceBy,
|
||||
),
|
||||
),
|
||||
Divider(color: Theme.of(context).extension<CakeMenuTheme>()!.dividerColor),
|
||||
Divider(color: Theme.of(context).colorScheme.outlineVariant),
|
||||
Observer(
|
||||
builder: (_) => SettingsSwitcherCell(
|
||||
title: S.of(context).pin_at_top(_homeSettingsViewModel.nativeToken.title),
|
||||
|
@ -49,56 +46,52 @@ class HomeSettingsPage extends BasePage {
|
|||
},
|
||||
),
|
||||
),
|
||||
Divider(color: Theme.of(context).extension<CakeMenuTheme>()!.dividerColor),
|
||||
Divider(color: Theme.of(context).colorScheme.outlineVariant),
|
||||
const SizedBox(height: 20),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsetsDirectional.only(start: 16),
|
||||
child: TextFormField(
|
||||
child: BaseTextFormField(
|
||||
controller: _searchController,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).extension<PickerTheme>()!.searchHintColor),
|
||||
decoration: InputDecoration(
|
||||
hintText: S.of(context).search_add_token,
|
||||
prefixIcon: Image.asset("assets/images/search_icon.png"),
|
||||
filled: true,
|
||||
fillColor: Theme.of(context).extension<AddressTheme>()!.actionButtonColor,
|
||||
alignLabelWithHint: false,
|
||||
contentPadding: const EdgeInsets.symmetric(vertical: 4, horizontal: 16),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(30),
|
||||
borderSide: const BorderSide(color: Colors.transparent),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(30),
|
||||
borderSide: const BorderSide(color: Colors.transparent),
|
||||
),
|
||||
textStyle: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
hintText: S.of(context).search_add_token,
|
||||
prefixIcon: Image.asset(
|
||||
"assets/images/search_icon.png",
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
alignLabelWithHint: false,
|
||||
contentPadding: const EdgeInsets.symmetric(vertical: 4, horizontal: 16),
|
||||
onChanged: (String text) => _homeSettingsViewModel.changeSearchText(text),
|
||||
),
|
||||
),
|
||||
),
|
||||
RawMaterialButton(
|
||||
onPressed: () async {
|
||||
Navigator.pushNamed(context, Routes.editToken, arguments: {
|
||||
'homeSettingsViewModel': _homeSettingsViewModel,
|
||||
if (AddressValidator(type: _homeSettingsViewModel.nativeToken)
|
||||
.isValid(_searchController.text))
|
||||
'contractAddress': _searchController.text,
|
||||
});
|
||||
Navigator.pushNamed(
|
||||
context,
|
||||
Routes.editToken,
|
||||
arguments: {
|
||||
'homeSettingsViewModel': _homeSettingsViewModel,
|
||||
if (AddressValidator(type: _homeSettingsViewModel.nativeToken)
|
||||
.isValid(_searchController.text))
|
||||
'contractAddress': _searchController.text,
|
||||
},
|
||||
);
|
||||
},
|
||||
elevation: 0,
|
||||
fillColor: Theme.of(context).cardColor,
|
||||
fillColor: Theme.of(context).colorScheme.surfaceContainer,
|
||||
child: Icon(
|
||||
Icons.add,
|
||||
color: Theme.of(context).extension<CakeTextTheme>()!.titleColor,
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
size: 22.0,
|
||||
),
|
||||
padding: EdgeInsets.all(12),
|
||||
shape: CircleBorder(),
|
||||
splashColor: Theme.of(context).cardColor,
|
||||
splashColor: Theme.of(context).colorScheme.surfaceContainer,
|
||||
),
|
||||
],
|
||||
),
|
||||
|
@ -136,24 +129,27 @@ class HomeSettingsPage extends BasePage {
|
|||
imageUrl: token.iconPath,
|
||||
height: 40,
|
||||
width: 40,
|
||||
displayOnError: Container(
|
||||
errorWidget: Container(
|
||||
height: 30.0,
|
||||
width: 30.0,
|
||||
child: Center(
|
||||
child: Text(
|
||||
token.title.substring(0, min(token.title.length, 2)),
|
||||
style: TextStyle(fontSize: 11),
|
||||
style: Theme.of(context).textTheme.bodySmall?.copyWith(
|
||||
fontSize: 11,
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Colors.grey.shade400,
|
||||
color: Theme.of(context).colorScheme.surfaceContainerHighest,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).cardColor,
|
||||
color: Theme.of(context).colorScheme.surfaceContainer,
|
||||
borderRadius: BorderRadius.circular(30),
|
||||
),
|
||||
);
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import 'package:cake_wallet/bitcoin/bitcoin.dart';
|
||||
import 'package:cake_wallet/src/screens/new_wallet/widgets/select_button.dart';
|
||||
import 'package:cake_wallet/themes/extensions/keyboard_theme.dart';
|
||||
import 'package:cake_wallet/di.dart';
|
||||
import 'package:cake_wallet/src/screens/base_page.dart';
|
||||
import 'package:cake_wallet/anonpay/anonpay_donation_link_info.dart';
|
||||
|
@ -9,8 +8,7 @@ import 'package:cw_core/receive_page_option.dart';
|
|||
import 'package:cake_wallet/src/screens/dashboard/widgets/present_receive_option_picker.dart';
|
||||
import 'package:cake_wallet/src/widgets/gradient_background.dart';
|
||||
import 'package:cake_wallet/src/widgets/keyboard_done_button.dart';
|
||||
import 'package:cake_wallet/themes/extensions/sync_indicator_theme.dart';
|
||||
import 'package:cake_wallet/themes/theme_base.dart';
|
||||
import 'package:cake_wallet/themes/core/material_base_theme.dart';
|
||||
import 'package:cake_wallet/utils/responsive_layout_util.dart';
|
||||
import 'package:cake_wallet/utils/share_util.dart';
|
||||
import 'package:cake_wallet/view_model/dashboard/receive_option_view_model.dart';
|
||||
|
@ -25,7 +23,6 @@ import 'package:flutter_mobx/flutter_mobx.dart';
|
|||
import 'package:keyboard_actions/keyboard_actions.dart';
|
||||
import 'package:mobx/mobx.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:cake_wallet/themes/extensions/balance_page_theme.dart';
|
||||
|
||||
class AddressPage extends BasePage {
|
||||
AddressPage({
|
||||
|
@ -68,7 +65,7 @@ class AddressPage extends BasePage {
|
|||
size: 16,
|
||||
);
|
||||
final _closeButton =
|
||||
currentTheme.type == ThemeType.dark ? closeButtonImageDarkTheme : closeButtonImage;
|
||||
currentTheme.isDark ? closeButtonImageDarkTheme : closeButtonImage;
|
||||
|
||||
bool isMobileView = responsiveLayoutUtil.shouldRenderMobileUI;
|
||||
|
||||
|
@ -130,53 +127,57 @@ class AddressPage extends BasePage {
|
|||
_setEffects(context);
|
||||
|
||||
return KeyboardActions(
|
||||
autoScroll: false,
|
||||
disableScroll: true,
|
||||
tapOutsideBehavior: TapOutsideBehavior.translucentDismiss,
|
||||
config: KeyboardActionsConfig(
|
||||
keyboardActionsPlatform: KeyboardActionsPlatform.IOS,
|
||||
keyboardBarColor: Theme.of(context).extension<KeyboardTheme>()!.keyboardBarColor,
|
||||
nextFocus: false,
|
||||
actions: [
|
||||
KeyboardActionsItem(
|
||||
focusNode: _cryptoAmountFocus,
|
||||
toolbarButtons: [(_) => KeyboardDoneButton()],
|
||||
)
|
||||
]),
|
||||
child: Container(
|
||||
padding: EdgeInsets.fromLTRB(24, 0, 24, 32),
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Observer(
|
||||
builder: (_) => QRWidget(
|
||||
formKey: _formKey,
|
||||
addressListViewModel: addressListViewModel,
|
||||
amountTextFieldFocusNode: _cryptoAmountFocus,
|
||||
amountController: _amountController,
|
||||
currentTheme:
|
||||
dashboardViewModel.settingsStore.currentTheme,
|
||||
))),
|
||||
SizedBox(height: 16),
|
||||
Observer(builder: (_) {
|
||||
autoScroll: false,
|
||||
disableScroll: true,
|
||||
tapOutsideBehavior: TapOutsideBehavior.translucentDismiss,
|
||||
config: KeyboardActionsConfig(
|
||||
keyboardActionsPlatform: KeyboardActionsPlatform.IOS,
|
||||
keyboardBarColor: Theme.of(context).colorScheme.surface,
|
||||
nextFocus: false,
|
||||
actions: [
|
||||
KeyboardActionsItem(
|
||||
focusNode: _cryptoAmountFocus,
|
||||
toolbarButtons: [(_) => KeyboardDoneButton()],
|
||||
)
|
||||
],
|
||||
),
|
||||
child: Container(
|
||||
padding: EdgeInsets.fromLTRB(24, 0, 24, 32),
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Observer(
|
||||
builder: (_) => QRWidget(
|
||||
formKey: _formKey,
|
||||
addressListViewModel: addressListViewModel,
|
||||
amountTextFieldFocusNode: _cryptoAmountFocus,
|
||||
amountController: _amountController,
|
||||
currentTheme: dashboardViewModel.appStore.themeStore.currentTheme,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
Observer(
|
||||
builder: (_) {
|
||||
if (addressListViewModel.hasAddressList) {
|
||||
return SelectButton(
|
||||
text: addressListViewModel.buttonTitle,
|
||||
onTap: () => Navigator.of(context).pushNamed(Routes.receive),
|
||||
textColor: Theme.of(context).extension<SyncIndicatorTheme>()!.textColor,
|
||||
color: Theme.of(context).extension<SyncIndicatorTheme>()!.syncedBackgroundColor,
|
||||
borderColor: Theme.of(context).extension<BalancePageTheme>()!.cardBorderColor,
|
||||
arrowColor: Theme.of(context).extension<SyncIndicatorTheme>()!.textColor,
|
||||
textColor: Theme.of(context).colorScheme.onSecondaryContainer,
|
||||
color: Theme.of(context).colorScheme.surfaceContainer,
|
||||
arrowColor: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
textSize: 14,
|
||||
height: 50,
|
||||
);
|
||||
} else {
|
||||
return const SizedBox();
|
||||
}
|
||||
}),
|
||||
],
|
||||
),
|
||||
));
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void _setEffects(BuildContext context) {
|
||||
|
@ -185,7 +186,8 @@ class AddressPage extends BasePage {
|
|||
}
|
||||
|
||||
reaction((_) => receiveOptionViewModel.selectedReceiveOption, (ReceivePageOption option) {
|
||||
if (dashboardViewModel.type == WalletType.bitcoin && bitcoin!.isBitcoinReceivePageOption(option)) {
|
||||
if (dashboardViewModel.type == WalletType.bitcoin &&
|
||||
bitcoin!.isBitcoinReceivePageOption(option)) {
|
||||
addressListViewModel.setAddressType(bitcoin!.getOptionToType(option));
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ import 'package:cake_wallet/reactions/wallet_connect.dart';
|
|||
import 'package:cake_wallet/src/screens/dashboard/pages/balance/crypto_balance_widget.dart';
|
||||
import 'package:cake_wallet/src/screens/dashboard/pages/nft_listing_page.dart';
|
||||
import 'package:cake_wallet/store/settings_store.dart';
|
||||
import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart';
|
||||
import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart';
|
||||
import 'package:cake_wallet/view_model/dashboard/nft_view_model.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
@ -37,34 +36,26 @@ class BalancePage extends StatelessWidget {
|
|||
child: TabBar(
|
||||
indicatorSize: TabBarIndicatorSize.label,
|
||||
isScrollable: true,
|
||||
physics: NeverScrollableScrollPhysics(),
|
||||
labelStyle: TextStyle(
|
||||
fontSize: 18,
|
||||
fontFamily: 'Lato',
|
||||
fontWeight: FontWeight.w600,
|
||||
color:
|
||||
Theme.of(context).extension<DashboardPageTheme>()!.pageTitleTextColor,
|
||||
height: 1,
|
||||
),
|
||||
unselectedLabelStyle: TextStyle(
|
||||
fontSize: 18,
|
||||
fontFamily: 'Lato',
|
||||
fontWeight: FontWeight.w600,
|
||||
color:
|
||||
Theme.of(context).extension<DashboardPageTheme>()!.pageTitleTextColor,
|
||||
height: 1,
|
||||
),
|
||||
labelColor:
|
||||
Theme.of(context).extension<DashboardPageTheme>()!.pageTitleTextColor,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
labelStyle: Theme.of(context).textTheme.titleMedium?.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 18,
|
||||
height: 1,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
unselectedLabelStyle: Theme.of(context).textTheme.titleMedium?.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 18,
|
||||
height: 1,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
labelColor: Theme.of(context).colorScheme.primary,
|
||||
dividerColor: Colors.transparent,
|
||||
indicatorColor:
|
||||
Theme.of(context).extension<DashboardPageTheme>()!.pageTitleTextColor,
|
||||
unselectedLabelColor: Theme.of(context)
|
||||
.extension<DashboardPageTheme>()!
|
||||
.pageTitleTextColor
|
||||
.withOpacity(0.5),
|
||||
indicatorColor: Theme.of(context).colorScheme.primary,
|
||||
unselectedLabelColor:
|
||||
Theme.of(context).colorScheme.secondary.withOpacity(0.7),
|
||||
tabAlignment: TabAlignment.start,
|
||||
tabs: [
|
||||
tabs: const [
|
||||
Tab(text: 'My Crypto'),
|
||||
Tab(text: 'My NFTs'),
|
||||
],
|
||||
|
@ -73,7 +64,7 @@ class BalancePage extends StatelessWidget {
|
|||
),
|
||||
Expanded(
|
||||
child: TabBarView(
|
||||
physics: NeverScrollableScrollPhysics(),
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
children: [
|
||||
CryptoBalanceWidget(dashboardViewModel: dashboardViewModel),
|
||||
if (isNFTActivated) NFTListingPage(nftViewModel: nftViewModel)
|
||||
|
|
|
@ -6,8 +6,7 @@ import 'package:cake_wallet/generated/i18n.dart';
|
|||
import 'package:cake_wallet/routes.dart';
|
||||
import 'package:cake_wallet/src/screens/exchange_trade/information_page.dart';
|
||||
import 'package:cake_wallet/src/widgets/cake_image_widget.dart';
|
||||
import 'package:cake_wallet/themes/extensions/balance_page_theme.dart';
|
||||
import 'package:cake_wallet/themes/extensions/sync_indicator_theme.dart';
|
||||
import 'package:cake_wallet/themes/utils/custom_theme_colors.dart';
|
||||
import 'package:cake_wallet/utils/payment_request.dart';
|
||||
import 'package:cake_wallet/utils/show_pop_up.dart';
|
||||
import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart';
|
||||
|
@ -70,30 +69,33 @@ class BalanceRowWidget extends StatelessWidget {
|
|||
Container(
|
||||
margin: const EdgeInsets.only(left: 16, right: 16),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(30.0),
|
||||
border: Border.all(
|
||||
color: Theme.of(context).extension<BalancePageTheme>()!.cardBorderColor,
|
||||
width: 1,
|
||||
),
|
||||
color: Theme.of(context).extension<SyncIndicatorTheme>()!.syncedBackgroundColor,
|
||||
// boxShadow: [
|
||||
// BoxShadow(
|
||||
// color: Theme.of(context)
|
||||
// .extension<BalancePageTheme>()!
|
||||
// .cardBorderColor
|
||||
// .withAlpha(50),
|
||||
// spreadRadius: dashboardViewModel.getShadowSpread(),
|
||||
// blurRadius: dashboardViewModel.getShadowBlur())
|
||||
// ],
|
||||
borderRadius: BorderRadius.circular(15.0),
|
||||
gradient: LinearGradient(
|
||||
colors: [
|
||||
dashboardViewModel.isDarkTheme
|
||||
? CustomThemeColors.cardGradientColorPrimaryDark
|
||||
: CustomThemeColors.cardGradientColorPrimaryLight,
|
||||
dashboardViewModel.isDarkTheme
|
||||
? CustomThemeColors.cardGradientColorSecondaryDark
|
||||
: CustomThemeColors.cardGradientColorSecondaryLight,
|
||||
],
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
),
|
||||
),
|
||||
child: TextButton(
|
||||
onPressed: _showToast,
|
||||
onLongPress: () => dashboardViewModel.balanceViewModel.switchBalanceValue(),
|
||||
style: TextButton.styleFrom(
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(30)),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(15)),
|
||||
),
|
||||
child: Container(
|
||||
margin: const EdgeInsets.only(top: 10, left: 12, right: 12, bottom: 10),
|
||||
margin: const EdgeInsets.only(
|
||||
top: 10,
|
||||
left: 12,
|
||||
right: 12,
|
||||
bottom: 10,
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
|
@ -115,61 +117,58 @@ class BalanceRowWidget extends StatelessWidget {
|
|||
Semantics(
|
||||
hint: 'Double tap to see more information',
|
||||
container: true,
|
||||
child: Text('${availableBalanceLabel}',
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontFamily: 'Lato',
|
||||
fontWeight: FontWeight.w400,
|
||||
color: Theme.of(context)
|
||||
.extension<BalancePageTheme>()!
|
||||
.labelTextColor,
|
||||
height: 1)),
|
||||
child: Text(
|
||||
'${availableBalanceLabel}',
|
||||
style: Theme.of(context).textTheme.bodySmall?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
height: 1,
|
||||
),
|
||||
),
|
||||
),
|
||||
if (hasAdditionalBalance)
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 4),
|
||||
child: Icon(Icons.help_outline,
|
||||
size: 16,
|
||||
color: Theme.of(context)
|
||||
.extension<BalancePageTheme>()!
|
||||
.labelTextColor),
|
||||
child: Icon(
|
||||
Icons.help_outline,
|
||||
size: 16,
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height: 6),
|
||||
AutoSizeText(availableBalance,
|
||||
style: TextStyle(
|
||||
fontSize: 24,
|
||||
fontFamily: 'Lato',
|
||||
AutoSizeText(
|
||||
availableBalance,
|
||||
style: Theme.of(context).textTheme.titleLarge?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
fontWeight: FontWeight.w900,
|
||||
color: Theme.of(context)
|
||||
.extension<BalancePageTheme>()!
|
||||
.balanceAmountColor,
|
||||
height: 1),
|
||||
maxLines: 1,
|
||||
textAlign: TextAlign.start),
|
||||
fontSize: 24,
|
||||
height: 1,
|
||||
),
|
||||
maxLines: 1,
|
||||
textAlign: TextAlign.start,
|
||||
),
|
||||
SizedBox(height: 6),
|
||||
if (isTestnet)
|
||||
Text(S.of(context).testnet_coins_no_value,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontFamily: 'Lato',
|
||||
fontWeight: FontWeight.w400,
|
||||
color:
|
||||
Theme.of(context).extension<BalancePageTheme>()!.textColor,
|
||||
height: 1)),
|
||||
Text(
|
||||
S.of(context).testnet_coins_no_value,
|
||||
textAlign: TextAlign.center,
|
||||
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||
height: 1,
|
||||
),
|
||||
),
|
||||
if (!isTestnet)
|
||||
Text('${availableFiatBalance}',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
Text(
|
||||
'${availableFiatBalance}',
|
||||
textAlign: TextAlign.center,
|
||||
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||
fontSize: 16,
|
||||
fontFamily: 'Lato',
|
||||
fontWeight: FontWeight.w500,
|
||||
color:
|
||||
Theme.of(context).extension<BalancePageTheme>()!.textColor,
|
||||
height: 1)),
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
height: 1,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
|
@ -181,33 +180,33 @@ class BalanceRowWidget extends StatelessWidget {
|
|||
imageUrl: currency.iconPath,
|
||||
height: 40,
|
||||
width: 40,
|
||||
displayOnError: Container(
|
||||
errorWidget: Container(
|
||||
height: 30.0,
|
||||
width: 30.0,
|
||||
child: Center(
|
||||
child: Text(
|
||||
currency.title.substring(0, min(currency.title.length, 2)),
|
||||
style: TextStyle(fontSize: 11),
|
||||
style: Theme.of(context).textTheme.bodySmall?.copyWith(
|
||||
fontSize: 11,
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Colors.grey.shade400,
|
||||
color: Theme.of(context).colorScheme.surfaceContainer,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Text(
|
||||
currency.title,
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
fontFamily: 'Lato',
|
||||
fontWeight: FontWeight.w800,
|
||||
color: Theme.of(context)
|
||||
.extension<BalancePageTheme>()!
|
||||
.assetTitleColor,
|
||||
height: 1,
|
||||
),
|
||||
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
height: 1,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
@ -220,7 +219,7 @@ class BalanceRowWidget extends StatelessWidget {
|
|||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 2),
|
||||
margin: EdgeInsets.only(top: 4),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.red[800],
|
||||
color: Theme.of(context).colorScheme.errorContainer,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Row(
|
||||
|
@ -229,15 +228,15 @@ class BalanceRowWidget extends StatelessWidget {
|
|||
Icon(
|
||||
Icons.warning_amber_outlined,
|
||||
size: 16,
|
||||
color: Colors.white,
|
||||
color: Theme.of(context).colorScheme.onErrorContainer,
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
S.of(context).potential_scam,
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
style: Theme.of(context).textTheme.bodySmall?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onErrorContainer,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
@ -252,28 +251,21 @@ class BalanceRowWidget extends StatelessWidget {
|
|||
Text(
|
||||
S.of(context).frozen_balance,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontFamily: 'Lato',
|
||||
fontWeight: FontWeight.w400,
|
||||
color:
|
||||
Theme.of(context).extension<BalancePageTheme>()!.labelTextColor,
|
||||
height: 1,
|
||||
),
|
||||
style: Theme.of(context).textTheme.bodySmall!.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
height: 1,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
AutoSizeText(
|
||||
frozenBalance,
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
fontFamily: 'Lato',
|
||||
fontWeight: FontWeight.w400,
|
||||
color:
|
||||
Theme.of(context).extension<BalancePageTheme>()!.balanceAmountColor,
|
||||
height: 1,
|
||||
),
|
||||
style: Theme.of(context).textTheme.bodyLarge!.copyWith(
|
||||
fontSize: 20,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
height: 1,
|
||||
),
|
||||
maxLines: 1,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
|
@ -282,13 +274,9 @@ class BalanceRowWidget extends StatelessWidget {
|
|||
Text(
|
||||
frozenFiatBalance,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontFamily: 'Lato',
|
||||
fontWeight: FontWeight.w400,
|
||||
color: Theme.of(context).extension<BalancePageTheme>()!.textColor,
|
||||
height: 1,
|
||||
),
|
||||
style: Theme.of(context).textTheme.bodySmall!.copyWith(
|
||||
height: 1,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
@ -300,24 +288,19 @@ class BalanceRowWidget extends StatelessWidget {
|
|||
Text(
|
||||
'${additionalBalanceLabel}',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontFamily: 'Lato',
|
||||
fontWeight: FontWeight.w400,
|
||||
color: Theme.of(context).extension<BalancePageTheme>()!.labelTextColor,
|
||||
height: 1,
|
||||
),
|
||||
style: Theme.of(context).textTheme.bodySmall!.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
height: 1,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
AutoSizeText(
|
||||
additionalBalance,
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
fontFamily: 'Lato',
|
||||
fontWeight: FontWeight.w400,
|
||||
color: Theme.of(context).extension<BalancePageTheme>()!.assetTitleColor,
|
||||
height: 1,
|
||||
),
|
||||
style: Theme.of(context).textTheme.bodyLarge!.copyWith(
|
||||
fontSize: 20,
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
height: 1,
|
||||
),
|
||||
maxLines: 1,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
|
@ -326,13 +309,9 @@ class BalanceRowWidget extends StatelessWidget {
|
|||
Text(
|
||||
'${additionalFiatBalance}',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontFamily: 'Lato',
|
||||
fontWeight: FontWeight.w400,
|
||||
color: Theme.of(context).extension<BalancePageTheme>()!.textColor,
|
||||
height: 1,
|
||||
),
|
||||
style: Theme.of(context).textTheme.bodySmall!.copyWith(
|
||||
height: 1,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
@ -342,16 +321,23 @@ class BalanceRowWidget extends StatelessWidget {
|
|||
),
|
||||
),
|
||||
if (hasSecondAdditionalBalance || hasSecondAvailableBalance) ...[
|
||||
SizedBox(height: 16),
|
||||
SizedBox(height: 10),
|
||||
Container(
|
||||
margin: const EdgeInsets.only(left: 16, right: 16),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(30.0),
|
||||
border: Border.all(
|
||||
color: Theme.of(context).extension<BalancePageTheme>()!.cardBorderColor,
|
||||
width: 1,
|
||||
borderRadius: BorderRadius.circular(15),
|
||||
gradient: LinearGradient(
|
||||
colors: [
|
||||
dashboardViewModel.isDarkTheme
|
||||
? CustomThemeColors.cardGradientColorPrimaryDark
|
||||
: CustomThemeColors.cardGradientColorPrimaryLight,
|
||||
dashboardViewModel.isDarkTheme
|
||||
? CustomThemeColors.cardGradientColorSecondaryDark
|
||||
: CustomThemeColors.cardGradientColorSecondaryLight,
|
||||
],
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
),
|
||||
color: Theme.of(context).extension<SyncIndicatorTheme>()!.syncedBackgroundColor,
|
||||
// boxShadow: [
|
||||
// BoxShadow(
|
||||
// color: Theme.of(context)
|
||||
|
@ -366,13 +352,13 @@ class BalanceRowWidget extends StatelessWidget {
|
|||
onPressed: _showToast,
|
||||
onLongPress: () => dashboardViewModel.balanceViewModel.switchBalanceValue(),
|
||||
style: TextButton.styleFrom(
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(30)),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(15)),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
margin: const EdgeInsets.only(top: 10, left: 12, right: 12, bottom: 10),
|
||||
margin: const EdgeInsets.only(top: 10, left: 12, right: 8, bottom: 10),
|
||||
child: Stack(
|
||||
children: [
|
||||
if (currency == CryptoCurrency.ltc)
|
||||
|
@ -385,24 +371,18 @@ class BalanceRowWidget extends StatelessWidget {
|
|||
Container(
|
||||
child: ImageIcon(
|
||||
AssetImage('assets/images/mweb_logo.png'),
|
||||
color: Theme.of(context)
|
||||
.extension<BalancePageTheme>()!
|
||||
.assetTitleColor,
|
||||
size: 40,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Text(
|
||||
'MWEB',
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
fontFamily: 'Lato',
|
||||
fontWeight: FontWeight.w800,
|
||||
color: Theme.of(context)
|
||||
.extension<BalancePageTheme>()!
|
||||
.assetTitleColor,
|
||||
height: 1,
|
||||
),
|
||||
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
height: 1,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
@ -427,23 +407,19 @@ class BalanceRowWidget extends StatelessWidget {
|
|||
Text(
|
||||
'${secondAvailableBalanceLabel}',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontFamily: 'Lato',
|
||||
fontWeight: FontWeight.w400,
|
||||
color: Theme.of(context)
|
||||
.extension<BalancePageTheme>()!
|
||||
.labelTextColor,
|
||||
height: 1,
|
||||
),
|
||||
style: Theme.of(context).textTheme.bodySmall?.copyWith(
|
||||
color:
|
||||
Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
height: 1,
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 4),
|
||||
child: Icon(Icons.help_outline,
|
||||
size: 16,
|
||||
color: Theme.of(context)
|
||||
.extension<BalancePageTheme>()!
|
||||
.labelTextColor),
|
||||
child: Icon(
|
||||
Icons.help_outline,
|
||||
size: 16,
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
|
@ -451,15 +427,12 @@ class BalanceRowWidget extends StatelessWidget {
|
|||
SizedBox(height: 8),
|
||||
AutoSizeText(
|
||||
secondAvailableBalance,
|
||||
style: TextStyle(
|
||||
fontSize: 24,
|
||||
fontFamily: 'Lato',
|
||||
fontWeight: FontWeight.w900,
|
||||
color: Theme.of(context)
|
||||
.extension<BalancePageTheme>()!
|
||||
.assetTitleColor,
|
||||
height: 1,
|
||||
),
|
||||
style: Theme.of(context).textTheme.bodyLarge?.copyWith(
|
||||
fontSize: 24,
|
||||
fontWeight: FontWeight.w800,
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
height: 1,
|
||||
),
|
||||
maxLines: 1,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
|
@ -468,15 +441,12 @@ class BalanceRowWidget extends StatelessWidget {
|
|||
Text(
|
||||
'${secondAvailableFiatBalance}',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontFamily: 'Lato',
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Theme.of(context)
|
||||
.extension<BalancePageTheme>()!
|
||||
.textColor,
|
||||
height: 1,
|
||||
),
|
||||
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
height: 1,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
@ -499,28 +469,19 @@ class BalanceRowWidget extends StatelessWidget {
|
|||
Text(
|
||||
'${secondAdditionalBalanceLabel}',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontFamily: 'Lato',
|
||||
fontWeight: FontWeight.w400,
|
||||
color: Theme.of(context)
|
||||
.extension<BalancePageTheme>()!
|
||||
.labelTextColor,
|
||||
height: 1,
|
||||
),
|
||||
style: Theme.of(context).textTheme.bodySmall?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
height: 1,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
AutoSizeText(
|
||||
secondAdditionalBalance,
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
fontFamily: 'Lato',
|
||||
fontWeight: FontWeight.w400,
|
||||
color: Theme.of(context)
|
||||
.extension<BalancePageTheme>()!
|
||||
.assetTitleColor,
|
||||
height: 1,
|
||||
),
|
||||
style: Theme.of(context).textTheme.bodyLarge?.copyWith(
|
||||
fontSize: 20,
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
height: 1,
|
||||
),
|
||||
maxLines: 1,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
|
@ -529,15 +490,9 @@ class BalanceRowWidget extends StatelessWidget {
|
|||
Text(
|
||||
'${secondAdditionalFiatBalance}',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontFamily: 'Lato',
|
||||
fontWeight: FontWeight.w400,
|
||||
color: Theme.of(context)
|
||||
.extension<BalancePageTheme>()!
|
||||
.textColor,
|
||||
height: 1,
|
||||
),
|
||||
style: Theme.of(context).textTheme.bodySmall?.copyWith(
|
||||
height: 1,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
@ -574,11 +529,13 @@ class BalanceRowWidget extends StatelessWidget {
|
|||
);
|
||||
},
|
||||
style: OutlinedButton.styleFrom(
|
||||
backgroundColor: Colors.grey.shade400.withAlpha(50),
|
||||
backgroundColor: Theme.of(context).colorScheme.primary,
|
||||
side: BorderSide(
|
||||
color: Colors.grey.shade400.withAlpha(50), width: 0),
|
||||
color: Theme.of(context).colorScheme.outlineVariant.withAlpha(0),
|
||||
width: 0,
|
||||
),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
),
|
||||
child: Container(
|
||||
|
@ -590,18 +547,15 @@ class BalanceRowWidget extends StatelessWidget {
|
|||
height: 30,
|
||||
width: 30,
|
||||
'assets/images/received.png',
|
||||
color: Theme.of(context)
|
||||
.extension<BalancePageTheme>()!
|
||||
.balanceAmountColor,
|
||||
color: Theme.of(context).colorScheme.onPrimary,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
S.of(context).litecoin_mweb_pegin,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context)
|
||||
.extension<BalancePageTheme>()!
|
||||
.textColor,
|
||||
),
|
||||
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onPrimary,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
@ -632,11 +586,13 @@ class BalanceRowWidget extends StatelessWidget {
|
|||
);
|
||||
},
|
||||
style: OutlinedButton.styleFrom(
|
||||
backgroundColor: Colors.grey.shade400.withAlpha(50),
|
||||
backgroundColor: Theme.of(context).colorScheme.surface,
|
||||
side: BorderSide(
|
||||
color: Colors.grey.shade400.withAlpha(50), width: 0),
|
||||
color: Theme.of(context).colorScheme.outlineVariant.withAlpha(0),
|
||||
width: 0,
|
||||
),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
),
|
||||
child: Container(
|
||||
|
@ -648,18 +604,17 @@ class BalanceRowWidget extends StatelessWidget {
|
|||
height: 30,
|
||||
width: 30,
|
||||
'assets/images/upload.png',
|
||||
color: Theme.of(context)
|
||||
.extension<BalancePageTheme>()!
|
||||
.balanceAmountColor,
|
||||
color: Theme.of(context).colorScheme.onSecondaryContainer,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
S.of(context).litecoin_mweb_pegout,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context)
|
||||
.extension<BalancePageTheme>()!
|
||||
.textColor,
|
||||
),
|
||||
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.onSecondaryContainer,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
@ -683,20 +638,16 @@ class BalanceRowWidget extends StatelessWidget {
|
|||
|
||||
// double getShadowSpread(){
|
||||
// double spread = 3;
|
||||
// if (dashboardViewModel.settingsStore.currentTheme.type == ThemeType.bright) spread = 3;
|
||||
// else if (dashboardViewModel.settingsStore.currentTheme.type == ThemeType.light) spread = 3;
|
||||
// else if (dashboardViewModel.settingsStore.currentTheme.type == ThemeType.dark) spread = 1;
|
||||
// else if (dashboardViewModel.settingsStore.currentTheme.type == ThemeType.oled) spread = 3;
|
||||
// else if (!dashboardViewModel.settingsStore.currentTheme.isDark) spread = 3;
|
||||
// else if (dashboardViewModel.settingsStore.currentTheme.isDark) spread = 1;
|
||||
// return spread;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// double getShadowBlur(){
|
||||
// double blur = 7;
|
||||
// if (dashboardViewModel.settingsStore.currentTheme.type == ThemeType.bright) blur = 7;
|
||||
// else if (dashboardViewModel.settingsStore.currentTheme.type == ThemeType.light) blur = 7;
|
||||
// else if (dashboardViewModel.settingsStore.currentTheme.type == ThemeType.dark) blur = 3;
|
||||
// else if (dashboardViewModel.settingsStore.currentTheme.type == ThemeType.oled) blur = 7;
|
||||
// else if (dashboardViewModel.settingsStore.currentTheme.isDark) blur = 7;
|
||||
// else if (dashboardViewModel.settingsStore.currentTheme.isDark) blur = 3;
|
||||
// return blur;
|
||||
// }
|
||||
|
||||
|
|
|
@ -9,13 +9,12 @@ import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart';
|
|||
import 'package:cake_wallet/src/widgets/dashboard_card_widget.dart';
|
||||
import 'package:cake_wallet/src/widgets/introducing_card.dart';
|
||||
import 'package:cake_wallet/src/widgets/standard_switch.dart';
|
||||
import 'package:cake_wallet/themes/extensions/balance_page_theme.dart';
|
||||
import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart';
|
||||
import 'package:cake_wallet/utils/feature_flag.dart';
|
||||
import 'package:cake_wallet/utils/show_pop_up.dart';
|
||||
import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_mobx/flutter_mobx.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
class CryptoBalanceWidget extends StatelessWidget {
|
||||
|
@ -25,6 +24,8 @@ class CryptoBalanceWidget extends StatelessWidget {
|
|||
});
|
||||
|
||||
final DashboardViewModel dashboardViewModel;
|
||||
final btcLockLight = 'assets/images/btc_lock_light.png';
|
||||
final btcLockDark = 'assets/images/btc_lock_dark.png';
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
@ -38,6 +39,7 @@ class CryptoBalanceWidget extends StatelessWidget {
|
|||
return Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 0, 16, 16),
|
||||
child: DashBoardRoundedCardWidget(
|
||||
isDarkTheme: dashboardViewModel.isDarkTheme,
|
||||
title: "Invalid monero bindings",
|
||||
subTitle: dashboardViewModel.getMoneroError.toString(),
|
||||
),
|
||||
|
@ -50,11 +52,13 @@ class CryptoBalanceWidget extends StatelessWidget {
|
|||
builder: (_) {
|
||||
if (dashboardViewModel.getWowneroError != null) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 0, 16, 16),
|
||||
child: DashBoardRoundedCardWidget(
|
||||
title: "Invalid wownero bindings",
|
||||
subTitle: dashboardViewModel.getWowneroError.toString(),
|
||||
));
|
||||
padding: const EdgeInsets.fromLTRB(16, 0, 16, 16),
|
||||
child: DashBoardRoundedCardWidget(
|
||||
isDarkTheme: dashboardViewModel.isDarkTheme,
|
||||
title: "Invalid wownero bindings",
|
||||
subTitle: dashboardViewModel.getWowneroError.toString(),
|
||||
),
|
||||
);
|
||||
}
|
||||
return Container();
|
||||
},
|
||||
|
@ -74,42 +78,39 @@ class CryptoBalanceWidget extends StatelessWidget {
|
|||
children: [
|
||||
Text(
|
||||
dashboardViewModel.balanceViewModel.asset,
|
||||
style: TextStyle(
|
||||
fontSize: 24,
|
||||
fontFamily: 'Lato',
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Theme.of(context)
|
||||
.extension<DashboardPageTheme>()!
|
||||
.pageTitleTextColor,
|
||||
height: 1,
|
||||
),
|
||||
style: Theme.of(context).textTheme.headlineSmall?.copyWith(
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
height: 1,
|
||||
),
|
||||
maxLines: 1,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
if (dashboardViewModel.wallet.isHardwareWallet)
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
Container(
|
||||
child: Image.asset(
|
||||
'assets/images/hardware_wallet/ledger_nano_x.png',
|
||||
width: 24,
|
||||
color: Theme.of(context)
|
||||
.extension<DashboardPageTheme>()!
|
||||
.pageTitleTextColor,
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
if (dashboardViewModel
|
||||
.balanceViewModel.isHomeScreenSettingsEnabled)
|
||||
InkWell(
|
||||
onTap: () => Navigator.pushNamed(context, Routes.homeSettings,
|
||||
arguments: dashboardViewModel.balanceViewModel),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Image.asset(
|
||||
'assets/images/home_screen_settings_icon.png',
|
||||
color: Theme.of(context)
|
||||
.extension<DashboardPageTheme>()!
|
||||
.pageTitleTextColor,
|
||||
),
|
||||
TextButton(
|
||||
style: TextButton.styleFrom(
|
||||
minimumSize: Size(50, 30),
|
||||
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
||||
alignment: Alignment.centerLeft),
|
||||
onPressed: () => Navigator.pushNamed(
|
||||
context,
|
||||
Routes.homeSettings,
|
||||
arguments: dashboardViewModel.balanceViewModel,
|
||||
),
|
||||
child: Container(
|
||||
child: SvgPicture.asset(
|
||||
'assets/images/home_screen_setting_icon.svg',
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
height: 30),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
@ -125,7 +126,7 @@ class CryptoBalanceWidget extends StatelessWidget {
|
|||
return IntroducingCard(
|
||||
title: S.of(context).introducing_cake_pay,
|
||||
subTitle: S.of(context).cake_pay_learn_more,
|
||||
borderColor: Theme.of(context).extension<BalancePageTheme>()!.cardBorderColor,
|
||||
borderColor: Theme.of(context).colorScheme.outline,
|
||||
closeCard: dashboardViewModel.balanceViewModel.disableIntroCakePayCard);
|
||||
}
|
||||
return Container();
|
||||
|
@ -138,6 +139,7 @@ class CryptoBalanceWidget extends StatelessWidget {
|
|||
return Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 0, 16, 8),
|
||||
child: DashBoardRoundedCardWidget(
|
||||
isDarkTheme: dashboardViewModel.isDarkTheme,
|
||||
title: S.of(context).rep_warning,
|
||||
subTitle: S.of(context).rep_warning_sub,
|
||||
onTap: () => Navigator.of(context).pushNamed(Routes.changeRep),
|
||||
|
@ -152,7 +154,7 @@ class CryptoBalanceWidget extends StatelessWidget {
|
|||
return ListView.separated(
|
||||
physics: NeverScrollableScrollPhysics(),
|
||||
shrinkWrap: true,
|
||||
separatorBuilder: (_, __) => Container(padding: EdgeInsets.only(bottom: 16)),
|
||||
separatorBuilder: (_, __) => Container(padding: EdgeInsets.only(bottom: 10)),
|
||||
itemCount: dashboardViewModel.balanceViewModel.formattedBalances.length,
|
||||
itemBuilder: (__, index) {
|
||||
final balance =
|
||||
|
@ -200,6 +202,7 @@ class CryptoBalanceWidget extends StatelessWidget {
|
|||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 0, 16, 8),
|
||||
child: DashBoardRoundedCardWidget(
|
||||
isDarkTheme: dashboardViewModel.isDarkTheme,
|
||||
customBorder: 30,
|
||||
title: "This wallet has encountered an issue",
|
||||
subTitle: "Here are the things that you should note:\n - " +
|
||||
|
@ -208,10 +211,11 @@ class CryptoBalanceWidget extends StatelessWidget {
|
|||
))
|
||||
],
|
||||
if (dashboardViewModel.showSilentPaymentsCard) ...[
|
||||
SizedBox(height: 16),
|
||||
SizedBox(height: 10),
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 0, 16, 8),
|
||||
padding: const EdgeInsets.fromLTRB(16, 0, 16, 0),
|
||||
child: DashBoardRoundedCardWidget(
|
||||
isDarkTheme: dashboardViewModel.isDarkTheme,
|
||||
shadowBlur: dashboardViewModel.getShadowBlur(),
|
||||
shadowSpread: dashboardViewModel.getShadowSpread(),
|
||||
marginV: 0,
|
||||
|
@ -235,24 +239,17 @@ class CryptoBalanceWidget extends StatelessWidget {
|
|||
children: [
|
||||
Text(
|
||||
S.of(context).what_is_silent_payments,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontFamily: 'Lato',
|
||||
fontWeight: FontWeight.w400,
|
||||
color: Theme.of(context)
|
||||
.extension<BalancePageTheme>()!
|
||||
.labelTextColor,
|
||||
height: 1,
|
||||
),
|
||||
style: Theme.of(context).textTheme.bodySmall?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
height: 1,
|
||||
),
|
||||
softWrap: true,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 4),
|
||||
child: Icon(Icons.help_outline,
|
||||
size: 16,
|
||||
color: Theme.of(context)
|
||||
.extension<BalancePageTheme>()!
|
||||
.labelTextColor),
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant),
|
||||
)
|
||||
],
|
||||
),
|
||||
|
@ -268,20 +265,18 @@ class CryptoBalanceWidget extends StatelessWidget {
|
|||
],
|
||||
),
|
||||
onTap: () => _toggleSilentPaymentsScanning(context),
|
||||
icon: Icon(
|
||||
Icons.lock,
|
||||
color:
|
||||
Theme.of(context).extension<DashboardPageTheme>()!.pageTitleTextColor,
|
||||
size: 50,
|
||||
),
|
||||
image: !dashboardViewModel.appStore.themeStore.currentTheme.isDark
|
||||
? Image.asset(btcLockLight, height: 48)
|
||||
: Image.asset(btcLockDark, height: 48),
|
||||
),
|
||||
),
|
||||
],
|
||||
if (dashboardViewModel.showMwebCard) ...[
|
||||
SizedBox(height: 16),
|
||||
SizedBox(height: 10),
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 0, 16, 8),
|
||||
child: InfoCard(
|
||||
isDarkTheme: dashboardViewModel.isDarkTheme,
|
||||
title: S.of(context).litecoin_mweb,
|
||||
description: S.of(context).litecoin_mweb_description,
|
||||
leftButtonTitle: S.of(context).litecoin_mweb_dismiss,
|
||||
|
@ -297,13 +292,10 @@ class CryptoBalanceWidget extends StatelessWidget {
|
|||
),
|
||||
child: Text(
|
||||
S.of(context).learn_more,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontFamily: 'Lato',
|
||||
fontWeight: FontWeight.w400,
|
||||
color: Theme.of(context).extension<BalancePageTheme>()!.labelTextColor,
|
||||
height: 1,
|
||||
),
|
||||
style: Theme.of(context).textTheme.bodySmall?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
height: 1,
|
||||
),
|
||||
softWrap: true,
|
||||
),
|
||||
),
|
||||
|
@ -315,13 +307,15 @@ class CryptoBalanceWidget extends StatelessWidget {
|
|||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 0, 16, 8),
|
||||
child: InfoCard(
|
||||
isDarkTheme: dashboardViewModel.isDarkTheme,
|
||||
title: S.of(context).synchronizing,
|
||||
description: S.of(context).decred_info_card_details,
|
||||
image: 'assets/images/dcr_icon.png',
|
||||
leftButtonTitle: S.of(context).litecoin_mweb_dismiss,
|
||||
rightButtonTitle: S.of(context).learn_more,
|
||||
leftButtonAction: () => dashboardViewModel.dismissDecredInfoCard(),
|
||||
rightButtonAction: () => launchUrl(Uri.parse("https://docs.cakewallet.com/cryptos/decred/#spv-sync")),
|
||||
rightButtonAction: () => launchUrl(
|
||||
Uri.parse("https://docs.cakewallet.com/cryptos/decred/#spv-sync")),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
@ -330,6 +324,7 @@ class CryptoBalanceWidget extends StatelessWidget {
|
|||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 0, 16, 8),
|
||||
child: InfoCard(
|
||||
isDarkTheme: dashboardViewModel.isDarkTheme,
|
||||
title: "Payjoin",
|
||||
description: S.of(context).payjoin_card_content,
|
||||
hintWidget: GestureDetector(
|
||||
|
@ -340,13 +335,10 @@ class CryptoBalanceWidget extends StatelessWidget {
|
|||
),
|
||||
child: Text(
|
||||
S.of(context).learn_more,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontFamily: 'Lato',
|
||||
fontWeight: FontWeight.w400,
|
||||
color: Theme.of(context).extension<BalancePageTheme>()!.labelTextColor,
|
||||
height: 1,
|
||||
),
|
||||
style: Theme.of(context).textTheme.bodySmall?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
height: 1,
|
||||
),
|
||||
softWrap: true,
|
||||
),
|
||||
),
|
||||
|
@ -396,19 +388,19 @@ class CryptoBalanceWidget extends StatelessWidget {
|
|||
}
|
||||
|
||||
return dashboardViewModel.setSilentPaymentsScanning(newValue);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void _enablePayjoin(BuildContext context) {
|
||||
showPopUp<void>(
|
||||
context: context,
|
||||
builder: (BuildContext context) => AlertWithOneAction(
|
||||
alertTitle: S.of(context).payjoin_enabling_popup_title,
|
||||
alertContent: S.of(context).payjoin_enabling_popup_content,
|
||||
buttonText: S.of(context).ok,
|
||||
buttonAction: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
));
|
||||
alertTitle: S.of(context).payjoin_enabling_popup_title,
|
||||
alertContent: S.of(context).payjoin_enabling_popup_content,
|
||||
buttonText: S.of(context).ok,
|
||||
buttonAction: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
));
|
||||
|
||||
dashboardViewModel.enablePayjoin();
|
||||
}
|
||||
|
|
|
@ -4,14 +4,12 @@ import 'package:cake_wallet/generated/i18n.dart';
|
|||
import 'package:cake_wallet/routes.dart';
|
||||
import 'package:cake_wallet/src/widgets/alert_with_one_action.dart';
|
||||
import 'package:cake_wallet/src/widgets/dashboard_card_widget.dart';
|
||||
import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart';
|
||||
import 'package:cake_wallet/utils/show_pop_up.dart';
|
||||
import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart';
|
||||
import 'package:cw_core/utils/print_verbose.dart';
|
||||
import 'package:cw_core/wallet_type.dart';
|
||||
import 'package:cake_wallet/view_model/dashboard/cake_features_view_model.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_mobx/flutter_mobx.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
class CakeFeaturesPage extends StatelessWidget {
|
||||
|
@ -22,64 +20,65 @@ class CakeFeaturesPage extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.only(left: 24, top: 16),
|
||||
return Container(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.only(left: 24, top: 16),
|
||||
child: Text(
|
||||
'Cake ${S.of(context).features}',
|
||||
style: TextStyle(
|
||||
fontSize: 24,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Theme.of(context).extension<DashboardPageTheme>()!.pageTitleTextColor,
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: ListView(
|
||||
children: <Widget>[
|
||||
SizedBox(height: 2),
|
||||
DashBoardRoundedCardWidget(
|
||||
shadowBlur: dashboardViewModel.getShadowBlur(),
|
||||
shadowSpread: dashboardViewModel.getShadowSpread(),
|
||||
onTap: () {
|
||||
if (Platform.isMacOS) {
|
||||
_launchUrl("buy.cakepay.com");
|
||||
} else {
|
||||
_navigatorToGiftCardsPage(context);
|
||||
}
|
||||
},
|
||||
title: 'Cake Pay',
|
||||
subTitle: S.of(context).cake_pay_subtitle,
|
||||
image: Image.asset(
|
||||
'assets/images/cards.png',
|
||||
height: 100,
|
||||
width: 115,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
style: Theme.of(context).textTheme.headlineSmall?.copyWith(
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
),
|
||||
DashBoardRoundedCardWidget(
|
||||
shadowBlur: dashboardViewModel.getShadowBlur(),
|
||||
shadowSpread: dashboardViewModel.getShadowSpread(),
|
||||
onTap: () => _launchUrl("cake.nano-gpt.com"),
|
||||
title: "NanoGPT",
|
||||
subTitle: S.of(context).nanogpt_subtitle,
|
||||
image: Image.asset(
|
||||
'assets/images/nanogpt.png',
|
||||
height: 80,
|
||||
width: 80,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 125),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
),
|
||||
Expanded(
|
||||
child: ListView(
|
||||
children: <Widget>[
|
||||
SizedBox(height: 2),
|
||||
DashBoardRoundedCardWidget(
|
||||
isDarkTheme: dashboardViewModel.isDarkTheme,
|
||||
shadowBlur: dashboardViewModel.getShadowBlur(),
|
||||
shadowSpread: dashboardViewModel.getShadowSpread(),
|
||||
onTap: () {
|
||||
if (Platform.isMacOS) {
|
||||
_launchUrl("buy.cakepay.com");
|
||||
} else {
|
||||
_navigatorToGiftCardsPage(context);
|
||||
}
|
||||
},
|
||||
title: 'Cake Pay',
|
||||
subTitle: S.of(context).cake_pay_subtitle,
|
||||
image: Image.asset(
|
||||
'assets/images/cards.png',
|
||||
height: 100,
|
||||
width: 115,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
DashBoardRoundedCardWidget(
|
||||
isDarkTheme: dashboardViewModel.isDarkTheme,
|
||||
shadowBlur: dashboardViewModel.getShadowBlur(),
|
||||
shadowSpread: dashboardViewModel.getShadowSpread(),
|
||||
onTap: () => _launchUrl("cake.nano-gpt.com"),
|
||||
title: "NanoGPT",
|
||||
subTitle: S.of(context).nanogpt_subtitle,
|
||||
image: Image.asset(
|
||||
'assets/images/nanogpt.png',
|
||||
height: 80,
|
||||
width: 80,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 125),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void _launchUrl(String url) {
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
import 'dart:ui';
|
||||
import 'package:cake_wallet/entities/main_actions.dart';
|
||||
import 'package:cake_wallet/themes/extensions/sync_indicator_theme.dart';
|
||||
import 'package:cake_wallet/themes/core/material_base_theme.dart';
|
||||
import 'package:cake_wallet/themes/utils/custom_theme_colors.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart';
|
||||
import 'package:cake_wallet/src/screens/dashboard/widgets/action_button.dart';
|
||||
import 'package:flutter_mobx/flutter_mobx.dart';
|
||||
import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart';
|
||||
import 'package:cake_wallet/themes/extensions/balance_page_theme.dart';
|
||||
import '../../../../themes/theme_base.dart';
|
||||
|
||||
class NavigationDock extends StatelessWidget {
|
||||
const NavigationDock({
|
||||
required this.dashboardViewModel,
|
||||
required this.currentTheme,
|
||||
});
|
||||
|
||||
final DashboardViewModel dashboardViewModel;
|
||||
final MaterialThemeBase currentTheme;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
@ -28,10 +28,19 @@ class NavigationDock extends StatelessWidget {
|
|||
gradient: LinearGradient(
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
colors: _getColors(context),
|
||||
colors: _getColors(context, !currentTheme.isDark),
|
||||
),
|
||||
),
|
||||
//color: Colors.transparent,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(50),
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
colors: _getColors(context, !currentTheme.isDark),
|
||||
),
|
||||
),
|
||||
margin: const EdgeInsets.only(left: 8, right: 8, bottom: 16),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(50),
|
||||
|
@ -40,12 +49,7 @@ class NavigationDock extends StatelessWidget {
|
|||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(50.0),
|
||||
border: Border.all(
|
||||
color: Theme.of(context).extension<BalancePageTheme>()!.cardBorderColor,
|
||||
width: 1,
|
||||
),
|
||||
color:
|
||||
Theme.of(context).extension<SyncIndicatorTheme>()!.syncedBackgroundColor,
|
||||
color: Theme.of(context).colorScheme.surfaceContainer,
|
||||
),
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 8),
|
||||
|
@ -62,18 +66,10 @@ class NavigationDock extends StatelessWidget {
|
|||
child: ActionButton(
|
||||
key: ValueKey(
|
||||
'dashboard_page_${action.name(context)}_action_button_key'),
|
||||
image: Image.asset(
|
||||
action.image,
|
||||
height: 24,
|
||||
width: 24,
|
||||
color: action.isEnabled?.call(dashboardViewModel) ?? true
|
||||
? Theme.of(context)
|
||||
.extension<DashboardPageTheme>()!
|
||||
.mainActionsIconColor
|
||||
: Theme.of(context)
|
||||
.extension<BalancePageTheme>()!
|
||||
.labelTextColor,
|
||||
),
|
||||
image: Image.asset(action.image,
|
||||
height: 24,
|
||||
width: 24,
|
||||
color: Theme.of(context).colorScheme.primary),
|
||||
title: action.name(context),
|
||||
onClick: (action.isEnabled?.call(dashboardViewModel) ?? true)
|
||||
? () async =>
|
||||
|
@ -81,9 +77,7 @@ class NavigationDock extends StatelessWidget {
|
|||
: null,
|
||||
textColor: action.isEnabled?.call(dashboardViewModel) ?? true
|
||||
? null
|
||||
: Theme.of(context)
|
||||
.extension<BalancePageTheme>()!
|
||||
.labelTextColor,
|
||||
: Theme.of(context).colorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -102,48 +96,25 @@ class NavigationDock extends StatelessWidget {
|
|||
);
|
||||
}
|
||||
|
||||
List<Color> _getColors(BuildContext context) {
|
||||
final isBright = dashboardViewModel.settingsStore.currentTheme.type == ThemeType.bright;
|
||||
List<Color> _getColors(BuildContext context, bool isBright) {
|
||||
return isBright
|
||||
? <Color>[
|
||||
Theme.of(context)
|
||||
.extension<DashboardPageTheme>()!
|
||||
.thirdGradientBackgroundColor
|
||||
.withAlpha(10),
|
||||
Theme.of(context)
|
||||
.extension<DashboardPageTheme>()!
|
||||
.thirdGradientBackgroundColor
|
||||
.withAlpha(75),
|
||||
Theme.of(context)
|
||||
.extension<DashboardPageTheme>()!
|
||||
.thirdGradientBackgroundColor
|
||||
.withAlpha(150),
|
||||
Theme.of(context).extension<DashboardPageTheme>()!.thirdGradientBackgroundColor,
|
||||
Theme.of(context).extension<DashboardPageTheme>()!.thirdGradientBackgroundColor
|
||||
CustomThemeColors.backgroundGradientColorLight.withAlpha(5),
|
||||
CustomThemeColors.backgroundGradientColorLight.withAlpha(50),
|
||||
CustomThemeColors.backgroundGradientColorLight.withAlpha(125),
|
||||
CustomThemeColors.backgroundGradientColorLight.withAlpha(150),
|
||||
CustomThemeColors.backgroundGradientColorLight.withAlpha(200),
|
||||
CustomThemeColors.backgroundGradientColorLight,
|
||||
CustomThemeColors.backgroundGradientColorLight
|
||||
]
|
||||
: <Color>[
|
||||
Theme.of(context)
|
||||
.extension<DashboardPageTheme>()!
|
||||
.thirdGradientBackgroundColor
|
||||
.withAlpha(5),
|
||||
Theme.of(context)
|
||||
.extension<DashboardPageTheme>()!
|
||||
.thirdGradientBackgroundColor
|
||||
.withAlpha(50),
|
||||
Theme.of(context)
|
||||
.extension<DashboardPageTheme>()!
|
||||
.thirdGradientBackgroundColor
|
||||
.withAlpha(125),
|
||||
Theme.of(context)
|
||||
.extension<DashboardPageTheme>()!
|
||||
.thirdGradientBackgroundColor
|
||||
.withAlpha(150),
|
||||
Theme.of(context)
|
||||
.extension<DashboardPageTheme>()!
|
||||
.thirdGradientBackgroundColor
|
||||
.withAlpha(200),
|
||||
Theme.of(context).extension<DashboardPageTheme>()!.thirdGradientBackgroundColor,
|
||||
Theme.of(context).extension<DashboardPageTheme>()!.thirdGradientBackgroundColor
|
||||
CustomThemeColors.backgroundGradientColorDark.withAlpha(5),
|
||||
CustomThemeColors.backgroundGradientColorDark.withAlpha(50),
|
||||
CustomThemeColors.backgroundGradientColorDark.withAlpha(125),
|
||||
CustomThemeColors.backgroundGradientColorDark.withAlpha(150),
|
||||
CustomThemeColors.backgroundGradientColorDark.withAlpha(200),
|
||||
CustomThemeColors.backgroundGradientColorDark,
|
||||
CustomThemeColors.backgroundGradientColorDark
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,9 +6,6 @@ import 'package:cake_wallet/src/screens/base_page.dart';
|
|||
import 'package:cake_wallet/src/screens/dashboard/widgets/menu_widget.dart';
|
||||
import 'package:cake_wallet/src/widgets/cake_image_widget.dart';
|
||||
import 'package:cake_wallet/src/widgets/gradient_background.dart';
|
||||
import 'package:cake_wallet/themes/extensions/balance_page_theme.dart';
|
||||
import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart';
|
||||
import 'package:cake_wallet/themes/extensions/sync_indicator_theme.dart';
|
||||
import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart';
|
||||
|
||||
class NFTDetailsPage extends BasePage {
|
||||
|
@ -41,7 +38,7 @@ class NFTDetailsPage extends BasePage {
|
|||
Widget trailing(BuildContext context) {
|
||||
final menuButton = Image.asset(
|
||||
'assets/images/menu.png',
|
||||
color: Theme.of(context).extension<DashboardPageTheme>()!.pageTitleTextColor,
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
);
|
||||
|
||||
return Container(
|
||||
|
@ -64,14 +61,13 @@ class NFTDetailsPage extends BasePage {
|
|||
child: Container(
|
||||
width: double.infinity,
|
||||
margin: const EdgeInsets.all(16),
|
||||
padding: const EdgeInsets.symmetric(vertical: 16),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(30.0),
|
||||
borderRadius: BorderRadius.circular(24.0),
|
||||
border: Border.all(
|
||||
color: Theme.of(context).extension<BalancePageTheme>()!.cardBorderColor,
|
||||
color: Theme.of(context).colorScheme.outline,
|
||||
width: 1,
|
||||
),
|
||||
color: Theme.of(context).extension<SyncIndicatorTheme>()!.syncedBackgroundColor,
|
||||
color: Theme.of(context).colorScheme.surface,
|
||||
),
|
||||
child: arguments.isSolanaNFT
|
||||
? SolanaNFTDetailsWidget(
|
||||
|
@ -92,21 +88,18 @@ class _NFTImageWidget extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final balanceTheme = Theme.of(context).extension<BalancePageTheme>()!;
|
||||
final syncTheme = Theme.of(context).extension<SyncIndicatorTheme>()!;
|
||||
|
||||
return Container(
|
||||
height: MediaQuery.sizeOf(context).height / 2.5,
|
||||
width: double.infinity,
|
||||
margin: const EdgeInsets.all(8),
|
||||
clipBehavior: Clip.hardEdge,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(16.0),
|
||||
borderRadius: BorderRadius.circular(24.0),
|
||||
border: Border.all(
|
||||
color: balanceTheme.cardBorderColor,
|
||||
color: Theme.of(context).colorScheme.outline,
|
||||
width: 1,
|
||||
),
|
||||
color: syncTheme.syncedBackgroundColor,
|
||||
color: Theme.of(context).colorScheme.surface,
|
||||
),
|
||||
child: CakeImageWidget(imageUrl: imageUrl),
|
||||
);
|
||||
|
@ -231,7 +224,6 @@ class _NFTSingleInfoTile extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final balanceTheme = Theme.of(context).extension<BalancePageTheme>()!;
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 24),
|
||||
child: Column(
|
||||
|
@ -239,22 +231,18 @@ class _NFTSingleInfoTile extends StatelessWidget {
|
|||
children: [
|
||||
Text(
|
||||
infoType,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontFamily: 'Lato',
|
||||
fontWeight: FontWeight.w400,
|
||||
color: balanceTheme.labelTextColor,
|
||||
style: Theme.of(context).textTheme.bodySmall?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
fontWeight: FontWeight.w500,
|
||||
height: 1,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
infoValue,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontFamily: 'Lato',
|
||||
style: Theme.of(context).textTheme.titleMedium?.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
color: balanceTheme.assetTitleColor,
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
height: 1,
|
||||
),
|
||||
),
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
import 'package:cake_wallet/palette.dart';
|
||||
import 'package:cake_wallet/src/screens/base_page.dart';
|
||||
import 'package:cake_wallet/src/widgets/address_text_field.dart';
|
||||
import 'package:cake_wallet/src/widgets/primary_button.dart';
|
||||
import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
|
||||
import 'package:cake_wallet/themes/extensions/seed_widget_theme.dart';
|
||||
import 'package:cake_wallet/view_model/dashboard/nft_view_model.dart';
|
||||
import 'package:cw_core/wallet_type.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
@ -72,14 +69,13 @@ class _ImportNFTPage extends BasePage {
|
|||
Text(
|
||||
S.current.address,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontFamily: 'Lato',
|
||||
fontWeight: FontWeight.w800,
|
||||
color: Theme.of(context).extension<SeedWidgetTheme>()!.hintTextColor,
|
||||
height: 1,
|
||||
),
|
||||
style: Theme.of(context).textTheme.titleMedium?.copyWith(
|
||||
fontWeight: FontWeight.w800,
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
height: 1,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
AddressTextField(
|
||||
controller: tokenAddressController,
|
||||
options: [AddressTextFieldOption.paste],
|
||||
|
@ -91,33 +87,28 @@ class _ImportNFTPage extends BasePage {
|
|||
tokenAddressController.text = tokenAddress;
|
||||
}
|
||||
},
|
||||
borderColor: Theme.of(context).extension<CakeTextTheme>()!.textfieldUnderlineColor,
|
||||
iconColor: Theme.of(context).primaryColor,
|
||||
fillColor: Theme.of(context).colorScheme.surfaceContainer,
|
||||
iconColor: Theme.of(context).colorScheme.primary,
|
||||
placeholder: '0x...',
|
||||
textStyle: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: PaletteDark.darkCyanBlue,
|
||||
),
|
||||
hintStyle: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: PaletteDark.darkCyanBlue,
|
||||
),
|
||||
textStyle: Theme.of(context).textTheme.bodyLarge?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
),
|
||||
hintStyle: Theme.of(context).textTheme.bodyLarge?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
if (nftViewModel.appStore.wallet!.type != WalletType.solana) ...[
|
||||
SizedBox(height: 48),
|
||||
Text(
|
||||
S.current.tokenID,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontFamily: 'Lato',
|
||||
fontWeight: FontWeight.w800,
|
||||
color: Theme.of(context).extension<SeedWidgetTheme>()!.hintTextColor,
|
||||
height: 1,
|
||||
),
|
||||
style: Theme.of(context).textTheme.titleMedium?.copyWith(
|
||||
fontWeight: FontWeight.w800,
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
height: 1,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
AddressTextField(
|
||||
controller: tokenIDController,
|
||||
options: [AddressTextFieldOption.paste],
|
||||
|
@ -129,19 +120,14 @@ class _ImportNFTPage extends BasePage {
|
|||
tokenIDController.text = tokenID;
|
||||
}
|
||||
},
|
||||
borderColor: Theme.of(context).extension<CakeTextTheme>()!.textfieldUnderlineColor,
|
||||
iconColor: Theme.of(context).primaryColor,
|
||||
iconColor: Theme.of(context).colorScheme.primary,
|
||||
placeholder: S.current.enterTokenID,
|
||||
textStyle: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: PaletteDark.darkCyanBlue,
|
||||
),
|
||||
hintStyle: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: PaletteDark.darkCyanBlue,
|
||||
),
|
||||
textStyle: Theme.of(context).textTheme.bodyLarge?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
),
|
||||
hintStyle: Theme.of(context).textTheme.bodyLarge?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
],
|
||||
Spacer(),
|
||||
|
@ -149,8 +135,8 @@ class _ImportNFTPage extends BasePage {
|
|||
return LoadingPrimaryButton(
|
||||
isLoading: nftViewModel.isImportNFTLoading,
|
||||
text: S.current.import,
|
||||
color: Theme.of(context).primaryColor,
|
||||
textColor: Colors.white,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
textColor: Theme.of(context).colorScheme.onPrimary,
|
||||
onPressed: () async {
|
||||
await nftViewModel.importNFT(tokenAddressController.text, tokenIDController.text);
|
||||
Navigator.pop(context);
|
||||
|
|
|
@ -5,9 +5,6 @@ import 'package:cake_wallet/routes.dart';
|
|||
import 'package:cake_wallet/src/screens/dashboard/widgets/nft_tile_widget.dart';
|
||||
import 'package:cake_wallet/src/screens/dashboard/widgets/solana_nft_tile_widget.dart';
|
||||
import 'package:cake_wallet/src/widgets/primary_button.dart';
|
||||
import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart';
|
||||
import 'package:cake_wallet/themes/extensions/exchange_page_theme.dart';
|
||||
import 'package:cake_wallet/themes/extensions/sync_indicator_theme.dart';
|
||||
import 'package:cake_wallet/view_model/dashboard/nft_view_model.dart';
|
||||
import 'package:cw_core/wallet_type.dart';
|
||||
|
||||
|
@ -34,10 +31,6 @@ class _NFTListingPageState extends State<NFTListingPage> {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final dashboardTheme = Theme.of(context).extension<DashboardPageTheme>()!;
|
||||
final syncIndicatorTheme = Theme.of(context).extension<SyncIndicatorTheme>()!;
|
||||
final exchangeTheme = Theme.of(context).extension<ExchangePageTheme>()!;
|
||||
|
||||
return Observer(
|
||||
builder: (context) {
|
||||
return Column(
|
||||
|
@ -47,8 +40,8 @@ class _NFTListingPageState extends State<NFTListingPage> {
|
|||
padding: const EdgeInsets.only(left: 16, right: 16, bottom: 16),
|
||||
child: PrimaryButton(
|
||||
text: S.current.import,
|
||||
color: syncIndicatorTheme.syncedBackgroundColor,
|
||||
textColor: Colors.white,
|
||||
color: Theme.of(context).colorScheme.surfaceContainer,
|
||||
textColor: Theme.of(context).colorScheme.onSecondaryContainer,
|
||||
onPressed: () => Navigator.pushNamed(
|
||||
context,
|
||||
Routes.importNFTPage,
|
||||
|
@ -60,9 +53,9 @@ class _NFTListingPageState extends State<NFTListingPage> {
|
|||
Expanded(
|
||||
child: Center(
|
||||
child: CircularProgressIndicator(
|
||||
backgroundColor: dashboardTheme.textColor,
|
||||
backgroundColor: Theme.of(context).colorScheme.surfaceContainerHighest,
|
||||
valueColor: AlwaysStoppedAnimation<Color>(
|
||||
exchangeTheme.firstGradientBottomPanelColor,
|
||||
Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -93,13 +86,9 @@ class NFTListWidget extends StatelessWidget {
|
|||
child: Text(
|
||||
S.current.noNFTYet,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
fontFamily: 'Lato',
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Theme.of(context).extension<DashboardPageTheme>()!.pageTitleTextColor,
|
||||
height: 1,
|
||||
),
|
||||
style: Theme.of(context).textTheme.bodyLarge?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@ import 'package:cake_wallet/src/screens/dashboard/widgets/anonpay_transaction_ro
|
|||
import 'package:cake_wallet/src/screens/dashboard/widgets/order_row.dart';
|
||||
import 'package:cake_wallet/src/screens/dashboard/widgets/payjoin_transaction_row.dart';
|
||||
import 'package:cake_wallet/src/screens/dashboard/widgets/trade_row.dart';
|
||||
import 'package:cake_wallet/themes/extensions/placeholder_theme.dart';
|
||||
import 'package:cake_wallet/src/widgets/dashboard_card_widget.dart';
|
||||
import 'package:cake_wallet/utils/responsive_layout_util.dart';
|
||||
import 'package:cake_wallet/view_model/dashboard/anonpay_transaction_list_item.dart';
|
||||
|
@ -41,18 +40,18 @@ class TransactionsPage extends StatelessWidget {
|
|||
child: Container(
|
||||
color: responsiveLayoutUtil.shouldRenderMobileUI
|
||||
? null
|
||||
: Theme.of(context).colorScheme.background,
|
||||
: Theme.of(context).colorScheme.surface,
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Observer(builder: (_) {
|
||||
final status = dashboardViewModel.status;
|
||||
if (status is SyncingSyncStatus) {
|
||||
return DashBoardRoundedCardWidget(
|
||||
isDarkTheme: dashboardViewModel.isDarkTheme,
|
||||
key: ValueKey('transactions_page_syncing_alert_card_key'),
|
||||
onTap: () {
|
||||
try {
|
||||
final uri = Uri.parse(
|
||||
"https://docs.cakewallet.com/faq/funds-not-appearing");
|
||||
final uri = Uri.parse("https://docs.cakewallet.com/faq/funds-not-appearing");
|
||||
launchUrl(uri, mode: LaunchMode.externalApplication);
|
||||
} catch (_) {}
|
||||
},
|
||||
|
@ -76,8 +75,7 @@ class TransactionsPage extends StatelessWidget {
|
|||
key: ValueKey('transactions_page_list_view_builder_key'),
|
||||
itemCount: items.length + 1,
|
||||
itemBuilder: (context, index) {
|
||||
|
||||
if(index == items.length) return SizedBox(height: 150);
|
||||
if (index == items.length) return SizedBox(height: 150);
|
||||
|
||||
final item = items[index];
|
||||
|
||||
|
@ -156,10 +154,9 @@ class TransactionsPage extends StatelessWidget {
|
|||
),
|
||||
currency: "BTC",
|
||||
state: item.status,
|
||||
amount: bitcoin!.formatterBitcoinAmountToString(
|
||||
amount: session.amount.toInt()),
|
||||
createdAt: DateFormat('HH:mm')
|
||||
.format(session.inProgressSince!),
|
||||
amount: bitcoin!
|
||||
.formatterBitcoinAmountToString(amount: session.amount.toInt()),
|
||||
createdAt: DateFormat('HH:mm').format(session.inProgressSince!),
|
||||
isSending: session.isSenderSession,
|
||||
);
|
||||
}
|
||||
|
@ -169,18 +166,17 @@ class TransactionsPage extends StatelessWidget {
|
|||
|
||||
return Observer(
|
||||
builder: (_) => TradeRow(
|
||||
key: item.key,
|
||||
onTap: () => Navigator.of(context)
|
||||
.pushNamed(Routes.tradeDetails, arguments: trade),
|
||||
provider: trade.provider,
|
||||
from: trade.from,
|
||||
to: trade.to,
|
||||
createdAtFormattedDate: trade.createdAt != null
|
||||
? DateFormat('HH:mm').format(trade.createdAt!)
|
||||
: null,
|
||||
formattedAmount: item.tradeFormattedAmount,
|
||||
formattedReceiveAmount: item.tradeFormattedReceiveAmount
|
||||
),
|
||||
key: item.key,
|
||||
onTap: () => Navigator.of(context)
|
||||
.pushNamed(Routes.tradeDetails, arguments: trade),
|
||||
provider: trade.provider,
|
||||
from: trade.from,
|
||||
to: trade.to,
|
||||
createdAtFormattedDate: trade.createdAt != null
|
||||
? DateFormat('HH:mm').format(trade.createdAt!)
|
||||
: null,
|
||||
formattedAmount: item.tradeFormattedAmount,
|
||||
formattedReceiveAmount: item.tradeFormattedReceiveAmount),
|
||||
);
|
||||
}
|
||||
if (item is OrderListItem) {
|
||||
|
@ -201,15 +197,15 @@ class TransactionsPage extends StatelessWidget {
|
|||
);
|
||||
}
|
||||
return Container(color: Colors.transparent, height: 1);
|
||||
})
|
||||
},
|
||||
)
|
||||
: Center(
|
||||
child: Text(
|
||||
key: ValueKey('transactions_page_placeholder_transactions_text_key'),
|
||||
S.of(context).placeholder_transactions,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Theme.of(context).extension<PlaceholderTheme>()!.color,
|
||||
),
|
||||
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
|
|
|
@ -6,9 +6,7 @@ import 'package:cake_wallet/src/screens/dashboard/widgets/verify_form.dart';
|
|||
import 'package:cake_wallet/src/widgets/alert_with_one_action.dart';
|
||||
import 'package:cake_wallet/src/widgets/keyboard_done_button.dart';
|
||||
import 'package:cake_wallet/src/widgets/primary_button.dart';
|
||||
import 'package:cake_wallet/themes/extensions/keyboard_theme.dart';
|
||||
import 'package:cake_wallet/themes/extensions/wallet_list_theme.dart';
|
||||
import 'package:cake_wallet/utils/responsive_layout_util.dart';
|
||||
|
||||
import 'package:cake_wallet/utils/show_pop_up.dart';
|
||||
import 'package:cake_wallet/view_model/dashboard/sign_view_model.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
@ -36,15 +34,16 @@ class SignPage extends BasePage {
|
|||
|
||||
@override
|
||||
Widget middle(BuildContext context) => Observer(
|
||||
builder: (_) => Text(
|
||||
builder: (_) {
|
||||
return Text(
|
||||
S.current.sign_verify_title,
|
||||
style: TextStyle(
|
||||
fontSize: 18.0,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontFamily: 'Lato',
|
||||
color: titleColor(context),
|
||||
),
|
||||
));
|
||||
style: Theme.of(context).textTheme.bodyLarge?.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 18,
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
final SignViewModel signViewModel;
|
||||
final PageController _controller;
|
||||
|
@ -60,7 +59,7 @@ class SignPage extends BasePage {
|
|||
return KeyboardActions(
|
||||
config: KeyboardActionsConfig(
|
||||
keyboardActionsPlatform: KeyboardActionsPlatform.IOS,
|
||||
keyboardBarColor: Theme.of(context).extension<KeyboardTheme>()!.keyboardBarColor,
|
||||
keyboardBarColor: Theme.of(context).colorScheme.surfaceVariant,
|
||||
nextFocus: false,
|
||||
actions: [
|
||||
KeyboardActionsItem(
|
||||
|
@ -71,69 +70,61 @@ class SignPage extends BasePage {
|
|||
),
|
||||
child: Container(
|
||||
height: 0,
|
||||
color: Theme.of(context).colorScheme.background,
|
||||
color: Theme.of(context).colorScheme.surface,
|
||||
child: Center(
|
||||
child: ConstrainedBox(
|
||||
constraints:
|
||||
BoxConstraints(maxWidth: ResponsiveLayoutUtilBase.kDesktopMaxWidthConstraint),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
child: PageView.builder(
|
||||
onPageChanged: (page) {
|
||||
signViewModel.isSigning = page == 0;
|
||||
},
|
||||
controller: _controller,
|
||||
itemCount: _pages.length,
|
||||
itemBuilder: (_, index) => SingleChildScrollView(child: _pages[index]),
|
||||
),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
child: PageView.builder(
|
||||
onPageChanged: (page) {
|
||||
signViewModel.isSigning = page == 0;
|
||||
},
|
||||
controller: _controller,
|
||||
itemCount: _pages.length,
|
||||
itemBuilder: (_, index) => SingleChildScrollView(child: _pages[index]),
|
||||
),
|
||||
if (_pages.length > 1)
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 10),
|
||||
child: SmoothPageIndicator(
|
||||
controller: _controller,
|
||||
count: _pages.length,
|
||||
effect: ColorTransitionEffect(
|
||||
spacing: 6.0,
|
||||
radius: 6.0,
|
||||
dotWidth: 6.0,
|
||||
dotHeight: 6.0,
|
||||
dotColor: Theme.of(context).hintColor.withOpacity(0.5),
|
||||
activeDotColor: Theme.of(context).hintColor,
|
||||
),
|
||||
),
|
||||
if (_pages.length > 1)
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 10),
|
||||
child: SmoothPageIndicator(
|
||||
controller: _controller,
|
||||
count: _pages.length,
|
||||
effect: ColorTransitionEffect(
|
||||
spacing: 6.0,
|
||||
radius: 6.0,
|
||||
dotWidth: 6.0,
|
||||
dotHeight: 6.0,
|
||||
dotColor: Theme.of(context).colorScheme.outline.withOpacity(0.5),
|
||||
activeDotColor: Theme.of(context).colorScheme.outline,
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 20, bottom: 24, left: 24, right: 24),
|
||||
child: Column(
|
||||
children: [
|
||||
Observer(
|
||||
builder: (context) {
|
||||
return LoadingPrimaryButton(
|
||||
onPressed: () async {
|
||||
await _confirmForm(context);
|
||||
},
|
||||
text: signViewModel.isSigning
|
||||
? S.current.sign_message
|
||||
: S.current.verify_message,
|
||||
color: Theme.of(context)
|
||||
.extension<WalletListTheme>()!
|
||||
.createNewWalletButtonBackgroundColor,
|
||||
textColor: Theme.of(context)
|
||||
.extension<WalletListTheme>()!
|
||||
.restoreWalletButtonTextColor,
|
||||
isLoading: signViewModel.state is IsExecutingState,
|
||||
isDisabled: signViewModel.state is IsExecutingState,
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 20, bottom: 24, left: 24, right: 24),
|
||||
child: Column(
|
||||
children: [
|
||||
Observer(
|
||||
builder: (context) {
|
||||
return LoadingPrimaryButton(
|
||||
onPressed: () async {
|
||||
await _confirmForm(context);
|
||||
},
|
||||
text: signViewModel.isSigning
|
||||
? S.current.sign_message
|
||||
: S.current.verify_message,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
textColor: Theme.of(context).colorScheme.onPrimary,
|
||||
isLoading: signViewModel.state is IsExecutingState,
|
||||
isDisabled: signViewModel.state is IsExecutingState,
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart';
|
||||
|
||||
class ActionButton extends StatelessWidget {
|
||||
ActionButton({
|
||||
|
@ -49,10 +48,8 @@ class ActionButton extends StatelessWidget {
|
|||
title,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.visible,
|
||||
style: TextStyle(
|
||||
fontSize: 9,
|
||||
color: textColor ??
|
||||
Theme.of(context).extension<DashboardPageTheme>()!.cardTextColor),
|
||||
style: Theme.of(context).textTheme.labelSmall?.copyWith(
|
||||
color: textColor ?? Theme.of(context).colorScheme.onSurface),
|
||||
textAlign: TextAlign.center,
|
||||
)
|
||||
],
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
|
||||
import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart';
|
||||
|
||||
class AnonpayTransactionRow extends StatelessWidget {
|
||||
AnonpayTransactionRow({
|
||||
|
@ -21,44 +19,53 @@ class AnonpayTransactionRow extends StatelessWidget {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: onTap,
|
||||
child: Container(
|
||||
padding: EdgeInsets.fromLTRB(24, 8, 24, 8),
|
||||
color: Colors.transparent,
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
_getImage(),
|
||||
SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Column(
|
||||
onTap: onTap,
|
||||
child: Container(
|
||||
padding: EdgeInsets.fromLTRB(24, 8, 24, 8),
|
||||
color: Colors.transparent,
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
_getImage(),
|
||||
SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: <Widget>[
|
||||
Text(provider,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
Text(
|
||||
provider,
|
||||
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Theme.of(context).extension<DashboardPageTheme>()!.textColor)),
|
||||
Text(amount + ' ' + currency,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
amount + ' ' + currency,
|
||||
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Theme.of(context).extension<DashboardPageTheme>()!.textColor))
|
||||
),
|
||||
),
|
||||
]),
|
||||
SizedBox(height: 5),
|
||||
Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: <Widget>[
|
||||
Text(createdAt,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Theme.of(context).extension<CakeTextTheme>()!.dateSectionRowColor))
|
||||
])
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
createdAt,
|
||||
style: Theme.of(context).textTheme.bodySmall?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
))
|
||||
],
|
||||
),
|
||||
));
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _getImage() => ClipRRect(
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
|
||||
import 'package:cake_wallet/utils/date_formatter.dart';
|
||||
|
||||
class DateSectionRaw extends StatelessWidget {
|
||||
|
@ -17,9 +16,8 @@ class DateSectionRaw extends StatelessWidget {
|
|||
color: Colors.transparent,
|
||||
child: Text(
|
||||
title,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: Theme.of(context).extension<CakeTextTheme>()!.dateSectionRowColor,
|
||||
style: Theme.of(context).textTheme.bodySmall?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
);
|
||||
|
|
|
@ -1,15 +1,11 @@
|
|||
import 'package:cake_wallet/entities/list_order_mode.dart';
|
||||
import 'package:cake_wallet/entities/wallet_list_order_types.dart';
|
||||
import 'package:cake_wallet/src/screens/settings/widgets/settings_choices_cell.dart';
|
||||
import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
|
||||
import 'package:cake_wallet/src/widgets/section_divider.dart';
|
||||
import 'package:cake_wallet/themes/extensions/menu_theme.dart';
|
||||
import 'package:cake_wallet/view_model/settings/choices_list_item.dart';
|
||||
import 'package:cake_wallet/view_model/wallet_list/wallet_list_view_model.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:cake_wallet/src/widgets/picker_wrapper_widget.dart';
|
||||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
import 'package:cake_wallet/themes/extensions/transaction_trade_theme.dart';
|
||||
|
||||
class FilterListWidget extends StatefulWidget {
|
||||
FilterListWidget({
|
||||
|
@ -57,19 +53,17 @@ class FilterListWidgetState extends State<FilterListWidget> {
|
|||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.all(Radius.circular(24)),
|
||||
child: Container(
|
||||
color: Theme.of(context).extension<CakeMenuTheme>()!.backgroundColor,
|
||||
color: Theme.of(context).colorScheme.surface,
|
||||
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.all(24.0),
|
||||
child: Text(
|
||||
S.of(context).order_by,
|
||||
style: TextStyle(
|
||||
color:
|
||||
Theme.of(context).extension<TransactionTradeTheme>()!.detailsTitlesColor,
|
||||
fontSize: 16,
|
||||
fontFamily: 'Lato',
|
||||
decoration: TextDecoration.none,
|
||||
),
|
||||
style: Theme.of(context).textTheme.titleMedium?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
fontSize: 16,
|
||||
decoration: TextDecoration.none,
|
||||
),
|
||||
),
|
||||
),
|
||||
if (type != FilterListOrderType.Custom) ...[
|
||||
|
@ -93,60 +87,56 @@ class FilterListWidgetState extends State<FilterListWidget> {
|
|||
groupValue: type,
|
||||
title: Text(
|
||||
FilterListOrderType.CreationDate.toString(),
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).extension<CakeTextTheme>()!.titleColor,
|
||||
fontSize: 16,
|
||||
fontFamily: 'Lato',
|
||||
fontWeight: FontWeight.bold,
|
||||
decoration: TextDecoration.none),
|
||||
style: Theme.of(context).textTheme.titleMedium?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
onChanged: setSelectedOrderType,
|
||||
activeColor: Theme.of(context).primaryColor,
|
||||
activeColor: Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
RadioListTile(
|
||||
value: FilterListOrderType.Alphabetical,
|
||||
groupValue: type,
|
||||
title: Text(
|
||||
FilterListOrderType.Alphabetical.toString(),
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).extension<CakeTextTheme>()!.titleColor,
|
||||
fontSize: 16,
|
||||
fontFamily: 'Lato',
|
||||
fontWeight: FontWeight.bold,
|
||||
decoration: TextDecoration.none),
|
||||
style: Theme.of(context).textTheme.titleMedium?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
onChanged: setSelectedOrderType,
|
||||
activeColor: Theme.of(context).primaryColor,
|
||||
activeColor: Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
RadioListTile(
|
||||
value: FilterListOrderType.GroupByType,
|
||||
groupValue: type,
|
||||
title: Text(
|
||||
FilterListOrderType.GroupByType.toString(),
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).extension<CakeTextTheme>()!.titleColor,
|
||||
fontSize: 16,
|
||||
fontFamily: 'Lato',
|
||||
fontWeight: FontWeight.bold,
|
||||
decoration: TextDecoration.none),
|
||||
style: Theme.of(context).textTheme.titleMedium?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
onChanged: setSelectedOrderType,
|
||||
activeColor: Theme.of(context).primaryColor,
|
||||
activeColor: Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
RadioListTile(
|
||||
value: FilterListOrderType.Custom,
|
||||
groupValue: type,
|
||||
title: Text(
|
||||
FilterListOrderType.Custom.toString(),
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).extension<CakeTextTheme>()!.titleColor,
|
||||
fontSize: 16,
|
||||
fontFamily: 'Lato',
|
||||
fontWeight: FontWeight.bold,
|
||||
decoration: TextDecoration.none),
|
||||
style: Theme.of(context).textTheme.titleMedium?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
onChanged: setSelectedOrderType,
|
||||
activeColor: Theme.of(context).primaryColor,
|
||||
activeColor: Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
]),
|
||||
),
|
||||
|
|
|
@ -1,16 +1,13 @@
|
|||
import 'package:cake_wallet/src/widgets/alert_background.dart';
|
||||
import 'package:cake_wallet/src/widgets/alert_close_button.dart';
|
||||
import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
|
||||
import 'package:cake_wallet/src/screens/dashboard/widgets/filter_tile.dart';
|
||||
import 'package:cake_wallet/src/widgets/section_divider.dart';
|
||||
import 'package:cake_wallet/src/widgets/standard_checkbox.dart';
|
||||
import 'package:cake_wallet/themes/extensions/menu_theme.dart';
|
||||
import 'package:cake_wallet/utils/responsive_layout_util.dart';
|
||||
import 'package:cake_wallet/view_model/dashboard/filter_item.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
import 'package:flutter_mobx/flutter_mobx.dart';
|
||||
import 'package:cake_wallet/themes/extensions/transaction_trade_theme.dart';
|
||||
|
||||
class FilterWidget extends StatefulWidget {
|
||||
const FilterWidget({required this.filterItems, this.onClose, Key? key}) : super(key: key);
|
||||
|
@ -75,7 +72,7 @@ class _FilterWidgetState extends State<FilterWidget> {
|
|||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(24),
|
||||
child: Container(
|
||||
color: Theme.of(context).extension<CakeMenuTheme>()!.backgroundColor,
|
||||
color: Theme.of(context).colorScheme.surface,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
|
@ -83,13 +80,9 @@ class _FilterWidgetState extends State<FilterWidget> {
|
|||
padding: const EdgeInsets.all(24.0),
|
||||
child: Text(
|
||||
S.of(context).filter_by,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context)
|
||||
.extension<TransactionTradeTheme>()!
|
||||
.detailsTitlesColor,
|
||||
fontSize: 16,
|
||||
fontFamily: 'Lato',
|
||||
decoration: TextDecoration.none,
|
||||
style: Theme.of(context).textTheme.titleMedium?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -125,8 +118,8 @@ class _FilterWidgetState extends State<FilterWidget> {
|
|||
value: item.value(),
|
||||
caption: item.caption,
|
||||
gradientBackground: true,
|
||||
borderColor: Theme.of(context).dividerColor,
|
||||
iconColor: Colors.white,
|
||||
borderColor: Theme.of(context).colorScheme.outlineVariant,
|
||||
iconColor: Theme.of(context).colorScheme.onSurface,
|
||||
onChanged: (value) => item.onChanged(),
|
||||
),
|
||||
);
|
||||
|
@ -143,10 +136,8 @@ class _FilterWidgetState extends State<FilterWidget> {
|
|||
padding: const EdgeInsets.only(top: 20, left: 24, right: 24),
|
||||
child: Text(
|
||||
title,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).extension<CakeTextTheme>()!.titleColor,
|
||||
fontSize: 16,
|
||||
fontFamily: 'Lato',
|
||||
style: Theme.of(context).textTheme.titleMedium?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
fontWeight: FontWeight.bold,
|
||||
decoration: TextDecoration.none,
|
||||
),
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
import 'package:cake_wallet/src/screens/dashboard/widgets/filter_widget.dart';
|
||||
import 'package:cake_wallet/themes/extensions/filter_theme.dart';
|
||||
import 'package:cake_wallet/utils/show_pop_up.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart';
|
||||
import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart';
|
||||
|
||||
class HeaderRow extends StatelessWidget {
|
||||
HeaderRow({required this.dashboardViewModel, super.key});
|
||||
|
@ -14,7 +12,7 @@ class HeaderRow extends StatelessWidget {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final filterIcon = Image.asset('assets/images/filter_icon.png',
|
||||
color: Theme.of(context).extension<FilterTheme>()!.iconColor);
|
||||
color: Theme.of(context).colorScheme.onSurface);
|
||||
|
||||
return Container(
|
||||
height: 52,
|
||||
|
@ -26,10 +24,9 @@ class HeaderRow extends StatelessWidget {
|
|||
children: <Widget>[
|
||||
Text(
|
||||
S.of(context).transactions,
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
style: Theme.of(context).textTheme.titleLarge?.copyWith(
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Theme.of(context).extension<DashboardPageTheme>()!.pageTitleTextColor),
|
||||
color: Theme.of(context).colorScheme.onSurface),
|
||||
),
|
||||
Semantics(
|
||||
container: true,
|
||||
|
@ -50,7 +47,7 @@ class HeaderRow extends StatelessWidget {
|
|||
width: 36,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Theme.of(context).extension<FilterTheme>()!.buttonColor,
|
||||
color: Theme.of(context).colorScheme.surfaceContainer,
|
||||
),
|
||||
child: filterIcon,
|
||||
),
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import 'package:cake_wallet/di.dart';
|
||||
import 'package:cake_wallet/src/screens/monero_accounts/monero_account_list_page.dart';
|
||||
import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart';
|
||||
import 'package:cake_wallet/utils/show_pop_up.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
|
@ -32,11 +31,9 @@ class HomeScreenAccountWidget extends StatelessWidget {
|
|||
Container(
|
||||
child: Text(
|
||||
walletName ?? '',
|
||||
style: TextStyle(
|
||||
fontSize: 22.0,
|
||||
style: Theme.of(context).textTheme.headlineSmall?.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontFamily: 'Lato',
|
||||
color: Theme.of(context).extension<DashboardPageTheme>()!.pageTitleTextColor,
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -46,11 +43,9 @@ class HomeScreenAccountWidget extends StatelessWidget {
|
|||
Container(
|
||||
child: Text(
|
||||
accountName ?? '',
|
||||
style: TextStyle(
|
||||
fontSize: 14.0,
|
||||
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontFamily: 'Lato',
|
||||
color: Theme.of(context).extension<DashboardPageTheme>()!.pageTitleTextColor,
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -59,7 +54,7 @@ class HomeScreenAccountWidget extends StatelessWidget {
|
|||
Container(
|
||||
child: Icon(
|
||||
Icons.keyboard_arrow_down,
|
||||
color: Theme.of(context).extension<DashboardPageTheme>()!.pageTitleTextColor,
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
],
|
||||
|
|
|
@ -8,7 +8,7 @@ class InfoCard extends StatelessWidget {
|
|||
final String title;
|
||||
final String description;
|
||||
final String image;
|
||||
|
||||
final bool isDarkTheme;
|
||||
final Function() leftButtonAction;
|
||||
final Function() rightButtonAction;
|
||||
|
||||
|
@ -23,12 +23,14 @@ class InfoCard extends StatelessWidget {
|
|||
required this.leftButtonAction,
|
||||
required this.rightButtonAction,
|
||||
required this.image,
|
||||
required this.isDarkTheme,
|
||||
this.hintWidget,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return DashBoardRoundedCardWidget(
|
||||
isDarkTheme: isDarkTheme,
|
||||
marginH: 0,
|
||||
marginV: 0,
|
||||
customBorder: 30,
|
||||
|
@ -45,11 +47,16 @@ class InfoCard extends StatelessWidget {
|
|||
child: ElevatedButton(
|
||||
onPressed: leftButtonAction,
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Theme.of(context).primaryColor,
|
||||
backgroundColor: Theme.of(context).colorScheme.surface,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
),
|
||||
child: Text(
|
||||
leftButtonTitle,
|
||||
style: TextStyle(color: Colors.white),
|
||||
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSecondaryContainer,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -58,12 +65,17 @@ class InfoCard extends StatelessWidget {
|
|||
child: ElevatedButton(
|
||||
onPressed: rightButtonAction,
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Colors.white,
|
||||
foregroundColor: Colors.black,
|
||||
backgroundColor: Theme.of(context).colorScheme.primary,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
),
|
||||
child: Text(
|
||||
rightButtonTitle,
|
||||
maxLines: 1,
|
||||
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onPrimary,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -74,7 +86,7 @@ class InfoCard extends StatelessWidget {
|
|||
onTap: () => {},
|
||||
icon: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
color: Theme.of(context).colorScheme.surfaceContainer,
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: CakeImageWidget(
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
import 'package:cake_wallet/src/widgets/setting_action_button.dart';
|
||||
import 'package:cake_wallet/src/widgets/setting_actions.dart';
|
||||
import 'package:cake_wallet/themes/extensions/menu_theme.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:cake_wallet/palette.dart';
|
||||
import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart';
|
||||
import 'package:cw_core/wallet_type.dart';
|
||||
import 'package:flutter_mobx/flutter_mobx.dart';
|
||||
|
@ -103,7 +101,8 @@ class MenuWidgetState extends State<MenuWidget> {
|
|||
Widget build(BuildContext context) {
|
||||
List<SettingActions> items = List.of(SettingActions.all);
|
||||
if (!widget.dashboardViewModel.hasSilentPayments) {
|
||||
items.removeWhere((element) => element.name(context) == S.of(context).silent_payments_settings);
|
||||
items.removeWhere(
|
||||
(element) => element.name(context) == S.of(context).silent_payments_settings);
|
||||
}
|
||||
if (!widget.dashboardViewModel.isMoneroViewOnly) {
|
||||
items.removeWhere((element) => element.name(context) == S.of(context).export_outputs);
|
||||
|
@ -113,10 +112,10 @@ class MenuWidgetState extends State<MenuWidget> {
|
|||
}
|
||||
int itemCount = items.length;
|
||||
|
||||
moneroIcon = Image.asset('assets/images/monero_menu.png',
|
||||
color: Theme.of(context).extension<CakeMenuTheme>()!.iconColor);
|
||||
bitcoinIcon = Image.asset('assets/images/bitcoin_menu.png',
|
||||
color: Theme.of(context).extension<CakeMenuTheme>()!.iconColor);
|
||||
moneroIcon =
|
||||
Image.asset('assets/images/monero_menu.png', color: Theme.of(context).colorScheme.primary);
|
||||
bitcoinIcon =
|
||||
Image.asset('assets/images/bitcoin_menu.png', color: Theme.of(context).colorScheme.primary);
|
||||
|
||||
return Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
|
@ -128,16 +127,20 @@ class MenuWidgetState extends State<MenuWidget> {
|
|||
height: 60,
|
||||
width: 4,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.all(Radius.circular(2)), color: PaletteDark.gray),
|
||||
borderRadius: BorderRadius.all(Radius.circular(2)),
|
||||
color: Theme.of(context).colorScheme.outline,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: ClipRRect(
|
||||
borderRadius:
|
||||
BorderRadius.only(topLeft: Radius.circular(24), bottomLeft: Radius.circular(24)),
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(24),
|
||||
bottomLeft: Radius.circular(24),
|
||||
),
|
||||
child: Container(
|
||||
color: Theme.of(context).extension<CakeMenuTheme>()!.backgroundColor,
|
||||
color: Theme.of(context).colorScheme.surface,
|
||||
child: ListView.separated(
|
||||
padding: EdgeInsets.only(top: 0),
|
||||
itemBuilder: (_, index) {
|
||||
|
@ -146,13 +149,14 @@ class MenuWidgetState extends State<MenuWidget> {
|
|||
height: headerHeight,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.only(bottomLeft: Radius.circular(24)),
|
||||
gradient: LinearGradient(colors: [
|
||||
Theme.of(context).extension<CakeMenuTheme>()!.headerFirstGradientColor,
|
||||
Theme.of(context).extension<CakeMenuTheme>()!.headerSecondGradientColor,
|
||||
], begin: Alignment.topLeft, end: Alignment.bottomRight),
|
||||
color: Theme.of(context).colorScheme.surface,
|
||||
),
|
||||
padding: EdgeInsets.only(
|
||||
left: 24, top: fromTopEdge, right: 24, bottom: fromBottomEdge),
|
||||
left: 24,
|
||||
top: fromTopEdge,
|
||||
right: 24,
|
||||
bottom: fromBottomEdge,
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
|
@ -168,21 +172,18 @@ class MenuWidgetState extends State<MenuWidget> {
|
|||
children: <Widget>[
|
||||
Text(
|
||||
widget.dashboardViewModel.name,
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold),
|
||||
style: Theme.of(context).textTheme.bodyLarge?.copyWith(
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
if (widget.dashboardViewModel.subname.isNotEmpty)
|
||||
Observer(
|
||||
builder: (_) => Text(
|
||||
widget.dashboardViewModel.subname,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context)
|
||||
.extension<CakeMenuTheme>()!
|
||||
.subnameTextColor,
|
||||
fontWeight: FontWeight.w500,
|
||||
fontSize: 12),
|
||||
style: Theme.of(context).textTheme.bodySmall?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
@ -213,7 +214,7 @@ class MenuWidgetState extends State<MenuWidget> {
|
|||
},
|
||||
separatorBuilder: (_, index) => Container(
|
||||
height: 0,
|
||||
color: Theme.of(context).extension<CakeMenuTheme>()!.dividerColor,
|
||||
color: Theme.of(context).colorScheme.outline,
|
||||
),
|
||||
itemCount: itemCount + 1,
|
||||
),
|
||||
|
|
|
@ -2,8 +2,6 @@ import 'package:cake_wallet/entities/wallet_nft_response.dart';
|
|||
import 'package:cake_wallet/routes.dart';
|
||||
import 'package:cake_wallet/src/screens/dashboard/pages/nft_details_page.dart';
|
||||
import 'package:cake_wallet/src/widgets/cake_image_widget.dart';
|
||||
import 'package:cake_wallet/themes/extensions/balance_page_theme.dart';
|
||||
import 'package:cake_wallet/themes/extensions/sync_indicator_theme.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class NFTTileWidget extends StatelessWidget {
|
||||
|
@ -27,8 +25,10 @@ class NFTTileWidget extends StatelessWidget {
|
|||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(30.0),
|
||||
border: Border.all(
|
||||
color: Theme.of(context).extension<BalancePageTheme>()!.cardBorderColor, width: 1),
|
||||
color: Theme.of(context).extension<SyncIndicatorTheme>()!.syncedBackgroundColor,
|
||||
color: Theme.of(context).colorScheme.outline,
|
||||
width: 0.0,
|
||||
),
|
||||
color: Theme.of(context).colorScheme.surfaceContainer,
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
|
@ -38,12 +38,12 @@ class NFTTileWidget extends StatelessWidget {
|
|||
clipBehavior: Clip.hardEdge,
|
||||
margin: const EdgeInsets.all(8),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(16.0),
|
||||
borderRadius: BorderRadius.circular(24.0),
|
||||
border: Border.all(
|
||||
color: Theme.of(context).extension<BalancePageTheme>()!.cardBorderColor,
|
||||
width: 1,
|
||||
color: Theme.of(context).colorScheme.outline,
|
||||
width: 0.0,
|
||||
),
|
||||
color: Theme.of(context).extension<SyncIndicatorTheme>()!.syncedBackgroundColor,
|
||||
color: Theme.of(context).colorScheme.surface,
|
||||
),
|
||||
child: CakeImageWidget(
|
||||
imageUrl: nftAsset.normalizedMetadata?.imageUrl,
|
||||
|
@ -56,24 +56,19 @@ class NFTTileWidget extends StatelessWidget {
|
|||
children: [
|
||||
Text(
|
||||
'${nftAsset.name ?? '---'} - ${nftAsset.symbol ?? '---'}',
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontFamily: 'Lato',
|
||||
fontWeight: FontWeight.w400,
|
||||
color: Theme.of(context).extension<BalancePageTheme>()!.labelTextColor,
|
||||
height: 1,
|
||||
),
|
||||
style: Theme.of(context).textTheme.bodySmall?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
height: 1,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
Text(
|
||||
nftAsset.normalizedMetadata?.name ?? nftAsset.name ?? "---",
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
fontFamily: 'Lato',
|
||||
fontWeight: FontWeight.w900,
|
||||
color: Theme.of(context).extension<BalancePageTheme>()!.assetTitleColor,
|
||||
height: 1,
|
||||
),
|
||||
style: Theme.of(context).textTheme.titleLarge?.copyWith(
|
||||
fontWeight: FontWeight.w900,
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
height: 1,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
import 'package:cake_wallet/buy/buy_provider_description.dart';
|
||||
import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
|
||||
import 'package:cake_wallet/buy/get_buy_provider_icon.dart';
|
||||
import 'package:cake_wallet/themes/extensions/order_theme.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart';
|
||||
|
||||
class OrderRow extends StatelessWidget {
|
||||
OrderRow({
|
||||
|
@ -15,7 +12,7 @@ class OrderRow extends StatelessWidget {
|
|||
this.formattedAmount,
|
||||
super.key,
|
||||
});
|
||||
|
||||
|
||||
final VoidCallback? onTap;
|
||||
final BuyProviderDescription provider;
|
||||
final String from;
|
||||
|
@ -25,55 +22,64 @@ class OrderRow extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final iconColor = Theme.of(context).extension<OrderTheme>()!.iconColor;
|
||||
final iconColor = Theme.of(context).colorScheme.onSurfaceVariant;
|
||||
|
||||
final providerIcon = getBuyProviderIcon(provider, iconColor: iconColor);
|
||||
|
||||
return InkWell(
|
||||
onTap: onTap,
|
||||
child: Container(
|
||||
padding: EdgeInsets.fromLTRB(24, 8, 24, 8),
|
||||
color: Colors.transparent,
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
if (providerIcon != null)
|
||||
Padding(
|
||||
padding: EdgeInsets.only(right: 12),
|
||||
child: providerIcon,
|
||||
),
|
||||
Expanded(
|
||||
child: Column(
|
||||
onTap: onTap,
|
||||
child: Container(
|
||||
padding: EdgeInsets.fromLTRB(24, 8, 24, 8),
|
||||
color: Colors.transparent,
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
if (providerIcon != null)
|
||||
Padding(
|
||||
padding: EdgeInsets.only(right: 12),
|
||||
child: providerIcon,
|
||||
),
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: <Widget>[
|
||||
Text('$from → $to',
|
||||
style: TextStyle(
|
||||
Text(
|
||||
'$from → $to',
|
||||
style: Theme.of(context).textTheme.bodyMedium!.copyWith(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Theme.of(context).extension<DashboardPageTheme>()!.textColor)),
|
||||
),
|
||||
),
|
||||
formattedAmount != null
|
||||
? Text(formattedAmount! + ' ' + to,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
color:
|
||||
Theme.of(context).extension<DashboardPageTheme>()!.textColor))
|
||||
? Text(
|
||||
formattedAmount! + ' ' + to,
|
||||
style: Theme.of(context).textTheme.bodyMedium!.copyWith(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
)
|
||||
: Container()
|
||||
]),
|
||||
SizedBox(height: 5),
|
||||
Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: <Widget>[
|
||||
Text(createdAtFormattedDate,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color:
|
||||
Theme.of(context).extension<CakeTextTheme>()!.dateSectionRowColor))
|
||||
])
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
createdAtFormattedDate,
|
||||
style: Theme.of(context).textTheme.bodyMedium!.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
))
|
||||
],
|
||||
),
|
||||
));
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
|
||||
import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class PayjoinTransactionRow extends StatelessWidget {
|
||||
|
@ -38,53 +36,37 @@ class PayjoinTransactionRow extends StatelessWidget {
|
|||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
"${isSending ? S.current.outgoing : S.current.incoming} Payjoin",
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: <Widget>[
|
||||
Text(
|
||||
"${isSending ? S.current.outgoing : S.current.incoming} Payjoin",
|
||||
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Theme.of(context)
|
||||
.extension<DashboardPageTheme>()!
|
||||
.textColor,
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
amount + ' ' + currency,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
),
|
||||
Text(
|
||||
amount + ' ' + currency,
|
||||
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Theme.of(context)
|
||||
.extension<DashboardPageTheme>()!
|
||||
.textColor,
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
),
|
||||
)
|
||||
]),
|
||||
)
|
||||
]),
|
||||
SizedBox(height: 5),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
createdAt,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Theme.of(context)
|
||||
.extension<CakeTextTheme>()!
|
||||
.dateSectionRowColor,
|
||||
Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: <Widget>[
|
||||
Text(
|
||||
createdAt,
|
||||
style: Theme.of(context).textTheme.bodySmall?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
state,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Theme.of(context)
|
||||
.extension<CakeTextTheme>()!
|
||||
.dateSectionRowColor,
|
||||
),
|
||||
Text(
|
||||
state,
|
||||
style: Theme.of(context).textTheme.bodySmall?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
])
|
||||
),
|
||||
])
|
||||
],
|
||||
))
|
||||
],
|
||||
|
@ -93,7 +75,11 @@ class PayjoinTransactionRow extends StatelessWidget {
|
|||
}
|
||||
|
||||
Widget _getImage() => ClipRRect(
|
||||
borderRadius: BorderRadius.circular(50),
|
||||
child: Image.asset('assets/images/payjoin.png', width: 36, height: 36));
|
||||
|
||||
borderRadius: BorderRadius.circular(50),
|
||||
child: Image.asset(
|
||||
'assets/images/payjoin.png',
|
||||
width: 36,
|
||||
height: 36,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import 'package:cake_wallet/src/widgets/alert_close_button.dart';
|
||||
import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
|
||||
import 'package:cake_wallet/src/screens/cake_pay/widgets/rounded_checkbox.dart';
|
||||
import 'package:cake_wallet/src/widgets/alert_background.dart';
|
||||
import 'package:cake_wallet/typography.dart';
|
||||
|
@ -26,10 +25,10 @@ class PresentReceiveOptionPicker extends StatelessWidget {
|
|||
return TextButton(
|
||||
onPressed: () => _showPicker(context),
|
||||
style: ButtonStyle(
|
||||
padding: MaterialStateProperty.all(EdgeInsets.zero),
|
||||
padding: WidgetStateProperty.all(EdgeInsets.zero),
|
||||
splashFactory: NoSplash.splashFactory,
|
||||
foregroundColor: MaterialStateProperty.all(Colors.transparent),
|
||||
overlayColor: MaterialStateProperty.all(Colors.transparent),
|
||||
foregroundColor: WidgetStateProperty.all(Colors.transparent),
|
||||
overlayColor: WidgetStateProperty.all(Colors.transparent),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
|
@ -41,18 +40,27 @@ class PresentReceiveOptionPicker extends StatelessWidget {
|
|||
children: <Widget>[
|
||||
Text(
|
||||
S.current.receive,
|
||||
style: TextStyle(
|
||||
fontSize: 18.0, fontWeight: FontWeight.bold, fontFamily: 'Lato', color: color),
|
||||
style: Theme.of(context).textTheme.bodyMedium!.copyWith(
|
||||
fontSize: 18.0,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: color,
|
||||
),
|
||||
),
|
||||
Observer(
|
||||
builder: (_) => Text(
|
||||
receiveOptionViewModel.selectedReceiveOption
|
||||
.toString()
|
||||
.replaceAll(RegExp(r'silent payments', caseSensitive: false),
|
||||
S.current.silent_payments)
|
||||
.replaceAll(
|
||||
RegExp(r'default', caseSensitive: false), S.current.string_default),
|
||||
style: TextStyle(fontSize: 10.0, fontWeight: FontWeight.w500, color: color)))
|
||||
builder: (_) => Text(
|
||||
receiveOptionViewModel.selectedReceiveOption
|
||||
.toString()
|
||||
.replaceAll(RegExp(r'silent payments', caseSensitive: false),
|
||||
S.current.silent_payments)
|
||||
.replaceAll(
|
||||
RegExp(r'default', caseSensitive: false), S.current.string_default),
|
||||
style: Theme.of(context).textTheme.bodySmall!.copyWith(
|
||||
fontSize: 10.0,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: color,
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
SizedBox(width: 5),
|
||||
|
@ -83,7 +91,7 @@ class PresentReceiveOptionPicker extends StatelessWidget {
|
|||
margin: EdgeInsets.symmetric(horizontal: 24),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(30),
|
||||
color: Theme.of(context).colorScheme.background,
|
||||
color: Theme.of(context).colorScheme.surface,
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(top: 24, bottom: 24),
|
||||
|
@ -117,9 +125,7 @@ class PresentReceiveOptionPicker extends StatelessWidget {
|
|||
S.current.string_default),
|
||||
textAlign: TextAlign.left,
|
||||
style: textSmall(
|
||||
color: Theme.of(context)
|
||||
.extension<CakeTextTheme>()!
|
||||
.titleColor,
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
).copyWith(
|
||||
fontWeight:
|
||||
value == option ? FontWeight.w800 : FontWeight.w500,
|
||||
|
|
|
@ -44,7 +44,7 @@ class SignFormState extends State<SignForm> with AutomaticKeepAliveClientMixin {
|
|||
|
||||
@override
|
||||
bool get wantKeepAlive => true;
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
super.build(context);
|
||||
|
@ -60,7 +60,8 @@ class SignFormState extends State<SignForm> with AutomaticKeepAliveClientMixin {
|
|||
controller: messageController,
|
||||
placeholder: S.current.message,
|
||||
options: [AddressTextFieldOption.paste],
|
||||
buttonColor: Theme.of(context).hintColor,
|
||||
buttonColor: Theme.of(context).colorScheme.surfaceContainerHighest,
|
||||
fillColor: Theme.of(context).colorScheme.surface,
|
||||
),
|
||||
if (widget.includeAddress) ...[
|
||||
const SizedBox(height: 20),
|
||||
|
@ -70,11 +71,12 @@ class SignFormState extends State<SignForm> with AutomaticKeepAliveClientMixin {
|
|||
AddressTextFieldOption.paste,
|
||||
AddressTextFieldOption.walletAddresses
|
||||
],
|
||||
buttonColor: Theme.of(context).hintColor,
|
||||
buttonColor: Theme.of(context).colorScheme.surfaceContainerHighest,
|
||||
onSelectedContact: (contact) {
|
||||
addressController.text = contact.address;
|
||||
},
|
||||
selectedCurrency: walletTypeToCryptoCurrency(widget.type),
|
||||
fillColor: Theme.of(context).colorScheme.surface,
|
||||
),
|
||||
],
|
||||
],
|
||||
|
|
|
@ -3,8 +3,6 @@ import 'package:cake_wallet/entities/solana_nft_asset_model.dart';
|
|||
import 'package:cake_wallet/routes.dart';
|
||||
import 'package:cake_wallet/src/screens/dashboard/pages/nft_details_page.dart';
|
||||
import 'package:cake_wallet/src/widgets/cake_image_widget.dart';
|
||||
import 'package:cake_wallet/themes/extensions/balance_page_theme.dart';
|
||||
import 'package:cake_wallet/themes/extensions/sync_indicator_theme.dart';
|
||||
|
||||
class SolanaNFTTileWidget extends StatelessWidget {
|
||||
const SolanaNFTTileWidget({super.key, required this.nftAsset});
|
||||
|
@ -13,9 +11,6 @@ class SolanaNFTTileWidget extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final balanceTheme = Theme.of(context).extension<BalancePageTheme>()!;
|
||||
final syncTheme = Theme.of(context).extension<SyncIndicatorTheme>()!;
|
||||
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
Navigator.pushNamed(
|
||||
|
@ -34,10 +29,10 @@ class SolanaNFTTileWidget extends StatelessWidget {
|
|||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(16.0),
|
||||
border: Border.all(
|
||||
color: balanceTheme.cardBorderColor,
|
||||
width: 1,
|
||||
color: Theme.of(context).colorScheme.outline,
|
||||
width: 0.0,
|
||||
),
|
||||
color: syncTheme.syncedBackgroundColor,
|
||||
color: Theme.of(context).colorScheme.surfaceContainer,
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
|
@ -47,12 +42,12 @@ class SolanaNFTTileWidget extends StatelessWidget {
|
|||
margin: const EdgeInsets.all(8),
|
||||
clipBehavior: Clip.hardEdge,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(16.0),
|
||||
borderRadius: BorderRadius.circular(24.0),
|
||||
border: Border.all(
|
||||
color: balanceTheme.cardBorderColor,
|
||||
width: 1,
|
||||
color: Theme.of(context).colorScheme.outline,
|
||||
width: 0.0,
|
||||
),
|
||||
color: syncTheme.syncedBackgroundColor,
|
||||
color: Theme.of(context).colorScheme.surface,
|
||||
),
|
||||
child: CakeImageWidget(
|
||||
imageUrl: nftAsset.imageOriginalUrl,
|
||||
|
@ -65,11 +60,8 @@ class SolanaNFTTileWidget extends StatelessWidget {
|
|||
children: [
|
||||
Text(
|
||||
'Symbol: ${nftAsset.symbol ?? '---'}',
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontFamily: 'Lato',
|
||||
fontWeight: FontWeight.w400,
|
||||
color: balanceTheme.labelTextColor,
|
||||
style: Theme.of(context).textTheme.bodySmall?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
height: 1,
|
||||
),
|
||||
),
|
||||
|
@ -78,11 +70,9 @@ class SolanaNFTTileWidget extends StatelessWidget {
|
|||
(nftAsset.name?.isNotEmpty ?? false)
|
||||
? nftAsset.name!
|
||||
: (nftAsset.symbol ?? '---'),
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
fontFamily: 'Lato',
|
||||
style: Theme.of(context).textTheme.titleLarge?.copyWith(
|
||||
fontWeight: FontWeight.w900,
|
||||
color: balanceTheme.assetTitleColor,
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
height: 1,
|
||||
),
|
||||
),
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import 'package:cake_wallet/themes/extensions/sync_indicator_theme.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart';
|
||||
import 'package:cake_wallet/core/sync_status_title.dart';
|
||||
|
@ -18,71 +17,65 @@ class SyncIndicator extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Observer(
|
||||
builder: (_) {
|
||||
final syncIndicatorWidth = 237.0;
|
||||
final status = dashboardViewModel.status;
|
||||
final statusText = syncStatusTitle(status);
|
||||
final progress = status.progress();
|
||||
final indicatorOffset = progress * syncIndicatorWidth;
|
||||
final indicatorWidth = progress < 1
|
||||
? indicatorOffset > 0 ? indicatorOffset : 0.0
|
||||
: syncIndicatorWidth;
|
||||
return Observer(builder: (_) {
|
||||
final syncIndicatorWidth = 237.0;
|
||||
final status = dashboardViewModel.status;
|
||||
final statusText = syncStatusTitle(status);
|
||||
final progress = status.progress();
|
||||
final indicatorOffset = progress * syncIndicatorWidth;
|
||||
final indicatorWidth = progress < 1
|
||||
? indicatorOffset > 0
|
||||
? indicatorOffset
|
||||
: 0.0
|
||||
: syncIndicatorWidth;
|
||||
|
||||
|
||||
return ClipRRect(
|
||||
return ClipRRect(
|
||||
borderRadius: BorderRadius.all(Radius.circular(15)),
|
||||
child: GestureDetector(
|
||||
child: GestureDetector(
|
||||
onTap: onTap,
|
||||
child: Container(
|
||||
height: 30,
|
||||
width: syncIndicatorWidth,
|
||||
color: Theme.of(context).extension<SyncIndicatorTheme>()!.notSyncedBackgroundColor,
|
||||
child: Stack(
|
||||
alignment: Alignment.center,
|
||||
children: <Widget>[
|
||||
progress <= 1
|
||||
? Positioned(
|
||||
left: 0,
|
||||
top: 0,
|
||||
bottom: 0,
|
||||
child: Container(
|
||||
width: indicatorWidth,
|
||||
height: 30,
|
||||
color: Theme.of(context).extension<SyncIndicatorTheme>()!.syncedBackgroundColor,
|
||||
)
|
||||
)
|
||||
: Offstage(),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(
|
||||
left: 24,
|
||||
right: 24
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
SyncIndicatorIcon(isSynced:status is SyncedSyncStatus),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(left: 6),
|
||||
child: Text(
|
||||
statusText,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Theme.of(context).extension<SyncIndicatorTheme>()!.textColor
|
||||
child: Container(
|
||||
height: 30,
|
||||
width: syncIndicatorWidth,
|
||||
color: Theme.of(context).colorScheme.surfaceContainerLow,
|
||||
child: Stack(
|
||||
alignment: Alignment.center,
|
||||
children: <Widget>[
|
||||
progress <= 1
|
||||
? Positioned(
|
||||
left: 0,
|
||||
top: 0,
|
||||
bottom: 0,
|
||||
child: Container(
|
||||
width: indicatorWidth,
|
||||
height: 30,
|
||||
color: Theme.of(context).colorScheme.surfaceContainer,
|
||||
))
|
||||
: Offstage(),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(left: 24, right: 24),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
SyncIndicatorIcon(isSynced: status is SyncedSyncStatus),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(left: 6),
|
||||
child: Text(
|
||||
statusText,
|
||||
style: Theme.of(context).textTheme.bodySmall?.copyWith(
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
));
|
||||
}
|
||||
);
|
||||
));
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,14 +1,9 @@
|
|||
import 'package:cake_wallet/themes/extensions/sync_indicator_theme.dart';
|
||||
import 'package:cake_wallet/themes/extensions/receive_page_theme.dart';
|
||||
import 'package:cake_wallet/themes/utils/custom_theme_colors.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:cake_wallet/palette.dart';
|
||||
|
||||
class SyncIndicatorIcon extends StatelessWidget {
|
||||
SyncIndicatorIcon(
|
||||
{this.boolMode = true,
|
||||
this.isSynced = false,
|
||||
this.value = waiting,
|
||||
this.size = 6.0});
|
||||
{this.boolMode = true, this.isSynced = false, this.value = waiting, this.size = 6.0});
|
||||
|
||||
final bool boolMode;
|
||||
final bool isSynced;
|
||||
|
@ -29,36 +24,32 @@ class SyncIndicatorIcon extends StatelessWidget {
|
|||
|
||||
if (boolMode) {
|
||||
indicatorColor = isSynced
|
||||
? PaletteDark.brightGreen
|
||||
: Theme.of(context).extension<SyncIndicatorTheme>()!.notSyncedIconColor;
|
||||
? CustomThemeColors.syncGreen
|
||||
: CustomThemeColors.syncYellow;
|
||||
} else {
|
||||
switch (value.toLowerCase()) {
|
||||
case waiting:
|
||||
indicatorColor = Colors.red;
|
||||
break;
|
||||
case actionRequired:
|
||||
indicatorColor =
|
||||
Theme.of(context).extension<ReceivePageTheme>()!.currentTileBackgroundColor;
|
||||
indicatorColor = Theme.of(context).colorScheme.surfaceContainer;
|
||||
break;
|
||||
case created:
|
||||
indicatorColor = PaletteDark.brightGreen;
|
||||
break;
|
||||
case fetching:
|
||||
indicatorColor = Colors.red;
|
||||
break;
|
||||
case finished:
|
||||
case success:
|
||||
case complete:
|
||||
indicatorColor = PaletteDark.brightGreen;
|
||||
indicatorColor = CustomThemeColors.syncGreen;
|
||||
break;
|
||||
case waiting:
|
||||
case fetching:
|
||||
default:
|
||||
indicatorColor = Colors.red;
|
||||
indicatorColor = Theme.of(context).colorScheme.errorContainer;
|
||||
}
|
||||
}
|
||||
return Container(
|
||||
height: size,
|
||||
width: size,
|
||||
decoration:
|
||||
BoxDecoration(shape: BoxShape.circle, color: indicatorColor));
|
||||
height: size,
|
||||
width: size,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: indicatorColor,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
|
||||
import 'package:cake_wallet/utils/image_utill.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:cw_core/crypto_currency.dart';
|
||||
import 'package:cake_wallet/exchange/exchange_provider_description.dart';
|
||||
import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart';
|
||||
|
||||
class TradeRow extends StatelessWidget {
|
||||
TradeRow({
|
||||
|
@ -31,59 +29,79 @@ class TradeRow extends StatelessWidget {
|
|||
final receiveAmountCrypto = to.toString();
|
||||
|
||||
return InkWell(
|
||||
onTap: onTap,
|
||||
child: Container(
|
||||
padding: EdgeInsets.fromLTRB(24, 8, 24, 8),
|
||||
color: Colors.transparent,
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
ClipRRect(
|
||||
borderRadius: BorderRadius.circular(50),
|
||||
child: ImageUtil.getImageFromPath(
|
||||
imagePath: provider.image, height: 36, width: 36)),
|
||||
SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Column(
|
||||
onTap: onTap,
|
||||
child: Container(
|
||||
padding: EdgeInsets.fromLTRB(24, 8, 24, 8),
|
||||
color: Colors.transparent,
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
ClipRRect(
|
||||
borderRadius: BorderRadius.circular(50),
|
||||
child: ImageUtil.getImageFromPath(
|
||||
imagePath: provider.image,
|
||||
height: 36,
|
||||
width: 36,
|
||||
),
|
||||
),
|
||||
SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: <Widget>[
|
||||
Text('${from.toString()} → ${to.toString()}',
|
||||
style: TextStyle(
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
'${from.toString()} → ${to.toString()}',
|
||||
style: Theme.of(context).textTheme.bodyLarge?.copyWith(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Theme.of(context).extension<DashboardPageTheme>()!.textColor)),
|
||||
formattedAmount != null
|
||||
? Text(formattedAmount! + ' ' + amountCrypto,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
color:
|
||||
Theme.of(context).extension<DashboardPageTheme>()!.textColor))
|
||||
: Container()
|
||||
]),
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Theme.of(context).colorScheme.primary),
|
||||
),
|
||||
formattedAmount != null
|
||||
? Text(
|
||||
formattedAmount! + ' ' + amountCrypto,
|
||||
style: Theme.of(context).textTheme.bodyLarge?.copyWith(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
),
|
||||
)
|
||||
: Container()
|
||||
],
|
||||
),
|
||||
SizedBox(height: 5),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
createdAtFormattedDate != null
|
||||
? Text(createdAtFormattedDate!,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Theme.of(context).extension<CakeTextTheme>()!.dateSectionRowColor))
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
createdAtFormattedDate != null
|
||||
? Text(
|
||||
createdAtFormattedDate!,
|
||||
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
)
|
||||
: Container(),
|
||||
formattedReceiveAmount != null
|
||||
? Text(formattedReceiveAmount! + ' ' + receiveAmountCrypto,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Theme.of(context).extension<CakeTextTheme>()!.dateSectionRowColor))
|
||||
formattedReceiveAmount != null
|
||||
? Text(
|
||||
formattedReceiveAmount! + ' ' + receiveAmountCrypto,
|
||||
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
)
|
||||
: Container(),
|
||||
])
|
||||
],
|
||||
)
|
||||
],
|
||||
))
|
||||
],
|
||||
),
|
||||
));
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:cw_core/transaction_direction.dart';
|
||||
import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart';
|
||||
import 'package:cake_wallet/themes/extensions/transaction_trade_theme.dart';
|
||||
|
||||
class TransactionRow extends StatelessWidget {
|
||||
TransactionRow({
|
||||
|
@ -39,8 +36,9 @@ class TransactionRow extends StatelessWidget {
|
|||
height: 36,
|
||||
width: 36,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Theme.of(context).extension<TransactionTradeTheme>()!.rowsColor),
|
||||
shape: BoxShape.circle,
|
||||
color: Theme.of(context).colorScheme.surfaceContainerHighest,
|
||||
),
|
||||
child: Image.asset(direction == TransactionDirection.incoming
|
||||
? 'assets/images/down_arrow.png'
|
||||
: 'assets/images/up_arrow.png'),
|
||||
|
@ -57,20 +55,19 @@ class TransactionRow extends StatelessWidget {
|
|||
children: [
|
||||
Text(
|
||||
title,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Theme.of(context).extension<DashboardPageTheme>()!.textColor,
|
||||
)),
|
||||
...tags.map((tag) => Row(children: [SizedBox(width: 8), TxTag(tag: tag)])),
|
||||
],
|
||||
),
|
||||
Text(formattedAmount,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Theme.of(context).extension<DashboardPageTheme>()!.textColor,
|
||||
),
|
||||
style: Theme.of(context).textTheme.bodyLarge?.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
...tags
|
||||
.map((tag) => Row(children: [SizedBox(width: 8), TxTag(tag: tag)])),
|
||||
],
|
||||
),
|
||||
Text(
|
||||
formattedAmount,
|
||||
style: Theme.of(context).textTheme.bodyLarge?.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
|
@ -78,18 +75,19 @@ class TransactionRow extends StatelessWidget {
|
|||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
Text(formattedDate,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Theme.of(context)
|
||||
.extension<CakeTextTheme>()!
|
||||
.dateSectionRowColor)),
|
||||
Text(
|
||||
formattedDate,
|
||||
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
formattedFiatAmount,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Theme.of(context).extension<CakeTextTheme>()!.dateSectionRowColor,
|
||||
),
|
||||
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
|
@ -117,16 +115,16 @@ class TxTag extends StatelessWidget {
|
|||
padding: EdgeInsets.only(left: 6, right: 6),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.all(Radius.circular(8.5)),
|
||||
color: Theme.of(context).extension<TransactionTradeTheme>()!.rowsColor,
|
||||
color: Theme.of(context).colorScheme.surfaceContainerHighest,
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
tag.toLowerCase(),
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).extension<DashboardPageTheme>()!.textColor,
|
||||
fontSize: 9,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
style: Theme.of(context).textTheme.bodySmall?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
fontSize: 9,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ class VerifyFormState extends State<VerifyForm> with AutomaticKeepAliveClientMix
|
|||
void dispose() {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
bool get wantKeepAlive => true;
|
||||
|
||||
|
@ -53,13 +53,15 @@ class VerifyFormState extends State<VerifyForm> with AutomaticKeepAliveClientMix
|
|||
controller: messageController,
|
||||
placeholder: S.current.message,
|
||||
options: [AddressTextFieldOption.paste],
|
||||
buttonColor: Theme.of(context).hintColor,
|
||||
buttonColor: Theme.of(context).colorScheme.surfaceContainerHighest,
|
||||
fillColor: Theme.of(context).colorScheme.surface,
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
AddressTextField(
|
||||
controller: addressController,
|
||||
options: [AddressTextFieldOption.paste, AddressTextFieldOption.walletAddresses],
|
||||
buttonColor: Theme.of(context).hintColor,
|
||||
buttonColor: Theme.of(context).colorScheme.surfaceContainerHighest,
|
||||
fillColor: Theme.of(context).colorScheme.surface,
|
||||
onSelectedContact: (contact) {
|
||||
addressController.text = contact.address;
|
||||
},
|
||||
|
@ -70,7 +72,8 @@ class VerifyFormState extends State<VerifyForm> with AutomaticKeepAliveClientMix
|
|||
controller: signatureController,
|
||||
placeholder: S.current.signature,
|
||||
options: [AddressTextFieldOption.paste],
|
||||
buttonColor: Theme.of(context).hintColor,
|
||||
buttonColor: Theme.of(context).colorScheme.surfaceContainerHighest,
|
||||
fillColor: Theme.of(context).colorScheme.surface,
|
||||
),
|
||||
],
|
||||
),
|
||||
|
|
|
@ -84,7 +84,7 @@ class DevBackgroundSyncLogsPage extends BasePage {
|
|||
}
|
||||
|
||||
final dateFormat = DateFormat('yyyy-MM-dd HH:mm:ss.SSS');
|
||||
|
||||
|
||||
return ListView.builder(
|
||||
itemCount: logs.length,
|
||||
itemBuilder: (context, index) {
|
||||
|
@ -92,18 +92,16 @@ class DevBackgroundSyncLogsPage extends BasePage {
|
|||
return ListTile(
|
||||
title: Text(
|
||||
log.message,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontFamily: 'Monospace',
|
||||
),
|
||||
style: Theme.of(context).textTheme.bodyMedium!.copyWith(
|
||||
fontFamily: 'Monospace',
|
||||
),
|
||||
),
|
||||
subtitle: Text(
|
||||
'${dateFormat.format(log.timestamp)} | ${log.level}' +
|
||||
(log.sessionId != null ? ' | Session: ${log.sessionId}' : ''),
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: _getLevelColor(log.level),
|
||||
),
|
||||
style: Theme.of(context).textTheme.bodySmall!.copyWith(
|
||||
color: _getLevelColor(log.level),
|
||||
),
|
||||
),
|
||||
dense: true,
|
||||
onTap: () {
|
||||
|
@ -132,24 +130,24 @@ class DevBackgroundSyncLogsPage extends BasePage {
|
|||
}
|
||||
|
||||
final dateFormat = DateFormat('yyyy-MM-dd HH:mm:ss');
|
||||
|
||||
|
||||
return ListView.builder(
|
||||
itemCount: sessions.length,
|
||||
itemBuilder: (context, index) {
|
||||
final session = sessions[index];
|
||||
final isActive = session.endTime == null;
|
||||
|
||||
|
||||
return ExpansionTile(
|
||||
title: Text(
|
||||
session.name,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: isActive ? Colors.green : null,
|
||||
),
|
||||
style: Theme.of(context).textTheme.bodyMedium!.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: isActive ? Colors.green : null,
|
||||
),
|
||||
),
|
||||
subtitle: Text(
|
||||
'ID: ${session.id} | Started: ${dateFormat.format(session.startTime)}',
|
||||
style: TextStyle(fontSize: 12),
|
||||
style: Theme.of(context).textTheme.bodySmall!,
|
||||
),
|
||||
children: [
|
||||
Padding(
|
||||
|
@ -158,8 +156,7 @@ class DevBackgroundSyncLogsPage extends BasePage {
|
|||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text('Start: ${session.startTime.toString()}'),
|
||||
if (session.endTime != null)
|
||||
Text('End: ${session.endTime.toString()}'),
|
||||
if (session.endTime != null) Text('End: ${session.endTime.toString()}'),
|
||||
if (session.duration != null)
|
||||
Text('Duration: ${_formatDuration(session.duration!)}'),
|
||||
SizedBox(height: 8),
|
||||
|
@ -174,19 +171,21 @@ class DevBackgroundSyncLogsPage extends BasePage {
|
|||
}
|
||||
|
||||
Widget _buildSessionLogs(BuildContext context, int sessionId) {
|
||||
final sessionLogs = viewModel.logs
|
||||
.where((log) => log.sessionId == sessionId)
|
||||
.toList();
|
||||
|
||||
final sessionLogs = viewModel.logs.where((log) => log.sessionId == sessionId).toList();
|
||||
|
||||
if (sessionLogs.isEmpty) {
|
||||
return Text('No logs for this session');
|
||||
}
|
||||
|
||||
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text('Session Logs (${sessionLogs.length}):',
|
||||
style: TextStyle(fontWeight: FontWeight.bold)),
|
||||
Text(
|
||||
'Session Logs (${sessionLogs.length}):',
|
||||
style: Theme.of(context).textTheme.bodyMedium!.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
Container(
|
||||
height: 200,
|
||||
|
@ -202,11 +201,10 @@ class DevBackgroundSyncLogsPage extends BasePage {
|
|||
padding: const EdgeInsets.symmetric(horizontal: 8.0, vertical: 4.0),
|
||||
child: Text(
|
||||
'[${log.level}] ${log.message}',
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontFamily: 'Monospace',
|
||||
color: _getLevelColor(log.level),
|
||||
),
|
||||
style: Theme.of(context).textTheme.bodySmall!.copyWith(
|
||||
fontFamily: 'Monospace',
|
||||
color: _getLevelColor(log.level),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
|
@ -248,14 +246,14 @@ class DevBackgroundSyncLogsPage extends BasePage {
|
|||
|
||||
void _copyAllLogs(BuildContext context) {
|
||||
if (viewModel.logData == null) return;
|
||||
|
||||
|
||||
final buffer = StringBuffer();
|
||||
final dateFormat = DateFormat('yyyy-MM-dd HH:mm:ss.SSS');
|
||||
|
||||
|
||||
for (final log in viewModel.logs) {
|
||||
buffer.writeln('${dateFormat.format(log.timestamp)} [${log.level}] ${log.message}');
|
||||
}
|
||||
|
||||
|
||||
Clipboard.setData(ClipboardData(text: buffer.toString()));
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text('All logs copied to clipboard')),
|
||||
|
@ -311,4 +309,4 @@ class DevBackgroundSyncLogsPage extends BasePage {
|
|||
String twoDigitSeconds = twoDigits(duration.inSeconds.remainder(60));
|
||||
return '${twoDigits(duration.inHours)}:$twoDigitMinutes:$twoDigitSeconds';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ class DevMoneroBackgroundSyncPage extends BasePage {
|
|||
@override
|
||||
String? get title => "[dev] xmr background sync";
|
||||
|
||||
Widget _buildSingleCell(String title, String value) {
|
||||
Widget _buildSingleCell(String title, String value, BuildContext context) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: Colors.grey),
|
||||
|
@ -22,7 +22,12 @@ class DevMoneroBackgroundSyncPage extends BasePage {
|
|||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(title, style: TextStyle(fontWeight: FontWeight.bold)),
|
||||
Text(
|
||||
title,
|
||||
style: Theme.of(context).textTheme.bodyMedium!.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
Text(value, maxLines: 1, overflow: TextOverflow.ellipsis),
|
||||
],
|
||||
),
|
||||
|
@ -36,59 +41,60 @@ class DevMoneroBackgroundSyncPage extends BasePage {
|
|||
return GridView.count(
|
||||
padding: const EdgeInsets.all(16),
|
||||
crossAxisCount: 2,
|
||||
childAspectRatio: 25/9,
|
||||
childAspectRatio: 25 / 9,
|
||||
crossAxisSpacing: 16,
|
||||
mainAxisSpacing: 16,
|
||||
children: [
|
||||
_buildSingleCell('Height (local)', viewModel.localBlockHeight ?? ''),
|
||||
_buildSingleCell('Height (node)', viewModel.nodeBlockHeight ?? ''),
|
||||
_buildSingleCell('Time', viewModel.tick.toString()),
|
||||
_buildSingleCell('Background Sync', viewModel.isBackgroundSyncing ? 'Enabled' : 'Disabled'),
|
||||
_buildSingleCell('Public View Key', viewModel.publicViewKey ?? ''),
|
||||
_buildSingleCell('Private View Key', viewModel.privateViewKey ?? ''),
|
||||
_buildSingleCell('Public Spend Key', viewModel.publicSpendKey ?? ''),
|
||||
_buildSingleCell('Private Spend Key', viewModel.privateSpendKey ?? ''),
|
||||
_buildSingleCell('Primary Address', viewModel.primaryAddress ?? ''),
|
||||
_buildSingleCell('Passphrase', viewModel.passphrase ?? ''),
|
||||
_buildSingleCell('Seed', viewModel.seed ?? ''),
|
||||
_buildSingleCell('Seed Legacy', viewModel.seedLegacy ?? ''),
|
||||
_enableBackgroundSyncButton(),
|
||||
_disableBackgroundSyncButton(),
|
||||
_refreshButton(),
|
||||
_manualRescanButton(),
|
||||
_buildSingleCell('Height (local)', viewModel.localBlockHeight ?? '', context),
|
||||
_buildSingleCell('Height (node)', viewModel.nodeBlockHeight ?? '', context),
|
||||
_buildSingleCell('Time', viewModel.tick.toString(), context),
|
||||
_buildSingleCell(
|
||||
'Background Sync', viewModel.isBackgroundSyncing ? 'Enabled' : 'Disabled', context),
|
||||
_buildSingleCell('Public View Key', viewModel.publicViewKey ?? '', context),
|
||||
_buildSingleCell('Private View Key', viewModel.privateViewKey ?? '', context),
|
||||
_buildSingleCell('Public Spend Key', viewModel.publicSpendKey ?? '', context),
|
||||
_buildSingleCell('Private Spend Key', viewModel.privateSpendKey ?? '', context),
|
||||
_buildSingleCell('Primary Address', viewModel.primaryAddress ?? '', context),
|
||||
_buildSingleCell('Passphrase', viewModel.passphrase ?? '', context),
|
||||
_buildSingleCell('Seed', viewModel.seed ?? '', context),
|
||||
_buildSingleCell('Seed Legacy', viewModel.seedLegacy ?? '', context),
|
||||
_enableBackgroundSyncButton(context),
|
||||
_disableBackgroundSyncButton(context),
|
||||
_refreshButton(context),
|
||||
_manualRescanButton(context),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
PrimaryButton _enableBackgroundSyncButton() {
|
||||
PrimaryButton _enableBackgroundSyncButton(BuildContext context) {
|
||||
return PrimaryButton(
|
||||
text: "Enable background sync",
|
||||
color: Colors.purple,
|
||||
textColor: Colors.white,
|
||||
textColor: Theme.of(context).colorScheme.onPrimary,
|
||||
onPressed: () {
|
||||
viewModel.startBackgroundSync();
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
PrimaryButton _disableBackgroundSyncButton() {
|
||||
PrimaryButton _disableBackgroundSyncButton(BuildContext context) {
|
||||
return PrimaryButton(
|
||||
text: "Disable background sync",
|
||||
color: Colors.purple,
|
||||
textColor: Colors.white,
|
||||
textColor: Theme.of(context).colorScheme.onPrimary,
|
||||
onPressed: () {
|
||||
viewModel.stopBackgroundSync();
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
PrimaryButton _refreshButton() {
|
||||
PrimaryButton _refreshButton(BuildContext context) {
|
||||
return PrimaryButton(
|
||||
text: viewModel.refreshTimer == null ? "Enable refresh" : "Disable refresh",
|
||||
color: Colors.purple,
|
||||
textColor: Colors.white,
|
||||
textColor: Theme.of(context).colorScheme.onPrimary,
|
||||
onPressed: () {
|
||||
if (viewModel.refreshTimer == null) {
|
||||
viewModel.startRefreshTimer();
|
||||
|
@ -99,11 +105,11 @@ class DevMoneroBackgroundSyncPage extends BasePage {
|
|||
);
|
||||
}
|
||||
|
||||
PrimaryButton _manualRescanButton() {
|
||||
PrimaryButton _manualRescanButton(BuildContext context) {
|
||||
return PrimaryButton(
|
||||
text: "Manual rescan",
|
||||
color: Colors.purple,
|
||||
textColor: Colors.white,
|
||||
textColor: Theme.of(context).colorScheme.onPrimary,
|
||||
onPressed: () {
|
||||
viewModel.manualRescan();
|
||||
},
|
||||
|
|
|
@ -123,7 +123,7 @@ max: slowest execution (% of frame)
|
|||
SelectableText cw(String text, Color? color) {
|
||||
return SelectableText(
|
||||
text,
|
||||
style: TextStyle(color: color),
|
||||
style: Theme.of(context).textTheme.bodyMedium!.copyWith(color: color),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -160,7 +160,7 @@ max: slowest execution (% of frame)
|
|||
child: ListTile(
|
||||
title: Text(
|
||||
key,
|
||||
style: TextStyle(color: perfc(np)),
|
||||
style: Theme.of(context).textTheme.bodyMedium!.copyWith(color: perfc(np)),
|
||||
),
|
||||
subtitle: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
|
|
|
@ -38,10 +38,10 @@ class DevSecurePreferencesPage extends BasePage {
|
|||
Clipboard.setData(ClipboardData(text: key + ": " + values[key].toString()));
|
||||
},
|
||||
title: switch (type) {
|
||||
PreferenceType.bool => Text(key, style: TextStyle(color: Colors.blue)),
|
||||
PreferenceType.int => Text(key, style: TextStyle(color: Colors.green)),
|
||||
PreferenceType.double => Text(key, style: TextStyle(color: Colors.yellow)),
|
||||
PreferenceType.listString => Text(key, style: TextStyle(color: Colors.purple)),
|
||||
PreferenceType.bool => Text(key, style: Theme.of(context).textTheme.bodyMedium!.copyWith(color: Colors.blue)),
|
||||
PreferenceType.int => Text(key, style: Theme.of(context).textTheme.bodyMedium!.copyWith(color: Colors.green)),
|
||||
PreferenceType.double => Text(key, style: Theme.of(context).textTheme.bodyMedium!.copyWith(color: Colors.yellow)),
|
||||
PreferenceType.listString => Text(key, style: Theme.of(context).textTheme.bodyMedium!.copyWith(color: Colors.purple)),
|
||||
PreferenceType.string => Text(key),
|
||||
PreferenceType.unknown => Text(key),
|
||||
},
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import 'package:cake_wallet/src/screens/base_page.dart';
|
||||
import 'package:cake_wallet/src/widgets/base_text_form_field.dart';
|
||||
import 'package:cake_wallet/view_model/dev/shared_preferences.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
@ -49,10 +50,10 @@ class DevSharedPreferencesPage extends BasePage {
|
|||
_showEditDialog(context, key, type, values[key]);
|
||||
},
|
||||
title: switch (type) {
|
||||
PreferenceType.bool => Text(key, style: TextStyle(color: Colors.blue)),
|
||||
PreferenceType.int => Text(key, style: TextStyle(color: Colors.green)),
|
||||
PreferenceType.double => Text(key, style: TextStyle(color: Colors.yellow)),
|
||||
PreferenceType.listString => Text(key, style: TextStyle(color: Colors.purple)),
|
||||
PreferenceType.bool => Text(key, style: Theme.of(context).textTheme.bodyMedium!.copyWith(color: Colors.blue)),
|
||||
PreferenceType.int => Text(key, style: Theme.of(context).textTheme.bodyMedium!.copyWith(color: Colors.green)),
|
||||
PreferenceType.double => Text(key, style: Theme.of(context).textTheme.bodyMedium!.copyWith(color: Colors.yellow)),
|
||||
PreferenceType.listString => Text(key, style: Theme.of(context).textTheme.bodyMedium!.copyWith(color: Colors.purple)),
|
||||
PreferenceType.string => Text(key),
|
||||
PreferenceType.unknown => Text(key),
|
||||
},
|
||||
|
@ -193,9 +194,9 @@ class DevSharedPreferencesPage extends BasePage {
|
|||
return Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
TextField(
|
||||
BaseTextFormField(
|
||||
controller: controller,
|
||||
decoration: InputDecoration(labelText: 'String value'),
|
||||
hintText: 'String value',
|
||||
maxLines: null,
|
||||
),
|
||||
],
|
||||
|
@ -206,9 +207,9 @@ class DevSharedPreferencesPage extends BasePage {
|
|||
return Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
TextField(
|
||||
BaseTextFormField(
|
||||
controller: controller,
|
||||
decoration: InputDecoration(labelText: label),
|
||||
hintText: label,
|
||||
keyboardType: isInteger
|
||||
? TextInputType.number
|
||||
: TextInputType.numberWithOptions(decimal: true),
|
||||
|
@ -261,9 +262,9 @@ class DevSharedPreferencesPage extends BasePage {
|
|||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: TextField(
|
||||
child: BaseTextFormField(
|
||||
controller: controller,
|
||||
decoration: InputDecoration(labelText: 'New item'),
|
||||
hintText: 'New item',
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
|
@ -344,9 +345,9 @@ class DevSharedPreferencesPage extends BasePage {
|
|||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
TextField(
|
||||
BaseTextFormField(
|
||||
controller: keyController,
|
||||
decoration: InputDecoration(labelText: 'Preference Key'),
|
||||
hintText: 'Preference Key',
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
DropdownButtonFormField<PreferenceType>(
|
||||
|
|
|
@ -1,17 +1,9 @@
|
|||
import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
|
||||
import 'dart:ui';
|
||||
import 'package:cake_wallet/palette.dart';
|
||||
import 'package:cake_wallet/routes.dart';
|
||||
import 'package:cake_wallet/themes/extensions/wallet_list_theme.dart';
|
||||
import 'package:cake_wallet/utils/show_pop_up.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
import 'package:cake_wallet/src/screens/base_page.dart';
|
||||
import 'package:cake_wallet/src/widgets/primary_button.dart';
|
||||
import 'package:cake_wallet/src/widgets/alert_with_one_action.dart';
|
||||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
import 'package:cake_wallet/wallet_type_utils.dart';
|
||||
|
||||
class DisclaimerPage extends BasePage {
|
||||
|
@ -23,12 +15,10 @@ class DisclaimerPage extends BasePage {
|
|||
String get title => 'Terms of Use';
|
||||
|
||||
@override
|
||||
Widget? leading(BuildContext context) =>
|
||||
isReadOnly ? super.leading(context) : null;
|
||||
Widget? leading(BuildContext context) => isReadOnly ? super.leading(context) : null;
|
||||
|
||||
@override
|
||||
Widget body(BuildContext context) =>
|
||||
DisclaimerPageBody(isReadOnly: isReadOnly);
|
||||
Widget body(BuildContext context) => DisclaimerPageBody(isReadOnly: isReadOnly);
|
||||
}
|
||||
|
||||
class DisclaimerPageBody extends StatefulWidget {
|
||||
|
@ -41,15 +31,12 @@ class DisclaimerPageBody extends StatefulWidget {
|
|||
}
|
||||
|
||||
class DisclaimerBodyState extends State<DisclaimerPageBody> {
|
||||
|
||||
bool _checked = false;
|
||||
String _fileText = '';
|
||||
|
||||
Future getFileLines() async {
|
||||
Future<void> getFileLines() async {
|
||||
_fileText = await rootBundle.loadString(
|
||||
isMoneroOnly
|
||||
? 'assets/text/Monerocom_Terms_of_Use.txt'
|
||||
: 'assets/text/Terms_of_Use.txt' );
|
||||
isMoneroOnly ? 'assets/text/Monerocom_Terms_of_Use.txt' : 'assets/text/Terms_of_Use.txt');
|
||||
setState(() {});
|
||||
}
|
||||
|
||||
|
@ -64,7 +51,7 @@ class DisclaimerBodyState extends State<DisclaimerPageBody> {
|
|||
return WillPopScope(
|
||||
onWillPop: () async => widget.isReadOnly,
|
||||
child: Container(
|
||||
color: Theme.of(context).colorScheme.background,
|
||||
color: Theme.of(context).colorScheme.surface,
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
SizedBox(height: 10.0),
|
||||
|
@ -81,10 +68,10 @@ class DisclaimerBodyState extends State<DisclaimerPageBody> {
|
|||
child: Text(
|
||||
'Terms and conditions',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
style: Theme.of(context).textTheme.titleLarge?.copyWith(
|
||||
fontSize: 20.0,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Theme.of(context).extension<CakeTextTheme>()!.titleColor),
|
||||
color: Theme.of(context).colorScheme.onSurface),
|
||||
),
|
||||
)
|
||||
],
|
||||
|
@ -98,10 +85,9 @@ class DisclaimerBodyState extends State<DisclaimerPageBody> {
|
|||
child: Text(
|
||||
'Legal Disclaimer\nAnd\nTerms of Use',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 12.0,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Theme.of(context).extension<CakeTextTheme>()!.titleColor),
|
||||
style: Theme.of(context).textTheme.bodySmall?.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
|
@ -114,10 +100,7 @@ class DisclaimerBodyState extends State<DisclaimerPageBody> {
|
|||
Expanded(
|
||||
child: Text(
|
||||
_fileText,
|
||||
style: TextStyle(
|
||||
fontSize: 12.0,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Theme.of(context).extension<CakeTextTheme>()!.titleColor),
|
||||
style: Theme.of(context).textTheme.bodySmall,
|
||||
))
|
||||
],
|
||||
),
|
||||
|
@ -138,11 +121,8 @@ class DisclaimerBodyState extends State<DisclaimerPageBody> {
|
|||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [
|
||||
Theme.of(context)
|
||||
.colorScheme
|
||||
.background
|
||||
.withOpacity(0.0),
|
||||
Theme.of(context).colorScheme.background,
|
||||
Theme.of(context).colorScheme.surface.withOpacity(0.0),
|
||||
Theme.of(context).colorScheme.surface,
|
||||
],
|
||||
begin: FractionalOffset.topCenter,
|
||||
end: FractionalOffset.bottomCenter,
|
||||
|
@ -160,8 +140,8 @@ class DisclaimerBodyState extends State<DisclaimerPageBody> {
|
|||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(
|
||||
left: 24.0, top: 10.0, right: 24.0, bottom: 10.0),
|
||||
padding:
|
||||
EdgeInsets.only(left: 24.0, top: 10.0, right: 24.0, bottom: 10.0),
|
||||
child: InkWell(
|
||||
key: ValueKey('disclaimer_check_key'),
|
||||
onTap: () {
|
||||
|
@ -180,26 +160,23 @@ class DisclaimerBodyState extends State<DisclaimerPageBody> {
|
|||
),
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
color: Theme.of(context).extension<CakeTextTheme>()!.secondaryTextColor,
|
||||
width: 1.0),
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(8.0)),
|
||||
color: Theme.of(context).colorScheme.background),
|
||||
color: Theme.of(context).colorScheme.outline, width: 1.0),
|
||||
borderRadius: BorderRadius.all(Radius.circular(8.0)),
|
||||
color: Theme.of(context).colorScheme.surface),
|
||||
child: _checked
|
||||
? Icon(
|
||||
key: ValueKey('disclaimer_check_icon_key'),
|
||||
Icons.check,
|
||||
color: Colors.blue,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
size: 20.0,
|
||||
)
|
||||
: null,
|
||||
),
|
||||
Text(
|
||||
'I agree to Terms of Use',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 14.0,
|
||||
color: Theme.of(context).extension<CakeTextTheme>()!.titleColor),
|
||||
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
|
@ -208,17 +185,15 @@ class DisclaimerBodyState extends State<DisclaimerPageBody> {
|
|||
],
|
||||
),
|
||||
Container(
|
||||
padding:
|
||||
EdgeInsets.only(left: 24.0, right: 24.0, bottom: 24.0),
|
||||
padding: EdgeInsets.only(left: 24.0, right: 24.0, bottom: 24.0),
|
||||
child: PrimaryButton(
|
||||
key: ValueKey('disclaimer_accept_button_key'),
|
||||
onPressed: _checked
|
||||
? () => Navigator.of(context)
|
||||
.popAndPushNamed(Routes.welcome)
|
||||
? () => Navigator.of(context).popAndPushNamed(Routes.welcome)
|
||||
: null,
|
||||
text: 'Accept',
|
||||
color: Theme.of(context).extension<WalletListTheme>()!.createNewWalletButtonBackgroundColor,
|
||||
textColor: Theme.of(context).extension<WalletListTheme>()!.restoreWalletButtonTextColor),
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
textColor: Theme.of(context).colorScheme.onPrimary),
|
||||
),
|
||||
],
|
||||
],
|
||||
|
|
|
@ -1,15 +1,12 @@
|
|||
import 'package:cake_wallet/exchange/exchange_provider_description.dart';
|
||||
import 'package:cake_wallet/exchange/provider/chainflip_exchange_provider.dart';
|
||||
import 'package:cake_wallet/exchange/provider/thorchain_exchange.provider.dart';
|
||||
import 'package:cake_wallet/themes/extensions/exchange_page_theme.dart';
|
||||
import 'package:cake_wallet/themes/extensions/keyboard_theme.dart';
|
||||
import 'package:cake_wallet/core/auth_service.dart';
|
||||
import 'package:cake_wallet/di.dart';
|
||||
import 'package:cake_wallet/src/screens/exchange/widgets/desktop_exchange_cards_section.dart';
|
||||
import 'package:cake_wallet/src/screens/exchange/widgets/mobile_exchange_cards_section.dart';
|
||||
import 'package:cake_wallet/src/widgets/add_template_button.dart';
|
||||
import 'package:cake_wallet/themes/extensions/send_page_theme.dart';
|
||||
import 'package:cake_wallet/themes/theme_base.dart';
|
||||
import 'package:cake_wallet/themes/core/material_base_theme.dart';
|
||||
import 'package:cake_wallet/utils/debounce.dart';
|
||||
import 'package:cake_wallet/utils/payment_request.dart';
|
||||
import 'package:cake_wallet/utils/responsive_layout_util.dart';
|
||||
|
@ -107,32 +104,34 @@ class ExchangePage extends BasePage {
|
|||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(right: 6.0),
|
||||
child: Observer(
|
||||
builder: (_) =>
|
||||
SyncIndicatorIcon(isSynced: exchangeViewModel.status is SyncedSyncStatus),
|
||||
)),
|
||||
padding: const EdgeInsets.only(right: 6.0),
|
||||
child: Observer(
|
||||
builder: (_) =>
|
||||
SyncIndicatorIcon(isSynced: exchangeViewModel.status is SyncedSyncStatus),
|
||||
),
|
||||
),
|
||||
PresentProviderPicker(exchangeViewModel: exchangeViewModel)
|
||||
],
|
||||
);
|
||||
|
||||
@override
|
||||
Widget trailing(BuildContext context) => TrailButton(
|
||||
caption: S.of(context).reset,
|
||||
onPressed: () {
|
||||
_formKey.currentState?.reset();
|
||||
exchangeViewModel.reset();
|
||||
});
|
||||
caption: S.of(context).reset,
|
||||
onPressed: () {
|
||||
_formKey.currentState?.reset();
|
||||
exchangeViewModel.reset();
|
||||
},
|
||||
);
|
||||
|
||||
@override
|
||||
Widget? leading(BuildContext context) {
|
||||
final _backButton = Icon(
|
||||
Icons.arrow_back_ios,
|
||||
color: titleColor(context),
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
size: 16,
|
||||
);
|
||||
final _closeButton =
|
||||
currentTheme.type == ThemeType.dark ? closeButtonImageDarkTheme : closeButtonImage;
|
||||
currentTheme.isDark ? closeButtonImageDarkTheme : closeButtonImage;
|
||||
|
||||
bool isMobileView = responsiveLayoutUtil.shouldRenderMobileUI;
|
||||
|
||||
|
@ -146,7 +145,7 @@ class ExchangePage extends BasePage {
|
|||
label: !isMobileView ? S.of(context).close : S.of(context).seed_alert_back,
|
||||
child: TextButton(
|
||||
style: ButtonStyle(
|
||||
overlayColor: MaterialStateColor.resolveWith((states) => Colors.transparent),
|
||||
overlayColor: WidgetStateColor.resolveWith((states) => Colors.transparent),
|
||||
),
|
||||
onPressed: () => onClose(context),
|
||||
child: !isMobileView ? _closeButton : _backButton,
|
||||
|
@ -162,55 +161,59 @@ class ExchangePage extends BasePage {
|
|||
WidgetsBinding.instance.addPostFrameCallback((_) => _setReactions(context, exchangeViewModel));
|
||||
|
||||
return KeyboardActions(
|
||||
disableScroll: true,
|
||||
config: KeyboardActionsConfig(
|
||||
keyboardActionsPlatform: KeyboardActionsPlatform.IOS,
|
||||
keyboardBarColor: Theme.of(context).extension<KeyboardTheme>()!.keyboardBarColor,
|
||||
nextFocus: false,
|
||||
actions: [
|
||||
KeyboardActionsItem(
|
||||
focusNode: _depositAmountFocus, toolbarButtons: [(_) => KeyboardDoneButton()]),
|
||||
KeyboardActionsItem(
|
||||
focusNode: _receiveAmountFocus, toolbarButtons: [(_) => KeyboardDoneButton()])
|
||||
]),
|
||||
child: Container(
|
||||
color: Theme.of(context).colorScheme.background,
|
||||
child: Form(
|
||||
key: _formKey,
|
||||
child: ScrollableWithBottomSection(
|
||||
contentPadding: EdgeInsets.only(bottom: 24),
|
||||
content: Observer(
|
||||
builder: (_) => Column(
|
||||
children: <Widget>[
|
||||
_exchangeCardsSection(context),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 12, left: 24),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
StandardCheckbox(
|
||||
value: exchangeViewModel.isFixedRateMode,
|
||||
caption: S.of(context).fixed_rate,
|
||||
onChanged: (value) {
|
||||
if (value) {
|
||||
exchangeViewModel.enableFixedRateMode();
|
||||
} else {
|
||||
exchangeViewModel.isFixedRateMode = false;
|
||||
}
|
||||
},
|
||||
),
|
||||
],
|
||||
)),
|
||||
SizedBox(height: 30),
|
||||
_buildTemplateSection(context)
|
||||
],
|
||||
),
|
||||
),
|
||||
bottomSectionPadding: EdgeInsets.only(left: 24, right: 24, bottom: 24),
|
||||
bottomSection: Column(children: <Widget>[
|
||||
disableScroll: true,
|
||||
config: KeyboardActionsConfig(
|
||||
keyboardActionsPlatform: KeyboardActionsPlatform.IOS,
|
||||
keyboardBarColor: Theme.of(context).colorScheme.surfaceContainerHighest,
|
||||
nextFocus: false,
|
||||
actions: [
|
||||
KeyboardActionsItem(
|
||||
focusNode: _depositAmountFocus, toolbarButtons: [(_) => KeyboardDoneButton()]),
|
||||
KeyboardActionsItem(
|
||||
focusNode: _receiveAmountFocus, toolbarButtons: [(_) => KeyboardDoneButton()])
|
||||
],
|
||||
),
|
||||
child: Container(
|
||||
color: Theme.of(context).colorScheme.surface,
|
||||
child: Form(
|
||||
key: _formKey,
|
||||
child: ScrollableWithBottomSection(
|
||||
contentPadding: EdgeInsets.only(bottom: 24),
|
||||
content: Observer(
|
||||
builder: (_) => Column(
|
||||
children: <Widget>[
|
||||
_exchangeCardsSection(context),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(bottom: 15),
|
||||
child: Observer(builder: (_) {
|
||||
padding: EdgeInsets.only(top: 12, left: 24),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
StandardCheckbox(
|
||||
value: exchangeViewModel.isFixedRateMode,
|
||||
caption: S.of(context).fixed_rate,
|
||||
onChanged: (value) {
|
||||
if (value) {
|
||||
exchangeViewModel.enableFixedRateMode();
|
||||
} else {
|
||||
exchangeViewModel.isFixedRateMode = false;
|
||||
}
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height: 30),
|
||||
_buildTemplateSection(context)
|
||||
],
|
||||
),
|
||||
),
|
||||
bottomSectionPadding: EdgeInsets.only(left: 24, right: 24, bottom: 24),
|
||||
bottomSection: Column(
|
||||
children: <Widget>[
|
||||
Padding(
|
||||
padding: EdgeInsets.only(bottom: 15),
|
||||
child: Observer(
|
||||
builder: (_) {
|
||||
final description = exchangeViewModel.isFixedRateMode
|
||||
? exchangeViewModel.isAvailableInSelected
|
||||
? S.of(context).amount_is_guaranteed
|
||||
|
@ -220,15 +223,14 @@ class ExchangePage extends BasePage {
|
|||
: S.of(context).this_pair_is_not_supported_warning;
|
||||
return Row(
|
||||
children: [
|
||||
if(description == S.of(context).this_pair_is_not_supported_warning)
|
||||
if (description == S.of(context).this_pair_is_not_supported_warning)
|
||||
Expanded(
|
||||
child: Container(
|
||||
alignment: Alignment.centerRight,
|
||||
child: Icon(Icons.warning_amber_rounded,
|
||||
color: Theme.of(context).extension<ExchangePageTheme>()!.receiveAmountColor,
|
||||
size: 26),
|
||||
child: Container(
|
||||
alignment: Alignment.centerRight,
|
||||
child: Icon(Icons.warning_amber_rounded,
|
||||
color: Theme.of(context).colorScheme.error, size: 26),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 8,
|
||||
child: Text(
|
||||
|
@ -237,41 +239,42 @@ class ExchangePage extends BasePage {
|
|||
softWrap: true,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
maxLines: 3,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context)
|
||||
.extension<ExchangePageTheme>()!
|
||||
.receiveAmountColor,
|
||||
fontWeight: FontWeight.w500,
|
||||
fontSize: 12,
|
||||
),
|
||||
style: Theme.of(context).textTheme.bodySmall?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}),
|
||||
},
|
||||
),
|
||||
Observer(
|
||||
builder: (_) => LoadingPrimaryButton(
|
||||
key: ValueKey('exchange_page_exchange_button_key'),
|
||||
text: exchangeViewModel.isAvailableInSelected ? S.of(context).swap : S.of(context).change_selected_exchanges,
|
||||
onPressed: exchangeViewModel.isAvailableInSelected ? () {
|
||||
),
|
||||
Observer(
|
||||
builder: (_) => LoadingPrimaryButton(
|
||||
key: ValueKey('exchange_page_exchange_button_key'),
|
||||
text: exchangeViewModel.isAvailableInSelected
|
||||
? S.of(context).swap
|
||||
: S.of(context).change_selected_exchanges,
|
||||
onPressed: exchangeViewModel.isAvailableInSelected
|
||||
? () {
|
||||
FocusScope.of(context).unfocus();
|
||||
|
||||
if (_formKey.currentState != null &&
|
||||
_formKey.currentState!.validate()) {
|
||||
if (_shouldWaitTillSynced) {
|
||||
showPopUp<void>(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertWithOneAction(
|
||||
alertTitle: S.of(context).exchange,
|
||||
alertContent:
|
||||
S.of(context).exchange_sync_alert_content,
|
||||
buttonText: S.of(context).ok,
|
||||
buttonAction: () => Navigator.of(context).pop(),
|
||||
);
|
||||
});
|
||||
} else {
|
||||
if (_formKey.currentState != null &&
|
||||
_formKey.currentState!.validate()) {
|
||||
if (_shouldWaitTillSynced) {
|
||||
showPopUp<void>(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertWithOneAction(
|
||||
alertTitle: S.of(context).exchange,
|
||||
alertContent: S.of(context).exchange_sync_alert_content,
|
||||
buttonText: S.of(context).ok,
|
||||
buttonAction: () => Navigator.of(context).pop(),
|
||||
);
|
||||
},
|
||||
);
|
||||
} else {
|
||||
final check = exchangeViewModel.shouldDisplayTOTP();
|
||||
authService.authenticateAction(
|
||||
context,
|
||||
|
@ -284,14 +287,21 @@ class ExchangePage extends BasePage {
|
|||
);
|
||||
}
|
||||
}
|
||||
} : () => PresentProviderPicker(exchangeViewModel: exchangeViewModel).presentProviderPicker(context),
|
||||
color: Theme.of(context).primaryColor,
|
||||
textColor: Colors.white,
|
||||
isDisabled: exchangeViewModel.selectedProviders.isEmpty,
|
||||
isLoading: exchangeViewModel.tradeState is TradeIsCreating)),
|
||||
]),
|
||||
)),
|
||||
));
|
||||
}
|
||||
: () => PresentProviderPicker(exchangeViewModel: exchangeViewModel)
|
||||
.presentProviderPicker(context),
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
textColor: Theme.of(context).colorScheme.onPrimary,
|
||||
isDisabled: exchangeViewModel.selectedProviders.isEmpty,
|
||||
isLoading: exchangeViewModel.tradeState is TradeIsCreating,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildTemplateSection(BuildContext context) {
|
||||
|
@ -329,20 +339,22 @@ class ExchangePage extends BasePage {
|
|||
},
|
||||
onRemove: () {
|
||||
showPopUp<void>(
|
||||
context: context,
|
||||
builder: (dialogContext) {
|
||||
return AlertWithTwoActions(
|
||||
alertTitle: S.of(context).template,
|
||||
alertContent: S.of(context).confirm_delete_template,
|
||||
rightButtonText: S.of(context).delete,
|
||||
leftButtonText: S.of(context).cancel,
|
||||
actionRightButton: () {
|
||||
Navigator.of(dialogContext).pop();
|
||||
exchangeViewModel.removeTemplate(template: template);
|
||||
exchangeViewModel.updateTemplate();
|
||||
},
|
||||
actionLeftButton: () => Navigator.of(dialogContext).pop());
|
||||
});
|
||||
context: context,
|
||||
builder: (dialogContext) {
|
||||
return AlertWithTwoActions(
|
||||
alertTitle: S.of(context).template,
|
||||
alertContent: S.of(context).confirm_delete_template,
|
||||
rightButtonText: S.of(context).delete,
|
||||
leftButtonText: S.of(context).cancel,
|
||||
actionRightButton: () {
|
||||
Navigator.of(dialogContext).pop();
|
||||
exchangeViewModel.removeTemplate(template: template);
|
||||
exchangeViewModel.updateTemplate();
|
||||
},
|
||||
actionLeftButton: () => Navigator.of(dialogContext).pop(),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
|
@ -470,7 +482,8 @@ class ExchangePage extends BasePage {
|
|||
if (state is TradeIsCreatedSuccessfully) {
|
||||
exchangeViewModel.reset();
|
||||
(exchangeViewModel.tradesStore.trade?.provider == ExchangeProviderDescription.thorChain ||
|
||||
exchangeViewModel.tradesStore.trade?.provider == ExchangeProviderDescription.chainflip)
|
||||
exchangeViewModel.tradesStore.trade?.provider ==
|
||||
ExchangeProviderDescription.chainflip)
|
||||
? Navigator.of(context).pushReplacementNamed(Routes.exchangeTrade)
|
||||
: Navigator.of(context).pushReplacementNamed(Routes.exchangeConfirm);
|
||||
}
|
||||
|
@ -605,7 +618,8 @@ class ExchangePage extends BasePage {
|
|||
key.currentState!.changeWalletName(isCurrentTypeWallet ? exchangeViewModel.wallet.name : '');
|
||||
|
||||
key.currentState!.changeAddress(
|
||||
address: isCurrentTypeWallet ? exchangeViewModel.wallet.walletAddresses.addressForExchange : '');
|
||||
address:
|
||||
isCurrentTypeWallet ? exchangeViewModel.wallet.walletAddresses.addressForExchange : '');
|
||||
|
||||
key.currentState!.changeAmount(amount: '');
|
||||
}
|
||||
|
@ -616,7 +630,8 @@ class ExchangePage extends BasePage {
|
|||
|
||||
if (isCurrentTypeWallet) {
|
||||
key.currentState!.changeWalletName(exchangeViewModel.wallet.name);
|
||||
key.currentState!.addressController.text = exchangeViewModel.wallet.walletAddresses.addressForExchange;
|
||||
key.currentState!.addressController.text =
|
||||
exchangeViewModel.wallet.walletAddresses.addressForExchange;
|
||||
} else if (key.currentState!.addressController.text ==
|
||||
exchangeViewModel.wallet.walletAddresses.addressForExchange) {
|
||||
key.currentState!.changeWalletName('');
|
||||
|
@ -646,7 +661,7 @@ class ExchangePage extends BasePage {
|
|||
}) ??
|
||||
false;
|
||||
if (confirmed) {
|
||||
exchangeViewModel.feesViewModel .setDefaultTransactionPriority();
|
||||
exchangeViewModel.feesViewModel.setDefaultTransactionPriority();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -654,132 +669,130 @@ class ExchangePage extends BasePage {
|
|||
|
||||
Widget _exchangeCardsSection(BuildContext context) {
|
||||
final firstExchangeCard = Observer(
|
||||
builder: (_) => ExchangeCard(
|
||||
cardInstanceName: 'deposit_exchange_card',
|
||||
onDispose: disposeBestRateSync,
|
||||
hasAllAmount: exchangeViewModel.hasAllAmount,
|
||||
allAmount: exchangeViewModel.hasAllAmount
|
||||
? () => exchangeViewModel.enableSendAllAmount()
|
||||
: null,
|
||||
isAllAmountEnabled: exchangeViewModel.isSendAllEnabled,
|
||||
amountFocusNode: _depositAmountFocus,
|
||||
addressFocusNode: _depositAddressFocus,
|
||||
key: depositKey,
|
||||
title: S.of(context).you_will_send,
|
||||
initialCurrency: exchangeViewModel.depositCurrency,
|
||||
initialWalletName: depositWalletName ?? '',
|
||||
initialAddress: exchangeViewModel.depositCurrency == exchangeViewModel.wallet.currency
|
||||
? exchangeViewModel.wallet.walletAddresses.addressForExchange
|
||||
: exchangeViewModel.depositAddress,
|
||||
initialIsAmountEditable: true,
|
||||
initialIsAddressEditable: exchangeViewModel.isDepositAddressEnabled,
|
||||
isAmountEstimated: false,
|
||||
hasRefundAddress: true,
|
||||
isMoneroWallet: exchangeViewModel.isMoneroWallet,
|
||||
currencies: exchangeViewModel.depositCurrencies,
|
||||
onCurrencySelected: (currency) {
|
||||
// FIXME: need to move it into view model
|
||||
if (currency == CryptoCurrency.xmr &&
|
||||
exchangeViewModel.wallet.type != WalletType.monero) {
|
||||
showPopUp<void>(
|
||||
context: context,
|
||||
builder: (dialogContext) {
|
||||
return AlertWithOneAction(
|
||||
alertTitle: S.of(context).error,
|
||||
alertContent: S.of(context).exchange_incorrect_current_wallet_for_xmr,
|
||||
buttonText: S.of(context).ok,
|
||||
buttonAction: () => Navigator.of(dialogContext).pop());
|
||||
});
|
||||
return;
|
||||
}
|
||||
builder: (_) => ExchangeCard(
|
||||
cardInstanceName: 'deposit_exchange_card',
|
||||
onDispose: disposeBestRateSync,
|
||||
hasAllAmount: exchangeViewModel.hasAllAmount,
|
||||
allAmount:
|
||||
exchangeViewModel.hasAllAmount ? () => exchangeViewModel.enableSendAllAmount() : null,
|
||||
isAllAmountEnabled: exchangeViewModel.isSendAllEnabled,
|
||||
amountFocusNode: _depositAmountFocus,
|
||||
addressFocusNode: _depositAddressFocus,
|
||||
key: depositKey,
|
||||
title: S.of(context).you_will_send,
|
||||
initialCurrency: exchangeViewModel.depositCurrency,
|
||||
initialWalletName: depositWalletName ?? '',
|
||||
initialAddress: exchangeViewModel.depositCurrency == exchangeViewModel.wallet.currency
|
||||
? exchangeViewModel.wallet.walletAddresses.addressForExchange
|
||||
: exchangeViewModel.depositAddress,
|
||||
initialIsAmountEditable: true,
|
||||
initialIsAddressEditable: exchangeViewModel.isDepositAddressEnabled,
|
||||
isAmountEstimated: false,
|
||||
hasRefundAddress: true,
|
||||
isMoneroWallet: exchangeViewModel.isMoneroWallet,
|
||||
currencies: exchangeViewModel.depositCurrencies,
|
||||
onCurrencySelected: (currency) {
|
||||
// FIXME: need to move it into view model
|
||||
if (currency == CryptoCurrency.xmr &&
|
||||
exchangeViewModel.wallet.type != WalletType.monero) {
|
||||
showPopUp<void>(
|
||||
context: context,
|
||||
builder: (dialogContext) {
|
||||
return AlertWithOneAction(
|
||||
alertTitle: S.of(context).error,
|
||||
alertContent: S.of(context).exchange_incorrect_current_wallet_for_xmr,
|
||||
buttonText: S.of(context).ok,
|
||||
buttonAction: () => Navigator.of(dialogContext).pop(),
|
||||
);
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
exchangeViewModel.changeDepositCurrency(currency: currency);
|
||||
},
|
||||
currencyButtonColor: Colors.transparent,
|
||||
addressButtonsColor:
|
||||
Theme.of(context).extension<SendPageTheme>()!.textFieldButtonColor,
|
||||
borderColor:
|
||||
Theme.of(context).extension<ExchangePageTheme>()!.textFieldBorderTopPanelColor,
|
||||
currencyValueValidator: (value) {
|
||||
return !exchangeViewModel.isFixedRateMode && value != S.of(context).all
|
||||
? AmountValidator(
|
||||
isAutovalidate: true,
|
||||
currency: exchangeViewModel.depositCurrency,
|
||||
minValue: exchangeViewModel.limits.min.toString(),
|
||||
maxValue: exchangeViewModel.limits.max.toString(),
|
||||
).call(value)
|
||||
: null;
|
||||
},
|
||||
addressTextFieldValidator: AddressValidator(type: exchangeViewModel.depositCurrency),
|
||||
onPushPasteButton: (context) async {
|
||||
final domain = exchangeViewModel.depositAddress;
|
||||
exchangeViewModel.depositAddress =
|
||||
await fetchParsedAddress(context, domain, exchangeViewModel.depositCurrency);
|
||||
},
|
||||
onPushAddressBookButton: (context) async {
|
||||
final domain = exchangeViewModel.depositAddress;
|
||||
exchangeViewModel.depositAddress =
|
||||
await fetchParsedAddress(context, domain, exchangeViewModel.depositCurrency);
|
||||
},
|
||||
));
|
||||
exchangeViewModel.changeDepositCurrency(currency: currency);
|
||||
},
|
||||
currencyButtonColor: Colors.transparent,
|
||||
addressButtonsColor: Colors.transparent,
|
||||
borderColor: Theme.of(context).colorScheme.outlineVariant,
|
||||
fillColor: Theme.of(context).colorScheme.surfaceContainer,
|
||||
currencyValueValidator: (value) {
|
||||
return !exchangeViewModel.isFixedRateMode && value != S.of(context).all
|
||||
? AmountValidator(
|
||||
isAutovalidate: true,
|
||||
currency: exchangeViewModel.depositCurrency,
|
||||
minValue: exchangeViewModel.limits.min.toString(),
|
||||
maxValue: exchangeViewModel.limits.max.toString(),
|
||||
).call(value)
|
||||
: null;
|
||||
},
|
||||
addressTextFieldValidator: AddressValidator(type: exchangeViewModel.depositCurrency),
|
||||
onPushPasteButton: (context) async {
|
||||
final domain = exchangeViewModel.depositAddress;
|
||||
exchangeViewModel.depositAddress =
|
||||
await fetchParsedAddress(context, domain, exchangeViewModel.depositCurrency);
|
||||
},
|
||||
onPushAddressBookButton: (context) async {
|
||||
final domain = exchangeViewModel.depositAddress;
|
||||
exchangeViewModel.depositAddress =
|
||||
await fetchParsedAddress(context, domain, exchangeViewModel.depositCurrency);
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
final secondExchangeCard = Observer(
|
||||
builder: (_) => ExchangeCard(
|
||||
cardInstanceName: 'receive_exchange_card',
|
||||
onDispose: disposeBestRateSync,
|
||||
amountFocusNode: _receiveAmountFocus,
|
||||
addressFocusNode: _receiveAddressFocus,
|
||||
key: receiveKey,
|
||||
title: S.of(context).you_will_get,
|
||||
initialCurrency: exchangeViewModel.receiveCurrency,
|
||||
initialWalletName: receiveWalletName ?? '',
|
||||
initialAddress: exchangeViewModel.receiveCurrency == exchangeViewModel.wallet.currency
|
||||
? exchangeViewModel.wallet.walletAddresses.addressForExchange
|
||||
: exchangeViewModel.receiveAddress,
|
||||
initialIsAmountEditable: exchangeViewModel.isReceiveAmountEditable,
|
||||
isAmountEstimated: true,
|
||||
isMoneroWallet: exchangeViewModel.isMoneroWallet,
|
||||
currencies: exchangeViewModel.receiveCurrencies,
|
||||
onCurrencySelected: (currency) =>
|
||||
exchangeViewModel.changeReceiveCurrency(currency: currency),
|
||||
currencyButtonColor: Colors.transparent,
|
||||
addressButtonsColor:
|
||||
Theme.of(context).extension<SendPageTheme>()!.textFieldButtonColor,
|
||||
borderColor:
|
||||
Theme.of(context).extension<ExchangePageTheme>()!.textFieldBorderBottomPanelColor,
|
||||
currencyValueValidator: (value) {
|
||||
return exchangeViewModel.isFixedRateMode
|
||||
? AmountValidator(
|
||||
isAutovalidate: true,
|
||||
currency: exchangeViewModel.receiveCurrency,
|
||||
minValue: exchangeViewModel.limits.min.toString(),
|
||||
maxValue: exchangeViewModel.limits.max.toString(),
|
||||
).call(value)
|
||||
: null;
|
||||
},
|
||||
addressTextFieldValidator: AddressValidator(type: exchangeViewModel.receiveCurrency),
|
||||
onPushPasteButton: (context) async {
|
||||
final domain = exchangeViewModel.receiveAddress;
|
||||
exchangeViewModel.receiveAddress =
|
||||
await fetchParsedAddress(context, domain, exchangeViewModel.receiveCurrency);
|
||||
},
|
||||
onPushAddressBookButton: (context) async {
|
||||
final domain = exchangeViewModel.receiveAddress;
|
||||
exchangeViewModel.receiveAddress =
|
||||
await fetchParsedAddress(context, domain, exchangeViewModel.receiveCurrency);
|
||||
},
|
||||
));
|
||||
|
||||
if (responsiveLayoutUtil.shouldRenderMobileUI) {
|
||||
return MobileExchangeCardsSection(
|
||||
firstExchangeCard: firstExchangeCard,
|
||||
secondExchangeCard: secondExchangeCard,
|
||||
);
|
||||
}
|
||||
|
||||
return DesktopExchangeCardsSection(
|
||||
firstExchangeCard: firstExchangeCard,
|
||||
secondExchangeCard: secondExchangeCard,
|
||||
builder: (_) => ExchangeCard(
|
||||
cardInstanceName: 'receive_exchange_card',
|
||||
onDispose: disposeBestRateSync,
|
||||
amountFocusNode: _receiveAmountFocus,
|
||||
addressFocusNode: _receiveAddressFocus,
|
||||
key: receiveKey,
|
||||
title: S.of(context).you_will_get,
|
||||
initialCurrency: exchangeViewModel.receiveCurrency,
|
||||
initialWalletName: receiveWalletName ?? '',
|
||||
initialAddress: exchangeViewModel.receiveCurrency == exchangeViewModel.wallet.currency
|
||||
? exchangeViewModel.wallet.walletAddresses.addressForExchange
|
||||
: exchangeViewModel.receiveAddress,
|
||||
initialIsAmountEditable: exchangeViewModel.isReceiveAmountEditable,
|
||||
isAmountEstimated: true,
|
||||
isMoneroWallet: exchangeViewModel.isMoneroWallet,
|
||||
currencies: exchangeViewModel.receiveCurrencies,
|
||||
onCurrencySelected: (currency) =>
|
||||
exchangeViewModel.changeReceiveCurrency(currency: currency),
|
||||
currencyButtonColor: Colors.transparent,
|
||||
addressButtonsColor: Colors.transparent,
|
||||
borderColor: Theme.of(context).colorScheme.outlineVariant,
|
||||
fillColor: Theme.of(context).colorScheme.surfaceContainerLow,
|
||||
currencyValueValidator: (value) {
|
||||
return exchangeViewModel.isFixedRateMode
|
||||
? AmountValidator(
|
||||
isAutovalidate: true,
|
||||
currency: exchangeViewModel.receiveCurrency,
|
||||
minValue: exchangeViewModel.limits.min.toString(),
|
||||
maxValue: exchangeViewModel.limits.max.toString(),
|
||||
).call(value)
|
||||
: null;
|
||||
},
|
||||
addressTextFieldValidator: AddressValidator(type: exchangeViewModel.receiveCurrency),
|
||||
onPushPasteButton: (context) async {
|
||||
final domain = exchangeViewModel.receiveAddress;
|
||||
exchangeViewModel.receiveAddress =
|
||||
await fetchParsedAddress(context, domain, exchangeViewModel.receiveCurrency);
|
||||
},
|
||||
onPushAddressBookButton: (context) async {
|
||||
final domain = exchangeViewModel.receiveAddress;
|
||||
exchangeViewModel.receiveAddress =
|
||||
await fetchParsedAddress(context, domain, exchangeViewModel.receiveCurrency);
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
return responsiveLayoutUtil.shouldRenderMobileUI
|
||||
? MobileExchangeCardsSection(
|
||||
firstExchangeCard: firstExchangeCard,
|
||||
secondExchangeCard: secondExchangeCard,
|
||||
)
|
||||
: DesktopExchangeCardsSection(
|
||||
firstExchangeCard: firstExchangeCard,
|
||||
secondExchangeCard: secondExchangeCard,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
import 'package:cake_wallet/themes/extensions/exchange_page_theme.dart';
|
||||
import 'package:cake_wallet/themes/extensions/keyboard_theme.dart';
|
||||
import 'package:cake_wallet/exchange/provider/exchange_provider.dart';
|
||||
import 'package:cake_wallet/src/screens/base_page.dart';
|
||||
import 'package:cake_wallet/src/widgets/keyboard_done_button.dart';
|
||||
|
@ -47,12 +45,12 @@ class ExchangeTemplatePage extends BasePage {
|
|||
Widget body(BuildContext context) {
|
||||
final arrowBottomPurple = Image.asset(
|
||||
'assets/images/arrow_bottom_purple_icon.png',
|
||||
color: Colors.white,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
height: 8,
|
||||
);
|
||||
final arrowBottomCakeGreen = Image.asset(
|
||||
'assets/images/arrow_bottom_cake_green.png',
|
||||
color: Colors.white,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
height: 8,
|
||||
);
|
||||
|
||||
|
@ -68,17 +66,18 @@ class ExchangeTemplatePage extends BasePage {
|
|||
return KeyboardActions(
|
||||
disableScroll: true,
|
||||
config: KeyboardActionsConfig(
|
||||
keyboardActionsPlatform: KeyboardActionsPlatform.IOS,
|
||||
keyboardBarColor: Theme.of(context).extension<KeyboardTheme>()!.keyboardBarColor,
|
||||
nextFocus: false,
|
||||
actions: [
|
||||
KeyboardActionsItem(
|
||||
focusNode: _depositAmountFocus, toolbarButtons: [(_) => KeyboardDoneButton()]),
|
||||
KeyboardActionsItem(
|
||||
focusNode: _receiveAmountFocus, toolbarButtons: [(_) => KeyboardDoneButton()])
|
||||
]),
|
||||
keyboardActionsPlatform: KeyboardActionsPlatform.IOS,
|
||||
keyboardBarColor: Theme.of(context).colorScheme.surfaceVariant,
|
||||
nextFocus: false,
|
||||
actions: [
|
||||
KeyboardActionsItem(
|
||||
focusNode: _depositAmountFocus, toolbarButtons: [(_) => KeyboardDoneButton()]),
|
||||
KeyboardActionsItem(
|
||||
focusNode: _receiveAmountFocus, toolbarButtons: [(_) => KeyboardDoneButton()])
|
||||
],
|
||||
),
|
||||
child: Container(
|
||||
color: Theme.of(context).colorScheme.background,
|
||||
color: Theme.of(context).colorScheme.surface,
|
||||
child: Form(
|
||||
key: _formKey,
|
||||
child: ScrollableWithBottomSection(
|
||||
|
@ -87,18 +86,10 @@ class ExchangeTemplatePage extends BasePage {
|
|||
padding: EdgeInsets.only(bottom: 32),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.only(
|
||||
bottomLeft: Radius.circular(24), bottomRight: Radius.circular(24)),
|
||||
gradient: LinearGradient(colors: [
|
||||
Theme.of(context)
|
||||
.extension<ExchangePageTheme>()!
|
||||
.firstGradientBottomPanelColor,
|
||||
Theme.of(context)
|
||||
.extension<ExchangePageTheme>()!
|
||||
.secondGradientBottomPanelColor,
|
||||
], stops: [
|
||||
0.35,
|
||||
1.0
|
||||
], begin: Alignment.topLeft, end: Alignment.bottomRight),
|
||||
bottomLeft: Radius.circular(24),
|
||||
bottomRight: Radius.circular(24),
|
||||
),
|
||||
color: Theme.of(context).colorScheme.surfaceContainer,
|
||||
),
|
||||
child: FocusTraversalGroup(
|
||||
policy: OrderedTraversalPolicy(),
|
||||
|
@ -109,14 +100,7 @@ class ExchangeTemplatePage extends BasePage {
|
|||
borderRadius: BorderRadius.only(
|
||||
bottomLeft: Radius.circular(24),
|
||||
bottomRight: Radius.circular(24)),
|
||||
gradient: LinearGradient(colors: [
|
||||
Theme.of(context)
|
||||
.extension<ExchangePageTheme>()!
|
||||
.firstGradientTopPanelColor,
|
||||
Theme.of(context)
|
||||
.extension<ExchangePageTheme>()!
|
||||
.secondGradientTopPanelColor,
|
||||
], begin: Alignment.topLeft, end: Alignment.bottomRight),
|
||||
color: Theme.of(context).colorScheme.surfaceContainerLow,
|
||||
),
|
||||
padding: EdgeInsets.fromLTRB(24, 100, 24, 32),
|
||||
child: Observer(
|
||||
|
@ -141,52 +125,45 @@ class ExchangeTemplatePage extends BasePage {
|
|||
exchangeViewModel.changeDepositCurrency(currency: currency),
|
||||
imageArrow: arrowBottomPurple,
|
||||
currencyButtonColor: Colors.transparent,
|
||||
addressButtonsColor: Theme.of(context)
|
||||
.extension<ExchangePageTheme>()!
|
||||
.textFieldButtonColor,
|
||||
borderColor: Theme.of(context)
|
||||
.extension<ExchangePageTheme>()!
|
||||
.textFieldBorderBottomPanelColor,
|
||||
addressButtonsColor:
|
||||
Theme.of(context).colorScheme.surfaceContainerHighest,
|
||||
borderColor: Theme.of(context).colorScheme.outlineVariant,
|
||||
fillColor: Theme.of(context).colorScheme.surfaceContainer,
|
||||
currencyValueValidator:
|
||||
AmountValidator(currency: exchangeViewModel.depositCurrency),
|
||||
//addressTextFieldValidator: AddressValidator(
|
||||
// type: exchangeViewModel.depositCurrency),
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 29, left: 24, right: 24),
|
||||
child: Observer(
|
||||
builder: (_) => ExchangeCard(
|
||||
cardInstanceName: 'receive_exchange_template_card',
|
||||
amountFocusNode: _receiveAmountFocus,
|
||||
key: receiveKey,
|
||||
title: S.of(context).you_will_get,
|
||||
initialCurrency: exchangeViewModel.receiveCurrency,
|
||||
initialWalletName: receiveWalletName ?? '',
|
||||
initialAddress: exchangeViewModel.receiveCurrency ==
|
||||
exchangeViewModel.wallet.currency
|
||||
? exchangeViewModel.wallet.walletAddresses.addressForExchange
|
||||
: exchangeViewModel.receiveAddress,
|
||||
initialIsAmountEditable: false,
|
||||
isAmountEstimated: true,
|
||||
isMoneroWallet: exchangeViewModel.isMoneroWallet,
|
||||
currencies: exchangeViewModel.receiveCurrencies,
|
||||
onCurrencySelected: (currency) => exchangeViewModel
|
||||
.changeReceiveCurrency(currency: currency),
|
||||
imageArrow: arrowBottomCakeGreen,
|
||||
currencyButtonColor: Colors.transparent,
|
||||
addressButtonsColor: Theme.of(context)
|
||||
.extension<ExchangePageTheme>()!
|
||||
.textFieldButtonColor,
|
||||
borderColor: Theme.of(context)
|
||||
.extension<ExchangePageTheme>()!
|
||||
.textFieldBorderBottomPanelColor,
|
||||
currencyValueValidator: AmountValidator(
|
||||
currency: exchangeViewModel.receiveCurrency),
|
||||
//addressTextFieldValidator: AddressValidator(
|
||||
// type: exchangeViewModel.receiveCurrency),
|
||||
)),
|
||||
builder: (_) => ExchangeCard(
|
||||
cardInstanceName: 'receive_exchange_template_card',
|
||||
amountFocusNode: _receiveAmountFocus,
|
||||
key: receiveKey,
|
||||
title: S.of(context).you_will_get,
|
||||
initialCurrency: exchangeViewModel.receiveCurrency,
|
||||
initialWalletName: receiveWalletName ?? '',
|
||||
initialAddress: exchangeViewModel.receiveCurrency ==
|
||||
exchangeViewModel.wallet.currency
|
||||
? exchangeViewModel.wallet.walletAddresses.addressForExchange
|
||||
: exchangeViewModel.receiveAddress,
|
||||
initialIsAmountEditable: false,
|
||||
isAmountEstimated: true,
|
||||
isMoneroWallet: exchangeViewModel.isMoneroWallet,
|
||||
currencies: exchangeViewModel.receiveCurrencies,
|
||||
onCurrencySelected: (currency) =>
|
||||
exchangeViewModel.changeReceiveCurrency(currency: currency),
|
||||
imageArrow: arrowBottomCakeGreen,
|
||||
currencyButtonColor: Colors.transparent,
|
||||
addressButtonsColor:
|
||||
Theme.of(context).colorScheme.surfaceContainerHighest,
|
||||
borderColor: Theme.of(context).colorScheme.outlineVariant,
|
||||
fillColor: Theme.of(context).colorScheme.surfaceContainerLow,
|
||||
currencyValueValidator:
|
||||
AmountValidator(currency: exchangeViewModel.receiveCurrency),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
|
@ -201,13 +178,10 @@ class ExchangeTemplatePage extends BasePage {
|
|||
child: Text(
|
||||
S.of(context).amount_is_estimate,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context)
|
||||
.extension<ExchangePageTheme>()!
|
||||
.receiveAmountColor,
|
||||
fontWeight: FontWeight.w500,
|
||||
fontSize: 12,
|
||||
),
|
||||
style: Theme.of(context).textTheme.bodySmall?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -231,8 +205,8 @@ class ExchangeTemplatePage extends BasePage {
|
|||
}
|
||||
},
|
||||
text: S.of(context).save,
|
||||
color: Theme.of(context).primaryColor,
|
||||
textColor: Colors.white),
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
textColor: Theme.of(context).colorScheme.onPrimary),
|
||||
]),
|
||||
))));
|
||||
}
|
||||
|
|
|
@ -31,18 +31,12 @@ class CurrencyPickerState extends State<CurrencyPicker> {
|
|||
CurrencyPickerState(this.items)
|
||||
: isSearchBarActive = false,
|
||||
textFieldValue = '',
|
||||
appBarTextStyle = TextStyle(
|
||||
fontSize: 20,
|
||||
fontFamily: 'Lato',
|
||||
backgroundColor: Colors.transparent,
|
||||
color: Colors.white),
|
||||
pickerItemsList = <PickerItem<CryptoCurrency>>[];
|
||||
|
||||
List<PickerItem<Currency>> pickerItemsList;
|
||||
List<Currency> items;
|
||||
bool isSearchBarActive;
|
||||
String textFieldValue;
|
||||
TextStyle appBarTextStyle;
|
||||
|
||||
bool currencySearchBySubstring(Currency currency, String subString) {
|
||||
return currency.name.toLowerCase().contains(subString.toLowerCase()) ||
|
||||
|
|
|
@ -1,15 +1,8 @@
|
|||
import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
|
||||
import 'package:cake_wallet/themes/extensions/cake_scrollbar_theme.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:cake_wallet/palette.dart';
|
||||
|
||||
class PickerItemWidget extends StatelessWidget {
|
||||
const PickerItemWidget({
|
||||
required this.title,
|
||||
this.iconPath,
|
||||
this.isSelected = false,
|
||||
this.tag,
|
||||
this.onTap});
|
||||
const PickerItemWidget(
|
||||
{required this.title, this.iconPath, this.isSelected = false, this.tag, this.onTap});
|
||||
|
||||
final String? iconPath;
|
||||
final String title;
|
||||
|
@ -22,7 +15,7 @@ class PickerItemWidget extends StatelessWidget {
|
|||
return GestureDetector(
|
||||
onTap: onTap,
|
||||
child: Container(
|
||||
color: Theme.of(context).dialogTheme.backgroundColor,
|
||||
color: Theme.of(context).colorScheme.surface,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8.0, horizontal: 24),
|
||||
child: Row(
|
||||
|
@ -40,14 +33,13 @@ class PickerItemWidget extends StatelessWidget {
|
|||
children: [
|
||||
Text(
|
||||
title.toUpperCase(),
|
||||
style: TextStyle(
|
||||
color: isSelected
|
||||
? Palette.blueCraiola
|
||||
: Theme.of(context).extension<CakeTextTheme>()!.titleColor,
|
||||
fontSize: isSelected ? 16 : 14.0,
|
||||
fontFamily: 'Lato',
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
style: Theme.of(context).textTheme.bodyMedium!.copyWith(
|
||||
color: isSelected
|
||||
? Theme.of(context).colorScheme.primary
|
||||
: Theme.of(context).colorScheme.onSurface,
|
||||
fontSize: isSelected ? 16 : 14.0,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
if (tag != null)
|
||||
Align(
|
||||
|
@ -58,16 +50,14 @@ class PickerItemWidget extends StatelessWidget {
|
|||
child: Center(
|
||||
child: Text(
|
||||
tag!,
|
||||
style: TextStyle(
|
||||
fontSize: 7.0,
|
||||
fontFamily: 'Lato',
|
||||
color: Theme.of(context).extension<CakeScrollbarTheme>()!.thumbColor),
|
||||
style: Theme.of(context).textTheme.bodyMedium!.copyWith(
|
||||
fontSize: 7.0, color: Theme.of(context).colorScheme.primary),
|
||||
),
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(6.0),
|
||||
//border: Border.all(color: ),
|
||||
color: Theme.of(context).extension<CakeScrollbarTheme>()!.trackColor,
|
||||
color: Theme.of(context).colorScheme.surfaceContainerHighest,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -75,8 +65,10 @@ class PickerItemWidget extends StatelessWidget {
|
|||
),
|
||||
),
|
||||
if (isSelected)
|
||||
Icon(Icons.check_circle,
|
||||
color: Theme.of(context).primaryColor)
|
||||
Icon(
|
||||
Icons.check,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import 'package:cake_wallet/themes/extensions/picker_theme.dart';
|
||||
import 'package:cw_core/currency.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'currency_picker_item_widget.dart';
|
||||
|
@ -21,7 +20,7 @@ class CurrencyPickerWidget extends StatelessWidget {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
color: Theme.of(context).extension<PickerTheme>()!.dividerColor,
|
||||
color: Theme.of(context).colorScheme.outlineVariant,
|
||||
child: Scrollbar(
|
||||
controller: _scrollController,
|
||||
child: GridView.builder(
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
import 'package:cake_wallet/core/amount_validator.dart';
|
||||
import 'package:cake_wallet/entities/contact_base.dart';
|
||||
import 'package:cake_wallet/src/screens/receive/widgets/currency_input_field.dart';
|
||||
import 'package:cake_wallet/themes/extensions/qr_code_theme.dart';
|
||||
import 'package:cake_wallet/routes.dart';
|
||||
import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart';
|
||||
import 'package:cake_wallet/themes/extensions/exchange_page_theme.dart';
|
||||
import 'package:cake_wallet/utils/show_bar.dart';
|
||||
import 'package:cake_wallet/utils/show_pop_up.dart';
|
||||
import 'package:cake_wallet/utils/payment_request.dart';
|
||||
|
@ -12,11 +10,9 @@ import 'package:cw_core/currency.dart';
|
|||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
import 'package:cw_core/crypto_currency.dart';
|
||||
import 'package:cake_wallet/src/widgets/address_text_field.dart';
|
||||
import 'package:cake_wallet/src/widgets/base_text_form_field.dart';
|
||||
import 'package:cake_wallet/src/screens/exchange/widgets/currency_picker.dart';
|
||||
import 'package:cake_wallet/themes/extensions/send_page_theme.dart';
|
||||
|
||||
class ExchangeCard<T extends Currency> extends StatefulWidget {
|
||||
ExchangeCard({
|
||||
|
@ -28,6 +24,7 @@ class ExchangeCard<T extends Currency> extends StatefulWidget {
|
|||
required this.isAmountEstimated,
|
||||
required this.currencies,
|
||||
required this.onCurrencySelected,
|
||||
required this.fillColor,
|
||||
this.imageArrow,
|
||||
this.currencyValueValidator,
|
||||
this.addressTextFieldValidator,
|
||||
|
@ -84,6 +81,7 @@ class ExchangeCard<T extends Currency> extends StatefulWidget {
|
|||
final void Function(BuildContext context)? onPushAddressBookButton;
|
||||
final Function()? onDispose;
|
||||
final String cardInstanceName;
|
||||
final Color fillColor;
|
||||
|
||||
@override
|
||||
ExchangeCardState<T> createState() => ExchangeCardState<T>();
|
||||
|
@ -184,226 +182,263 @@ class ExchangeCardState<T extends Currency> extends State<ExchangeCard<T>> {
|
|||
});
|
||||
}
|
||||
|
||||
final copyImage = Image.asset('assets/images/copy_content.png',
|
||||
height: 16,
|
||||
width: 16,
|
||||
color: Theme.of(context).extension<SendPageTheme>()!.estimatedFeeColor);
|
||||
final copyImage = Image.asset(
|
||||
'assets/images/copy_content.png',
|
||||
height: 16,
|
||||
width: 16,
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
);
|
||||
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
color: Colors.transparent,
|
||||
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[
|
||||
SizedBox(height: 10),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
SizedBox(height: 40),
|
||||
Text(
|
||||
key: ValueKey('${_cardInstanceName}_title_key'),
|
||||
_title,
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Theme.of(context).extension<QRCodeTheme>()!.qrCodeColor),
|
||||
)
|
||||
],
|
||||
),
|
||||
CurrencyAmountTextField(
|
||||
padding: EdgeInsets.zero,
|
||||
currencyPickerButtonKey: ValueKey('${_cardInstanceName}_currency_picker_button_key'),
|
||||
selectedCurrencyTextKey: ValueKey('${_cardInstanceName}_selected_currency_text_key'),
|
||||
selectedCurrencyTagTextKey:
|
||||
ValueKey('${_cardInstanceName}_selected_currency_tag_text_key'),
|
||||
amountTextfieldKey: ValueKey('${_cardInstanceName}_amount_textfield_key'),
|
||||
sendAllButtonKey: ValueKey('${_cardInstanceName}_send_all_button_key'),
|
||||
currencyAmountTextFieldWidgetKey:
|
||||
ValueKey('${_cardInstanceName}_currency_amount_textfield_widget_key'),
|
||||
imageArrow: widget.imageArrow,
|
||||
selectedCurrency: _selectedCurrency.toString(),
|
||||
amountFocusNode: widget.amountFocusNode,
|
||||
amountController: amountController,
|
||||
onTapPicker: () => _presentPicker(context),
|
||||
isAmountEditable: _isAmountEditable,
|
||||
isPickerEnable: true,
|
||||
allAmountButton: widget.hasAllAmount,
|
||||
currencyValueValidator: widget.currencyValueValidator,
|
||||
tag: _selectedCurrency.tag,
|
||||
allAmountCallback: widget.allAmount,
|
||||
),
|
||||
Divider(height: 1, color: Theme.of(context).extension<SendPageTheme>()!.textFieldHintColor),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 5),
|
||||
child: widget.showLimitsField ? Container(
|
||||
height: 15,
|
||||
child: Row(mainAxisAlignment: MainAxisAlignment.start, children: <Widget>[
|
||||
_min != null
|
||||
? Text(
|
||||
key: ValueKey('${_cardInstanceName}_min_limit_text_key'),
|
||||
S.of(context).min_value(_min ?? '', _selectedCurrency.toString()),
|
||||
style: TextStyle(
|
||||
fontSize: 10,
|
||||
height: 1.2,
|
||||
color: Theme.of(context).extension<ExchangePageTheme>()!.hintTextColor),
|
||||
)
|
||||
: Offstage(),
|
||||
_min != null ? SizedBox(width: 10) : Offstage(),
|
||||
_max != null
|
||||
? Text(
|
||||
key: ValueKey('${_cardInstanceName}_max_limit_text_key'),
|
||||
S.of(context).max_value(_max ?? '', _selectedCurrency.toString()),
|
||||
style: TextStyle(
|
||||
fontSize: 10,
|
||||
height: 1.2,
|
||||
color: Theme.of(context).extension<ExchangePageTheme>()!.hintTextColor,
|
||||
),
|
||||
)
|
||||
: Offstage(),
|
||||
])) : Offstage(),
|
||||
),
|
||||
!_isAddressEditable && widget.hasRefundAddress
|
||||
? Padding(
|
||||
padding: EdgeInsets.only(top: 20),
|
||||
child: Text(
|
||||
S.of(context).refund_address,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Theme.of(context).extension<ExchangePageTheme>()!.hintTextColor),
|
||||
))
|
||||
: Offstage(),
|
||||
_isAddressEditable
|
||||
? widget.showAddressField
|
||||
? FocusTraversalOrder(
|
||||
order: NumericFocusOrder(2),
|
||||
child: Padding(
|
||||
padding: widget.addressRowPadding ?? EdgeInsets.only(top: 12),
|
||||
child: AddressTextField(
|
||||
addressKey: ValueKey('${_cardInstanceName}_editable_address_textfield_key'),
|
||||
focusNode: widget.addressFocusNode,
|
||||
controller: addressController,
|
||||
onURIScanned: (uri) {
|
||||
final paymentRequest = PaymentRequest.fromUri(uri);
|
||||
addressController.text = paymentRequest.address;
|
||||
|
||||
if (amountController.text.isNotEmpty) {
|
||||
_showAmountPopup(context, paymentRequest);
|
||||
return;
|
||||
}
|
||||
widget.amountFocusNode?.requestFocus();
|
||||
amountController.text = paymentRequest.amount;
|
||||
},
|
||||
placeholder:
|
||||
widget.hasRefundAddress ? S.of(context).refund_address : null,
|
||||
options: [
|
||||
AddressTextFieldOption.paste,
|
||||
AddressTextFieldOption.qrCode,
|
||||
AddressTextFieldOption.addressBook,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
SizedBox(height: 10),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
SizedBox(height: 40),
|
||||
Text(
|
||||
key: ValueKey('${_cardInstanceName}_title_key'),
|
||||
_title,
|
||||
style: Theme.of(context).textTheme.titleLarge!.copyWith(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
CurrencyAmountTextField(
|
||||
hasUnderlineBorder: true,
|
||||
borderWidth: 0.0,
|
||||
padding: EdgeInsets.zero,
|
||||
currencyPickerButtonKey: ValueKey('${_cardInstanceName}_currency_picker_button_key'),
|
||||
selectedCurrencyTextKey: ValueKey('${_cardInstanceName}_selected_currency_text_key'),
|
||||
selectedCurrencyTagTextKey:
|
||||
ValueKey('${_cardInstanceName}_selected_currency_tag_text_key'),
|
||||
amountTextfieldKey: ValueKey('${_cardInstanceName}_amount_textfield_key'),
|
||||
sendAllButtonKey: ValueKey('${_cardInstanceName}_send_all_button_key'),
|
||||
currencyAmountTextFieldWidgetKey:
|
||||
ValueKey('${_cardInstanceName}_currency_amount_textfield_widget_key'),
|
||||
imageArrow: widget.imageArrow,
|
||||
selectedCurrency: _selectedCurrency.toString(),
|
||||
amountFocusNode: widget.amountFocusNode,
|
||||
amountController: amountController,
|
||||
onTapPicker: () => _presentPicker(context),
|
||||
isAmountEditable: _isAmountEditable,
|
||||
isPickerEnable: true,
|
||||
allAmountButton: widget.hasAllAmount,
|
||||
currencyValueValidator: widget.currencyValueValidator,
|
||||
tag: _selectedCurrency.tag,
|
||||
allAmountCallback: widget.allAmount,
|
||||
fillColor: widget.fillColor,
|
||||
),
|
||||
Divider(height: 1, color: Theme.of(context).colorScheme.outlineVariant),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 5),
|
||||
child: widget.showLimitsField
|
||||
? Container(
|
||||
height: 15,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
_min != null
|
||||
? Text(
|
||||
key: ValueKey('${_cardInstanceName}_min_limit_text_key'),
|
||||
S.of(context).min_value(_min ?? '', _selectedCurrency.toString()),
|
||||
style: Theme.of(context).textTheme.bodySmall!.copyWith(
|
||||
fontSize: 10,
|
||||
height: 1.2,
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
)
|
||||
: Offstage(),
|
||||
_min != null ? SizedBox(width: 10) : Offstage(),
|
||||
_max != null
|
||||
? Text(
|
||||
key: ValueKey('${_cardInstanceName}_max_limit_text_key'),
|
||||
S.of(context).max_value(_max ?? '', _selectedCurrency.toString()),
|
||||
style: Theme.of(context).textTheme.bodySmall!.copyWith(
|
||||
fontSize: 10,
|
||||
height: 1.2,
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
)
|
||||
: Offstage(),
|
||||
],
|
||||
isBorderExist: false,
|
||||
textStyle: TextStyle(
|
||||
fontSize: 16, fontWeight: FontWeight.w600, color: Colors.white),
|
||||
hintStyle: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
color:
|
||||
Theme.of(context).extension<ExchangePageTheme>()!.hintTextColor),
|
||||
buttonColor: widget.addressButtonsColor,
|
||||
validator: widget.addressTextFieldValidator,
|
||||
onPushPasteButton: widget.onPushPasteButton,
|
||||
onPushAddressBookButton: widget.onPushAddressBookButton,
|
||||
selectedCurrency: _selectedCurrency),
|
||||
),
|
||||
)
|
||||
: Offstage()
|
||||
: Padding(
|
||||
padding: EdgeInsets.only(top: 0),
|
||||
child: Builder(
|
||||
builder: (context) => Stack(children: <Widget>[
|
||||
FocusTraversalOrder(
|
||||
order: NumericFocusOrder(3),
|
||||
child: BaseTextFormField(
|
||||
key: ValueKey(
|
||||
'${_cardInstanceName}_non_editable_address_textfield_key'),
|
||||
controller: addressController,
|
||||
borderColor: Colors.transparent,
|
||||
suffixIcon: SizedBox(width: _isMoneroWallet ? 80 : 36),
|
||||
textStyle: TextStyle(
|
||||
fontSize: 16, fontWeight: FontWeight.w600, color: Colors.white),
|
||||
validator: widget.addressTextFieldValidator),
|
||||
),
|
||||
Positioned(
|
||||
top: 2,
|
||||
right: 0,
|
||||
child: SizedBox(
|
||||
width: _isMoneroWallet ? 80 : 36,
|
||||
child: Row(children: <Widget>[
|
||||
if (_isMoneroWallet)
|
||||
Padding(
|
||||
padding: EdgeInsets.only(left: 10),
|
||||
child: Container(
|
||||
width: 34,
|
||||
height: 34,
|
||||
padding: EdgeInsets.only(top: 0),
|
||||
child: Semantics(
|
||||
label: S.of(context).address_book,
|
||||
child: InkWell(
|
||||
key: ValueKey(
|
||||
'${_cardInstanceName}_address_book_button_key'),
|
||||
onTap: () async {
|
||||
final contact =
|
||||
await Navigator.of(context).pushNamed(
|
||||
Routes.pickerAddressBook,
|
||||
arguments: widget.initialCurrency,
|
||||
);
|
||||
),
|
||||
)
|
||||
: Offstage(),
|
||||
),
|
||||
!_isAddressEditable && widget.hasRefundAddress
|
||||
? Padding(
|
||||
padding: EdgeInsets.only(top: 20),
|
||||
child: Text(
|
||||
S.of(context).refund_address,
|
||||
style: Theme.of(context).textTheme.bodyMedium!.copyWith(
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant
|
||||
),
|
||||
),
|
||||
)
|
||||
: Offstage(),
|
||||
_isAddressEditable
|
||||
? widget.showAddressField
|
||||
? FocusTraversalOrder(
|
||||
order: NumericFocusOrder(2),
|
||||
child: Padding(
|
||||
padding: widget.addressRowPadding ?? EdgeInsets.only(top: 12),
|
||||
child: AddressTextField(
|
||||
hasUnderlineBorder: true,
|
||||
borderWidth: 0.0,
|
||||
addressKey:
|
||||
ValueKey('${_cardInstanceName}_editable_address_textfield_key'),
|
||||
focusNode: widget.addressFocusNode,
|
||||
controller: addressController,
|
||||
onURIScanned: (uri) {
|
||||
final paymentRequest = PaymentRequest.fromUri(uri);
|
||||
addressController.text = paymentRequest.address;
|
||||
|
||||
if (contact is ContactBase) {
|
||||
setState(() =>
|
||||
addressController.text = contact.address);
|
||||
widget.onPushAddressBookButton?.call(context);
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(8),
|
||||
decoration: BoxDecoration(
|
||||
color: widget.addressButtonsColor,
|
||||
borderRadius:
|
||||
BorderRadius.all(Radius.circular(6))),
|
||||
child: Image.asset(
|
||||
'assets/images/open_book.png',
|
||||
color: Theme.of(context)
|
||||
.extension<SendPageTheme>()!
|
||||
.textFieldButtonIconColor,
|
||||
)),
|
||||
),
|
||||
)),
|
||||
if (amountController.text.isNotEmpty) {
|
||||
_showAmountPopup(context, paymentRequest);
|
||||
return;
|
||||
}
|
||||
widget.amountFocusNode?.requestFocus();
|
||||
amountController.text = paymentRequest.amount;
|
||||
},
|
||||
placeholder:
|
||||
widget.hasRefundAddress ? S.of(context).refund_address : null,
|
||||
options: [
|
||||
AddressTextFieldOption.paste,
|
||||
AddressTextFieldOption.qrCode,
|
||||
AddressTextFieldOption.addressBook,
|
||||
],
|
||||
textStyle: Theme.of(context).textTheme.bodyMedium!.copyWith(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
),
|
||||
hintStyle: Theme.of(context).textTheme.bodyMedium!.copyWith(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
buttonColor: widget.addressButtonsColor,
|
||||
validator: widget.addressTextFieldValidator,
|
||||
onPushPasteButton: widget.onPushPasteButton,
|
||||
onPushAddressBookButton: widget.onPushAddressBookButton,
|
||||
selectedCurrency: _selectedCurrency,
|
||||
fillColor: widget.fillColor,
|
||||
iconColor: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
)
|
||||
: Offstage()
|
||||
: Padding(
|
||||
padding: EdgeInsets.only(top: 0),
|
||||
child: Builder(
|
||||
builder: (context) => Stack(
|
||||
children: <Widget>[
|
||||
FocusTraversalOrder(
|
||||
order: NumericFocusOrder(3),
|
||||
child: BaseTextFormField(
|
||||
hasUnderlineBorder: true,
|
||||
borderWidth: 0.0,
|
||||
key:
|
||||
ValueKey('${_cardInstanceName}_non_editable_address_textfield_key'),
|
||||
controller: addressController,
|
||||
suffixIcon: SizedBox(width: _isMoneroWallet ? 80 : 36),
|
||||
textStyle: Theme.of(context).textTheme.bodyMedium!.copyWith(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
validator: widget.addressTextFieldValidator,
|
||||
fillColor: widget.fillColor,
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
top: 2,
|
||||
right: 0,
|
||||
child: SizedBox(
|
||||
width: _isMoneroWallet ? 80 : 36,
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
if (_isMoneroWallet)
|
||||
Padding(
|
||||
padding: EdgeInsets.only(left: 10),
|
||||
child: Container(
|
||||
width: 34,
|
||||
height: 34,
|
||||
padding: EdgeInsets.only(top: 0),
|
||||
child: Semantics(
|
||||
label: S.of(context).address_book,
|
||||
child: InkWell(
|
||||
key: ValueKey(
|
||||
'${_cardInstanceName}_address_book_button_key'),
|
||||
onTap: () async {
|
||||
final contact = await Navigator.of(context).pushNamed(
|
||||
Routes.pickerAddressBook,
|
||||
arguments: widget.initialCurrency,
|
||||
);
|
||||
|
||||
if (contact is ContactBase) {
|
||||
setState(
|
||||
() => addressController.text = contact.address);
|
||||
widget.onPushAddressBookButton?.call(context);
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(8),
|
||||
decoration: BoxDecoration(
|
||||
color: widget.addressButtonsColor,
|
||||
borderRadius: BorderRadius.all(Radius.circular(6))),
|
||||
child: Image.asset(
|
||||
'assets/images/open_book.png',
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(left: 2),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(left: 2),
|
||||
child: Container(
|
||||
width: 34,
|
||||
height: 34,
|
||||
padding: EdgeInsets.only(top: 0),
|
||||
child: Semantics(
|
||||
label: S.of(context).copy_address,
|
||||
child: InkWell(
|
||||
key: ValueKey(
|
||||
'${_cardInstanceName}_copy_refund_address_button_key'),
|
||||
onTap: () {
|
||||
Clipboard.setData(
|
||||
ClipboardData(text: addressController.text));
|
||||
showBar<void>(context, S.of(context).copied_to_clipboard);
|
||||
},
|
||||
child: Container(
|
||||
width: 34,
|
||||
height: 34,
|
||||
padding: EdgeInsets.only(top: 0),
|
||||
child: Semantics(
|
||||
label: S.of(context).copy_address,
|
||||
child: InkWell(
|
||||
key: ValueKey(
|
||||
'${_cardInstanceName}_copy_refund_address_button_key'),
|
||||
onTap: () {
|
||||
Clipboard.setData(
|
||||
ClipboardData(text: addressController.text));
|
||||
showBar<void>(
|
||||
context, S.of(context).copied_to_clipboard);
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.fromLTRB(8, 8, 0, 8),
|
||||
color: Colors.transparent,
|
||||
child: copyImage),
|
||||
),
|
||||
)))
|
||||
])))
|
||||
])),
|
||||
),
|
||||
]),
|
||||
padding: EdgeInsets.fromLTRB(8, 8, 0, 8),
|
||||
color: Colors.transparent,
|
||||
child: copyImage,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -445,4 +480,3 @@ class ExchangeCardState<T extends Currency> extends State<ExchangeCard<T>> {
|
|||
return address;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
import 'package:cake_wallet/src/screens/new_wallet/widgets/select_button.dart';
|
||||
import 'package:cake_wallet/themes/extensions/exchange_page_theme.dart';
|
||||
import 'package:cake_wallet/themes/extensions/send_page_theme.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class MobileExchangeCardsSection extends StatelessWidget {
|
||||
|
@ -29,40 +27,28 @@ class MobileExchangeCardsSection extends StatelessWidget {
|
|||
bottomLeft: Radius.circular(24),
|
||||
bottomRight: Radius.circular(24),
|
||||
),
|
||||
gradient: LinearGradient(
|
||||
colors: [
|
||||
Theme.of(context).extension<ExchangePageTheme>()!.firstGradientBottomPanelColor,
|
||||
Theme.of(context).extension<ExchangePageTheme>()!.secondGradientBottomPanelColor,
|
||||
],
|
||||
stops: [0.35, 1.0],
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
),
|
||||
color: Theme.of(context).colorScheme.surfaceContainer,
|
||||
),
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.only(
|
||||
bottomLeft: Radius.circular(24), bottomRight: Radius.circular(24)),
|
||||
gradient: LinearGradient(
|
||||
colors: [
|
||||
Theme.of(context).extension<ExchangePageTheme>()!.firstGradientTopPanelColor,
|
||||
Theme.of(context).extension<ExchangePageTheme>()!.secondGradientTopPanelColor,
|
||||
],
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
bottomLeft: Radius.circular(24),
|
||||
bottomRight: Radius.circular(24),
|
||||
),
|
||||
color: Theme.of(context).colorScheme.surfaceContainerLow,
|
||||
),
|
||||
padding: EdgeInsets.fromLTRB(24, 90, 24, isBuySellOption ? 24 : 16),
|
||||
padding: EdgeInsets.fromLTRB(24, 105, 24, 24),
|
||||
child: Column(
|
||||
children: [
|
||||
if (isBuySellOption) Column(
|
||||
children: [
|
||||
const SizedBox(height: 16),
|
||||
BuySellOptionButtons(onBuyTap: onBuyTap, onSellTap: onSellTap),
|
||||
],
|
||||
),
|
||||
if (isBuySellOption)
|
||||
Column(
|
||||
children: [
|
||||
const SizedBox(height: 16),
|
||||
BuySellOptionButtons(onBuyTap: onBuyTap, onSellTap: onSellTap),
|
||||
],
|
||||
),
|
||||
firstExchangeCard,
|
||||
],
|
||||
),
|
||||
|
@ -104,12 +90,21 @@ class _BuySellOptionButtonsState extends State<BuySellOptionButtons> {
|
|||
text: S.of(context).buy,
|
||||
isSelected: isBuySelected,
|
||||
showTrailingIcon: false,
|
||||
textColor: Colors.white,
|
||||
image: Image.asset('assets/images/buy.png', height: 25, width: 25),
|
||||
textColor: isBuySelected
|
||||
? Theme.of(context).colorScheme.onPrimary
|
||||
: Theme.of(context).colorScheme.onSecondaryContainer,
|
||||
image: Image.asset(
|
||||
'assets/images/buy.png',
|
||||
height: 25,
|
||||
width: 25,
|
||||
color: isBuySelected
|
||||
? Theme.of(context).colorScheme.onPrimary
|
||||
: Theme.of(context).colorScheme.onSecondaryContainer,
|
||||
),
|
||||
padding: EdgeInsets.only(left: 10, right: 30),
|
||||
color: isBuySelected
|
||||
? null
|
||||
: Theme.of(context).extension<SendPageTheme>()!.textFieldButtonColor,
|
||||
? Theme.of(context).colorScheme.primary
|
||||
: Theme.of(context).colorScheme.surfaceContainer,
|
||||
onTap: () {
|
||||
setState(() => isBuySelected = true);
|
||||
if (widget.onBuyTap != null) widget.onBuyTap!();
|
||||
|
@ -124,12 +119,21 @@ class _BuySellOptionButtonsState extends State<BuySellOptionButtons> {
|
|||
text: S.of(context).sell,
|
||||
isSelected: !isBuySelected,
|
||||
showTrailingIcon: false,
|
||||
textColor: Colors.white,
|
||||
image: Image.asset('assets/images/sell.png', height: 25, width: 25),
|
||||
textColor: !isBuySelected
|
||||
? Theme.of(context).colorScheme.onPrimary
|
||||
: Theme.of(context).colorScheme.onSecondaryContainer,
|
||||
image: Image.asset(
|
||||
'assets/images/sell.png',
|
||||
height: 25,
|
||||
width: 25,
|
||||
color: !isBuySelected
|
||||
? Theme.of(context).colorScheme.onPrimary
|
||||
: Theme.of(context).colorScheme.onSecondaryContainer,
|
||||
),
|
||||
padding: EdgeInsets.only(left: 10, right: 30),
|
||||
color: !isBuySelected
|
||||
? null
|
||||
: Theme.of(context).extension<SendPageTheme>()!.textFieldButtonColor,
|
||||
? Theme.of(context).colorScheme.primary
|
||||
: Theme.of(context).colorScheme.surfaceContainer,
|
||||
onTap: () {
|
||||
setState(() => isBuySelected = false);
|
||||
if (widget.onSellTap != null) widget.onSellTap!();
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import 'package:cake_wallet/src/widgets/alert_with_one_action.dart';
|
||||
import 'package:cake_wallet/themes/extensions/qr_code_theme.dart';
|
||||
import 'package:cake_wallet/src/widgets/check_box_picker.dart';
|
||||
import 'package:cake_wallet/utils/show_pop_up.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
@ -15,83 +14,93 @@ class PresentProviderPicker extends StatelessWidget {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final arrowBottom = Image.asset(
|
||||
'assets/images/arrow_bottom_purple_icon.png',
|
||||
color: Colors.white,
|
||||
height: 6);
|
||||
'assets/images/arrow_bottom_purple_icon.png',
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
height: 6,
|
||||
);
|
||||
|
||||
return TextButton(
|
||||
onPressed: () => presentProviderPicker(context),
|
||||
style: ButtonStyle(
|
||||
padding: MaterialStateProperty.all(EdgeInsets.zero),
|
||||
splashFactory: NoSplash.splashFactory,
|
||||
foregroundColor: MaterialStateProperty.all(Colors.transparent),
|
||||
overlayColor: MaterialStateProperty.all(Colors.transparent),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Text(S.of(context).swap,
|
||||
style: TextStyle(
|
||||
fontSize: 16.0,
|
||||
fontWeight: FontWeight.w600,
|
||||
|
||||
color: Colors.white)),
|
||||
Observer(
|
||||
builder: (_) => Text(
|
||||
exchangeViewModel.selectedProviders.isEmpty
|
||||
? S.of(context).choose_one
|
||||
: exchangeViewModel.selectedProviders.length > 1
|
||||
? S.of(context).automatic
|
||||
: exchangeViewModel.selectedProviders.first.title,
|
||||
style: TextStyle(
|
||||
fontSize: 10.0,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Theme.of(context).extension<QRCodeTheme>()!.qrCodeColor)))
|
||||
],
|
||||
),
|
||||
SizedBox(width: 5),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 12),
|
||||
child: arrowBottom,
|
||||
)
|
||||
],
|
||||
));
|
||||
onPressed: () => presentProviderPicker(context),
|
||||
style: ButtonStyle(
|
||||
padding: WidgetStateProperty.all(EdgeInsets.zero),
|
||||
splashFactory: NoSplash.splashFactory,
|
||||
foregroundColor: WidgetStateProperty.all(Colors.transparent),
|
||||
overlayColor: WidgetStateProperty.all(Colors.transparent),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
S.of(context).swap,
|
||||
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||
fontSize: 16.0,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
Observer(
|
||||
builder: (_) => Text(
|
||||
exchangeViewModel.selectedProviders.isEmpty
|
||||
? S.of(context).choose_one
|
||||
: exchangeViewModel.selectedProviders.length > 1
|
||||
? S.of(context).automatic
|
||||
: exchangeViewModel.selectedProviders.first.title,
|
||||
style: Theme.of(context).textTheme.bodySmall?.copyWith(
|
||||
fontSize: 10.0,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
SizedBox(width: 5),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 12),
|
||||
child: arrowBottom,
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void presentProviderPicker(BuildContext context) async {
|
||||
await showPopUp<void>(
|
||||
builder: (BuildContext popUpContext) => CheckBoxPicker(
|
||||
items: exchangeViewModel.providerList
|
||||
.map((e) => CheckBoxItem(
|
||||
e.title,
|
||||
exchangeViewModel.selectedProviders.contains(e),
|
||||
isDisabled: !exchangeViewModel.providersForCurrentPair().contains(e),
|
||||
))
|
||||
.toList(),
|
||||
title: S.of(context).change_exchange_provider,
|
||||
onChanged: (int index, bool value) {
|
||||
if (!exchangeViewModel.providerList[index].isAvailable) {
|
||||
showPopUp<void>(
|
||||
builder: (BuildContext popUpContext) => AlertWithOneAction(
|
||||
alertTitle: 'Error',
|
||||
alertContent: 'The exchange is blocked in your region.',
|
||||
buttonText: S.of(context).ok,
|
||||
buttonAction: () => Navigator.of(context).pop()),
|
||||
context: context);
|
||||
return;
|
||||
}
|
||||
if (value) {
|
||||
exchangeViewModel.addExchangeProvider(exchangeViewModel.providerList[index]);
|
||||
} else {
|
||||
exchangeViewModel.removeExchangeProvider(exchangeViewModel.providerList[index]);
|
||||
}
|
||||
}),
|
||||
context: context);
|
||||
builder: (BuildContext popUpContext) => CheckBoxPicker(
|
||||
items: exchangeViewModel.providerList
|
||||
.map(
|
||||
(e) => CheckBoxItem(
|
||||
e.title,
|
||||
exchangeViewModel.selectedProviders.contains(e),
|
||||
isDisabled: !exchangeViewModel.providersForCurrentPair().contains(e),
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
title: S.of(context).change_exchange_provider,
|
||||
onChanged: (int index, bool value) {
|
||||
if (!exchangeViewModel.providerList[index].isAvailable) {
|
||||
showPopUp<void>(
|
||||
builder: (BuildContext popUpContext) => AlertWithOneAction(
|
||||
alertTitle: 'Error',
|
||||
alertContent: 'The exchange is blocked in your region.',
|
||||
buttonText: S.of(context).ok,
|
||||
buttonAction: () => Navigator.of(context).pop()),
|
||||
context: context);
|
||||
return;
|
||||
}
|
||||
if (value) {
|
||||
exchangeViewModel.addExchangeProvider(exchangeViewModel.providerList[index]);
|
||||
} else {
|
||||
exchangeViewModel.removeExchangeProvider(exchangeViewModel.providerList[index]);
|
||||
}
|
||||
},
|
||||
),
|
||||
context: context,
|
||||
);
|
||||
|
||||
exchangeViewModel.saveSelectedProviders();
|
||||
}
|
||||
|
|
|
@ -1,18 +1,14 @@
|
|||
import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
|
||||
import 'package:cake_wallet/exchange/exchange_provider_description.dart';
|
||||
import 'package:cake_wallet/store/dashboard/trades_store.dart';
|
||||
import 'package:cake_wallet/themes/extensions/exchange_page_theme.dart';
|
||||
import 'package:cake_wallet/utils/image_utill.dart';
|
||||
import 'package:cake_wallet/utils/show_bar.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:cake_wallet/routes.dart';
|
||||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
import 'package:cake_wallet/src/widgets/primary_button.dart';
|
||||
import 'package:cake_wallet/src/screens/base_page.dart';
|
||||
import 'package:cake_wallet/exchange/trade.dart';
|
||||
import 'package:cake_wallet/themes/extensions/transaction_trade_theme.dart';
|
||||
|
||||
class ExchangeConfirmPage extends BasePage {
|
||||
ExchangeConfirmPage({required this.tradesStore}) : trade = tradesStore.trade!;
|
||||
|
@ -30,117 +26,123 @@ class ExchangeConfirmPage extends BasePage {
|
|||
child: Column(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Flexible(
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Flexible(
|
||||
child: Center(
|
||||
child: Text(
|
||||
S.of(context).exchange_result_write_down_trade_id,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 18.0,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Theme.of(context).extension<TransactionTradeTheme>()!.detailsTitlesColor),
|
||||
child: Text(
|
||||
S.of(context).exchange_result_write_down_trade_id,
|
||||
textAlign: TextAlign.center,
|
||||
style: Theme.of(context).textTheme.bodyLarge?.copyWith(
|
||||
fontSize: 18.0,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
)),
|
||||
Container(
|
||||
height: 178,
|
||||
decoration: BoxDecoration(
|
||||
Container(
|
||||
height: 178,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.all(Radius.circular(30)),
|
||||
border: Border.all(
|
||||
width: 1,
|
||||
color: Theme.of(context).cardColor),
|
||||
color: Theme.of(context).dialogTheme.backgroundColor),
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(24),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
"${trade.provider.title} ${S.of(context).trade_id}",
|
||||
style: TextStyle(
|
||||
fontSize: 12.0,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Theme.of(context).extension<TransactionTradeTheme>()!.detailsTitlesColor),
|
||||
),
|
||||
Text(
|
||||
trade.id,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Theme.of(context).extension<CakeTextTheme>()!.titleColor),
|
||||
),
|
||||
],
|
||||
),
|
||||
)),
|
||||
Padding(
|
||||
padding: EdgeInsets.fromLTRB(10, 0, 10, 10),
|
||||
child: Builder(
|
||||
builder: (context) => PrimaryButton(
|
||||
key: ValueKey('exchange_confirm_page_copy_to_clipboard_button_key'),
|
||||
onPressed: () {
|
||||
Clipboard.setData(ClipboardData(text: trade.id));
|
||||
showBar<void>(
|
||||
context, S.of(context).copied_to_clipboard);
|
||||
},
|
||||
text: S.of(context).copy_id,
|
||||
color: Theme.of(context).extension<ExchangePageTheme>()!.buttonBackgroundColor,
|
||||
textColor: Theme.of(context).extension<CakeTextTheme>()!.titleColor),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Column(
|
||||
children: [
|
||||
if (trade.provider == ExchangeProviderDescription.trocador)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 8.0),
|
||||
child: Text(
|
||||
S.of(context).selected_trocador_provider +':${trade.providerName}',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 12.0,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Theme.of(context).extension<TransactionTradeTheme>()!.detailsTitlesColor),
|
||||
),
|
||||
width: 0.0,
|
||||
color: Theme.of(context).colorScheme.outlineVariant,
|
||||
),
|
||||
Flexible(
|
||||
child: Center(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
(trade.provider.image?.isNotEmpty ?? false)
|
||||
? ImageUtil.getImageFromPath(imagePath: trade.provider.image, height: 50, width: 50)
|
||||
: const SizedBox(),
|
||||
if (!trade.provider.horizontalLogo)
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8.0),
|
||||
child: Text(trade.provider.title),
|
||||
color: Theme.of(context).colorScheme.surfaceContainer,
|
||||
),
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(24),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
"${trade.provider.title} ${S.of(context).trade_id}",
|
||||
style: Theme.of(context).textTheme.bodySmall?.copyWith(
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
],
|
||||
Text(
|
||||
trade.id,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: Theme.of(context).textTheme.titleLarge?.copyWith(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
Padding(
|
||||
padding: EdgeInsets.fromLTRB(10, 0, 10, 10),
|
||||
child: Builder(
|
||||
builder: (context) => PrimaryButton(
|
||||
key: ValueKey('exchange_confirm_page_copy_to_clipboard_button_key'),
|
||||
onPressed: () {
|
||||
Clipboard.setData(ClipboardData(text: trade.id));
|
||||
showBar<void>(context, S.of(context).copied_to_clipboard);
|
||||
},
|
||||
text: S.of(context).copy_id,
|
||||
color: Theme.of(context).colorScheme.surfaceContainerLow,
|
||||
textColor: Theme.of(context).colorScheme.onSurface,
|
||||
borderRadius: BorderRadius.circular(30.0),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
)),
|
||||
Expanded(
|
||||
child: Column(
|
||||
children: [
|
||||
if (trade.provider == ExchangeProviderDescription.trocador)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 8.0),
|
||||
child: Text(
|
||||
S.of(context).selected_trocador_provider + ':${trade.providerName}',
|
||||
textAlign: TextAlign.center,
|
||||
style: Theme.of(context).textTheme.bodySmall?.copyWith(
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
),
|
||||
Flexible(
|
||||
child: Center(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
(trade.provider.image.isNotEmpty)
|
||||
? ImageUtil.getImageFromPath(
|
||||
imagePath: trade.provider.image, height: 50, width: 50)
|
||||
: const SizedBox(),
|
||||
if (!trade.provider.horizontalLogo)
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8.0),
|
||||
child: Text(trade.provider.title),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
PrimaryButton(
|
||||
key: ValueKey('exchange_confirm_page_saved_id_button_key'),
|
||||
onPressed: () => Navigator.of(context)
|
||||
.pushReplacementNamed(Routes.exchangeTrade),
|
||||
text: S.of(context).saved_the_trade_id,
|
||||
color: Theme.of(context).primaryColor,
|
||||
textColor: Colors.white)
|
||||
onPressed: () => Navigator.of(context).pushReplacementNamed(Routes.exchangeTrade),
|
||||
text: S.of(context).saved_the_trade_id,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
textColor: Theme.of(context).colorScheme.onPrimary,
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
import 'package:cake_wallet/src/screens/exchange_trade/widgets/exchange_trade_card_item_widget.dart';
|
||||
import 'package:cake_wallet/src/screens/receive/widgets/qr_image.dart';
|
||||
import 'package:cake_wallet/themes/extensions/exchange_page_theme.dart';
|
||||
import 'package:cake_wallet/themes/extensions/send_page_theme.dart';
|
||||
import 'package:flutter_mobx/flutter_mobx.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
|
@ -39,7 +37,7 @@ class ExchangeTradeExternalSendPage extends BasePage {
|
|||
'assets/images/copy_content.png',
|
||||
height: 16,
|
||||
width: 16,
|
||||
color: Theme.of(context).extension<SendPageTheme>()!.estimatedFeeColor,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
);
|
||||
return Container(
|
||||
child: ScrollableWithBottomSection(
|
||||
|
@ -52,14 +50,7 @@ class ExchangeTradeExternalSendPage extends BasePage {
|
|||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.only(
|
||||
bottomLeft: Radius.circular(24), bottomRight: Radius.circular(24)),
|
||||
gradient: LinearGradient(
|
||||
colors: [
|
||||
Theme.of(context).extension<SendPageTheme>()!.firstGradientColor,
|
||||
Theme.of(context).extension<SendPageTheme>()!.secondGradientColor,
|
||||
],
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
),
|
||||
color: Theme.of(context).colorScheme.surfaceContainerLow,
|
||||
),
|
||||
padding: EdgeInsets.fromLTRB(24, 110, 24, 32),
|
||||
child: Column(
|
||||
|
@ -78,9 +69,7 @@ class ExchangeTradeExternalSendPage extends BasePage {
|
|||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
width: 3,
|
||||
color: Theme.of(context)
|
||||
.extension<ExchangePageTheme>()!
|
||||
.qrCodeColor,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
),
|
||||
child: QrImage(
|
||||
|
@ -128,8 +117,8 @@ class ExchangeTradeExternalSendPage extends BasePage {
|
|||
Navigator.of(context).popUntil((route) => route.isFirst);
|
||||
},
|
||||
text: S.current.continue_text,
|
||||
color: Theme.of(context).primaryColor,
|
||||
textColor: Colors.white,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
textColor: Theme.of(context).colorScheme.onPrimary,
|
||||
)
|
||||
: Offstage();
|
||||
},
|
||||
|
|
|
@ -5,8 +5,7 @@ import 'package:cake_wallet/src/screens/exchange/widgets/mobile_exchange_cards_s
|
|||
import 'package:cake_wallet/src/screens/exchange_trade/widgets/exchange_trade_card_item_widget.dart';
|
||||
import 'package:cake_wallet/src/widgets/bottom_sheet/confirm_sending_bottom_sheet_widget.dart';
|
||||
import 'package:cake_wallet/src/widgets/bottom_sheet/info_bottom_sheet_widget.dart';
|
||||
import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
|
||||
import 'package:cake_wallet/themes/theme_base.dart';
|
||||
import 'package:cake_wallet/themes/core/material_base_theme.dart';
|
||||
import 'package:cake_wallet/utils/request_review_handler.dart';
|
||||
import 'package:cake_wallet/utils/responsive_layout_util.dart';
|
||||
import 'package:mobx/mobx.dart';
|
||||
|
@ -23,7 +22,6 @@ import 'package:cake_wallet/src/screens/exchange_trade/widgets/timer_widget.dart
|
|||
import 'package:cake_wallet/src/widgets/primary_button.dart';
|
||||
import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart';
|
||||
import 'package:cake_wallet/src/widgets/alert_with_one_action.dart';
|
||||
import 'package:cake_wallet/themes/extensions/transaction_trade_theme.dart';
|
||||
|
||||
void showInformation(ExchangeTradeViewModel exchangeTradeViewModel, BuildContext context) {
|
||||
final trade = exchangeTradeViewModel.trade;
|
||||
|
@ -36,9 +34,12 @@ void showInformation(ExchangeTradeViewModel exchangeTradeViewModel, BuildContext
|
|||
exchangeTradeViewModel.extraInfo;
|
||||
|
||||
showPopUp<void>(
|
||||
context: context,
|
||||
builder: (_) =>
|
||||
InformationPage(key: ValueKey('information_page_dialog_key'), information: information));
|
||||
context: context,
|
||||
builder: (_) => InformationPage(
|
||||
key: ValueKey('information_page_dialog_key'),
|
||||
information: information,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
class ExchangeTradePage extends BasePage {
|
||||
|
@ -64,7 +65,7 @@ class ExchangeTradePage extends BasePage {
|
|||
@override
|
||||
Widget trailing(BuildContext context) {
|
||||
final questionImage = Image.asset('assets/images/question_mark.png',
|
||||
color: Theme.of(context).extension<CakeTextTheme>()!.titleColor);
|
||||
color: Theme.of(context).colorScheme.onSurface);
|
||||
|
||||
return SizedBox(
|
||||
height: 20.0,
|
||||
|
@ -96,7 +97,7 @@ class ExchangeTradeForm extends StatefulWidget {
|
|||
);
|
||||
|
||||
final ExchangeTradeViewModel exchangeTradeViewModel;
|
||||
final ThemeBase currentTheme;
|
||||
final MaterialThemeBase currentTheme;
|
||||
|
||||
@override
|
||||
ExchangeTradeState createState() => ExchangeTradeState();
|
||||
|
@ -147,16 +148,13 @@ class ExchangeTradeState extends State<ExchangeTradeForm> {
|
|||
children: <Widget>[
|
||||
Text(
|
||||
S.of(context).offer_expires_in,
|
||||
style: TextStyle(
|
||||
fontSize: 14.0,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Theme.of(context)
|
||||
.extension<TransactionTradeTheme>()!
|
||||
.detailsTitlesColor),
|
||||
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
if (trade.expiredAt != null)
|
||||
TimerWidget(trade.expiredAt!,
|
||||
color: Theme.of(context).extension<CakeTextTheme>()!.titleColor)
|
||||
color: Theme.of(context).colorScheme.onSurface)
|
||||
])
|
||||
: Offstage(),
|
||||
_ExchangeTradeItemsCardSection(
|
||||
|
@ -175,8 +173,8 @@ class ExchangeTradeState extends State<ExchangeTradeForm> {
|
|||
onPressed: () async {
|
||||
Navigator.of(context).pushNamed(Routes.exchangeTradeExternalSendPage);
|
||||
},
|
||||
color: Theme.of(context).cardColor,
|
||||
textColor: Theme.of(context).extension<CakeTextTheme>()!.buttonTextColor,
|
||||
color: Theme.of(context).colorScheme.surfaceContainer,
|
||||
textColor: Theme.of(context).colorScheme.onSecondaryContainer,
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
Observer(
|
||||
|
@ -192,8 +190,8 @@ class ExchangeTradeState extends State<ExchangeTradeForm> {
|
|||
isLoading: sendingState is IsExecutingState,
|
||||
onPressed: () => widget.exchangeTradeViewModel.confirmSending(),
|
||||
text: S.current.send_from_cake_wallet,
|
||||
color: Theme.of(context).primaryColor,
|
||||
textColor: Colors.white,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
textColor: Theme.of(context).colorScheme.onPrimary,
|
||||
)
|
||||
: Offstage();
|
||||
},
|
||||
|
@ -214,10 +212,9 @@ class ExchangeTradeState extends State<ExchangeTradeForm> {
|
|||
|
||||
_exchangeStateReaction = reaction((_) => this.widget.exchangeTradeViewModel.sendViewModel.state,
|
||||
(ExecutionState state) async {
|
||||
|
||||
if (dialogContext != null && dialogContext?.mounted == true) {
|
||||
Navigator.of(dialogContext!).pop();
|
||||
}
|
||||
if (dialogContext != null && dialogContext?.mounted == true) {
|
||||
Navigator.of(dialogContext!).pop();
|
||||
}
|
||||
|
||||
if (state is! IsExecutingState &&
|
||||
loadingBottomSheetContext != null &&
|
||||
|
@ -346,7 +343,7 @@ class _ExchangeTradeItemsCardSection extends StatelessWidget {
|
|||
});
|
||||
|
||||
final ExchangeTradeViewModel viewModel;
|
||||
final ThemeBase currentTheme;
|
||||
final MaterialThemeBase currentTheme;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
|
|
@ -1,13 +1,7 @@
|
|||
import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
|
||||
import 'dart:ui';
|
||||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
import 'package:cake_wallet/src/widgets/primary_button.dart';
|
||||
import 'package:cake_wallet/themes/extensions/exchange_page_theme.dart';
|
||||
import 'package:cake_wallet/themes/extensions/info_theme.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:cake_wallet/src/widgets/alert_background.dart';
|
||||
import 'package:cake_wallet/themes/extensions/menu_theme.dart';
|
||||
|
||||
class InformationPage extends StatelessWidget {
|
||||
InformationPage({required this.information, super.key});
|
||||
|
@ -17,47 +11,37 @@ class InformationPage extends StatelessWidget {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AlertBackground(
|
||||
child: Center(
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(
|
||||
left: 24,
|
||||
right: 24
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.all(Radius.circular(30)),
|
||||
color: Theme.of(context).extension<CakeMenuTheme>()!.backgroundColor
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
padding: EdgeInsets.fromLTRB(24, 28, 24, 24),
|
||||
child: Text(
|
||||
information,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.normal,
|
||||
fontFamily: 'Lato',
|
||||
decoration: TextDecoration.none,
|
||||
color: Theme.of(context).extension<InfoTheme>()!.textColor
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.fromLTRB(10, 0, 10, 10),
|
||||
child: PrimaryButton(
|
||||
key: ValueKey('information_page_got_it_button_key'),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
text: S.of(context).got_it,
|
||||
color: Theme.of(context).extension<ExchangePageTheme>()!.buttonBackgroundColor,
|
||||
textColor: Theme.of(context).extension<CakeTextTheme>()!.titleColor
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
child: Center(
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(left: 24, right: 24),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.all(Radius.circular(30)),
|
||||
color: Theme.of(context).colorScheme.surface,
|
||||
),
|
||||
)
|
||||
);
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
padding: EdgeInsets.fromLTRB(24, 28, 24, 24),
|
||||
child: Text(
|
||||
information,
|
||||
textAlign: TextAlign.center,
|
||||
style: Theme.of(context).textTheme.bodyMedium,
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.fromLTRB(10, 0, 10, 10),
|
||||
child: PrimaryButton(
|
||||
key: ValueKey('information_page_got_it_button_key'),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
text: S.of(context).got_it,
|
||||
color: Theme.of(context).colorScheme.surfaceContainer,
|
||||
textColor: Theme.of(context).colorScheme.onSurface,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import 'package:cake_wallet/routes.dart';
|
|||
import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart';
|
||||
import 'package:cake_wallet/src/widgets/list_row.dart';
|
||||
import 'package:cake_wallet/src/widgets/picker.dart';
|
||||
import 'package:cake_wallet/themes/core/material_base_theme.dart';
|
||||
import 'package:cake_wallet/utils/show_bar.dart';
|
||||
import 'package:cake_wallet/utils/show_pop_up.dart';
|
||||
import 'package:cake_wallet/view_model/exchange/exchange_trade_view_model.dart';
|
||||
|
@ -12,12 +13,8 @@ import 'package:cake_wallet/view_model/send/output.dart';
|
|||
import 'package:cw_core/transaction_priority.dart';
|
||||
import 'package:cw_core/wallet_type.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:cake_wallet/themes/extensions/send_page_theme.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_mobx/flutter_mobx.dart';
|
||||
import '../../../../themes/extensions/cake_text_theme.dart';
|
||||
import '../../../../themes/extensions/transaction_trade_theme.dart';
|
||||
import '../../../../themes/theme_base.dart';
|
||||
|
||||
class ExchangeTradeCardItemWidget extends StatelessWidget {
|
||||
ExchangeTradeCardItemWidget({
|
||||
|
@ -32,7 +29,7 @@ class ExchangeTradeCardItemWidget extends StatelessWidget {
|
|||
final bool isReceiveDetailsCard;
|
||||
final FeesViewModel feesViewModel;
|
||||
final ExchangeTradeViewModel exchangeTradeViewModel;
|
||||
final ThemeBase currentTheme;
|
||||
final MaterialThemeBase currentTheme;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
@ -40,7 +37,7 @@ class ExchangeTradeCardItemWidget extends StatelessWidget {
|
|||
'assets/images/copy_content.png',
|
||||
height: 16,
|
||||
width: 16,
|
||||
color: Theme.of(context).extension<SendPageTheme>()!.estimatedFeeColor,
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
);
|
||||
|
||||
return Container(
|
||||
|
@ -154,7 +151,7 @@ class TradeItemRowWidget extends StatelessWidget {
|
|||
final String value;
|
||||
final bool isCopied;
|
||||
final Image copyImage;
|
||||
final ThemeBase currentTheme;
|
||||
final MaterialThemeBase currentTheme;
|
||||
|
||||
const TradeItemRowWidget({
|
||||
required this.title,
|
||||
|
@ -166,15 +163,6 @@ class TradeItemRowWidget extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
final hintTextColor = currentTheme == ThemeType.bright
|
||||
? Theme.of(context).extension<TransactionTradeTheme>()!.detailsTitlesColor
|
||||
: Colors.white.withAlpha(175);
|
||||
|
||||
final mainTextColor = currentTheme == ThemeType.bright
|
||||
? Theme.of(context).extension<CakeTextTheme>()!.titleColor
|
||||
: Colors.white;
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8),
|
||||
child: GestureDetector(
|
||||
|
@ -189,8 +177,8 @@ class TradeItemRowWidget extends StatelessWidget {
|
|||
value: value,
|
||||
image: isCopied ? copyImage : null,
|
||||
color: Colors.transparent,
|
||||
hintTextColor: hintTextColor,
|
||||
mainTextColor: mainTextColor,
|
||||
hintTextColor: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
mainTextColor: Theme.of(context).colorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
);
|
||||
|
@ -222,11 +210,10 @@ class FeeSelectionWidget extends StatelessWidget {
|
|||
children: <Widget>[
|
||||
Text(
|
||||
S.of(context).send_estimated_fee,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Colors.white,
|
||||
),
|
||||
style: Theme.of(context).textTheme.bodySmall?.copyWith(
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
|
@ -236,23 +223,20 @@ class FeeSelectionWidget extends StatelessWidget {
|
|||
children: [
|
||||
Text(
|
||||
'${output.estimatedFee} ${feesViewModel.currency}',
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Colors.white,
|
||||
),
|
||||
style: Theme.of(context).textTheme.bodySmall?.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
if (!feesViewModel.isFiatDisabled)
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 5),
|
||||
child: Text(
|
||||
'${output.estimatedFeeFiatAmount} ${feesViewModel.fiat.title}',
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w600,
|
||||
color:
|
||||
Theme.of(context).extension<SendPageTheme>()!.textFieldHintColor,
|
||||
),
|
||||
style: Theme.of(context).textTheme.bodySmall?.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
@ -262,7 +246,7 @@ class FeeSelectionWidget extends StatelessWidget {
|
|||
child: Icon(
|
||||
Icons.arrow_forward_ios,
|
||||
size: 12,
|
||||
color: Colors.white,
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
],
|
||||
|
@ -293,16 +277,15 @@ class CoinControlWidget extends StatelessWidget {
|
|||
children: [
|
||||
Text(
|
||||
S.of(context).coin_control,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Colors.white,
|
||||
),
|
||||
style: Theme.of(context).textTheme.bodySmall?.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
Icon(
|
||||
Icons.arrow_forward_ios,
|
||||
size: 12,
|
||||
color: Colors.white,
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
],
|
||||
),
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue