loris/lib/themes/themes.dart

181 lines
5.2 KiB
Dart

import 'package:flutter/material.dart';
import 'dracula.dart' as color_dracula;
import 'tess.dart' as color_tess;
import 'adwaita.dart' as color_adwaita;
// color schemes to pick from can be added here
// there is a class to create these
final available = [
color_dracula.theme,
color_adwaita.themeDark,
color_adwaita.themeLight,
color_tess.theme,
];
ThemeData getTheme(CustomColors colors) {
return ThemeData(
floatingActionButtonTheme: const FloatingActionButtonThemeData(
elevation: 0,
enableFeedback: false,
hoverElevation: 24,
),
fontFamily: 'Atkinson',
textTheme: TextTheme(
bodyLarge: TextStyle(
color: colors.colorScheme.onSurface,
fontSize: 24,
),
bodyMedium: TextStyle(
color: colors.colorScheme.onSurface,
fontSize: 18,
),
bodySmall: TextStyle(
color: colors.colorScheme.secondary,
fontSize: 18,
),
displayLarge: TextStyle(
color: colors.colorScheme.onSurface,
fontSize: 42,
fontWeight: FontWeight.w700,
),
displayMedium: TextStyle(
color: colors.colorScheme.onSurface,
fontWeight: FontWeight.w700,
fontSize: 36,
),
displaySmall: TextStyle(
color: colors.colorScheme.onSurface,
fontWeight: FontWeight.w700,
fontSize: 24,
),
headlineLarge: TextStyle(
color: colors.colorScheme.onSurface,
fontSize: 42,
),
headlineMedium: TextStyle(
color: colors.colorScheme.onSurface,
fontSize: 36,
),
headlineSmall: TextStyle(
color: colors.colorScheme.onSurface,
fontSize: 24,
),
),
iconTheme: IconThemeData(
size: 24,
color: colors.colorScheme.onSurface,
),
outlinedButtonTheme: OutlinedButtonThemeData(
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all(
colors.colorScheme.primary,
),
foregroundColor: MaterialStateProperty.all(
colors.colorScheme.onPrimary,
),
textStyle: MaterialStateProperty.all(
const TextStyle(
fontSize: 18,
fontWeight: FontWeight.w700,
),
),
),
),
textButtonTheme: TextButtonThemeData(
style: ButtonStyle(
textStyle: MaterialStateProperty.all(
const TextStyle(fontSize: 18),
),
),
),
popupMenuTheme: PopupMenuThemeData(
color: colors.colorScheme.background,
textStyle: TextStyle(
color: colors.colorScheme.onBackground,
),
),
scaffoldBackgroundColor: colors.colorScheme.background,
bottomAppBarColor: colors.colorScheme.background,
hintColor: colors.hintColor,
colorScheme: colors.colorScheme,
errorColor: colors.colorScheme.error,
bottomAppBarTheme: BottomAppBarTheme(
color: colors.colorScheme.surface,
shape: const CircularNotchedRectangle(),
elevation: 0,
),
navigationBarTheme: NavigationBarThemeData(
labelTextStyle: MaterialStateProperty.all(
TextStyle(
color: colors.colorScheme.onSurface,
fontSize: 14,
),
),
backgroundColor: Colors.transparent,
labelBehavior: NavigationDestinationLabelBehavior.onlyShowSelected,
indicatorColor: Colors.transparent,
elevation: 0,
height: 64,
),
scrollbarTheme: ScrollbarThemeData(
thumbColor: MaterialStateProperty.all(colors.hintColor),
),
sliderTheme: SliderThemeData(
valueIndicatorColor: colors.colorScheme.primary,
valueIndicatorTextStyle: TextStyle(
color: colors.colorScheme.onPrimary,
fontSize: 18,
fontWeight: FontWeight.w700,
),
),
tooltipTheme: TooltipThemeData(
textStyle: TextStyle(
color: colors.colorScheme.onPrimary,
fontSize: 18,
fontWeight: FontWeight.w700,
),
decoration: BoxDecoration(
borderRadius: const BorderRadius.all(Radius.circular(8)),
color: colors.colorScheme.primary,
),
),
canvasColor: colors.colorScheme.surface,
dialogBackgroundColor: colors.colorScheme.surface,
selectedRowColor: colors.colorScheme.background,
textSelectionTheme:
TextSelectionThemeData(selectionColor: colors.hintColor),
primaryIconTheme: const IconThemeData(size: 24),
hoverColor: colors.colorScheme.background,
shadowColor: colors.colorScheme.surface,
focusColor: colors.hintColor,
indicatorColor: colors.hintColor,
disabledColor: colors.hintColor,
unselectedWidgetColor: colors.hintColor,
toggleableActiveColor: colors.colorScheme.primary,
splashColor: colors.colorScheme.onSurface,
highlightColor: colors.hintColor,
inputDecorationTheme: InputDecorationTheme(
helperStyle: TextStyle(
color: colors.hintColor,
),
hintStyle: TextStyle(
color: colors.hintColor,
),
fillColor: colors.colorScheme.background,
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: colors.hintColor,
width: 2,
),
),
),
);
}
class CustomColors {
late String name;
late Color hintColor;
late ColorScheme colorScheme;
CustomColors(this.name, this.hintColor, this.colorScheme);
}