mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-12-23 12:09:43 +00:00
refactor: accentTextTheme.titleLarge.backgroundColor -> PickerTheme.dividerColor
This commit is contained in:
parent
b5c90c2f9e
commit
5ba89213c1
10 changed files with 50 additions and 44 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
import 'package:cake_wallet/themes/extensions/picker_theme.dart';
|
||||||
import 'package:cw_core/currency.dart';
|
import 'package:cw_core/currency.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'currency_picker_item_widget.dart';
|
import 'currency_picker_item_widget.dart';
|
||||||
|
@ -20,10 +21,7 @@ class CurrencyPickerWidget extends StatelessWidget {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return Container(
|
||||||
color: Theme.of(context)
|
color: Theme.of(context).extension<PickerTheme>()!.dividerColor,
|
||||||
.accentTextTheme!
|
|
||||||
.titleLarge!
|
|
||||||
.backgroundColor!,
|
|
||||||
child: Scrollbar(
|
child: Scrollbar(
|
||||||
controller: _scrollController,
|
controller: _scrollController,
|
||||||
child: GridView.builder(
|
child: GridView.builder(
|
||||||
|
|
|
@ -4,6 +4,7 @@ import 'package:cw_core/currency.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart';
|
import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart';
|
||||||
|
import 'package:cake_wallet/themes/extensions/picker_theme.dart';
|
||||||
|
|
||||||
class CurrencyInputField extends StatelessWidget {
|
class CurrencyInputField extends StatelessWidget {
|
||||||
const CurrencyInputField({
|
const CurrencyInputField({
|
||||||
|
@ -50,7 +51,7 @@ class CurrencyInputField extends StatelessWidget {
|
||||||
color: Theme.of(context).primaryTextTheme!.headlineSmall!.color!,
|
color: Theme.of(context).primaryTextTheme!.headlineSmall!.color!,
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
),
|
),
|
||||||
borderColor: Theme.of(context).accentTextTheme!.titleLarge!.backgroundColor!,
|
borderColor: Theme.of(context).extension<PickerTheme>()!.dividerColor,
|
||||||
textColor: Theme.of(context).extension<DashboardPageTheme>()!.textColor,
|
textColor: Theme.of(context).extension<DashboardPageTheme>()!.textColor,
|
||||||
textStyle: TextStyle(
|
textStyle: TextStyle(
|
||||||
color: Theme.of(context).extension<DashboardPageTheme>()!.textColor,
|
color: Theme.of(context).extension<DashboardPageTheme>()!.textColor,
|
||||||
|
|
|
@ -12,6 +12,7 @@ import 'package:cake_wallet/src/widgets/list_row.dart';
|
||||||
import 'package:cake_wallet/view_model/wallet_keys_view_model.dart';
|
import 'package:cake_wallet/view_model/wallet_keys_view_model.dart';
|
||||||
import 'package:cake_wallet/routes.dart';
|
import 'package:cake_wallet/routes.dart';
|
||||||
import 'package:qr_flutter/qr_flutter.dart';
|
import 'package:qr_flutter/qr_flutter.dart';
|
||||||
|
import 'package:cake_wallet/themes/extensions/picker_theme.dart';
|
||||||
|
|
||||||
class WalletKeysPage extends BasePage {
|
class WalletKeysPage extends BasePage {
|
||||||
WalletKeysPage(this.walletKeysViewModel);
|
WalletKeysPage(this.walletKeysViewModel);
|
||||||
|
@ -84,7 +85,7 @@ class WalletKeysPage extends BasePage {
|
||||||
separatorBuilder: (context, index) => Container(
|
separatorBuilder: (context, index) => Container(
|
||||||
height: 1,
|
height: 1,
|
||||||
padding: EdgeInsets.only(left: 24),
|
padding: EdgeInsets.only(left: 24),
|
||||||
color: Theme.of(context).accentTextTheme!.titleLarge!.backgroundColor!,
|
color: Theme.of(context).extension<PickerTheme>()!.dividerColor,
|
||||||
child: const HorizontalSectionDivider(),
|
child: const HorizontalSectionDivider(),
|
||||||
),
|
),
|
||||||
itemCount: walletKeysViewModel.items.length,
|
itemCount: walletKeysViewModel.items.length,
|
||||||
|
|
|
@ -3,6 +3,7 @@ import 'package:cake_wallet/utils/responsive_layout_util.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:cake_wallet/src/widgets/picker_wrapper_widget.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/filter_theme.dart';
|
||||||
|
import 'package:cake_wallet/themes/extensions/picker_theme.dart';
|
||||||
|
|
||||||
class CheckBoxPicker extends StatefulWidget {
|
class CheckBoxPicker extends StatefulWidget {
|
||||||
CheckBoxPicker({
|
CheckBoxPicker({
|
||||||
|
@ -88,20 +89,14 @@ class CheckBoxPickerState extends State<CheckBoxPicker> {
|
||||||
|
|
||||||
Widget itemsList() {
|
Widget itemsList() {
|
||||||
return Container(
|
return Container(
|
||||||
color: Theme.of(context)
|
color: Theme.of(context).extension<PickerTheme>()!.dividerColor,
|
||||||
.accentTextTheme!
|
|
||||||
.titleLarge!
|
|
||||||
.backgroundColor!,
|
|
||||||
child: ListView.separated(
|
child: ListView.separated(
|
||||||
padding: EdgeInsets.zero,
|
padding: EdgeInsets.zero,
|
||||||
controller: controller,
|
controller: controller,
|
||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
separatorBuilder: (context, index) => widget.isSeparated
|
separatorBuilder: (context, index) => widget.isSeparated
|
||||||
? Divider(
|
? Divider(
|
||||||
color: Theme.of(context)
|
color: Theme.of(context).extension<PickerTheme>()!.dividerColor,
|
||||||
.accentTextTheme!
|
|
||||||
.titleLarge!
|
|
||||||
.backgroundColor!,
|
|
||||||
height: 1,
|
height: 1,
|
||||||
)
|
)
|
||||||
: const SizedBox(),
|
: const SizedBox(),
|
||||||
|
|
|
@ -6,6 +6,7 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:cw_core/currency.dart';
|
import 'package:cw_core/currency.dart';
|
||||||
import 'package:cake_wallet/src/widgets/picker_wrapper_widget.dart';
|
import 'package:cake_wallet/src/widgets/picker_wrapper_widget.dart';
|
||||||
import 'package:cake_wallet/themes/extensions/address_theme.dart';
|
import 'package:cake_wallet/themes/extensions/address_theme.dart';
|
||||||
|
import 'package:cake_wallet/themes/extensions/picker_theme.dart';
|
||||||
|
|
||||||
class Picker<Item> extends StatefulWidget {
|
class Picker<Item> extends StatefulWidget {
|
||||||
Picker({
|
Picker({
|
||||||
|
@ -187,10 +188,7 @@ class _PickerState<Item> extends State<Picker<Item>> {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Divider(
|
Divider(
|
||||||
color: Theme.of(context)
|
color: Theme.of(context).extension<PickerTheme>()!.dividerColor,
|
||||||
.accentTextTheme!
|
|
||||||
.titleLarge!
|
|
||||||
.backgroundColor!,
|
|
||||||
height: 1,
|
height: 1,
|
||||||
),
|
),
|
||||||
if (widget.selectedAtIndex != -1)
|
if (widget.selectedAtIndex != -1)
|
||||||
|
@ -241,10 +239,7 @@ class _PickerState<Item> extends State<Picker<Item>> {
|
||||||
|
|
||||||
Widget itemsList() {
|
Widget itemsList() {
|
||||||
return Container(
|
return Container(
|
||||||
color: Theme.of(context)
|
color: Theme.of(context).extension<PickerTheme>()!.dividerColor,
|
||||||
.accentTextTheme!
|
|
||||||
.titleLarge!
|
|
||||||
.backgroundColor!,
|
|
||||||
child: widget.isGridView
|
child: widget.isGridView
|
||||||
? GridView.builder(
|
? GridView.builder(
|
||||||
padding: EdgeInsets.zero,
|
padding: EdgeInsets.zero,
|
||||||
|
@ -264,10 +259,7 @@ class _PickerState<Item> extends State<Picker<Item>> {
|
||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
separatorBuilder: (context, index) => widget.isSeparated
|
separatorBuilder: (context, index) => widget.isSeparated
|
||||||
? Divider(
|
? Divider(
|
||||||
color: Theme.of(context)
|
color: Theme.of(context).extension<PickerTheme>()!.dividerColor,
|
||||||
.accentTextTheme!
|
|
||||||
.titleLarge!
|
|
||||||
.backgroundColor!,
|
|
||||||
height: 1,
|
height: 1,
|
||||||
)
|
)
|
||||||
: const SizedBox(),
|
: const SizedBox(),
|
||||||
|
|
|
@ -179,10 +179,5 @@ class BrightTheme extends LightTheme {
|
||||||
bodyLarge: TextStyle(
|
bodyLarge: TextStyle(
|
||||||
backgroundColor: Palette.brightOrange // alert left button text
|
backgroundColor: Palette.brightOrange // alert left button text
|
||||||
)),
|
)),
|
||||||
accentTextTheme: TextTheme(
|
);
|
||||||
// title -> titleLarge
|
|
||||||
titleLarge: TextStyle(
|
|
||||||
backgroundColor: Palette.periwinkleCraiola, // picker divider
|
|
||||||
),
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ import 'package:cake_wallet/themes/extensions/info_theme.dart';
|
||||||
import 'package:cake_wallet/themes/extensions/keyboard_theme.dart';
|
import 'package:cake_wallet/themes/extensions/keyboard_theme.dart';
|
||||||
import 'package:cake_wallet/themes/extensions/menu_theme.dart';
|
import 'package:cake_wallet/themes/extensions/menu_theme.dart';
|
||||||
import 'package:cake_wallet/themes/extensions/new_wallet_theme.dart';
|
import 'package:cake_wallet/themes/extensions/new_wallet_theme.dart';
|
||||||
|
import 'package:cake_wallet/themes/extensions/picker_theme.dart';
|
||||||
import 'package:cake_wallet/themes/extensions/pin_code_theme.dart';
|
import 'package:cake_wallet/themes/extensions/pin_code_theme.dart';
|
||||||
import 'package:cake_wallet/themes/extensions/support_page_theme.dart';
|
import 'package:cake_wallet/themes/extensions/support_page_theme.dart';
|
||||||
import 'package:cake_wallet/themes/extensions/sync_indicator_theme.dart';
|
import 'package:cake_wallet/themes/extensions/sync_indicator_theme.dart';
|
||||||
|
@ -122,6 +123,10 @@ class DarkTheme extends ThemeBase {
|
||||||
@override
|
@override
|
||||||
InfoTheme get infoTheme => InfoTheme(textColor: Palette.darkLavender);
|
InfoTheme get infoTheme => InfoTheme(textColor: Palette.darkLavender);
|
||||||
|
|
||||||
|
@override
|
||||||
|
PickerTheme get pickerTheme =>
|
||||||
|
PickerTheme(dividerColor: PaletteDark.dividerColor);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
ThemeData get themeData => super.themeData.copyWith(
|
ThemeData get themeData => super.themeData.copyWith(
|
||||||
indicatorColor: PaletteDark.cyanBlue, // page indicator
|
indicatorColor: PaletteDark.cyanBlue, // page indicator
|
||||||
|
@ -232,11 +237,5 @@ class DarkTheme extends ThemeBase {
|
||||||
backgroundColor: Palette.alizarinRed // alert left button text
|
backgroundColor: Palette.alizarinRed // alert left button text
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
accentTextTheme: TextTheme(
|
|
||||||
// title -> titleLarge
|
|
||||||
titleLarge: TextStyle(
|
|
||||||
backgroundColor: PaletteDark.dividerColor, // picker divider
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
22
lib/themes/extensions/picker_theme.dart
Normal file
22
lib/themes/extensions/picker_theme.dart
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class PickerTheme extends ThemeExtension<PickerTheme> {
|
||||||
|
final Color dividerColor;
|
||||||
|
|
||||||
|
PickerTheme({required this.dividerColor});
|
||||||
|
|
||||||
|
@override
|
||||||
|
PickerTheme copyWith({Color? dividerColor}) =>
|
||||||
|
PickerTheme(dividerColor: dividerColor ?? this.dividerColor);
|
||||||
|
|
||||||
|
@override
|
||||||
|
PickerTheme lerp(ThemeExtension<PickerTheme>? other, double t) {
|
||||||
|
if (other is! PickerTheme) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
return PickerTheme(
|
||||||
|
dividerColor:
|
||||||
|
Color.lerp(dividerColor, other.dividerColor, t) ?? dividerColor);
|
||||||
|
}
|
||||||
|
}
|
|
@ -9,6 +9,7 @@ import 'package:cake_wallet/themes/extensions/info_theme.dart';
|
||||||
import 'package:cake_wallet/themes/extensions/keyboard_theme.dart';
|
import 'package:cake_wallet/themes/extensions/keyboard_theme.dart';
|
||||||
import 'package:cake_wallet/themes/extensions/menu_theme.dart';
|
import 'package:cake_wallet/themes/extensions/menu_theme.dart';
|
||||||
import 'package:cake_wallet/themes/extensions/new_wallet_theme.dart';
|
import 'package:cake_wallet/themes/extensions/new_wallet_theme.dart';
|
||||||
|
import 'package:cake_wallet/themes/extensions/picker_theme.dart';
|
||||||
import 'package:cake_wallet/themes/extensions/pin_code_theme.dart';
|
import 'package:cake_wallet/themes/extensions/pin_code_theme.dart';
|
||||||
import 'package:cake_wallet/themes/extensions/support_page_theme.dart';
|
import 'package:cake_wallet/themes/extensions/support_page_theme.dart';
|
||||||
import 'package:cake_wallet/themes/extensions/sync_indicator_theme.dart';
|
import 'package:cake_wallet/themes/extensions/sync_indicator_theme.dart';
|
||||||
|
@ -123,6 +124,10 @@ class LightTheme extends ThemeBase {
|
||||||
@override
|
@override
|
||||||
InfoTheme get infoTheme => InfoTheme(textColor: Palette.darkBlueCraiola);
|
InfoTheme get infoTheme => InfoTheme(textColor: Palette.darkBlueCraiola);
|
||||||
|
|
||||||
|
@override
|
||||||
|
PickerTheme get pickerTheme =>
|
||||||
|
PickerTheme(dividerColor: Palette.periwinkleCraiola);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
ThemeData get themeData => super.themeData.copyWith(
|
ThemeData get themeData => super.themeData.copyWith(
|
||||||
indicatorColor:
|
indicatorColor:
|
||||||
|
@ -233,11 +238,5 @@ class LightTheme extends ThemeBase {
|
||||||
backgroundColor: Palette.brightOrange // alert left button text
|
backgroundColor: Palette.brightOrange // alert left button text
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
accentTextTheme: TextTheme(
|
|
||||||
// title -> headlititleLargene6
|
|
||||||
titleLarge: TextStyle(
|
|
||||||
backgroundColor: Palette.periwinkleCraiola, // picker divider
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@ import 'package:cake_wallet/themes/extensions/info_theme.dart';
|
||||||
import 'package:cake_wallet/themes/extensions/keyboard_theme.dart';
|
import 'package:cake_wallet/themes/extensions/keyboard_theme.dart';
|
||||||
import 'package:cake_wallet/themes/extensions/menu_theme.dart';
|
import 'package:cake_wallet/themes/extensions/menu_theme.dart';
|
||||||
import 'package:cake_wallet/themes/extensions/new_wallet_theme.dart';
|
import 'package:cake_wallet/themes/extensions/new_wallet_theme.dart';
|
||||||
|
import 'package:cake_wallet/themes/extensions/picker_theme.dart';
|
||||||
import 'package:cake_wallet/themes/extensions/pin_code_theme.dart';
|
import 'package:cake_wallet/themes/extensions/pin_code_theme.dart';
|
||||||
import 'package:cake_wallet/themes/extensions/support_page_theme.dart';
|
import 'package:cake_wallet/themes/extensions/support_page_theme.dart';
|
||||||
import 'package:cake_wallet/themes/extensions/sync_indicator_theme.dart';
|
import 'package:cake_wallet/themes/extensions/sync_indicator_theme.dart';
|
||||||
|
@ -76,6 +77,8 @@ abstract class ThemeBase {
|
||||||
|
|
||||||
InfoTheme get infoTheme;
|
InfoTheme get infoTheme;
|
||||||
|
|
||||||
|
PickerTheme get pickerTheme;
|
||||||
|
|
||||||
ThemeData get themeData => generatedThemeData.copyWith(
|
ThemeData get themeData => generatedThemeData.copyWith(
|
||||||
primaryColor: primaryColor,
|
primaryColor: primaryColor,
|
||||||
cardColor: containerColor,
|
cardColor: containerColor,
|
||||||
|
@ -95,6 +98,7 @@ abstract class ThemeBase {
|
||||||
filterTheme,
|
filterTheme,
|
||||||
walletListTheme,
|
walletListTheme,
|
||||||
infoTheme,
|
infoTheme,
|
||||||
|
pickerTheme,
|
||||||
],
|
],
|
||||||
scrollbarTheme: ScrollbarThemeData(
|
scrollbarTheme: ScrollbarThemeData(
|
||||||
thumbColor: MaterialStateProperty.all(scrollbarTheme.thumbColor),
|
thumbColor: MaterialStateProperty.all(scrollbarTheme.thumbColor),
|
||||||
|
|
Loading…
Reference in a new issue