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",
"yesLabel": "Yes",
"noLabel": "No",
"main": {
"navigationView": {
"dashboardTab": "Dashboard",
"patcherTab": "Patcher",
"settingsTab": "Settings"

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -19,14 +19,20 @@ class AvailableUpdatesCard extends StatelessWidget {
child: Center(
child: Column(
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),
I18nText(
'homeView.noUpdates',
child: Text(
'',
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: Column(
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),
I18nText(
'homeView.noInstallations',
child: Text(
'',
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>[
I18nText(
'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>(
@ -56,6 +59,9 @@ class _LatestCommitCardState extends State<LatestCommitCard> {
context,
'latestCommitCard.loadingLabel',
),
style: TextStyle(
color: Theme.of(context).colorScheme.secondary,
),
),
),
],
@ -65,22 +71,39 @@ class _LatestCommitCardState extends State<LatestCommitCard> {
children: <Widget>[
I18nText(
'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>(
future: _githubAPI.latestCommitTime(
_managerAPI.getManagerRepo(),
),
builder: (context, snapshot) =>
snapshot.hasData && snapshot.data!.isNotEmpty
? I18nText(
'latestCommitCard.timeagoLabel',
translationParams: {'time': snapshot.data!},
)
: I18nText('latestCommitCard.loadingLabel'),
builder: (context, snapshot) => snapshot.hasData &&
snapshot.data!.isNotEmpty
? I18nText(
'latestCommitCard.timeagoLabel',
translationParams: {'time': snapshot.data!},
child: Text(
'',
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,
prefixIcon: Icon(
Icons.search,
color: Theme.of(context).iconTheme.color,
color: Theme.of(context).colorScheme.secondary,
),
suffixIcon: _textController.text.isNotEmpty
? IconButton(