Flutter update (#1048)

* Update Flutter
Update packages

* Fix localization issues
Fix UI issues
Update old packages
Update workflow
Update how to build guide

* Additional UI fixes for merged conflicts
This commit is contained in:
Omar Hatem
2023-08-18 18:37:17 +03:00
committed by GitHub
parent 09c942564e
commit 9ddab2b472
27 changed files with 311 additions and 282 deletions
@@ -13,7 +13,6 @@ import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/routes.dart';
import 'package:cake_wallet/src/screens/yat_emoji_id.dart';
import 'package:cake_wallet/src/widgets/alert_with_one_action.dart';
import 'package:cake_wallet/themes/theme_base.dart';
import 'package:cake_wallet/utils/responsive_layout_util.dart';
import 'package:cake_wallet/utils/show_pop_up.dart';
import 'package:flutter/material.dart';
@@ -109,7 +108,7 @@ class _DashboardPageView extends BasePage {
Widget trailing(BuildContext context) {
final menuButton = Image.asset(
'assets/images/menu.png',
color: Theme.of(context).accentTextTheme.displayMedium!.backgroundColor,
color: Theme.of(context).extension<DashboardPageTheme>()!.pageTitleTextColor,
);
return Container(
@@ -128,6 +127,7 @@ class _DashboardPageView extends BasePage {
final DashboardViewModel dashboardViewModel;
final WalletAddressListViewModel addressListViewModel;
int get initialPage => dashboardViewModel.shouldShowMarketPlaceInDashboard ? 1 : 0;
ObservableList<Widget> pages = ObservableList<Widget>();
bool _isEffectsInstalled = false;
@@ -1,5 +1,4 @@
import 'package:cake_wallet/themes/extensions/keyboard_theme.dart';
import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
import 'package:cake_wallet/anonpay/anonpay_donation_link_info.dart';
import 'package:cake_wallet/entities/preferences_key.dart';
import 'package:cake_wallet/entities/receive_page_option.dart';
@@ -64,14 +63,6 @@ class AddressPage extends BasePage {
@override
Widget? leading(BuildContext context) {
final _backButton = Icon(
Icons.arrow_back_ios,
color: Theme.of(context).accentTextTheme.displayMedium!.backgroundColor!,
size: 16,
);
final _closeButton =
currentTheme.type == ThemeType.dark ? closeButtonImageDarkTheme : closeButtonImage;
bool isMobileView = ResponsiveLayoutUtil.instance.isMobile;
return MergeSemantics(
@@ -119,11 +110,7 @@ class AddressPage extends BasePage {
context: context,
);
},
icon: Icon(
Icons.share,
size: 20,
color: Theme.of(context).accentTextTheme.displayMedium!.backgroundColor!,
),
icon: Icon(Icons.share, size: 20, color: pageIconColor(context)),
),
);
}
@@ -160,10 +147,10 @@ class AddressPage extends BasePage {
return KeyboardActions(
autoScroll: false,
disableScroll: true,
tapOutsideToDismiss: true,
tapOutsideBehavior: TapOutsideBehavior.translucentDismiss,
config: KeyboardActionsConfig(
keyboardActionsPlatform: KeyboardActionsPlatform.IOS,
keyboardBarColor: Theme.of(context).accentTextTheme.bodyLarge!.backgroundColor!,
keyboardBarColor: Theme.of(context).extension<KeyboardTheme>()!.keyboardBarColor,
nextFocus: false,
actions: [
KeyboardActionsItem(
+1 -2
View File
@@ -5,7 +5,6 @@ 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/utils/debounce.dart';
import 'package:cake_wallet/utils/responsive_layout_util.dart';
@@ -250,7 +249,7 @@ class ExchangePage extends BasePage {
}
}
},
color: Theme.of(context).accentTextTheme.bodyLarge!.color!,
color: Theme.of(context).primaryColor,
textColor: Colors.white,
isDisabled: exchangeViewModel.selectedProviders.isEmpty,
isLoading: exchangeViewModel.tradeState is TradeIsCreating)),
@@ -1,3 +1,4 @@
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';
@@ -24,7 +25,7 @@ class RestoreButton extends StatelessWidget {
alignment: Alignment.topLeft,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(12)),
color: Theme.of(context).accentTextTheme.bodySmall!.color!,
color: Theme.of(context).cardColor,
),
child: Row(
mainAxisSize: MainAxisSize.max,
@@ -43,24 +44,22 @@ class RestoreButton extends StatelessWidget {
Text(
title,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w500,
color: Theme.of(context)
.primaryTextTheme
.titleLarge!
.color!),
fontSize: 16,
fontWeight: FontWeight.w500,
color: Theme.of(context).extension<CakeTextTheme>()!.titleColor,
),
),
Padding(
padding: EdgeInsets.only(top: 5),
child: Text(
description,
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.normal,
color: Theme.of(context)
.primaryTextTheme
.labelSmall!
.color!),
fontSize: 14,
fontWeight: FontWeight.normal,
color: Theme.of(context)
.extension<TransactionTradeTheme>()!
.detailsTitlesColor,
),
),
)
],
+1 -3
View File
@@ -6,8 +6,6 @@ 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/theme_base.dart';
import 'package:cake_wallet/utils/responsive_layout_util.dart';
import 'package:cw_core/wallet_type.dart';
import 'package:flutter/material.dart';
class PreSeedPage extends BasePage {
@@ -62,7 +60,7 @@ class PreSeedPage extends BasePage {
onPressed: () =>
Navigator.of(context).popAndPushNamed(Routes.seed, arguments: true),
text: S.of(context).pre_seed_button_text,
color: Theme.of(context).accentTextTheme.bodyLarge!.color!,
color: Theme.of(context).primaryColor,
textColor: Colors.white)
],
),
+6 -21
View File
@@ -208,14 +208,8 @@ class SendPage extends BasePage {
radius: 6.0,
dotWidth: 6.0,
dotHeight: 6.0,
dotColor: Theme.of(context)
.primaryTextTheme!
.displaySmall!
.backgroundColor!,
activeDotColor: Theme.of(context)
.primaryTextTheme!
.displayMedium!
.backgroundColor!),
dotColor: Theme.of(context).extension<SendPageTheme>()!.indicatorDotColor,
activeDotColor: Theme.of(context).extension<SendPageTheme>()!.templateBackgroundColor),
)
: Offstage();
},
@@ -340,10 +334,7 @@ class SendPage extends BasePage {
text:
'Change your asset (${sendViewModel.selectedCryptoCurrency})',
color: Colors.transparent,
textColor: Theme.of(context)
.accentTextTheme!
.displaySmall!
.decorationColor!,
textColor: Theme.of(context).extension<SeedWidgetTheme>()!.hintTextColor,
))),
if (sendViewModel.sendTemplateViewModel.hasMultiRecipient)
Padding(
@@ -358,15 +349,9 @@ class SendPage extends BasePage {
},
text: S.of(context).add_receiver,
color: Colors.transparent,
textColor: Theme.of(context)
.accentTextTheme!
.displaySmall!
.decorationColor!,
textColor: Theme.of(context).extension<SeedWidgetTheme>()!.hintTextColor,
isDottedBorder: true,
borderColor: Theme.of(context)
.primaryTextTheme!
.displaySmall!
.decorationColor!,
borderColor: Theme.of(context).extension<SendPageTheme>()!.templateDottedBorderColor,
)),
Observer(
builder: (_) {
@@ -387,7 +372,7 @@ class SendPage extends BasePage {
item.cryptoAmount.isEmpty)
.toList();
if (notValidItems.isNotEmpty ?? false) {
if (notValidItems.isNotEmpty) {
showErrorValidationAlert(context);
return;
}
+5 -8
View File
@@ -167,8 +167,8 @@ class SendCardState extends State<SendCard> with AutomaticKeepAliveClientMixin<S
AddressTextFieldOption.qrCode,
AddressTextFieldOption.addressBook
],
buttonColor: Theme.of(context).primaryTextTheme.headlineMedium!.color!,
borderColor: Theme.of(context).primaryTextTheme.headlineSmall!.color!,
buttonColor: Theme.of(context).extension<SendPageTheme>()!.textFieldButtonColor,
borderColor: Theme.of(context).extension<SendPageTheme>()!.textFieldBorderColor,
textStyle: TextStyle(
fontSize: 14, fontWeight: FontWeight.w500, color: Colors.white),
hintStyle: TextStyle(
@@ -403,14 +403,11 @@ class SendCardState extends State<SendCard> with AutomaticKeepAliveClientMixin<S
),
),
hintText: '0.00',
borderColor: Theme.of(context).primaryTextTheme.headlineSmall!.color!,
borderColor: Theme.of(context).extension<SendPageTheme>()!.textFieldBorderColor,
textStyle: TextStyle(
fontSize: 14, fontWeight: FontWeight.w500, color: Colors.white),
placeholderTextStyle: TextStyle(
color: Theme.of(context)
.primaryTextTheme
.headlineSmall!
.decorationColor!,
color: Theme.of(context).extension<SendPageTheme>()!.textFieldHintColor,
fontWeight: FontWeight.w500,
fontSize: 14),
),
@@ -421,7 +418,7 @@ class SendCardState extends State<SendCard> with AutomaticKeepAliveClientMixin<S
controller: noteController,
keyboardType: TextInputType.multiline,
maxLines: null,
borderColor: Theme.of(context).primaryTextTheme.headlineSmall!.color!,
borderColor: Theme.of(context).extension<SendPageTheme>()!.textFieldBorderColor,
textStyle: TextStyle(
fontSize: 14, fontWeight: FontWeight.w500, color: Colors.white),
hintText: S.of(context).note_optional,
@@ -59,7 +59,7 @@ class SettingsChoicesCell extends StatelessWidget {
style: TextStyle(
color: isSelected
? Colors.white
: Theme.of(context).primaryTextTheme.bodySmall!.color!,
: Theme.of(context).extension<CakeTextTheme>()!.secondaryTextColor,
fontWeight: isSelected ? FontWeight.w700 : FontWeight.normal,
),
),
+119 -114
View File
@@ -1,10 +1,8 @@
import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
import 'package:cake_wallet/core/auth_service.dart';
import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart';
import 'package:cake_wallet/themes/extensions/receive_page_theme.dart';
import 'package:cake_wallet/utils/responsive_layout_util.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';
import 'package:another_flushbar/flushbar.dart';
import 'package:flutter/material.dart';
@@ -66,106 +64,110 @@ class WalletListBodyState extends State<WalletListBody> {
return Container(
padding: EdgeInsets.only(top: 16),
child: ScrollableWithBottomSection(
contentPadding: EdgeInsets.only(bottom: 20),
content: Container(
child: Observer(
builder: (_) => ListView.separated(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
separatorBuilder: (_, index) =>
Divider(color: Theme.of(context).colorScheme.background, height: 32),
itemCount: widget.walletListViewModel.wallets.length,
itemBuilder: (__, index) {
final wallet = widget.walletListViewModel.wallets[index];
final currentColor = wallet.isCurrent
? Theme.of(context)
.extension<WalletListTheme>()!
.createNewWalletButtonBackgroundColor
: Theme.of(context).colorScheme.background;
final row = GestureDetector(
onTap: () => wallet.isCurrent ? null : _loadWallet(wallet),
child: Container(
contentPadding: EdgeInsets.only(bottom: 20),
content: Container(
child: Observer(
builder: (_) => ListView.separated(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
separatorBuilder: (_, index) =>
Divider(color: Theme.of(context).colorScheme.background, height: 32),
itemCount: widget.walletListViewModel.wallets.length,
itemBuilder: (__, index) {
final wallet = widget.walletListViewModel.wallets[index];
final currentColor = wallet.isCurrent
? Theme.of(context)
.extension<WalletListTheme>()!
.createNewWalletButtonBackgroundColor
: Theme.of(context).colorScheme.background;
final row = GestureDetector(
onTap: () => wallet.isCurrent ? null : _loadWallet(wallet),
child: Container(
height: tileHeight,
width: double.infinity,
child: Row(
children: <Widget>[
Container(
height: tileHeight,
width: double.infinity,
child: Row(
children: <Widget>[
Container(
height: tileHeight,
width: 4,
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
topRight: Radius.circular(4),
bottomRight: Radius.circular(4)),
color: currentColor),
),
Expanded(
child: Container(
height: tileHeight,
padding: EdgeInsets.only(left: 20, right: 20),
color: Theme.of(context).colorScheme.background,
alignment: Alignment.centerLeft,
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
wallet.isEnabled
? _imageFor(type: wallet.type)
: nonWalletTypeIcon,
SizedBox(width: 10),
Flexible(
child: Text(
wallet.name,
maxLines: null,
softWrap: true,
style: TextStyle(
fontSize: 22,
fontWeight: FontWeight.w500,
color: Theme.of(context)
.extension<CakeTextTheme>()!
.titleColor),
))
]),
),
),
],
),
));
return wallet.isCurrent
? row
: Row(children: [
Expanded(child: row),
GestureDetector(
onTap: () => Navigator.of(context).pushNamed(Routes.walletEdit,
arguments: [widget.walletListViewModel, wallet]),
child: Container(
padding: EdgeInsets.only(right: 20),
child: Center(
child: Container(
height: 40,
width: 44,
padding: EdgeInsets.all(10),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Theme.of(context)
.extension<ReceivePageTheme>()!
.iconsBackgroundColor),
child: Icon(
Icons.edit,
size: 14,
color: Theme.of(context)
.extension<ReceivePageTheme>()!
.iconsColor,
width: 4,
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
topRight: Radius.circular(4), bottomRight: Radius.circular(4)),
color: currentColor),
),
Expanded(
child: Container(
height: tileHeight,
padding: EdgeInsets.only(left: 20, right: 20),
color: Theme.of(context).colorScheme.background,
alignment: Alignment.centerLeft,
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
wallet.isEnabled ? _imageFor(type: wallet.type) : nonWalletTypeIcon,
SizedBox(width: 10),
Flexible(
child: Text(
wallet.name,
maxLines: null,
softWrap: true,
style: TextStyle(
fontSize: 22,
fontWeight: FontWeight.w500,
color:
Theme.of(context).extension<CakeTextTheme>()!.titleColor,
),
),
),
],
),
),
),
],
),
),
);
return wallet.isCurrent
? row
: Row(
children: [
Expanded(child: row),
GestureDetector(
onTap: () => Navigator.of(context).pushNamed(Routes.walletEdit,
arguments: [widget.walletListViewModel, wallet]),
child: Container(
padding: EdgeInsets.only(right: 20),
child: Center(
child: Container(
height: 40,
width: 44,
padding: EdgeInsets.all(10),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Theme.of(context)
.extension<ReceivePageTheme>()!
.iconsBackgroundColor,
),
child: Icon(
Icons.edit,
size: 14,
color:
Theme.of(context).extension<ReceivePageTheme>()!.iconsColor,
),
),
),
)
]);
}),
),
),
],
);
},
),
),
bottomSectionPadding: EdgeInsets.only(bottom: 24, right: 24, left: 24),
bottomSection: Column(children: <Widget>[
),
bottomSectionPadding: EdgeInsets.only(bottom: 24, right: 24, left: 24),
bottomSection: Column(
children: <Widget>[
PrimaryImageButton(
onPressed: () {
//TODO(David): Find a way to optimize this
@@ -199,29 +201,32 @@ class WalletListBodyState extends State<WalletListBody> {
},
image: newWalletImage,
text: S.of(context).wallet_list_create_new_wallet,
color: Theme.of(context).accentTextTheme.bodyLarge!.color!,
color: Theme.of(context).primaryColor,
textColor: Colors.white,
),
SizedBox(height: 10.0),
PrimaryImageButton(
onPressed: () {
if (widget.walletListViewModel.shouldRequireTOTP2FAForCreatingNewWallets) {
widget.authService.authenticateAction(
context,
route: Routes.restoreOptions,
arguments: false,
conditionToDetermineIfToUse2FA:
widget.walletListViewModel.shouldRequireTOTP2FAForCreatingNewWallets,
);
} else {
Navigator.of(context).pushNamed(Routes.restoreOptions, arguments: false);
}
},
image: restoreWalletImage,
text: S.of(context).wallet_list_restore_wallet,
color: Theme.of(context).accentTextTheme.bodySmall!.color!,
textColor: Theme.of(context).primaryTextTheme.titleLarge!.color!)
])),
onPressed: () {
if (widget.walletListViewModel.shouldRequireTOTP2FAForCreatingNewWallets) {
widget.authService.authenticateAction(
context,
route: Routes.restoreOptions,
arguments: false,
conditionToDetermineIfToUse2FA:
widget.walletListViewModel.shouldRequireTOTP2FAForCreatingNewWallets,
);
} else {
Navigator.of(context).pushNamed(Routes.restoreOptions, arguments: false);
}
},
image: restoreWalletImage,
text: S.of(context).wallet_list_restore_wallet,
color: Theme.of(context).cardColor,
textColor: Theme.of(context).extension<CakeTextTheme>()!.buttonTextColor,
)
],
),
),
);
}
+11 -5
View File
@@ -72,7 +72,10 @@ class SectionHeaderListRow extends StatelessWidget {
Widget build(BuildContext context) => Column(children: [
StandardListSeparator(padding: EdgeInsets.only(left: 24)),
Container(
width: double.infinity, height: 40, color: Theme.of(context).colorScheme.background),
width: double.infinity,
height: 40,
color: Theme.of(context).colorScheme.background,
),
//StandardListSeparator(padding: EdgeInsets.only(left: 24))
]);
}
@@ -86,11 +89,14 @@ class StandardListSeparator extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
height: height,
padding: padding,
color: Theme.of(context).colorScheme.background,
child: Container(
height: height,
padding: padding,
color: Theme.of(context).colorScheme.background,
child: Container(
height: height, color: Theme.of(context).primaryTextTheme.titleLarge?.backgroundColor));
color: Theme.of(context).extension<CakeTextTheme>()!.textfieldUnderlineColor,
),
);
}
}