mirror of
https://github.com/wger-project/flutter.git
synced 2026-11-28 17:08:29 +01:00
Update theme
This is now created with flex_color_scheme, which makes tweaking this much much easier
This commit is contained in:
@@ -16,8 +16,10 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
import 'package:flutter_zxing/flutter_zxing.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:wger/providers/add_exercise.dart';
|
||||
import 'package:wger/providers/base_provider.dart';
|
||||
@@ -50,8 +52,6 @@ import 'package:wger/theme/theme.dart';
|
||||
import 'package:wger/widgets/core/about.dart';
|
||||
|
||||
import 'providers/auth.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter_zxing/flutter_zxing.dart';
|
||||
|
||||
void main() {
|
||||
zx.setLogEnabled(kDebugMode);
|
||||
|
||||
@@ -16,29 +16,44 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import 'package:flex_seed_scheme/flex_seed_scheme.dart';
|
||||
import 'package:flex_color_scheme/flex_color_scheme.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:table_calendar/table_calendar.dart';
|
||||
|
||||
// Color scheme, please consult
|
||||
// * https://pub.dev/packages/flex_color_scheme
|
||||
// * https://rydmike.com/flexseedscheme/demo-v1/#/
|
||||
|
||||
const Color wgerPrimaryColor = Color(0xff2a4c7d);
|
||||
const Color wgerPrimaryButtonColor = Color(0xff266dd3);
|
||||
const Color wgerPrimaryColorLight = Color(0xff94B2DB);
|
||||
const Color wgerSecondaryColor = Color(0xffe63946);
|
||||
const Color wgerSecondaryColorLight = Color(0xffF6B4BA);
|
||||
const Color wgerTertiaryColor = Color(0xFF6CA450);
|
||||
|
||||
const FlexSubThemesData wgerSubThemeData = FlexSubThemesData(
|
||||
fabSchemeColor: SchemeColor.secondary,
|
||||
inputDecoratorBorderType: FlexInputBorderType.underline,
|
||||
useTextTheme: true,
|
||||
);
|
||||
|
||||
// Make a light ColorScheme from the seeds.
|
||||
final ColorScheme schemeLight = SeedColorScheme.fromSeeds(
|
||||
primary: wgerPrimaryColor,
|
||||
primaryKey: wgerPrimaryColor,
|
||||
secondaryKey: wgerSecondaryColor,
|
||||
secondary: wgerSecondaryColor,
|
||||
tertiaryKey: wgerTertiaryColor,
|
||||
brightness: Brightness.light,
|
||||
tones: FlexTones.vivid(Brightness.light),
|
||||
);
|
||||
|
||||
// Make a dark ColorScheme from the seeds.
|
||||
final ColorScheme schemeDark = SeedColorScheme.fromSeeds(
|
||||
// primary: wgerPrimaryColor,
|
||||
primaryKey: wgerPrimaryColor,
|
||||
secondaryKey: wgerSecondaryColor,
|
||||
secondary: wgerSecondaryColor,
|
||||
brightness: Brightness.dark,
|
||||
tones: FlexTones.vivid(Brightness.dark),
|
||||
);
|
||||
@@ -59,47 +74,34 @@ final ColorScheme schemeDarkHc = SeedColorScheme.fromSeeds(
|
||||
tones: FlexTones.ultraContrast(Brightness.dark),
|
||||
);
|
||||
|
||||
final wgerLightTheme = ThemeData.from(
|
||||
final wgerLightTheme = FlexThemeData.light(
|
||||
colorScheme: schemeLight,
|
||||
useMaterial3: true,
|
||||
textTheme: const TextTheme(
|
||||
displayLarge: TextStyle(fontSize: 57, fontFamily: 'OpenSansLight', fontWeight: FontWeight.bold),
|
||||
displayMedium:
|
||||
TextStyle(fontSize: 45, fontFamily: 'OpenSansLight', fontWeight: FontWeight.bold),
|
||||
displaySmall: TextStyle(fontSize: 36, fontFamily: 'OpenSansLight', fontWeight: FontWeight.bold),
|
||||
headlineLarge: TextStyle(fontSize: 32, fontFamily: 'OpenSansLight'),
|
||||
headlineMedium: TextStyle(fontSize: 28, fontFamily: 'OpenSansLight'),
|
||||
headlineSmall: TextStyle(fontSize: 24, fontFamily: 'OpenSansLight'),
|
||||
titleLarge: TextStyle(fontSize: 22, fontFamily: 'OpenSansLight'),
|
||||
titleMedium: TextStyle(fontSize: 16, fontFamily: 'OpenSansLight'),
|
||||
titleSmall: TextStyle(fontSize: 14, fontFamily: 'OpenSansLight'),
|
||||
labelLarge: TextStyle(fontSize: 14, fontFamily: 'OpenSansLight'),
|
||||
labelMedium: TextStyle(fontSize: 12, fontFamily: 'OpenSansLight'),
|
||||
labelSmall: TextStyle(fontSize: 11, fontFamily: 'OpenSansLight'),
|
||||
bodyLarge: TextStyle(fontSize: 16, fontFamily: 'OpenSansLight'),
|
||||
bodyMedium: TextStyle(fontSize: 14, fontFamily: 'OpenSansLight'),
|
||||
bodySmall: TextStyle(fontSize: 12, fontFamily: 'OpenSansLight'),
|
||||
),
|
||||
appBarStyle: FlexAppBarStyle.primary,
|
||||
subThemesData: wgerSubThemeData,
|
||||
);
|
||||
|
||||
final wgerDarkTheme = ThemeData.from(
|
||||
final wgerDarkTheme = FlexThemeData.dark(
|
||||
colorScheme: schemeDark,
|
||||
useMaterial3: true,
|
||||
subThemesData: wgerSubThemeData,
|
||||
);
|
||||
|
||||
final wgerLightThemeHc = ThemeData.from(
|
||||
final wgerLightThemeHc = FlexThemeData.light(
|
||||
colorScheme: schemeLightHc,
|
||||
useMaterial3: true,
|
||||
appBarStyle: FlexAppBarStyle.primary,
|
||||
subThemesData: wgerSubThemeData,
|
||||
);
|
||||
|
||||
final wgerDarkThemeHc = ThemeData.from(
|
||||
final wgerDarkThemeHc = FlexThemeData.dark(
|
||||
colorScheme: schemeDarkHc,
|
||||
useMaterial3: true,
|
||||
subThemesData: wgerSubThemeData,
|
||||
);
|
||||
|
||||
CalendarStyle getWgerCalendarStyle(ThemeData theme) {
|
||||
return CalendarStyle(
|
||||
// Use `CalendarStyle` to customize the UI
|
||||
outsideDaysVisible: false,
|
||||
todayDecoration: const BoxDecoration(
|
||||
color: Colors.amber,
|
||||
|
||||
16
pubspec.lock
16
pubspec.lock
@@ -361,6 +361,22 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.64.0"
|
||||
flex_color_scheme:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: flex_color_scheme
|
||||
sha256: "32914024a4f404d90ff449f58d279191675b28e7c08824046baf06826e99d984"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "7.3.1"
|
||||
flex_seed_scheme:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: flex_seed_scheme
|
||||
sha256: "29c12aba221eb8a368a119685371381f8035011d18de5ba277ad11d7dfb8657f"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.4.0"
|
||||
flutter:
|
||||
dependency: "direct main"
|
||||
description: flutter
|
||||
|
||||
@@ -60,6 +60,7 @@ dependencies:
|
||||
fl_chart: ^0.64.0
|
||||
flutter_zxing: ^1.1.2
|
||||
flex_seed_scheme: ^1.4.0
|
||||
flex_color_scheme: ^7.3.1
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
||||
Reference in New Issue
Block a user