Files
flutter/lib/theme/theme.dart
Roland Geider 969c643e5c Update theme
This is now created with flex_color_scheme, which makes tweaking this
much much easier
2023-11-10 19:07:14 +01:00

130 lines
4.1 KiB
Dart

/*
* This file is part of wger Workout Manager <https://github.com/wger-project>.
* Copyright (C) 2020, 2021 wger Team
*
* wger Workout Manager is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* wger Workout Manager is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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),
);
// Make a high contrast light ColorScheme from the seeds
final ColorScheme schemeLightHc = SeedColorScheme.fromSeeds(
primaryKey: wgerPrimaryColor,
secondaryKey: wgerSecondaryColor,
brightness: Brightness.light,
tones: FlexTones.ultraContrast(Brightness.light),
);
// Make a ultra contrast dark ColorScheme from the seeds.
final ColorScheme schemeDarkHc = SeedColorScheme.fromSeeds(
primaryKey: wgerPrimaryColor,
secondaryKey: wgerSecondaryColor,
brightness: Brightness.dark,
tones: FlexTones.ultraContrast(Brightness.dark),
);
final wgerLightTheme = FlexThemeData.light(
colorScheme: schemeLight,
useMaterial3: true,
appBarStyle: FlexAppBarStyle.primary,
subThemesData: wgerSubThemeData,
);
final wgerDarkTheme = FlexThemeData.dark(
colorScheme: schemeDark,
useMaterial3: true,
subThemesData: wgerSubThemeData,
);
final wgerLightThemeHc = FlexThemeData.light(
colorScheme: schemeLightHc,
useMaterial3: true,
appBarStyle: FlexAppBarStyle.primary,
subThemesData: wgerSubThemeData,
);
final wgerDarkThemeHc = FlexThemeData.dark(
colorScheme: schemeDarkHc,
useMaterial3: true,
subThemesData: wgerSubThemeData,
);
CalendarStyle getWgerCalendarStyle(ThemeData theme) {
return CalendarStyle(
outsideDaysVisible: false,
todayDecoration: const BoxDecoration(
color: Colors.amber,
shape: BoxShape.circle,
),
markerDecoration: BoxDecoration(
color: theme.textTheme.headlineLarge?.color,
shape: BoxShape.circle,
),
selectedDecoration: const BoxDecoration(
color: wgerSecondaryColor,
shape: BoxShape.circle,
),
rangeStartDecoration: const BoxDecoration(
color: wgerSecondaryColor,
shape: BoxShape.circle,
),
rangeEndDecoration: const BoxDecoration(
color: wgerSecondaryColor,
shape: BoxShape.circle,
),
rangeHighlightColor: wgerSecondaryColorLight,
weekendTextStyle: const TextStyle(color: wgerSecondaryColor),
);
}