From 61a50b83652b6ef0d59cc5a12c4e8ac0cb09909f Mon Sep 17 00:00:00 2001 From: Rafael Saes Date: Thu, 17 Aug 2023 09:44:19 -0300 Subject: [PATCH] fix: merge fixes --- .../screens/contact/contact_list_page.dart | 6 +-- .../dashboard/widgets/balance_page.dart | 4 +- .../dashboard/widgets/menu_widget.dart | 52 +++++++++--------- .../monero_accounts/widgets/account_tile.dart | 42 +++++++-------- .../screens/receive/anonpay_receive_page.dart | 2 - lib/src/screens/send/send_page.dart | 2 +- .../screens/setup_2fa/setup_2fa_qr_page.dart | 1 + .../screens/wallet_keys/wallet_keys_page.dart | 2 +- lib/src/widgets/picker.dart | 40 ++++---------- lib/src/widgets/standard_list.dart | 53 +++++++------------ 10 files changed, 83 insertions(+), 121 deletions(-) diff --git a/lib/src/screens/contact/contact_list_page.dart b/lib/src/screens/contact/contact_list_page.dart index 68a16a3dd..bb9a16dce 100644 --- a/lib/src/screens/contact/contact_list_page.dart +++ b/lib/src/screens/contact/contact_list_page.dart @@ -77,12 +77,8 @@ class ContactListPage extends BasePage { final contacts = contactListViewModel.contactsToShow; final walletContacts = contactListViewModel.walletContactsToShow; return CollapsibleSectionList( - context: context, sectionCount: 2, - themeColor: Theme.of(context).primaryTextTheme.titleLarge!.color!, - dividerThemeColor: - Theme.of(context).primaryTextTheme.bodySmall!.decorationColor!, - sectionTitleBuilder: (_, int sectionIndex) { + sectionTitleBuilder: (int sectionIndex) { var title = S.current.contact_list_contacts; if (sectionIndex == 0) { diff --git a/lib/src/screens/dashboard/widgets/balance_page.dart b/lib/src/screens/dashboard/widgets/balance_page.dart index d762f1324..f799950ea 100644 --- a/lib/src/screens/dashboard/widgets/balance_page.dart +++ b/lib/src/screens/dashboard/widgets/balance_page.dart @@ -144,7 +144,7 @@ class BalancePage extends StatelessWidget { : Colors.transparent, width: 1, ), - color: Theme.of(context).textTheme.titleLarge!.backgroundColor!, + color: Theme.of(context).extension()!.syncedBackgroundColor, ), child: Container( margin: const EdgeInsets.only(top: 16, left: 24, right: 24, bottom: 24), @@ -212,7 +212,7 @@ class BalancePage extends StatelessWidget { fontSize: 28, fontFamily: 'Lato', fontWeight: FontWeight.w800, - color: Theme.of(context).accentTextTheme!.displayMedium!.backgroundColor!, + color: Theme.of(context).extension()!.assetTitleColor, height: 1)), ], ), diff --git a/lib/src/screens/dashboard/widgets/menu_widget.dart b/lib/src/screens/dashboard/widgets/menu_widget.dart index 9b3887a01..1424eb143 100644 --- a/lib/src/screens/dashboard/widgets/menu_widget.dart +++ b/lib/src/screens/dashboard/widgets/menu_widget.dart @@ -20,18 +20,18 @@ class MenuWidget extends StatefulWidget { class MenuWidgetState extends State { MenuWidgetState() - : this.menuWidth = 0, - this.screenWidth = 0, - this.screenHeight = 0, - this.headerHeight = 120, - this.tileHeight = 60, - this.fromTopEdge = 50, - this.fromBottomEdge = 25, - this.moneroIcon = Image.asset('assets/images/monero_menu.png'), - this.bitcoinIcon = Image.asset('assets/images/bitcoin_menu.png'), - this.litecoinIcon = Image.asset('assets/images/litecoin_menu.png'), - this.havenIcon = Image.asset('assets/images/haven_menu.png'), - this.ethereumIcon = Image.asset('assets/images/eth_icon.png'); + : this.menuWidth = 0, + this.screenWidth = 0, + this.screenHeight = 0, + this.headerHeight = 120, + this.tileHeight = 60, + this.fromTopEdge = 50, + this.fromBottomEdge = 25, + this.moneroIcon = Image.asset('assets/images/monero_menu.png'), + this.bitcoinIcon = Image.asset('assets/images/bitcoin_menu.png'), + this.litecoinIcon = Image.asset('assets/images/litecoin_menu.png'), + this.havenIcon = Image.asset('assets/images/haven_menu.png'), + this.ethereumIcon = Image.asset('assets/images/eth_icon.png'); final largeScreen = 731; @@ -87,15 +87,11 @@ class MenuWidgetState extends State { final itemCount = SettingActions.all.length; moneroIcon = Image.asset('assets/images/monero_menu.png', - color: Theme.of(context) - .accentTextTheme - .labelSmall! - .decorationColor!); + color: Theme.of(context).extension()!.iconColor); bitcoinIcon = Image.asset('assets/images/bitcoin_menu.png', - color: Theme.of(context) - .accentTextTheme - .labelSmall! - .decorationColor!); + color: Theme.of(context).extension()!.iconColor); + litecoinIcon = Image.asset('assets/images/litecoin_menu.png'); + havenIcon = Image.asset('assets/images/haven_menu.png'); return Row( mainAxisSize: MainAxisSize.max, @@ -115,8 +111,7 @@ class MenuWidgetState extends State { borderRadius: BorderRadius.only( topLeft: Radius.circular(24), bottomLeft: Radius.circular(24)), child: Container( - color: - Theme.of(context).extension()!.backgroundColor, + color: Theme.of(context).extension()!.backgroundColor, child: ListView.separated( padding: EdgeInsets.only(top: 0), itemBuilder: (_, index) { @@ -125,8 +120,13 @@ class MenuWidgetState extends State { height: headerHeight, decoration: BoxDecoration( gradient: LinearGradient(colors: [ - Theme.of(context).extension()!.headerFirstGradientColor, - Theme.of(context).extension()!.headerSecondGradientColor, ], begin: Alignment.topLeft, end: Alignment.bottomRight), + Theme.of(context) + .extension()! + .headerFirstGradientColor, + Theme.of(context) + .extension()! + .headerSecondGradientColor, + ], begin: Alignment.topLeft, end: Alignment.bottomRight), ), padding: EdgeInsets.only( left: 24, top: fromTopEdge, right: 24, bottom: fromBottomEdge), @@ -155,7 +155,9 @@ class MenuWidgetState extends State { builder: (_) => Text( widget.dashboardViewModel.subname, style: TextStyle( - color: Theme.of(context).extension()!.subnameTextColor, + color: Theme.of(context) + .extension()! + .subnameTextColor, fontWeight: FontWeight.w500, fontSize: 12), )) diff --git a/lib/src/screens/monero_accounts/widgets/account_tile.dart b/lib/src/screens/monero_accounts/widgets/account_tile.dart index 1ad781eaa..fa8221513 100644 --- a/lib/src/screens/monero_accounts/widgets/account_tile.dart +++ b/lib/src/screens/monero_accounts/widgets/account_tile.dart @@ -23,11 +23,11 @@ class AccountTile extends StatelessWidget { @override Widget build(BuildContext context) { final color = isCurrent - ? Theme.of(context).textTheme.titleSmall!.decorationColor! - : Theme.of(context).textTheme.displayLarge!.decorationColor!; + ? Theme.of(context).extension()!.currentAccountBackgroundColor + : Theme.of(context).extension()!.tilesBackgroundColor; final textColor = isCurrent - ? Theme.of(context).textTheme.titleSmall!.color! - : Theme.of(context).textTheme.displayLarge!.color!; + ? Theme.of(context).extension()!.currentAccountTextColor + : Theme.of(context).extension()!.tilesTextColor; final Widget cell = GestureDetector( onTap: onTap, @@ -63,7 +63,9 @@ class AccountTile extends StatelessWidget { fontSize: 15, fontWeight: FontWeight.w600, fontFamily: 'Lato', - color: Theme.of(context).textTheme.headlineMedium!.color!, + color: isCurrent + ? Theme.of(context).extension()!.currentAccountAmountColor + : Theme.of(context).extension()!.tilesAmountColor, decoration: TextDecoration.none, ), ), @@ -74,24 +76,20 @@ class AccountTile extends StatelessWidget { ); // return cell; - return Slidable( - key: Key(accountName), - child: cell, - endActionPane: _actionPane(context) - ); + return Slidable(key: Key(accountName), child: cell, endActionPane: _actionPane(context)); } ActionPane _actionPane(BuildContext context) => ActionPane( - motion: const ScrollMotion(), - extentRatio: 0.3, - children: [ - SlidableAction( - onPressed: (_) => onEdit.call(), - backgroundColor: Colors.blue, - foregroundColor: Colors.white, - icon: Icons.edit, - label: S.of(context).edit, - ), - ], - ); + motion: const ScrollMotion(), + extentRatio: 0.3, + children: [ + SlidableAction( + onPressed: (_) => onEdit.call(), + backgroundColor: Colors.blue, + foregroundColor: Colors.white, + icon: Icons.edit, + label: S.of(context).edit, + ), + ], + ); } diff --git a/lib/src/screens/receive/anonpay_receive_page.dart b/lib/src/screens/receive/anonpay_receive_page.dart index e9e32bc1f..1dae8e452 100644 --- a/lib/src/screens/receive/anonpay_receive_page.dart +++ b/lib/src/screens/receive/anonpay_receive_page.dart @@ -32,8 +32,6 @@ class AnonPayReceivePage extends BasePage { @override void onClose(BuildContext context) => Navigator.popUntil(context, (route) => route.isFirst); - void onClose(BuildContext context) => Navigator.popUntil(context, (route) => route.isFirst); - @override Widget middle(BuildContext context) { return Column( diff --git a/lib/src/screens/send/send_page.dart b/lib/src/screens/send/send_page.dart index fe495d8aa..dab78f3ef 100644 --- a/lib/src/screens/send/send_page.dart +++ b/lib/src/screens/send/send_page.dart @@ -63,7 +63,7 @@ class SendPage extends BasePage { Widget? leading(BuildContext context) { final _backButton = Icon( Icons.arrow_back_ios, - color: titleColor, + color: titleColor(context), size: 16, ); final _closeButton = currentTheme.type == ThemeType.dark diff --git a/lib/src/screens/setup_2fa/setup_2fa_qr_page.dart b/lib/src/screens/setup_2fa/setup_2fa_qr_page.dart index 6e83fffc3..82a079b39 100644 --- a/lib/src/screens/setup_2fa/setup_2fa_qr_page.dart +++ b/lib/src/screens/setup_2fa/setup_2fa_qr_page.dart @@ -6,6 +6,7 @@ import 'package:cake_wallet/src/widgets/standard_list.dart'; import 'package:cake_wallet/generated/i18n.dart'; import 'package:cake_wallet/palette.dart'; import 'package:cake_wallet/routes.dart'; +import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart'; import 'package:cake_wallet/utils/clipboard_util.dart'; import 'package:cake_wallet/utils/show_bar.dart'; import 'package:cake_wallet/view_model/set_up_2fa_viewmodel.dart'; diff --git a/lib/src/screens/wallet_keys/wallet_keys_page.dart b/lib/src/screens/wallet_keys/wallet_keys_page.dart index 8ec8a1a00..d15de875d 100644 --- a/lib/src/screens/wallet_keys/wallet_keys_page.dart +++ b/lib/src/screens/wallet_keys/wallet_keys_page.dart @@ -87,7 +87,7 @@ class WalletKeysPage extends BasePage { height: 1, padding: EdgeInsets.only(left: 24), color: Theme.of(context).accentTextTheme.titleLarge!.backgroundColor!, - child: const SectionDivider(), + child: const HorizontalSectionDivider(), ), itemCount: walletKeysViewModel.items.length, itemBuilder: (BuildContext context, int index) { diff --git a/lib/src/widgets/picker.dart b/lib/src/widgets/picker.dart index 96749d20b..16f386917 100644 --- a/lib/src/widgets/picker.dart +++ b/lib/src/widgets/picker.dart @@ -147,9 +147,7 @@ class _PickerState extends State> { child: ClipRRect( borderRadius: BorderRadius.all(Radius.circular(30)), child: Container( - color: Theme.of(context) - .accentTextTheme.titleLarge! - .color!, + color: Theme.of(context).accentTextTheme.titleLarge!.color!, child: ConstrainedBox( constraints: BoxConstraints( maxHeight: containerHeight, @@ -164,9 +162,7 @@ class _PickerState extends State> { child: SearchBarWidget(searchController: searchController), ), Divider( - color: Theme.of(context) - .accentTextTheme.titleLarge! - .backgroundColor!, + color: Theme.of(context).accentTextTheme.titleLarge!.backgroundColor!, height: 1, ), if (widget.selectedAtIndex != -1) buildSelectedItem(widget.selectedAtIndex), @@ -214,9 +210,7 @@ class _PickerState extends State> { Widget itemsList() { return Container( - color: Theme.of(context) - .accentTextTheme.titleLarge! - .backgroundColor!, + color: Theme.of(context).accentTextTheme.titleLarge!.backgroundColor!, child: widget.isGridView ? GridView.builder( padding: EdgeInsets.zero, @@ -236,9 +230,7 @@ class _PickerState extends State> { shrinkWrap: true, separatorBuilder: (context, index) => widget.isSeparated ? Divider( - color: Theme.of(context) - .accentTextTheme.titleLarge! - .backgroundColor!, + color: Theme.of(context).accentTextTheme.titleLarge!.backgroundColor!, height: 1, ) : const SizedBox(), @@ -263,9 +255,7 @@ class _PickerState extends State> { }, child: Container( height: 55, - color: Theme.of(context) - .accentTextTheme.titleLarge! - .color!, + color: Theme.of(context).accentTextTheme.titleLarge!.color!, padding: EdgeInsets.symmetric(horizontal: 24), child: Row( mainAxisSize: MainAxisSize.max, @@ -286,9 +276,7 @@ class _PickerState extends State> { fontSize: 14, fontFamily: 'Lato', fontWeight: FontWeight.w600, - color: Theme.of(context) - .primaryTextTheme.titleLarge! - .color!, + color: Theme.of(context).primaryTextTheme.titleLarge!.color!, decoration: TextDecoration.none, ), ), @@ -313,9 +301,7 @@ class _PickerState extends State> { decoration: BoxDecoration( borderRadius: BorderRadius.circular(6.0), //border: Border.all(color: ), - color: Theme.of(context) - .textTheme.bodyMedium! - .decorationColor!, + color: Theme.of(context).extension()!.trackColor, ), ), ), @@ -343,9 +329,7 @@ class _PickerState extends State> { }, child: Container( height: 55, - color: Theme.of(context) - .accentTextTheme.titleLarge! - .color!, + color: Theme.of(context).accentTextTheme.titleLarge!.color!, padding: EdgeInsets.symmetric(horizontal: 24), child: Row( mainAxisSize: MainAxisSize.max, @@ -366,9 +350,7 @@ class _PickerState extends State> { fontSize: 16, fontFamily: 'Lato', fontWeight: FontWeight.w700, - color: Theme.of(context) - .primaryTextTheme.titleLarge! - .color!, + color: Theme.of(context).primaryTextTheme.titleLarge!.color!, decoration: TextDecoration.none, ), ), @@ -393,9 +375,7 @@ class _PickerState extends State> { decoration: BoxDecoration( borderRadius: BorderRadius.circular(6.0), //border: Border.all(color: ), - color: Theme.of(context) - .textTheme.bodyMedium! - .decorationColor!, + color: Theme.of(context).extension()!.trackColor, ), ), ), diff --git a/lib/src/widgets/standard_list.dart b/lib/src/widgets/standard_list.dart index 938928b9f..09329ce03 100644 --- a/lib/src/widgets/standard_list.dart +++ b/lib/src/widgets/standard_list.dart @@ -5,8 +5,7 @@ import 'package:cake_wallet/src/widgets/standard_list_status_row.dart'; import 'package:flutter/material.dart'; class StandardListRow extends StatelessWidget { - StandardListRow( - {required this.title, required this.isSelected, this.onTap, this.decoration}); + StandardListRow({required this.title, required this.isSelected, this.onTap, this.decoration}); final String title; final bool isSelected; @@ -23,16 +22,15 @@ class StandardListRow extends StatelessWidget { child: Container( height: 56, padding: EdgeInsets.only(left: 24, right: 24), - decoration: decoration ?? BoxDecoration( - color: Theme.of(context).colorScheme.background, - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - if (leading != null) leading, - buildCenter(context, hasLeftOffset: leading != null), - if (trailing != null) trailing - ]))); + decoration: decoration ?? + BoxDecoration( + color: Theme.of(context).colorScheme.background, + ), + child: Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ + if (leading != null) leading, + buildCenter(context, hasLeftOffset: leading != null), + if (trailing != null) trailing + ]))); } Widget? buildLeading(BuildContext context) => null; @@ -58,8 +56,8 @@ class StandardListRow extends StatelessWidget { Widget? buildTrailing(BuildContext context) => null; Color titleColor(BuildContext context) => isSelected - ? Palette.blueCraiola - : Theme.of(context).primaryTextTheme.titleLarge!.color!; + ? Theme.of(context).primaryColor + : Theme.of(context).extension()!.titleColor; Color _backgroundColor(BuildContext context) { return Theme.of(context).colorScheme.background; @@ -71,15 +69,12 @@ 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)) ]); } class StandardListSeparator extends StatelessWidget { - const StandardListSeparator({this.padding, this.height = 1}); final EdgeInsets? padding; @@ -92,11 +87,7 @@ class StandardListSeparator extends StatelessWidget { padding: padding, color: Theme.of(context).colorScheme.background, child: Container( - height: height, - color: Theme.of(context) - .primaryTextTheme - .titleLarge - ?.backgroundColor)); + height: height, color: Theme.of(context).primaryTextTheme.titleLarge?.backgroundColor)); } } @@ -109,8 +100,7 @@ class StandardList extends StatelessWidget { @override Widget build(BuildContext context) { return ListView.separated( - separatorBuilder: (_, __) => - StandardListSeparator(padding: EdgeInsets.only(left: 24)), + separatorBuilder: (_, __) => StandardListSeparator(padding: EdgeInsets.only(left: 24)), itemCount: itemCount, itemBuilder: itemBuilder); } @@ -178,8 +168,7 @@ class SectionStandardList extends StatelessWidget { return sectionTitleBuilder!.call(sectionIndex); } - List buildSection( - int itemCount, List items, int sectionIndex) { + List buildSection(int itemCount, List items, int sectionIndex) { final List section = []; for (var itemIndex = 0; itemIndex < itemCount; itemIndex++) { @@ -192,8 +181,8 @@ class SectionStandardList extends StatelessWidget { @override Widget build(BuildContext context) { - totalRows.addAll(transform(hasTopSeparator, sectionCount, itemCounter, - itemBuilder, sectionTitleBuilder)); + totalRows.addAll( + transform(hasTopSeparator, sectionCount, itemCounter, itemBuilder, sectionTitleBuilder)); return ListView.separated( separatorBuilder: (_, index) { @@ -203,16 +192,14 @@ class SectionStandardList extends StatelessWidget { return Container(); } - if (row is StandardListStatusRow || - row is TradeDetailsStandardListCard) { + if (row is StandardListStatusRow || row is TradeDetailsStandardListCard) { return Container(); } final nextRow = totalRows[index + 1]; // If current row is pre last and last row is separator. - if (nextRow is StandardListSeparator || - nextRow is SectionHeaderListRow) { + if (nextRow is StandardListSeparator || nextRow is SectionHeaderListRow) { return Container(); }