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:flutter/material.dart';
|
||||
import 'currency_picker_item_widget.dart';
|
||||
|
@ -20,10 +21,7 @@ class CurrencyPickerWidget extends StatelessWidget {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
color: Theme.of(context)
|
||||
.accentTextTheme!
|
||||
.titleLarge!
|
||||
.backgroundColor!,
|
||||
color: Theme.of(context).extension<PickerTheme>()!.dividerColor,
|
||||
child: Scrollbar(
|
||||
controller: _scrollController,
|
||||
child: GridView.builder(
|
||||
|
|
|
@ -4,6 +4,7 @@ import 'package:cw_core/currency.dart';
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart';
|
||||
import 'package:cake_wallet/themes/extensions/picker_theme.dart';
|
||||
|
||||
class CurrencyInputField extends StatelessWidget {
|
||||
const CurrencyInputField({
|
||||
|
@ -50,7 +51,7 @@ class CurrencyInputField extends StatelessWidget {
|
|||
color: Theme.of(context).primaryTextTheme!.headlineSmall!.color!,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
borderColor: Theme.of(context).accentTextTheme!.titleLarge!.backgroundColor!,
|
||||
borderColor: Theme.of(context).extension<PickerTheme>()!.dividerColor,
|
||||
textColor: Theme.of(context).extension<DashboardPageTheme>()!.textColor,
|
||||
textStyle: TextStyle(
|
||||
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/routes.dart';
|
||||
import 'package:qr_flutter/qr_flutter.dart';
|
||||
import 'package:cake_wallet/themes/extensions/picker_theme.dart';
|
||||
|
||||
class WalletKeysPage extends BasePage {
|
||||
WalletKeysPage(this.walletKeysViewModel);
|
||||
|
@ -84,7 +85,7 @@ class WalletKeysPage extends BasePage {
|
|||
separatorBuilder: (context, index) => Container(
|
||||
height: 1,
|
||||
padding: EdgeInsets.only(left: 24),
|
||||
color: Theme.of(context).accentTextTheme!.titleLarge!.backgroundColor!,
|
||||
color: Theme.of(context).extension<PickerTheme>()!.dividerColor,
|
||||
child: const HorizontalSectionDivider(),
|
||||
),
|
||||
itemCount: walletKeysViewModel.items.length,
|
||||
|
|
|
@ -3,6 +3,7 @@ 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({
|
||||
|
@ -88,20 +89,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(),
|
||||
|
|
|
@ -6,6 +6,7 @@ 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/address_theme.dart';
|
||||
import 'package:cake_wallet/themes/extensions/picker_theme.dart';
|
||||
|
||||
class Picker<Item> extends StatefulWidget {
|
||||
Picker({
|
||||
|
@ -187,10 +188,7 @@ class _PickerState<Item> extends State<Picker<Item>> {
|
|||
),
|
||||
),
|
||||
Divider(
|
||||
color: Theme.of(context)
|
||||
.accentTextTheme!
|
||||
.titleLarge!
|
||||
.backgroundColor!,
|
||||
color: Theme.of(context).extension<PickerTheme>()!.dividerColor,
|
||||
height: 1,
|
||||
),
|
||||
if (widget.selectedAtIndex != -1)
|
||||
|
@ -241,10 +239,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,
|
||||
|
@ -264,10 +259,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(),
|
||||
|
|
|
@ -179,10 +179,5 @@ class BrightTheme extends LightTheme {
|
|||
bodyLarge: TextStyle(
|
||||
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/menu_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/support_page_theme.dart';
|
||||
import 'package:cake_wallet/themes/extensions/sync_indicator_theme.dart';
|
||||
|
@ -122,6 +123,10 @@ class DarkTheme extends ThemeBase {
|
|||
@override
|
||||
InfoTheme get infoTheme => InfoTheme(textColor: Palette.darkLavender);
|
||||
|
||||
@override
|
||||
PickerTheme get pickerTheme =>
|
||||
PickerTheme(dividerColor: PaletteDark.dividerColor);
|
||||
|
||||
@override
|
||||
ThemeData get themeData => super.themeData.copyWith(
|
||||
indicatorColor: PaletteDark.cyanBlue, // page indicator
|
||||
|
@ -232,11 +237,5 @@ class DarkTheme extends ThemeBase {
|
|||
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/menu_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/support_page_theme.dart';
|
||||
import 'package:cake_wallet/themes/extensions/sync_indicator_theme.dart';
|
||||
|
@ -123,6 +124,10 @@ class LightTheme extends ThemeBase {
|
|||
@override
|
||||
InfoTheme get infoTheme => InfoTheme(textColor: Palette.darkBlueCraiola);
|
||||
|
||||
@override
|
||||
PickerTheme get pickerTheme =>
|
||||
PickerTheme(dividerColor: Palette.periwinkleCraiola);
|
||||
|
||||
@override
|
||||
ThemeData get themeData => super.themeData.copyWith(
|
||||
indicatorColor:
|
||||
|
@ -233,11 +238,5 @@ class LightTheme extends ThemeBase {
|
|||
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/menu_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/support_page_theme.dart';
|
||||
import 'package:cake_wallet/themes/extensions/sync_indicator_theme.dart';
|
||||
|
@ -76,6 +77,8 @@ abstract class ThemeBase {
|
|||
|
||||
InfoTheme get infoTheme;
|
||||
|
||||
PickerTheme get pickerTheme;
|
||||
|
||||
ThemeData get themeData => generatedThemeData.copyWith(
|
||||
primaryColor: primaryColor,
|
||||
cardColor: containerColor,
|
||||
|
@ -95,6 +98,7 @@ abstract class ThemeBase {
|
|||
filterTheme,
|
||||
walletListTheme,
|
||||
infoTheme,
|
||||
pickerTheme,
|
||||
],
|
||||
scrollbarTheme: ScrollbarThemeData(
|
||||
thumbColor: MaterialStateProperty.all(scrollbarTheme.thumbColor),
|
||||
|
|
Loading…
Reference in a new issue