Cw 373 theme refactoring in preparation to support additional themes (#933)

* refactor(Theme): migrate accentColor

- based on the specs at https://docs.flutter.dev/release/breaking-changes/theme-data-accent-properties#migration-guide.

* refactor(Theme): all deprecated TextTheme styles

* refactor(Theme): deprecated backgroundColor for colorScheme.background

* refactor(Theme): deprecated buttonColor to use TextTheme backgroundColor instead

* refactor(Theme): deprecated isAlwaysShown to use thumbVisibility instead
This commit is contained in:
Rafael Saes
2023-05-25 02:19:51 +03:00
committed by GitHub
parent c835059d13
commit baabc0a915
141 changed files with 1954 additions and 1111 deletions
@@ -45,7 +45,11 @@ class ActionButton extends StatelessWidget {
title,
style: TextStyle(
fontSize: 10,
color: textColor ?? Theme.of(context).accentTextTheme!.headline2!.backgroundColor!),
color: textColor ??
Theme.of(context)
.accentTextTheme!
.displayMedium!
.backgroundColor!),
)
],
),
@@ -63,7 +63,10 @@ class AddressPage extends BasePage {
Widget? leading(BuildContext context) {
final _backButton = Icon(
Icons.arrow_back_ios,
color: Theme.of(context).accentTextTheme!.headline2!.backgroundColor!,
color: Theme.of(context)
.accentTextTheme!
.displayMedium!
.backgroundColor!,
size: 16,
);
final _closeButton = currentTheme.type == ThemeType.dark
@@ -106,7 +109,7 @@ class AddressPage extends BasePage {
(BuildContext context, Widget scaffold) => Container(
decoration: BoxDecoration(
gradient: LinearGradient(colors: [
Theme.of(context).accentColor,
Theme.of(context).colorScheme.secondary,
Theme.of(context).scaffoldBackgroundColor,
Theme.of(context).primaryColor,
], begin: Alignment.topRight, end: Alignment.bottomLeft)),
@@ -131,7 +134,10 @@ class AddressPage extends BasePage {
icon: Icon(
Icons.share,
size: 20,
color: Theme.of(context).accentTextTheme.headline2!.backgroundColor!,
color: Theme.of(context)
.accentTextTheme!
.displayMedium!
.backgroundColor!,
),
),
);
@@ -172,7 +178,10 @@ class AddressPage extends BasePage {
tapOutsideToDismiss: true,
config: KeyboardActionsConfig(
keyboardActionsPlatform: KeyboardActionsPlatform.IOS,
keyboardBarColor: Theme.of(context).accentTextTheme.bodyText1!.backgroundColor!,
keyboardBarColor: Theme.of(context)
.accentTextTheme!
.bodyLarge!
.backgroundColor!,
nextFocus: false,
actions: [
KeyboardActionsItem(
@@ -204,8 +213,15 @@ class AddressPage extends BasePage {
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(25)),
border: Border.all(
color: Theme.of(context).textTheme.subtitle1!.color!, width: 1),
color: Theme.of(context).buttonColor),
color: Theme.of(context)
.textTheme!
.titleMedium!
.color!,
width: 1),
color: Theme.of(context)
.textTheme!
.titleLarge!
.backgroundColor!),
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
@@ -219,15 +235,17 @@ class AddressPage extends BasePage {
fontSize: 14,
fontWeight: FontWeight.w500,
color: Theme.of(context)
.accentTextTheme
.headline2!
.accentTextTheme!
.displayMedium!
.backgroundColor!),
)),
Icon(
Icons.arrow_forward_ios,
size: 14,
color:
Theme.of(context).accentTextTheme.headline2!.backgroundColor!,
color: Theme.of(context)
.accentTextTheme!
.displayMedium!
.backgroundColor!,
)
],
),
@@ -237,7 +255,10 @@ class AddressPage extends BasePage {
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 15,
color: Theme.of(context).accentTextTheme.headline3!.backgroundColor!));
color: Theme.of(context)
.accentTextTheme!
.displaySmall!
.backgroundColor!));
})
],
),
@@ -37,19 +37,19 @@ class AnonpayTransactionRow extends StatelessWidget {
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w500,
color: Theme.of(context).accentTextTheme.headline2!.backgroundColor!)),
color: Theme.of(context).accentTextTheme!.displayMedium!.backgroundColor!)),
Text(amount + ' ' + currency,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w500,
color: Theme.of(context).accentTextTheme.headline2!.backgroundColor!))
color: Theme.of(context).accentTextTheme!.displayMedium!.backgroundColor!))
]),
SizedBox(height: 5),
Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: <Widget>[
Text(createdAt,
style: TextStyle(
fontSize: 14,
color: Theme.of(context).textTheme.overline!.backgroundColor!))
color: Theme.of(context).textTheme!.labelSmall!.backgroundColor!))
])
],
))
@@ -35,7 +35,10 @@ class BalancePage extends StatelessWidget {
fontSize: 24,
fontFamily: 'Lato',
fontWeight: FontWeight.w600,
color: Theme.of(context).accentTextTheme!.headline2!.backgroundColor!,
color: Theme.of(context)
.accentTextTheme!
.displayMedium!
.backgroundColor!,
height: 1),
maxLines: 1,
textAlign: TextAlign.center);
@@ -98,7 +101,7 @@ class BalancePage extends StatelessWidget {
: Colors.transparent,
width: 1,
),
color: Theme.of(context).textTheme!.headline6!.backgroundColor!),
color: Theme.of(context).textTheme!.titleLarge!.backgroundColor!),
child: Container(
margin: const EdgeInsets.only(top: 16, left: 24, right: 24, bottom: 24),
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
@@ -111,7 +114,10 @@ class BalancePage extends StatelessWidget {
fontSize: 12,
fontFamily: 'Lato',
fontWeight: FontWeight.w400,
color: Theme.of(context).accentTextTheme!.headline3!.backgroundColor!,
color: Theme.of(context)
.accentTextTheme!
.displaySmall!
.backgroundColor!,
height: 1)),
SizedBox(height: 5),
Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
@@ -120,7 +126,10 @@ class BalancePage extends StatelessWidget {
fontSize: 24,
fontFamily: 'Lato',
fontWeight: FontWeight.w900,
color: Theme.of(context).accentTextTheme!.headline2!.backgroundColor!,
color: Theme.of(context)
.accentTextTheme!
.displayMedium!
.backgroundColor!,
height: 1),
maxLines: 1,
textAlign: TextAlign.center),
@@ -129,7 +138,10 @@ class BalancePage extends StatelessWidget {
fontSize: 28,
fontFamily: 'Lato',
fontWeight: FontWeight.w800,
color: Theme.of(context).accentTextTheme!.headline2!.backgroundColor!,
color: Theme.of(context)
.accentTextTheme!
.displayMedium!
.backgroundColor!,
height: 1)),
]),
SizedBox(
@@ -141,7 +153,10 @@ class BalancePage extends StatelessWidget {
fontSize: 16,
fontFamily: 'Lato',
fontWeight: FontWeight.w500,
color: Theme.of(context).accentTextTheme!.headline2!.backgroundColor!,
color: Theme.of(context)
.accentTextTheme!
.displayMedium!
.backgroundColor!,
height: 1)),
SizedBox(height: 26),
if (frozenBalance.isNotEmpty)
@@ -152,7 +167,10 @@ class BalancePage extends StatelessWidget {
fontSize: 12,
fontFamily: 'Lato',
fontWeight: FontWeight.w400,
color: Theme.of(context).accentTextTheme!.headline3!.backgroundColor!,
color: Theme.of(context)
.accentTextTheme!
.displaySmall!
.backgroundColor!,
height: 1)),
SizedBox(height: 8),
AutoSizeText(frozenBalance,
@@ -160,7 +178,10 @@ class BalancePage extends StatelessWidget {
fontSize: 20,
fontFamily: 'Lato',
fontWeight: FontWeight.w400,
color: Theme.of(context).accentTextTheme!.headline2!.backgroundColor!,
color: Theme.of(context)
.accentTextTheme!
.displayMedium!
.backgroundColor!,
height: 1),
maxLines: 1,
textAlign: TextAlign.center),
@@ -172,7 +193,10 @@ class BalancePage extends StatelessWidget {
fontSize: 12,
fontFamily: 'Lato',
fontWeight: FontWeight.w400,
color: Theme.of(context).accentTextTheme!.headline2!.backgroundColor!,
color: Theme.of(context)
.accentTextTheme!
.displayMedium!
.backgroundColor!,
height: 1),
),
SizedBox(height: 24)
@@ -183,7 +207,10 @@ class BalancePage extends StatelessWidget {
fontSize: 12,
fontFamily: 'Lato',
fontWeight: FontWeight.w400,
color: Theme.of(context).accentTextTheme!.headline3!.backgroundColor!,
color: Theme.of(context)
.accentTextTheme!
.displaySmall!
.backgroundColor!,
height: 1)),
SizedBox(height: 8),
AutoSizeText(additionalBalance,
@@ -191,7 +218,10 @@ class BalancePage extends StatelessWidget {
fontSize: 20,
fontFamily: 'Lato',
fontWeight: FontWeight.w400,
color: Theme.of(context).accentTextTheme!.headline2!.backgroundColor!,
color: Theme.of(context)
.accentTextTheme!
.displayMedium!
.backgroundColor!,
height: 1),
maxLines: 1,
textAlign: TextAlign.center),
@@ -205,7 +235,10 @@ class BalancePage extends StatelessWidget {
fontSize: 12,
fontFamily: 'Lato',
fontWeight: FontWeight.w400,
color: Theme.of(context).accentTextTheme!.headline2!.backgroundColor!,
color: Theme.of(context)
.accentTextTheme!
.displayMedium!
.backgroundColor!,
height: 1),
)
])),
@@ -36,6 +36,9 @@ class DateSectionRaw extends StatelessWidget {
child: Text(title,
style: TextStyle(
fontSize: 12,
color: Theme.of(context).textTheme!.overline!.backgroundColor!)));
color: Theme.of(context)
.textTheme!
.labelSmall!
.backgroundColor!)));
}
}
@@ -23,7 +23,7 @@ class FilterWidget extends StatelessWidget {
child: ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(24)),
child: Container(
color: Theme.of(context).textTheme!.bodyText1!.decorationColor!,
color: Theme.of(context).textTheme!.bodyLarge!.decorationColor!,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@@ -33,8 +33,8 @@ class FilterWidget extends StatelessWidget {
S.of(context).filter_by,
style: TextStyle(
color: Theme.of(context)
.primaryTextTheme
.overline!
.primaryTextTheme!
.labelSmall!
.color!,
fontSize: 16,
fontFamily: 'Lato',
@@ -65,7 +65,7 @@ class FilterWidget extends StatelessWidget {
style: TextStyle(
color: Theme.of(context)
.primaryTextTheme!
.headline6!
.titleLarge!
.color!,
fontSize: 16,
fontFamily: 'Lato',
@@ -12,7 +12,7 @@ class HeaderRow extends StatelessWidget {
@override
Widget build(BuildContext context) {
final filterIcon = Image.asset('assets/images/filter_icon.png',
color: Theme.of(context).textTheme!.caption!.decorationColor!);
color: Theme.of(context).textTheme!.bodySmall!.decorationColor!);
return Container(
height: 52,
@@ -25,10 +25,12 @@ class HeaderRow extends StatelessWidget {
Text(
S.of(context).transactions,
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.w500,
color: Theme.of(context).accentTextTheme!.headline2!.backgroundColor!
),
fontSize: 20,
fontWeight: FontWeight.w500,
color: Theme.of(context)
.accentTextTheme!
.displayMedium!
.backgroundColor!),
),
GestureDetector(
onTap: () {
@@ -43,8 +45,7 @@ class HeaderRow extends StatelessWidget {
width: 36,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Theme.of(context).textTheme!.overline!.color!
),
color: Theme.of(context).textTheme!.labelSmall!.color!),
child: filterIcon,
),
)
@@ -22,7 +22,7 @@ class MarketPlacePage extends StatelessWidget {
child: RawScrollbar(
thumbColor: Colors.white.withOpacity(0.15),
radius: Radius.circular(20),
isAlwaysShown: true,
thumbVisibility: true,
thickness: 2,
controller: _scrollController,
child: Padding(
@@ -36,7 +36,10 @@ class MarketPlacePage extends StatelessWidget {
style: TextStyle(
fontSize: 24,
fontWeight: FontWeight.w500,
color: Theme.of(context).accentTextTheme!.headline2!.backgroundColor!,
color: Theme.of(context)
.accentTextTheme!
.displayMedium!
.backgroundColor!,
),
),
Expanded(
@@ -84,9 +84,15 @@ class MenuWidgetState extends State<MenuWidget> {
final itemCount = SettingActions.all.length;
moneroIcon = Image.asset('assets/images/monero_menu.png',
color: Theme.of(context).accentTextTheme.overline!.decorationColor!);
color: Theme.of(context)
.accentTextTheme!
.labelSmall!
.decorationColor!);
bitcoinIcon = Image.asset('assets/images/bitcoin_menu.png',
color: Theme.of(context).accentTextTheme.overline!.decorationColor!);
color: Theme.of(context)
.accentTextTheme!
.labelSmall!
.decorationColor!);
litecoinIcon = Image.asset('assets/images/litecoin_menu.png');
havenIcon = Image.asset('assets/images/haven_menu.png');
@@ -108,7 +114,8 @@ class MenuWidgetState extends State<MenuWidget> {
borderRadius: BorderRadius.only(
topLeft: Radius.circular(24), bottomLeft: Radius.circular(24)),
child: Container(
color: Theme.of(context).textTheme.bodyText1!.decorationColor!,
color:
Theme.of(context).textTheme!.bodyLarge!.decorationColor!,
child: ListView.separated(
padding: EdgeInsets.only(top: 0),
itemBuilder: (_, index) {
@@ -117,9 +124,14 @@ class MenuWidgetState extends State<MenuWidget> {
height: headerHeight,
decoration: BoxDecoration(
gradient: LinearGradient(colors: [
Theme.of(context).accentTextTheme.headline4!.color!,
Theme.of(context).accentTextTheme.headline4!.decorationColor!,
], begin: Alignment.topLeft, end: Alignment.bottomRight),
Theme.of(context)
.accentTextTheme!
.headlineMedium!
.color!,
Theme.of(context)
.accentTextTheme!
.headlineMedium!
.decorationColor!, ], begin: Alignment.topLeft, end: Alignment.bottomRight),
),
padding: EdgeInsets.only(
left: 24, top: fromTopEdge, right: 24, bottom: fromBottomEdge),
@@ -149,8 +161,8 @@ class MenuWidgetState extends State<MenuWidget> {
widget.dashboardViewModel.subname,
style: TextStyle(
color: Theme.of(context)
.accentTextTheme
.overline!
.accentTextTheme!
.labelSmall!
.decorationColor!,
fontWeight: FontWeight.w500,
fontSize: 12),
@@ -182,7 +194,10 @@ class MenuWidgetState extends State<MenuWidget> {
},
separatorBuilder: (_, index) => Container(
height: 1,
color: Theme.of(context).primaryTextTheme.caption!.decorationColor!,
color: Theme.of(context)
.primaryTextTheme!
.bodySmall!
.decorationColor!,
),
itemCount: itemCount + 1),
)))
@@ -20,7 +20,7 @@ class OrderRow extends StatelessWidget {
@override
Widget build(BuildContext context) {
final iconColor =
Theme.of(context).primaryTextTheme!.headline1!.backgroundColor!;
Theme.of(context).primaryTextTheme!.displayLarge!.backgroundColor!;
final providerIcon = getBuyProviderIcon(provider, iconColor: iconColor);
@@ -48,14 +48,14 @@ class OrderRow extends StatelessWidget {
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w500,
color: Theme.of(context).accentTextTheme!.headline2!.backgroundColor!
color: Theme.of(context).accentTextTheme!.displayMedium!.backgroundColor!
)),
formattedAmount != null
? Text(formattedAmount! + ' ' + to,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w500,
color: Theme.of(context).accentTextTheme!.headline2!.backgroundColor!
color: Theme.of(context).accentTextTheme!.displayMedium!.backgroundColor!
))
: Container()
]),
@@ -66,8 +66,10 @@ class OrderRow extends StatelessWidget {
Text(createdAtFormattedDate,
style: TextStyle(
fontSize: 14,
color: Theme.of(context).textTheme!
.overline!.backgroundColor!))
color: Theme.of(context)
.textTheme!
.labelSmall!
.backgroundColor!))
])
],
)
@@ -18,7 +18,10 @@ class PresentReceiveOptionPicker extends StatelessWidget {
@override
Widget build(BuildContext context) {
final textIconTheme = hasWhiteBackground
? Theme.of(context).accentTextTheme.headline2!.backgroundColor!
? Theme.of(context)
.accentTextTheme!
.displayMedium!
.backgroundColor!
: Colors.white;
final arrowBottom = Image.asset(
'assets/images/arrow_bottom_purple_icon.png',
@@ -83,7 +86,7 @@ class PresentReceiveOptionPicker extends StatelessWidget {
margin: EdgeInsets.symmetric(horizontal: 24),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(30),
color: Theme.of(context).backgroundColor,
color: Theme.of(context).colorScheme.background,
),
child: Padding(
padding: const EdgeInsets.only(top: 24, bottom: 24),
@@ -110,7 +113,10 @@ class PresentReceiveOptionPicker extends StatelessWidget {
Text(option.toString(),
textAlign: TextAlign.left,
style: textSmall(
color: Theme.of(context).primaryTextTheme.headline6!.color!,
color: Theme.of(context)
.primaryTextTheme!
.titleLarge!
.color!,
).copyWith(
fontWeight:
value == option ? FontWeight.w800 : FontWeight.w500,
@@ -32,7 +32,7 @@ class SyncIndicator extends StatelessWidget {
child: Container(
height: 30,
width: syncIndicatorWidth,
color: Theme.of(context).textTheme!.headline6!.decorationColor!,
color: Theme.of(context).textTheme!.titleLarge!.decorationColor!,
child: Stack(
alignment: Alignment.center,
children: <Widget>[
@@ -44,7 +44,7 @@ class SyncIndicator extends StatelessWidget {
child: Container(
width: indicatorWidth,
height: 30,
color: Theme.of(context).textTheme!.headline6!.backgroundColor!,
color: Theme.of(context).textTheme!.titleLarge!.backgroundColor!,
)
)
: Offstage(),
@@ -66,7 +66,7 @@ class SyncIndicator extends StatelessWidget {
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w500,
color: Theme.of(context).textTheme!.headline6!.color!
color: Theme.of(context).textTheme!.titleLarge!.color!
),
),
)
@@ -26,14 +26,15 @@ class SyncIndicatorIcon extends StatelessWidget {
if (boolMode) {
indicatorColor = isSynced
? PaletteDark.brightGreen
: Theme.of(context).textTheme!.caption!.color!;
: Theme.of(context).textTheme!.bodySmall!.color!;
} else {
switch (value.toLowerCase()) {
case waiting:
indicatorColor = Colors.red;
break;
case actionRequired:
indicatorColor = Theme.of(context).textTheme!.headline2!.decorationColor!;
indicatorColor =
Theme.of(context).textTheme!.displayMedium!.decorationColor!;
break;
case created:
indicatorColor = PaletteDark.brightGreen;
@@ -43,14 +43,14 @@ class TradeRow extends StatelessWidget {
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w500,
color: Theme.of(context).accentTextTheme!.headline2!.backgroundColor!)),
color: Theme.of(context).accentTextTheme!.displayMedium!.backgroundColor!)),
formattedAmount != null
? Text(formattedAmount! + ' ' + amountCrypto,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w500,
color:
Theme.of(context).accentTextTheme!.headline2!.backgroundColor!))
Theme.of(context).accentTextTheme!.displayMedium!.backgroundColor!))
: Container()
]),
SizedBox(height: 5),
@@ -59,7 +59,7 @@ class TradeRow extends StatelessWidget {
Text(createdAtFormattedDate!,
style: TextStyle(
fontSize: 14,
color: Theme.of(context).textTheme!.overline!.backgroundColor!))
color: Theme.of(context).textTheme!.labelSmall!.backgroundColor!))
])
],
))
@@ -35,7 +35,7 @@ class TransactionRow extends StatelessWidget {
width: 36,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Theme.of(context).textTheme!.overline!.decorationColor!
color: Theme.of(context).textTheme!.labelSmall!.decorationColor!
),
child: Image.asset(
direction == TransactionDirection.incoming
@@ -55,13 +55,13 @@ class TransactionRow extends StatelessWidget {
fontSize: 16,
fontWeight: FontWeight.w500,
color: Theme.of(context).accentTextTheme!
.headline2!.backgroundColor!)),
.displayMedium!.backgroundColor!)),
Text(formattedAmount,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w500,
color: Theme.of(context).accentTextTheme!
.headline2!.backgroundColor!))
.displayMedium!.backgroundColor!))
]),
SizedBox(height: 5),
Row(
@@ -72,14 +72,14 @@ class TransactionRow extends StatelessWidget {
fontSize: 14,
color: Theme.of(context)
.textTheme!
.overline!
.labelSmall!
.backgroundColor!)),
Text(formattedFiatAmount,
style: TextStyle(
fontSize: 14,
color: Theme.of(context)
.textTheme!
.overline!
.labelSmall!
.backgroundColor!))
])
],
@@ -28,7 +28,7 @@ class TransactionsPage extends StatelessWidget {
return Container(
color: ResponsiveLayoutUtil.instance.isMobile(context)
? null
: Theme.of(context).backgroundColor,
: Theme.of(context).colorScheme.background,
padding: EdgeInsets.only(top: 24, bottom: 24),
child: Column(
children: <Widget>[
@@ -121,7 +121,7 @@ class TransactionsPage extends StatelessWidget {
S.of(context).placeholder_transactions,
style: TextStyle(
fontSize: 14,
color: Theme.of(context).primaryTextTheme.overline!.decorationColor!),
color: Theme.of(context).primaryTextTheme!.labelSmall!.decorationColor!),
),
);
}))