fix: Further improvements on app theming

This commit is contained in:
Alberto Ponces 2022-09-07 12:01:04 +01:00
parent 3b830cf15a
commit 1e890708d2
11 changed files with 98 additions and 46 deletions

View File

@ -5,7 +5,7 @@
"disabledLabel": "Disabled", "disabledLabel": "Disabled",
"yesLabel": "Yes", "yesLabel": "Yes",
"noLabel": "No", "noLabel": "No",
"main": { "navigationView": {
"dashboardTab": "Dashboard", "dashboardTab": "Dashboard",
"patcherTab": "Patcher", "patcherTab": "Patcher",
"settingsTab": "Settings" "settingsTab": "Settings"

View File

@ -1,15 +1,18 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart'; import 'package:google_fonts/google_fonts.dart';
var lightCustomColorScheme = ColorScheme.fromSeed(
seedColor: Colors.blue,
brightness: Brightness.light,
);
var lightCustomTheme = ThemeData( var lightCustomTheme = ThemeData(
useMaterial3: true, useMaterial3: true,
colorScheme: ColorScheme.fromSeed( colorScheme: lightCustomColorScheme,
seedColor: Colors.blue,
brightness: Brightness.light,
),
navigationBarTheme: NavigationBarThemeData( navigationBarTheme: NavigationBarThemeData(
labelTextStyle: MaterialStateProperty.all( labelTextStyle: MaterialStateProperty.all(
const TextStyle( TextStyle(
color: lightCustomColorScheme.secondary,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
), ),
), ),
@ -17,17 +20,20 @@ var lightCustomTheme = ThemeData(
textTheme: GoogleFonts.robotoTextTheme(ThemeData.light().textTheme), textTheme: GoogleFonts.robotoTextTheme(ThemeData.light().textTheme),
); );
var darkCustomColorScheme = ColorScheme.fromSeed(
seedColor: Colors.blue,
brightness: Brightness.dark,
primary: const Color(0xff7792BA),
surface: const Color(0xff0A0D11),
);
var darkCustomTheme = ThemeData( var darkCustomTheme = ThemeData(
useMaterial3: true, useMaterial3: true,
colorScheme: ColorScheme.fromSeed( colorScheme: darkCustomColorScheme,
seedColor: Colors.blue,
brightness: Brightness.dark,
primary: const Color(0xff7792BA),
surface: const Color(0xff0A0D11),
),
navigationBarTheme: NavigationBarThemeData( navigationBarTheme: NavigationBarThemeData(
labelTextStyle: MaterialStateProperty.all( labelTextStyle: MaterialStateProperty.all(
const TextStyle( TextStyle(
color: darkCustomColorScheme.secondary,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
), ),
), ),

View File

@ -29,10 +29,16 @@ class DynamicThemeBuilder extends StatelessWidget {
backgroundColor: lightColorScheme?.background, backgroundColor: lightColorScheme?.background,
indicatorColor: lightColorScheme?.primary.withAlpha(150), indicatorColor: lightColorScheme?.primary.withAlpha(150),
labelTextStyle: MaterialStateProperty.all( labelTextStyle: MaterialStateProperty.all(
const TextStyle( GoogleFonts.roboto(
color: lightColorScheme?.secondary,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
), ),
), ),
iconTheme: MaterialStateProperty.all(
IconThemeData(
color: lightColorScheme?.secondary,
),
),
), ),
scaffoldBackgroundColor: lightColorScheme?.background, scaffoldBackgroundColor: lightColorScheme?.background,
colorScheme: lightColorScheme?.harmonized(), colorScheme: lightColorScheme?.harmonized(),
@ -46,13 +52,14 @@ class DynamicThemeBuilder extends StatelessWidget {
backgroundColor: darkColorScheme?.background, backgroundColor: darkColorScheme?.background,
indicatorColor: darkColorScheme?.primary.withOpacity(0.4), indicatorColor: darkColorScheme?.primary.withOpacity(0.4),
labelTextStyle: MaterialStateProperty.all( labelTextStyle: MaterialStateProperty.all(
const TextStyle( GoogleFonts.roboto(
color: darkColorScheme?.secondary,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
), ),
), ),
iconTheme: MaterialStateProperty.all( iconTheme: MaterialStateProperty.all(
const IconThemeData( IconThemeData(
color: Colors.white, color: darkColorScheme?.secondary,
), ),
), ),
), ),

View File

@ -60,7 +60,7 @@ class InstallerView extends StatelessWidget {
preferredSize: const Size(double.infinity, 1.0), preferredSize: const Size(double.infinity, 1.0),
child: LinearProgressIndicator( child: LinearProgressIndicator(
color: Theme.of(context).colorScheme.primary, color: Theme.of(context).colorScheme.primary,
backgroundColor: Colors.white, backgroundColor: Theme.of(context).colorScheme.secondary,
value: model.progress, value: model.progress,
), ),
), ),

View File

@ -34,26 +34,30 @@ class NavigationView extends StatelessWidget {
selectedIndex: model.currentIndex, selectedIndex: model.currentIndex,
destinations: <Widget>[ destinations: <Widget>[
NavigationDestination( NavigationDestination(
icon: const Icon( icon: model.isIndexSelected(0)
Icons.dashboard_outlined, ? const Icon(Icons.dashboard)
), : const Icon(Icons.dashboard_outlined),
label: FlutterI18n.translate( label: FlutterI18n.translate(
context, context,
'main.dashboardTab', 'navigationView.dashboardTab',
), ),
), ),
NavigationDestination( NavigationDestination(
icon: const Icon(Icons.build_outlined), icon: model.isIndexSelected(1)
? const Icon(Icons.build)
: const Icon(Icons.build_outlined),
label: FlutterI18n.translate( label: FlutterI18n.translate(
context, context,
'main.patcherTab', 'navigationView.patcherTab',
), ),
), ),
NavigationDestination( NavigationDestination(
icon: const Icon(Icons.settings_outlined), icon: model.isIndexSelected(2)
? const Icon(Icons.settings)
: const Icon(Icons.settings_outlined),
label: FlutterI18n.translate( label: FlutterI18n.translate(
context, context,
'main.settingsTab', 'navigationView.settingsTab',
), ),
), ),
], ],

View File

@ -70,7 +70,7 @@ class SettingsViewModel extends BaseViewModel {
context: context, context: context,
builder: (context) => SimpleDialog( builder: (context) => SimpleDialog(
title: I18nText('settingsView.languageLabel'), title: I18nText('settingsView.languageLabel'),
backgroundColor: Theme.of(context).colorScheme.surface, backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
children: <Widget>[ children: <Widget>[
RadioListTile<String>( RadioListTile<String>(
title: I18nText('settingsView.englishOption'), title: I18nText('settingsView.englishOption'),

View File

@ -46,6 +46,7 @@ class AppInfoViewModel extends BaseViewModel {
context: context, context: context,
builder: (context) => AlertDialog( builder: (context) => AlertDialog(
title: I18nText('appInfoView.alertDialogTitle'), title: I18nText('appInfoView.alertDialogTitle'),
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
content: I18nText('appInfoView.errorDialogText'), content: I18nText('appInfoView.errorDialogText'),
actions: [ actions: [
CustomMaterialButton( CustomMaterialButton(
@ -53,7 +54,6 @@ class AppInfoViewModel extends BaseViewModel {
onPressed: () => Navigator.of(context).pop(), onPressed: () => Navigator.of(context).pop(),
) )
], ],
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
), ),
); );
} else { } else {
@ -61,6 +61,7 @@ class AppInfoViewModel extends BaseViewModel {
context: context, context: context,
builder: (context) => AlertDialog( builder: (context) => AlertDialog(
title: I18nText('appInfoView.alertDialogTitle'), title: I18nText('appInfoView.alertDialogTitle'),
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
content: I18nText('appInfoView.alertDialogText'), content: I18nText('appInfoView.alertDialogText'),
actions: [ actions: [
CustomMaterialButton( CustomMaterialButton(
@ -78,7 +79,6 @@ class AppInfoViewModel extends BaseViewModel {
}, },
) )
], ],
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
), ),
); );
} }
@ -102,6 +102,7 @@ class AppInfoViewModel extends BaseViewModel {
context: context, context: context,
builder: (context) => AlertDialog( builder: (context) => AlertDialog(
title: I18nText('appInfoView.appliedPatchesLabel'), title: I18nText('appInfoView.appliedPatchesLabel'),
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
content: Text(getAppliedPatchesString(app.appliedPatches)), content: Text(getAppliedPatchesString(app.appliedPatches)),
actions: [ actions: [
CustomMaterialButton( CustomMaterialButton(
@ -109,7 +110,6 @@ class AppInfoViewModel extends BaseViewModel {
onPressed: () => Navigator.of(context).pop(), onPressed: () => Navigator.of(context).pop(),
) )
], ],
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
), ),
); );
} }

View File

@ -19,14 +19,20 @@ class AvailableUpdatesCard extends StatelessWidget {
child: Center( child: Center(
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
const Icon(Icons.update_disabled, size: 40), Icon(
size: 40,
Icons.update_disabled,
color: Theme.of(context).colorScheme.secondary,
),
const SizedBox(height: 16), const SizedBox(height: 16),
I18nText( I18nText(
'homeView.noUpdates', 'homeView.noUpdates',
child: Text( child: Text(
'', '',
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: Theme.of(context).textTheme.subtitle1!, style: Theme.of(context).textTheme.subtitle1!.copyWith(
color: Theme.of(context).colorScheme.secondary,
),
), ),
) )
], ],

View File

@ -19,14 +19,20 @@ class InstalledAppsCard extends StatelessWidget {
child: Center( child: Center(
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
const Icon(Icons.file_download_off, size: 40), Icon(
size: 40,
Icons.file_download_off,
color: Theme.of(context).colorScheme.secondary,
),
const SizedBox(height: 16), const SizedBox(height: 16),
I18nText( I18nText(
'homeView.noInstallations', 'homeView.noInstallations',
child: Text( child: Text(
'', '',
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: Theme.of(context).textTheme.subtitle1!, style: Theme.of(context).textTheme.subtitle1!.copyWith(
color: Theme.of(context).colorScheme.secondary,
),
), ),
) )
], ],

View File

@ -36,9 +36,12 @@ class _LatestCommitCardState extends State<LatestCommitCard> {
children: <Widget>[ children: <Widget>[
I18nText( I18nText(
'latestCommitCard.patcherLabel', 'latestCommitCard.patcherLabel',
child: const Text( child: Text(
'', '',
style: TextStyle(fontWeight: FontWeight.bold), style: TextStyle(
fontWeight: FontWeight.bold,
color: Theme.of(context).colorScheme.secondary,
),
), ),
), ),
FutureBuilder<String>( FutureBuilder<String>(
@ -56,6 +59,9 @@ class _LatestCommitCardState extends State<LatestCommitCard> {
context, context,
'latestCommitCard.loadingLabel', 'latestCommitCard.loadingLabel',
), ),
style: TextStyle(
color: Theme.of(context).colorScheme.secondary,
),
), ),
), ),
], ],
@ -65,22 +71,39 @@ class _LatestCommitCardState extends State<LatestCommitCard> {
children: <Widget>[ children: <Widget>[
I18nText( I18nText(
'latestCommitCard.managerLabel', 'latestCommitCard.managerLabel',
child: const Text( child: Text(
'', '',
style: TextStyle(fontWeight: FontWeight.bold), style: TextStyle(
fontWeight: FontWeight.bold,
color: Theme.of(context).colorScheme.secondary,
),
), ),
), ),
FutureBuilder<String>( FutureBuilder<String>(
future: _githubAPI.latestCommitTime( future: _githubAPI.latestCommitTime(
_managerAPI.getManagerRepo(), _managerAPI.getManagerRepo(),
), ),
builder: (context, snapshot) => builder: (context, snapshot) => snapshot.hasData &&
snapshot.hasData && snapshot.data!.isNotEmpty snapshot.data!.isNotEmpty
? I18nText( ? I18nText(
'latestCommitCard.timeagoLabel', 'latestCommitCard.timeagoLabel',
translationParams: {'time': snapshot.data!}, translationParams: {'time': snapshot.data!},
) child: Text(
: I18nText('latestCommitCard.loadingLabel'), '',
style: TextStyle(
color: Theme.of(context).colorScheme.secondary,
),
),
)
: I18nText(
'latestCommitCard.loadingLabel',
child: Text(
'',
style: TextStyle(
color: Theme.of(context).colorScheme.secondary,
),
),
),
), ),
], ],
), ),

View File

@ -43,7 +43,7 @@ class _SearchBarState extends State<SearchBar> {
hintText: widget.hintText, hintText: widget.hintText,
prefixIcon: Icon( prefixIcon: Icon(
Icons.search, Icons.search,
color: Theme.of(context).iconTheme.color, color: Theme.of(context).colorScheme.secondary,
), ),
suffixIcon: _textController.text.isNotEmpty suffixIcon: _textController.text.isNotEmpty
? IconButton( ? IconButton(