Cw 396 additional themes (#962)

* fix: SectionStandardList using BuildContext as param

* refactor: deprecated backgroundColor -> colorScheme.background

* refactor: themeBase and current themes

* refactor: accentTextTheme.titleLarge.color -> dialogTheme.backgroundColor

* refactor: gradient background

* refactor: text themes using the same color as primaryColor

* refactor: accentTextTheme.bodySmall.color -> cardColor

* refactor: text themes using same dialogBackgroundColor

* refactor: scrollbarTheme

* refactor: create SyncIndicatorTheme

* refactor: SectionDivider

* refactor: base_page improvements and simplify

* refactor: collapsible_standart_list improvements

* refactor: accentTextTheme.bodyLarge.backgroundColor -> KeyboardTheme.keyboardBarColor

* refactor: create PinCodeTheme for accentTextTheme.bodyMedium

* refactor: create SupportPageTheme for accentTextTheme.displayLarge.backgroundColor and fix cases that use it

* refactor: accentTextTheme.displayLarge.color -> disabledColor

* refactor: create ExchangePageTheme

* refactor: create DashboardPageTheme and use textColor

* refactor: create NewWalletTheme for accentTextTheme.displayMedium

* refactor: create BalancePageTheme for accentTextTheme.displaySmall.backgroundColor

* refactor: create AddressTheme for accentTextTheme.displaySmall.color

* refactor: create IndicatorDotTheme

* refactor: create CakeMenuTheme

* refactor: create FilterTheme

* refactor: create WalletListTheme

* refactor: accentTextTheme.bodySmall.decorationColor -> InfoTheme.textColor

* refactor: accentTextTheme.titleLarge.backgroundColor -> PickerTheme.dividerColor

* refactor: primaryTextTheme.bodyLarge.backgroundColor -> AlertTheme.leftButtonTextColor

* refactor: primaryTextTheme.displayLarge.backgroundColor -> OrderTheme.iconColor

* refactor: create SendPageTheme

* fix: missing migrated styles

* refactor: primaryTextTheme.labelSmall.decorationColor -> PlaceholderTheme.color

* refactor: create TransactionTradeTheme

* refactor: create CakeTextTheme

* refactor: create AccountListTheme

* refactor: create ReceivePageTheme

* refactor: create QRCodeTheme

* refactor: move remaining items to CakeTextTheme and some missing fixes

* feat(display_settings): add new theme selector

* feat: additional themes

* fix: conflict error

* fix(lag): move colorScheme initialization to constructor

* feat: add backdropColor to alert and picker backdrop filters

* fix: merge fixes

* fix: send template page missing new colors

* fix: anonpay pages title and icon colors

* fix: merge fixes

* fix: unspent coins page

* fix: also fix exchange template

* fix: missing checkbox

* fix: fixes for high contrast theme

* Merge branch 'main' into CW-396-additional-themes

* fix: merge fixes

* fix: .gitignore and rm added files

* Fix review comments

---------

Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>
This commit is contained in:
Rafael Saes
2023-08-17 18:28:31 +03:00
committed by GitHub
co-authored by OmarHatem
parent 5ec930cbc6
commit 09c942564e
229 changed files with 4089 additions and 2869 deletions
+4 -9
View File
@@ -2,6 +2,7 @@ import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/utils/responsive_layout_util.dart';
import 'package:dotted_border/dotted_border.dart';
import 'package:flutter/material.dart';
import 'package:cake_wallet/themes/extensions/send_page_theme.dart';
class AddTemplateButton extends StatelessWidget {
final Function() onTap;
@@ -20,7 +21,7 @@ class AddTemplateButton extends StatelessWidget {
borderType: BorderType.RRect,
dashPattern: [6, 4],
color:
Theme.of(context).primaryTextTheme!.displaySmall!.decorationColor!,
Theme.of(context).extension<SendPageTheme>()!.templateDottedBorderColor,
strokeWidth: 2,
radius: Radius.circular(20),
child: Container(
@@ -35,20 +36,14 @@ class AddTemplateButton extends StatelessWidget {
child: currentTemplatesLength >= 1
? Icon(
Icons.add,
color: Theme.of(context)
.primaryTextTheme!
.displayMedium!
.color!,
color: Theme.of(context).extension<SendPageTheme>()!.templateNewTextColor,
)
: Text(
S.of(context).new_template,
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w600,
color: Theme.of(context)
.primaryTextTheme!
.displayMedium!
.color!,
color: Theme.of(context).extension<SendPageTheme>()!.templateNewTextColor,
),
),
),
+13 -13
View File
@@ -1,3 +1,4 @@
import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
import 'package:cake_wallet/utils/device_info.dart';
import 'package:cake_wallet/utils/responsive_layout_util.dart';
import 'package:flutter/services.dart';
@@ -7,6 +8,7 @@ import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/entities/qr_scanner.dart';
import 'package:cake_wallet/entities/contact_base.dart';
import 'package:cw_core/crypto_currency.dart';
import 'package:cake_wallet/themes/extensions/send_page_theme.dart';
enum AddressTextFieldOption { paste, qrCode, addressBook }
@@ -64,7 +66,8 @@ class AddressTextField extends StatelessWidget {
controller: controller,
focusNode: focusNode,
style: textStyle ??
TextStyle(fontSize: 16, color: Theme.of(context).primaryTextTheme.titleLarge!.color!),
TextStyle(
fontSize: 16, color: Theme.of(context).extension<CakeTextTheme>()!.titleColor),
decoration: InputDecoration(
suffixIcon: SizedBox(
width: prefixIconWidth * options.length + (spaceBetweenPrefixIcons * options.length),
@@ -113,15 +116,14 @@ class AddressTextField extends StatelessWidget {
padding: EdgeInsets.all(8),
decoration: BoxDecoration(
color: buttonColor ??
Theme.of(context).accentTextTheme.titleLarge!.color!,
Theme.of(context).dialogTheme.backgroundColor,
borderRadius: BorderRadius.all(Radius.circular(6))),
child: Image.asset(
'assets/images/paste_ios.png',
color: iconColor ??
Theme.of(context)
.primaryTextTheme
.headlineMedium!
.decorationColor!,
.extension<SendPageTheme>()!
.textFieldButtonIconColor,
)),
),
)),
@@ -140,15 +142,14 @@ class AddressTextField extends StatelessWidget {
padding: EdgeInsets.all(8),
decoration: BoxDecoration(
color: buttonColor ??
Theme.of(context).accentTextTheme.titleLarge!.color!,
Theme.of(context).dialogTheme.backgroundColor,
borderRadius: BorderRadius.all(Radius.circular(6))),
child: Image.asset(
'assets/images/qr_code_icon.png',
color: iconColor ??
Theme.of(context)
.primaryTextTheme
.headlineMedium!
.decorationColor!,
.extension<SendPageTheme>()!
.textFieldButtonIconColor,
)),
),
))
@@ -167,15 +168,14 @@ class AddressTextField extends StatelessWidget {
padding: EdgeInsets.all(8),
decoration: BoxDecoration(
color: buttonColor ??
Theme.of(context).accentTextTheme.titleLarge!.color!,
Theme.of(context).dialogTheme.backgroundColor,
borderRadius: BorderRadius.all(Radius.circular(6))),
child: Image.asset(
'assets/images/open_book.png',
color: iconColor ??
Theme.of(context)
.primaryTextTheme
.headlineMedium!
.decorationColor!,
.extension<SendPageTheme>()!
.textFieldButtonIconColor,
)),
),
))
+4 -2
View File
@@ -1,7 +1,7 @@
import 'dart:ui';
import 'package:cake_wallet/themes/extensions/alert_theme.dart';
import 'package:cake_wallet/utils/responsive_layout_util.dart';
import 'package:flutter/material.dart';
import 'package:cake_wallet/palette.dart';
class AlertBackground extends StatelessWidget {
AlertBackground({required this.child});
@@ -20,7 +20,9 @@ class AlertBackground extends StatelessWidget {
child: BackdropFilter(
filter: ImageFilter.blur(sigmaX: 3.0, sigmaY: 3.0),
child: Container(
decoration: BoxDecoration(color: PaletteDark.darkNightBlue.withOpacity(0.75)),
decoration: BoxDecoration(
color:
Theme.of(context).extension<AlertTheme>()!.backdropColor),
child: Center(
child: Container(
width: ResponsiveLayoutUtil.kDesktopMaxWidthConstraint,
+2 -8
View File
@@ -31,10 +31,7 @@ class AlertWithOneAction extends BaseAlertDialog {
width: 300,
height: 52,
padding: EdgeInsets.only(left: 12, right: 12),
color: Theme.of(context)
.accentTextTheme!
.bodyMedium!
.backgroundColor!,
color: Theme.of(context).dialogBackgroundColor,
child: ButtonTheme(
minWidth: double.infinity,
child: TextButton(
@@ -48,10 +45,7 @@ class AlertWithOneAction extends BaseAlertDialog {
style: TextStyle(
fontSize: 15,
fontWeight: FontWeight.w600,
color: Theme.of(context)
.primaryTextTheme!
.bodyMedium!
.backgroundColor!,
color: Theme.of(context).primaryColor,
decoration: TextDecoration.none,
),
)),
+15 -26
View File
@@ -1,5 +1,7 @@
import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
import 'dart:ui';
import 'package:cake_wallet/src/widgets/section_divider.dart';
import 'package:cake_wallet/themes/extensions/alert_theme.dart';
import 'package:flutter/material.dart';
import 'package:cake_wallet/palette.dart';
@@ -25,7 +27,7 @@ class BaseAlertDialog extends StatelessWidget {
fontSize: 20,
fontFamily: 'Lato',
fontWeight: FontWeight.w600,
color: Theme.of(context).primaryTextTheme!.titleLarge!.color!,
color: Theme.of(context).extension<CakeTextTheme>()!.titleColor,
decoration: TextDecoration.none,
),
);
@@ -39,7 +41,7 @@ class BaseAlertDialog extends StatelessWidget {
fontSize: 16,
fontWeight: FontWeight.normal,
fontFamily: 'Lato',
color: Theme.of(context).primaryTextTheme!.titleLarge!.color!,
color: Theme.of(context).extension<CakeTextTheme>()!.titleColor,
decoration: TextDecoration.none,
),
);
@@ -57,10 +59,7 @@ class BaseAlertDialog extends StatelessWidget {
onPressed: actionLeft,
style: TextButton.styleFrom(
backgroundColor: leftActionButtonColor ??
Theme.of(context)
.accentTextTheme!
.bodyLarge!
.decorationColor!,
Theme.of(context).dialogBackgroundColor,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.zero))),
child: Text(
@@ -71,24 +70,18 @@ class BaseAlertDialog extends StatelessWidget {
fontFamily: 'Lato',
fontWeight: FontWeight.w600,
color: leftActionButtonTextColor ??
Theme.of(context)
.primaryTextTheme!
.bodyLarge!
.backgroundColor!,
Theme.of(context).extension<AlertTheme>()!.leftButtonTextColor,
decoration: TextDecoration.none,
),
)),
),
const SectionDivider(),
const VerticalSectionDivider(),
Expanded(
child: TextButton(
onPressed: actionRight,
style: TextButton.styleFrom(
backgroundColor: rightActionButtonColor ??
Theme.of(context)
.accentTextTheme!
.bodyMedium!
.backgroundColor!,
Theme.of(context).dialogBackgroundColor,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.zero))),
child: Text(
@@ -99,10 +92,7 @@ class BaseAlertDialog extends StatelessWidget {
fontFamily: 'Lato',
fontWeight: FontWeight.w600,
color: rightActionButtonTextColor ??
Theme.of(context)
.primaryTextTheme!
.bodyMedium!
.backgroundColor!,
Theme.of(context).primaryColor,
decoration: TextDecoration.none,
),
)),
@@ -120,7 +110,9 @@ class BaseAlertDialog extends StatelessWidget {
child: BackdropFilter(
filter: ImageFilter.blur(sigmaX: 3.0, sigmaY: 3.0),
child: Container(
decoration: BoxDecoration(color: PaletteDark.darkNightBlue.withOpacity(0.75)),
decoration: BoxDecoration(
color:
Theme.of(context).extension<AlertTheme>()!.backdropColor),
child: Center(
child: GestureDetector(
onTap: () => null,
@@ -128,10 +120,7 @@ class BaseAlertDialog extends StatelessWidget {
borderRadius: BorderRadius.all(Radius.circular(30)),
child: Container(
width: 300,
color: Theme.of(context)
.accentTextTheme!
.titleLarge!
.decorationColor!,
color: Theme.of(context).dialogBackgroundColor,
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
@@ -145,7 +134,7 @@ class BaseAlertDialog extends StatelessWidget {
isDividerExists
? Padding(
padding: EdgeInsets.only(top: 16, bottom: 8),
child: const SectionDivider(),
child: const HorizontalSectionDivider(),
)
: Offstage(),
Padding(
@@ -154,7 +143,7 @@ class BaseAlertDialog extends StatelessWidget {
)
],
),
const SectionDivider(),
const HorizontalSectionDivider(),
actionButtons(context)
],
),
+5 -13
View File
@@ -1,3 +1,4 @@
import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
@@ -78,7 +79,7 @@ class BaseTextFormField extends StatelessWidget {
TextStyle(
fontSize: 16.0,
color: textColor ??
Theme.of(context).primaryTextTheme!.titleLarge!.color!),
Theme.of(context).extension<CakeTextTheme>()!.titleColor),
decoration: InputDecoration(
prefix: prefix,
prefixIcon: prefixIcon,
@@ -92,26 +93,17 @@ class BaseTextFormField extends StatelessWidget {
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: borderColor ??
Theme.of(context)
.primaryTextTheme!
.titleLarge!
.backgroundColor!,
Theme.of(context).extension<CakeTextTheme>()!.textfieldUnderlineColor,
width: borderWidth)),
disabledBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: borderColor ??
Theme.of(context)
.primaryTextTheme!
.titleLarge!
.backgroundColor!,
Theme.of(context).extension<CakeTextTheme>()!.textfieldUnderlineColor,
width: borderWidth)),
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: borderColor ??
Theme.of(context)
.primaryTextTheme!
.titleLarge!
.backgroundColor!,
Theme.of(context).extension<CakeTextTheme>()!.textfieldUnderlineColor,
width: borderWidth))),
validator: validator,
);
@@ -1,3 +1,4 @@
import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
import 'package:cake_wallet/utils/date_picker.dart';
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
@@ -81,7 +82,7 @@ class BlockchainHeightState extends State<BlockchainHeightWidget> {
fontSize: 16.0,
fontWeight: FontWeight.w500,
color:
Theme.of(context).primaryTextTheme!.titleLarge!.color!),
Theme.of(context).extension<CakeTextTheme>()!.titleColor),
),
),
Row(
+3 -2
View File
@@ -1,3 +1,4 @@
import 'package:cake_wallet/themes/extensions/cake_scrollbar_theme.dart';
import 'package:flutter/material.dart';
class CakeScrollbar extends StatelessWidget {
@@ -28,7 +29,7 @@ class CakeScrollbar extends StatelessWidget {
width: width,
decoration: BoxDecoration(
color: backgroundColor ??
Theme.of(context).textTheme!.bodyMedium!.decorationColor!,
Theme.of(context).extension<CakeScrollbarTheme>()!.trackColor,
borderRadius: BorderRadius.all(Radius.circular(3))),
child: Stack(
children: <Widget>[
@@ -40,7 +41,7 @@ class CakeScrollbar extends StatelessWidget {
width: width,
decoration: BoxDecoration(
color: thumbColor ??
Theme.of(context).textTheme!.bodyMedium!.color!,
Theme.of(context).extension<CakeScrollbarTheme>()!.thumbColor,
borderRadius: BorderRadius.all(Radius.circular(3))),
),
)
+9 -21
View File
@@ -1,7 +1,10 @@
import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
import 'package:cake_wallet/palette.dart';
import 'package:cake_wallet/utils/responsive_layout_util.dart';
import 'package:flutter/material.dart';
import 'package:cake_wallet/src/widgets/picker_wrapper_widget.dart';
import 'package:cake_wallet/themes/extensions/filter_theme.dart';
import 'package:cake_wallet/themes/extensions/picker_theme.dart';
class CheckBoxPicker extends StatefulWidget {
CheckBoxPicker({
@@ -53,10 +56,7 @@ class CheckBoxPickerState extends State<CheckBoxPicker> {
child: ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(30)),
child: Container(
color: Theme.of(context)
.accentTextTheme!
.titleLarge!
.color!,
color: Theme.of(context).dialogTheme.backgroundColor,
child: ConstrainedBox(
constraints: BoxConstraints(
maxHeight: MediaQuery.of(context).size.height * 0.65,
@@ -90,20 +90,14 @@ class CheckBoxPickerState extends State<CheckBoxPicker> {
Widget itemsList() {
return Container(
color: Theme.of(context)
.accentTextTheme!
.titleLarge!
.backgroundColor!,
color: Theme.of(context).extension<PickerTheme>()!.dividerColor,
child: ListView.separated(
padding: EdgeInsets.zero,
controller: controller,
shrinkWrap: true,
separatorBuilder: (context, index) => widget.isSeparated
? Divider(
color: Theme.of(context)
.accentTextTheme!
.titleLarge!
.backgroundColor!,
color: Theme.of(context).extension<PickerTheme>()!.dividerColor,
height: 1,
)
: const SizedBox(),
@@ -122,19 +116,13 @@ class CheckBoxPickerState extends State<CheckBoxPicker> {
},
child: Container(
height: 55,
color: Theme.of(context)
.accentTextTheme!
.titleLarge!
.color!,
color: Theme.of(context).dialogTheme.backgroundColor,
padding: EdgeInsets.only(left: 24, right: 24),
child: CheckboxListTile(
value: item.value,
activeColor: item.value
? Palette.blueCraiola
: Theme.of(context)
.accentTextTheme!
.titleMedium!
.decorationColor!,
: Theme.of(context).extension<FilterTheme>()!.checkboxBackgroundColor,
checkColor: Colors.white,
title: widget.displayItem?.call(item) ??
Text(
@@ -145,7 +133,7 @@ class CheckBoxPickerState extends State<CheckBoxPicker> {
fontWeight: FontWeight.w600,
color: item.isDisabled
? Colors.grey.withOpacity(0.5)
: Theme.of(context).primaryTextTheme!.titleLarge!.color!,
: Theme.of(context).extension<CakeTextTheme>()!.titleColor,
decoration: TextDecoration.none,
),
),
+7 -3
View File
@@ -1,5 +1,7 @@
import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
import 'package:cake_wallet/palette.dart';
import 'package:flutter/material.dart';
import 'package:cake_wallet/themes/extensions/filter_theme.dart';
class CheckboxWidget extends StatefulWidget {
CheckboxWidget({required this.value, required this.caption, required this.onChanged});
@@ -37,7 +39,9 @@ class CheckboxWidgetState extends State<CheckboxWidget> {
margin: EdgeInsets.only(right: 10.0),
decoration: BoxDecoration(
border: Border.all(
color: Theme.of(context).primaryTextTheme.bodySmall!.color!,
color: value
? Palette.blueCraiola
: Theme.of(context).extension<FilterTheme>()!.checkboxBoundsColor,
width: 1.0,
),
borderRadius: BorderRadius.all(
@@ -59,12 +63,12 @@ class CheckboxWidgetState extends State<CheckboxWidget> {
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14.0,
color: Theme.of(context).primaryTextTheme.titleLarge!.color!,
color: Theme.of(context).extension<CakeTextTheme>()!.titleColor,
),
),
)
],
),
)
);
}
}
+14 -68
View File
@@ -3,90 +3,36 @@ import 'package:flutter/material.dart';
class CollapsibleSectionList extends SectionStandardList {
CollapsibleSectionList(
{required BuildContext context,
required int sectionCount,
required int Function(int sectionIndex) itemCounter,
required Widget Function(BuildContext context, int sectionIndex, int itemIndex) itemBuilder,
Color? themeColor,
Color? dividerThemeColor,
Widget Function(BuildContext context, int sectionIndex)? sectionTitleBuilder,
bool hasTopSeparator = false})
{required int sectionCount,
required int Function(int sectionIndex) itemCounter,
required Widget Function(int sectionIndex, int itemIndex) itemBuilder,
Widget Function(int sectionIndex)? sectionTitleBuilder,
bool hasTopSeparator = false})
: super(
context: context,
hasTopSeparator: hasTopSeparator,
sectionCount: sectionCount,
itemCounter: itemCounter,
itemBuilder: itemBuilder,
sectionTitleBuilder: sectionTitleBuilder,
themeColor: themeColor,
dividerThemeColor: dividerThemeColor);
hasTopSeparator: hasTopSeparator,
sectionCount: sectionCount,
itemCounter: itemCounter,
itemBuilder: itemBuilder,
sectionTitleBuilder: sectionTitleBuilder);
@override
List<Widget> transform(
bool hasTopSeparator,
BuildContext context,
int sectionCount,
int Function(int sectionIndex) itemCounter,
Widget Function(BuildContext context, int sectionIndex, int itemIndex) itemBuilder,
Widget Function(BuildContext context, int sectionIndex)? sectionTitleBuilder,
Color? themeColor,
Color? dividerThemeColor) {
final items = <Widget>[];
for (var sectionIndex = 0; sectionIndex < sectionCount; sectionIndex++) {
final itemCount = itemCounter(sectionIndex);
items.add(Theme(
data: ThemeData(
textTheme: TextTheme(titleMedium: TextStyle(color: themeColor,fontFamily: 'Lato')),
backgroundColor: dividerThemeColor,
unselectedWidgetColor: themeColor,
accentColor: themeColor)
.copyWith(dividerColor: Colors.transparent),
child: Padding(
padding: const EdgeInsets.only(left: 24.0),
child: ListTileTheme(
contentPadding: EdgeInsets.only(right: 16,top:sectionIndex>0?26:0),
child: ExpansionTile(
textColor: themeColor,
iconColor: themeColor,
title: sectionTitleBuilder == null
? Container()
: Container(child: buildTitle(items, sectionIndex, context)),
initiallyExpanded: true,
children: buildSection(itemCount, items, sectionIndex, context),
),
),
),
));
}
items.add(StandardListSeparator(padding: EdgeInsets.only(left: 24)));
return items;
}
@override
Widget buildTitle(
List<Widget> items, int sectionIndex, BuildContext context) {
Widget buildTitle(List<Widget> items, int sectionIndex) {
if (sectionTitleBuilder == null) {
throw Exception('Cannot to build title. sectionTitleBuilder is null');
}
return sectionTitleBuilder!.call(context, sectionIndex);
return sectionTitleBuilder!.call(sectionIndex);
}
@override
List<Widget> buildSection(int itemCount, List<Widget> items, int sectionIndex,
BuildContext context) {
List<Widget> buildSection(int itemCount, List<Widget> items, int sectionIndex) {
final List<Widget> section = [];
for (var itemIndex = 0; itemIndex < itemCount; itemIndex++) {
final item = itemBuilder(context, sectionIndex, itemIndex);
final item = itemBuilder(sectionIndex, itemIndex);
section.add(StandardListSeparator());
section.add(item);
}
return section;
}
+7 -10
View File
@@ -1,4 +1,7 @@
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';
import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart';
class DashBoardRoundedCardWidget extends StatelessWidget {
@@ -26,10 +29,10 @@ class DashBoardRoundedCardWidget extends StatelessWidget {
padding: EdgeInsets.all(20),
width: double.infinity,
decoration: BoxDecoration(
color: Theme.of(context).textTheme!.titleLarge!.backgroundColor!,
color: Theme.of(context).extension<SyncIndicatorTheme>()!.syncedBackgroundColor,
borderRadius: BorderRadius.circular(20),
border: Border.all(
color: Colors.white.withOpacity(0.20),
color: Theme.of(context).extension<BalancePageTheme>()!.cardBorderColor,
),
),
child:
@@ -39,10 +42,7 @@ class DashBoardRoundedCardWidget extends StatelessWidget {
Text(
title,
style: TextStyle(
color: Theme.of(context)
.accentTextTheme!
.displayMedium!
.backgroundColor!,
color: Theme.of(context).extension<DashboardPageTheme>()!.cardTextColor,
fontSize: 24,
fontWeight: FontWeight.w900,
),
@@ -51,10 +51,7 @@ class DashBoardRoundedCardWidget extends StatelessWidget {
Text(
subTitle,
style: TextStyle(
color: Theme.of(context)
.accentTextTheme!
.displayMedium!
.backgroundColor!,
color: Theme.of(context).extension<DashboardPageTheme>()!.cardTextColor,
fontWeight: FontWeight.w500,
fontFamily: 'Lato'),
)
+30
View File
@@ -0,0 +1,30 @@
import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart';
import 'package:flutter/material.dart';
class GradientBackground extends StatelessWidget {
const GradientBackground({required this.scaffold});
final Widget scaffold;
@override
Widget build(BuildContext context) {
return Container(
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
Theme.of(context)
.extension<DashboardPageTheme>()!
.firstGradientBackgroundColor,
Theme.of(context)
.extension<DashboardPageTheme>()!
.secondGradientBackgroundColor,
Theme.of(context)
.extension<DashboardPageTheme>()!
.thirdGradientBackgroundColor,
],
begin: Alignment.topRight,
end: Alignment.bottomLeft,
)),
child: scaffold);
}
}
+5 -9
View File
@@ -1,6 +1,8 @@
import 'package:auto_size_text/auto_size_text.dart';
import 'package:cake_wallet/themes/extensions/sync_indicator_theme.dart';
import 'package:flutter/material.dart';
import 'package:cake_wallet/palette.dart';
import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart';
import 'package:cake_wallet/generated/i18n.dart';
class IntroducingCard extends StatelessWidget {
@@ -27,7 +29,7 @@ class IntroducingCard extends StatelessWidget {
color: borderColor,
width: 1,
),
color: Theme.of(context).textTheme!.titleLarge!.backgroundColor!),
color: Theme.of(context).extension<SyncIndicatorTheme>()!.syncedBackgroundColor),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
@@ -45,10 +47,7 @@ class IntroducingCard extends StatelessWidget {
fontSize: 24,
fontFamily: 'Lato',
fontWeight: FontWeight.bold,
color: Theme.of(context)
.accentTextTheme!
.displayMedium!
.backgroundColor!,
color: Theme.of(context).extension<DashboardPageTheme>()!.cardTextColor,
height: 1),
maxLines: 1,
textAlign: TextAlign.center),
@@ -58,10 +57,7 @@ class IntroducingCard extends StatelessWidget {
style: TextStyle(
fontSize: 12,
fontFamily: 'Lato',
color: Theme.of(context)
.accentTextTheme!
.displayMedium!
.backgroundColor!,
color: Theme.of(context).extension<DashboardPageTheme>()!.cardTextColor,
height: 1)),
],
),
+4 -8
View File
@@ -1,5 +1,7 @@
import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:cake_wallet/themes/extensions/transaction_trade_theme.dart';
class ListRow extends StatelessWidget {
ListRow(
@@ -30,10 +32,7 @@ class ListRow extends StatelessWidget {
style: TextStyle(
fontSize: titleFontSize,
fontWeight: FontWeight.w500,
color: Theme.of(context)
.primaryTextTheme!
.labelSmall!
.color!),
color: Theme.of(context).extension<TransactionTradeTheme>()!.detailsTitlesColor),
textAlign: TextAlign.left),
Padding(
padding: const EdgeInsets.only(top: 12),
@@ -47,10 +46,7 @@ class ListRow extends StatelessWidget {
style: TextStyle(
fontSize: valueFontSize,
fontWeight: FontWeight.w500,
color: Theme.of(context)
.primaryTextTheme!
.titleLarge!
.color!)),
color: Theme.of(context).extension<CakeTextTheme>()!.titleColor)),
),
image != null
? Padding(
+29 -53
View File
@@ -7,6 +7,9 @@ import 'package:cake_wallet/utils/responsive_layout_util.dart';
import 'package:flutter/material.dart';
import 'package:cw_core/currency.dart';
import 'package:cake_wallet/src/widgets/picker_wrapper_widget.dart';
import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
import 'package:cake_wallet/themes/extensions/cake_scrollbar_theme.dart';
import 'package:cake_wallet/themes/extensions/picker_theme.dart';
class Picker<Item> extends StatefulWidget {
Picker({
@@ -40,8 +43,7 @@ class Picker<Item> extends StatefulWidget {
final bool Function(Item, String)? matchingCriteria;
@override
_PickerState<Item> createState() =>
_PickerState<Item>(items, images, onItemSelected);
_PickerState<Item> createState() => _PickerState<Item>(items, images, onItemSelected);
}
class _PickerState<Item> extends State<Picker<Item>> {
@@ -90,8 +92,7 @@ class _PickerState<Item> extends State<Picker<Item>> {
setState(() {
filteredItems = List.from(items.where((element) {
if (widget.selectedAtIndex != items.indexOf(element) &&
(widget.matchingCriteria?.call(element, searchController.text) ??
true)) {
(widget.matchingCriteria?.call(element, searchController.text) ?? true)) {
if (images.isNotEmpty) {
filteredImages.add(images[items.indexOf(element)]);
}
@@ -146,9 +147,7 @@ class _PickerState<Item> extends State<Picker<Item>> {
child: ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(30)),
child: Container(
color: Theme.of(context)
.accentTextTheme.titleLarge!
.color!,
color: Theme.of(context).dialogTheme.backgroundColor,
child: ConstrainedBox(
constraints: BoxConstraints(
maxHeight: containerHeight,
@@ -163,13 +162,10 @@ class _PickerState<Item> extends State<Picker<Item>> {
child: SearchBarWidget(searchController: searchController),
),
Divider(
color: Theme.of(context)
.accentTextTheme.titleLarge!
.backgroundColor!,
color: Theme.of(context).extension<PickerTheme>()!.dividerColor,
height: 1,
),
if (widget.selectedAtIndex != -1)
buildSelectedItem(widget.selectedAtIndex),
if (widget.selectedAtIndex != -1) buildSelectedItem(widget.selectedAtIndex),
Flexible(
child: Stack(
alignment: Alignment.center,
@@ -193,9 +189,8 @@ class _PickerState<Item> extends State<Picker<Item>> {
fontWeight: FontWeight.w500,
fontFamily: 'Lato',
decoration: TextDecoration.none,
color: Theme.of(context)
.primaryTextTheme.titleLarge!
.color!,
color:
Theme.of(context).extension<CakeTextTheme>()!.titleColor,
),
),
)
@@ -215,9 +210,7 @@ class _PickerState<Item> extends State<Picker<Item>> {
Widget itemsList() {
return Container(
color: Theme.of(context)
.accentTextTheme.titleLarge!
.backgroundColor!,
color: Theme.of(context).extension<PickerTheme>()!.dividerColor,
child: widget.isGridView
? GridView.builder(
padding: EdgeInsets.zero,
@@ -237,9 +230,7 @@ class _PickerState<Item> extends State<Picker<Item>> {
shrinkWrap: true,
separatorBuilder: (context, index) => widget.isSeparated
? Divider(
color: Theme.of(context)
.accentTextTheme.titleLarge!
.backgroundColor!,
color: Theme.of(context).extension<PickerTheme>()!.dividerColor,
height: 1,
)
: const SizedBox(),
@@ -264,9 +255,7 @@ class _PickerState<Item> extends State<Picker<Item>> {
},
child: Container(
height: 55,
color: Theme.of(context)
.accentTextTheme.titleLarge!
.color!,
color: Theme.of(context).dialogTheme.backgroundColor,
padding: EdgeInsets.symmetric(horizontal: 24),
child: Row(
mainAxisSize: MainAxisSize.max,
@@ -287,9 +276,7 @@ class _PickerState<Item> extends State<Picker<Item>> {
fontSize: 14,
fontFamily: 'Lato',
fontWeight: FontWeight.w600,
color: Theme.of(context)
.primaryTextTheme.titleLarge!
.color!,
color: Theme.of(context).extension<CakeTextTheme>()!.titleColor,
decoration: TextDecoration.none,
),
),
@@ -304,19 +291,17 @@ class _PickerState<Item> extends State<Picker<Item>> {
child: Text(
tag,
style: TextStyle(
fontSize: 7.0,
fontFamily: 'Lato',
color: Theme.of(context)
.textTheme.bodyMedium!
.color!),
fontSize: 7.0,
fontFamily: 'Lato',
color:
Theme.of(context).extension<CakeScrollbarTheme>()!.thumbColor,
),
),
),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(6.0),
//border: Border.all(color: ),
color: Theme.of(context)
.textTheme.bodyMedium!
.decorationColor!,
color: Theme.of(context).extension<CakeScrollbarTheme>()!.trackColor,
),
),
),
@@ -344,9 +329,7 @@ class _PickerState<Item> extends State<Picker<Item>> {
},
child: Container(
height: 55,
color: Theme.of(context)
.accentTextTheme.titleLarge!
.color!,
color: Theme.of(context).dialogTheme.backgroundColor,
padding: EdgeInsets.symmetric(horizontal: 24),
child: Row(
mainAxisSize: MainAxisSize.max,
@@ -367,9 +350,7 @@ class _PickerState<Item> extends State<Picker<Item>> {
fontSize: 16,
fontFamily: 'Lato',
fontWeight: FontWeight.w700,
color: Theme.of(context)
.primaryTextTheme.titleLarge!
.color!,
color: Theme.of(context).extension<CakeTextTheme>()!.titleColor,
decoration: TextDecoration.none,
),
),
@@ -384,19 +365,17 @@ class _PickerState<Item> extends State<Picker<Item>> {
child: Text(
tag,
style: TextStyle(
fontSize: 7.0,
fontFamily: 'Lato',
color: Theme.of(context)
.textTheme.bodyMedium!
.color!),
fontSize: 7.0,
fontFamily: 'Lato',
color:
Theme.of(context).extension<CakeScrollbarTheme>()!.thumbColor,
),
),
),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(6.0),
//border: Border.all(color: ),
color: Theme.of(context)
.textTheme.bodyMedium!
.decorationColor!,
color: Theme.of(context).extension<CakeScrollbarTheme>()!.trackColor,
),
),
),
@@ -404,10 +383,7 @@ class _PickerState<Item> extends State<Picker<Item>> {
),
),
),
Icon(Icons.check_circle,
color: Theme.of(context)
.accentTextTheme.bodyLarge!
.color!),
Icon(Icons.check_circle, color: Theme.of(context).primaryColor),
],
),
),
@@ -1,3 +1,4 @@
import 'package:cake_wallet/themes/extensions/account_list_theme.dart';
import 'package:cake_wallet/utils/responsive_layout_util.dart';
import 'package:flutter/material.dart';
import 'package:cake_wallet/src/widgets/picker_wrapper_widget.dart';
@@ -44,7 +45,7 @@ class PickerInnerWrapperWidget extends StatelessWidget {
child: ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(14)),
child: Container(
color: Theme.of(context).textTheme.displayLarge!.decorationColor!,
color: Theme.of(context).dialogTheme.backgroundColor,
child: ConstrainedBox(
constraints: BoxConstraints(
maxHeight:
@@ -72,7 +73,7 @@ class PickerInnerWrapperWidget extends StatelessWidget {
child: ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(14)),
child: Container(
color: Theme.of(context).textTheme.displayLarge!.decorationColor!,
color: Theme.of(context).dialogTheme.backgroundColor,
child: ConstrainedBox(
constraints: BoxConstraints(
maxHeight: containerHeight,
+10 -3
View File
@@ -1,3 +1,4 @@
import 'package:cake_wallet/themes/extensions/picker_theme.dart';
import 'package:flutter/material.dart';
import 'package:cake_wallet/generated/i18n.dart';
@@ -16,12 +17,18 @@ class SearchBarWidget extends StatelessWidget {
Widget build(BuildContext context) {
return TextFormField(
controller: searchController,
style: TextStyle(color: Theme.of(context).primaryTextTheme!.titleLarge!.color!),
style: TextStyle(
color: Theme.of(context).extension<PickerTheme>()!.searchTextColor),
decoration: InputDecoration(
hintText: hintText ?? S.of(context).search_currency,
prefixIcon: Image.asset("assets/images/search_icon.png"),
hintStyle: TextStyle(
color: Theme.of(context).extension<PickerTheme>()!.searchHintColor),
prefixIcon: Image.asset("assets/images/search_icon.png",
color: Theme.of(context).extension<PickerTheme>()!.searchIconColor),
filled: true,
fillColor: Theme.of(context).accentTextTheme!.displaySmall!.color!,
fillColor: Theme.of(context)
.extension<PickerTheme>()!
.searchBackgroundFillColor,
alignLabelWithHint: false,
contentPadding: const EdgeInsets.symmetric(vertical: 4, horizontal: 16),
enabledBorder: OutlineInputBorder(
+24 -3
View File
@@ -1,13 +1,34 @@
import 'package:flutter/material.dart';
class SectionDivider extends StatelessWidget {
const SectionDivider();
const SectionDivider({required this.direction});
final Axis direction;
@override
Widget build(BuildContext context) {
return Container(
height: 1,
height: direction == Axis.horizontal ? 1 : null,
width: direction == Axis.vertical ? 1 : null,
color: Theme.of(context).dividerColor,
);
}
}
}
class HorizontalSectionDivider extends StatelessWidget {
const HorizontalSectionDivider();
@override
Widget build(BuildContext context) {
return SectionDivider(direction: Axis.horizontal);
}
}
class VerticalSectionDivider extends StatelessWidget {
const VerticalSectionDivider();
@override
Widget build(BuildContext context) {
return SectionDivider(direction: Axis.vertical);
}
}
+6 -16
View File
@@ -1,3 +1,4 @@
import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
import 'package:cw_core/wallet_type.dart';
import 'package:cake_wallet/src/widgets/validable_annotated_editable_text.dart';
import 'package:cake_wallet/src/widgets/blockchain_height_widget.dart';
@@ -10,6 +11,7 @@ import 'package:cake_wallet/src/widgets/primary_button.dart';
import 'package:cake_wallet/entities/mnemonic_item.dart';
import 'package:cake_wallet/generated/i18n.dart';
import 'package:flutter/widgets.dart';
import 'package:cake_wallet/themes/extensions/send_page_theme.dart';
class SeedWidget extends StatefulWidget {
SeedWidget({
@@ -89,10 +91,7 @@ class SeedWidgetState extends State<SeedWidget> {
cursorColor: Colors.blue,
backgroundCursorColor: Colors.blue,
validStyle: TextStyle(
color: Theme.of(context)
.primaryTextTheme!
.titleLarge!
.color!,
color: Theme.of(context).extension<CakeTextTheme>()!.titleColor,
backgroundColor: Colors.transparent,
fontWeight: FontWeight.normal,
fontSize: 16),
@@ -105,10 +104,7 @@ class SeedWidgetState extends State<SeedWidget> {
controller: controller,
words: words,
textStyle: TextStyle(
color: Theme.of(context)
.primaryTextTheme!
.titleLarge!
.color!,
color: Theme.of(context).extension<CakeTextTheme>()!.titleColor,
backgroundColor: Colors.transparent,
fontWeight: FontWeight.normal,
fontSize: 16),
@@ -128,19 +124,13 @@ class SeedWidgetState extends State<SeedWidget> {
borderRadius:
BorderRadius.all(Radius.circular(6))),
child: Image.asset('assets/images/paste_ios.png',
color: Theme.of(context)
.primaryTextTheme!
.headlineMedium!
.decorationColor!)),
color: Theme.of(context).extension<SendPageTheme>()!.textFieldButtonIconColor)),
)))
]),
Container(
margin: EdgeInsets.only(top: 15),
height: 1.0,
color: Theme.of(context)
.primaryTextTheme!
.titleLarge!
.backgroundColor!),
color: Theme.of(context).extension<CakeTextTheme>()!.textfieldUnderlineColor),
]));
}
+7 -4
View File
@@ -1,4 +1,5 @@
import 'package:cake_wallet/palette.dart';
import 'package:cake_wallet/themes/extensions/menu_theme.dart';
import 'package:flutter/material.dart';
class SettingActionButton extends StatelessWidget {
@@ -29,15 +30,15 @@ class SettingActionButton extends StatelessWidget {
@override
Widget build(BuildContext context) {
Color? color = isSelected
? Theme.of(context).textTheme!.displaySmall!.color
? Theme.of(context).extension<CakeMenuTheme>()!.settingTitleColor
: selectionActive
? Palette.darkBlue
: Theme.of(context).textTheme!.displaySmall!.color;
: Theme.of(context).extension<CakeMenuTheme>()!.settingTitleColor;
return InkWell(
onTap: onTap,
hoverColor: Colors.transparent,
child: Container(
height: tileHeight,
height: tileHeight,
padding: isLastTile
? EdgeInsets.only(
left: 24,
@@ -54,7 +55,9 @@ class SettingActionButton extends StatelessWidget {
image,
height: 16,
width: 16,
color: Palette.darkBlue,
color: Theme.of(context)
.extension<CakeMenuTheme>()!
.settingActionsIconColor,
),
SizedBox(width: 16),
Expanded(
+7 -7
View File
@@ -1,5 +1,5 @@
import 'dart:ui';
import 'package:flutter/cupertino.dart';
import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
import 'package:cake_wallet/themes/extensions/filter_theme.dart';
import 'package:flutter/material.dart';
class StandardCheckbox extends StatelessWidget {
@@ -21,12 +21,12 @@ class StandardCheckbox extends StatelessWidget {
@override
Widget build(BuildContext context) {
final baseGradient = LinearGradient(colors: [
Theme.of(context).primaryTextTheme!.titleMedium!.color!,
Theme.of(context).primaryTextTheme!.titleMedium!.decorationColor!,
Theme.of(context).extension<FilterTheme>()!.checkboxFirstGradientColor,
Theme.of(context).extension<FilterTheme>()!.checkboxSecondGradientColor,
], begin: Alignment.centerLeft, end: Alignment.centerRight);
final boxBorder = Border.all(
color: borderColor ?? Theme.of(context).primaryTextTheme!.bodySmall!.color!, width: 1.0);
color: borderColor ?? Theme.of(context).extension<CakeTextTheme>()!.secondaryTextColor, width: 1.0);
final checkedBoxDecoration = BoxDecoration(
gradient: gradientBackground ? baseGradient : null,
@@ -49,7 +49,7 @@ class StandardCheckbox extends StatelessWidget {
child: value
? Icon(
Icons.check,
color: iconColor ?? Colors.blue,
color: iconColor ?? Theme.of(context).primaryColor,
size: 20.0,
)
: Offstage(),
@@ -60,7 +60,7 @@ class StandardCheckbox extends StatelessWidget {
child: Text(
caption,
style: TextStyle(
fontSize: 16.0, color: Theme.of(context).primaryTextTheme!.titleLarge!.color!),
fontSize: 16.0, color: Theme.of(context).extension<CakeTextTheme>()!.titleColor),
))
],
),
+77 -103
View File
@@ -1,11 +1,10 @@
import 'package:cake_wallet/palette.dart';
import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
import 'package:cake_wallet/src/widgets/standard_list_card.dart';
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;
@@ -18,50 +17,54 @@ class StandardListRow extends StatelessWidget {
final trailing = buildTrailing(context);
return InkWell(
onTap: () => onTap?.call(context),
child: Container(
height: 56,
padding: EdgeInsets.only(left: 24, right: 24),
decoration: decoration ?? BoxDecoration(
color: _backgroundColor(context),
onTap: () => onTap?.call(context),
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: <Widget>[
if (leading != null) leading,
buildCenter(context, hasLeftOffset: leading != null),
if (trailing != null) trailing
])));
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
if (leading != null) leading,
buildCenter(context, hasLeftOffset: leading != null),
if (trailing != null) trailing,
],
),
),
);
}
Widget? buildLeading(BuildContext context) => null;
Widget buildCenter(BuildContext context, {required bool hasLeftOffset}) {
// FIXME: find better way for keep text on left side.
return Expanded(
child: Row(mainAxisAlignment: MainAxisAlignment.start, children: [
if (hasLeftOffset) SizedBox(width: 10),
Expanded(
child: Text(title,
style: TextStyle(
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
if (hasLeftOffset) SizedBox(width: 10),
Expanded(
child: Text(
title,
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.normal,
color: titleColor(context),
),
),
),
)
]));
)
],
),
);
}
Widget? buildTrailing(BuildContext context) => null;
Color titleColor(BuildContext context) => isSelected
? Palette.blueCraiola
: Theme.of(context).primaryTextTheme.titleLarge!.color!;
Color _backgroundColor(BuildContext context) {
return Theme.of(context).colorScheme.background;
}
? Theme.of(context).primaryColor
: Theme.of(context).extension<CakeTextTheme>()!.titleColor;
}
class SectionHeaderListRow extends StatelessWidget {
@@ -69,15 +72,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;
@@ -90,11 +90,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));
}
}
@@ -107,11 +103,9 @@ 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);
}
}
@@ -123,51 +117,29 @@ class SectionStandardListItem {
}
class SectionStandardList extends StatelessWidget {
SectionStandardList(
{required this.itemCounter,
required this.itemBuilder,
required this.sectionCount,
required BuildContext context,
this.dividerPadding = const EdgeInsets.only(left: 24),
this.themeColor,
this.dividerThemeColor,
this.sectionTitleBuilder,
this.hasTopSeparator = false,})
: totalRows = [] {
totalRows.addAll(transform(
hasTopSeparator,
context,
sectionCount,
itemCounter,
itemBuilder,
sectionTitleBuilder,
themeColor,
dividerThemeColor));
}
SectionStandardList({
required this.itemCounter,
required this.itemBuilder,
required this.sectionCount,
this.dividerPadding = const EdgeInsets.only(left: 24),
this.sectionTitleBuilder,
this.hasTopSeparator = false,
}) : totalRows = [];
final int sectionCount;
final bool hasTopSeparator;
final int Function(int sectionIndex) itemCounter;
final Widget Function(BuildContext context, int sectionIndex, int itemIndex)
itemBuilder;
final Widget Function(BuildContext context, int sectionIndex)?
sectionTitleBuilder;
final Widget Function(int sectionIndex, int itemIndex) itemBuilder;
final Widget Function(int sectionIndex)? sectionTitleBuilder;
final List<Widget> totalRows;
final Color? themeColor;
final Color? dividerThemeColor;
final EdgeInsets dividerPadding;
List<Widget> transform(
bool hasTopSeparator,
BuildContext context,
int sectionCount,
int Function(int sectionIndex) itemCounter,
Widget Function(BuildContext context, int sectionIndex, int itemIndex)
itemBuilder,
Widget Function(BuildContext context, int sectionIndex)?
sectionTitleBuilder,
Color? themeColor,
Color? dividerThemeColor) {
Widget Function(int sectionIndex, int itemIndex) itemBuilder,
Widget Function(int sectionIndex)? sectionTitleBuilder) {
final items = <Widget>[];
for (var sectionIndex = 0; sectionIndex < sectionCount; sectionIndex++) {
@@ -176,12 +148,12 @@ class SectionStandardList extends StatelessWidget {
}
if (sectionTitleBuilder != null) {
items.add(buildTitle(items, sectionIndex, context));
items.add(buildTitle(items, sectionIndex));
}
final itemCount = itemCounter(sectionIndex);
items.addAll(buildSection(itemCount, items, sectionIndex, context));
items.addAll(buildSection(itemCount, items, sectionIndex));
items.add(sectionIndex + 1 != sectionCount
? SectionHeaderListRow()
@@ -191,21 +163,19 @@ class SectionStandardList extends StatelessWidget {
return items;
}
Widget buildTitle(
List<Widget> items, int sectionIndex, BuildContext context) {
Widget buildTitle(List<Widget> items, int sectionIndex) {
if (sectionTitleBuilder == null) {
throw Exception('Cannot to build title. sectionTitleBuilder is null');
}
return sectionTitleBuilder!.call(context, sectionIndex);
return sectionTitleBuilder!.call(sectionIndex);
}
List<Widget> buildSection(int itemCount, List<Widget> items, int sectionIndex,
BuildContext context) {
List<Widget> buildSection(int itemCount, List<Widget> items, int sectionIndex) {
final List<Widget> section = [];
for (var itemIndex = 0; itemIndex < itemCount; itemIndex++) {
final item = itemBuilder(context, sectionIndex, itemIndex);
final item = itemBuilder(sectionIndex, itemIndex);
section.add(item);
}
@@ -214,29 +184,33 @@ class SectionStandardList extends StatelessWidget {
@override
Widget build(BuildContext context) {
totalRows.clear();
totalRows.addAll(
transform(hasTopSeparator, sectionCount, itemCounter, itemBuilder, sectionTitleBuilder));
return ListView.separated(
separatorBuilder: (_, index) {
final row = totalRows[index];
separatorBuilder: (_, index) {
final row = totalRows[index];
if (row is StandardListSeparator || row is SectionHeaderListRow) {
return Container();
}
if (row is StandardListSeparator || row is SectionHeaderListRow) {
return Container();
}
if (row is StandardListStatusRow || row is TradeDetailsStandardListCard) {
return Container();
}
if (row is StandardListStatusRow || row is TradeDetailsStandardListCard) {
return Container();
}
final nextRow = totalRows[index + 1];
final nextRow = totalRows[index + 1];
// If current row is pre last and last row is separator.
if (nextRow is StandardListSeparator ||
nextRow is SectionHeaderListRow) {
return Container();
}
// If current row is pre last and last row is separator.
if (nextRow is StandardListSeparator || nextRow is SectionHeaderListRow) {
return Container();
}
return StandardListSeparator(padding: dividerPadding);
},
itemCount: totalRows.length,
itemBuilder: (_, index) => totalRows[index]);
return StandardListSeparator(padding: dividerPadding);
},
itemCount: totalRows.length,
itemBuilder: (_, index) => totalRows[index],
);
}
}
+3 -2
View File
@@ -1,4 +1,5 @@
import 'package:cake_wallet/palette.dart';
import 'package:cake_wallet/themes/extensions/exchange_page_theme.dart';
import 'package:flutter/material.dart';
import 'package:cake_wallet/themes/theme_base.dart';
@@ -21,8 +22,8 @@ class TradeDetailsStandardListCard extends StatelessWidget {
final darkTheme = currentTheme == ThemeType.dark;
final baseGradient = LinearGradient(colors: [
Theme.of(context).primaryTextTheme!.titleSmall!.color!,
Theme.of(context).primaryTextTheme!.titleSmall!.decorationColor!,
Theme.of(context).extension<ExchangePageTheme>()!.firstGradientTopPanelColor,
Theme.of(context).extension<ExchangePageTheme>()!.secondGradientTopPanelColor,
], begin: Alignment.centerLeft, end: Alignment.centerRight);
final gradient = LinearGradient(colors: [
@@ -1,7 +1,10 @@
import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
import 'package:cake_wallet/palette.dart';
import 'package:cake_wallet/src/screens/dashboard/widgets/sync_indicator_icon.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:cake_wallet/themes/extensions/address_theme.dart';
import 'package:cake_wallet/themes/extensions/transaction_trade_theme.dart';
class StandardListStatusRow extends StatelessWidget {
StandardListStatusRow({required this.title, required this.value});
@@ -24,13 +27,13 @@ class StandardListStatusRow extends StatelessWidget {
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w500,
color: Theme.of(context).primaryTextTheme!.labelSmall!.color!),
color: Theme.of(context).extension<TransactionTradeTheme>()!.detailsTitlesColor),
textAlign: TextAlign.left),
Padding(
padding: const EdgeInsets.only(top: 12),
child: Container(
decoration: BoxDecoration(
color: Theme.of(context).accentTextTheme!.displaySmall!.color!,
color: Theme.of(context).extension<AddressTheme>()!.actionButtonColor,
borderRadius: BorderRadius.circular(30.0),
),
child: Padding(
@@ -50,10 +53,7 @@ class StandardListStatusRow extends StatelessWidget {
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w500,
color: Theme.of(context)
.primaryTextTheme!
.titleLarge!
.color!))
color: Theme.of(context).extension<CakeTextTheme>()!.titleColor))
],
),
),
+2 -8
View File
@@ -24,14 +24,8 @@ class StandardSwitchState extends State<StandardSwitch> {
height: 28,
decoration: BoxDecoration(
color: widget.value
? Theme.of(context)
.accentTextTheme!
.bodyLarge!
.color!
: Theme.of(context)
.accentTextTheme!
.displayLarge!
.color!,
? Theme.of(context).primaryColor
: Theme.of(context).disabledColor,
borderRadius: BorderRadius.all(Radius.circular(14.0))),
child: Container(
width: 24.0,
+7 -3
View File
@@ -1,5 +1,7 @@
import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
import 'package:flutter/material.dart';
import 'package:cake_wallet/palette.dart';
import 'package:cake_wallet/themes/extensions/send_page_theme.dart';
class TemplateTile extends StatefulWidget {
TemplateTile({
@@ -49,7 +51,9 @@ class TemplateTileState extends State<TemplateTile> {
@override
Widget build(BuildContext context) {
final color = isRemovable ? Colors.white : Theme.of(context).primaryTextTheme!.titleLarge!.color!;
final color = isRemovable
? Colors.white
: Theme.of(context).extension<SendPageTheme>()!.templateTitleColor;
final toIcon = Image.asset('assets/images/to_icon.png', color: color);
final content = Row(
@@ -109,7 +113,7 @@ class TemplateTileState extends State<TemplateTile> {
child: Container(
height: 40,
padding: EdgeInsets.only(left: 24, right: 24),
color: Theme.of(context).primaryTextTheme!.displayMedium!.decorationColor!,
color: Theme.of(context).extension<SendPageTheme>()!.templateBackgroundColor,
child: content,
),
),
@@ -154,4 +158,4 @@ class TemplateTileState extends State<TemplateTile> {
return isRemovable ? removableTile : tile;
}
}
}
+2 -4
View File
@@ -1,3 +1,4 @@
import 'package:cake_wallet/themes/extensions/exchange_page_theme.dart';
import 'package:flutter/material.dart';
import 'package:cake_wallet/palette.dart';
@@ -24,10 +25,7 @@ class TrailButton extends StatelessWidget {
caption,
style: TextStyle(
color: textColor ??
Theme.of(context)
.accentTextTheme!
.displayLarge!
.decorationColor!,
Theme.of(context).extension<ExchangePageTheme>()!.hintTextColor,
fontWeight: FontWeight.w600,
fontSize: 14),
),