Revert "Rename everything filcnaplo-related to refilc"
This reverts commit d1a9625d93.
This commit is contained in:
33
filcnaplo/lib/theme/colors/accent.dart
Normal file
33
filcnaplo/lib/theme/colors/accent.dart
Normal file
@@ -0,0 +1,33 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
enum AccentColor {
|
||||
filc,
|
||||
blue,
|
||||
green,
|
||||
lime,
|
||||
yellow,
|
||||
orange,
|
||||
red,
|
||||
pink,
|
||||
purple,
|
||||
none,
|
||||
ogfilc,
|
||||
adaptive,
|
||||
custom
|
||||
}
|
||||
|
||||
Map<AccentColor, Color> accentColorMap = {
|
||||
AccentColor.filc: const Color(0xFF3D7BF4),
|
||||
AccentColor.blue: Colors.blue.shade300,
|
||||
AccentColor.green: Colors.green.shade400,
|
||||
AccentColor.lime: Colors.lightGreen.shade400,
|
||||
AccentColor.yellow: Colors.orange.shade300,
|
||||
AccentColor.orange: Colors.deepOrange.shade300,
|
||||
AccentColor.red: Colors.red.shade300,
|
||||
AccentColor.pink: Colors.pink.shade300,
|
||||
AccentColor.purple: Colors.purple.shade300,
|
||||
//AccentColor.none: Colors.black,
|
||||
AccentColor.ogfilc: const Color(0xff20AC9B),
|
||||
AccentColor.adaptive: const Color(0xFF3D7BF4),
|
||||
AccentColor.custom: const Color(0xFF3D7BF4),
|
||||
};
|
||||
53
filcnaplo/lib/theme/colors/colors.dart
Normal file
53
filcnaplo/lib/theme/colors/colors.dart
Normal file
@@ -0,0 +1,53 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:filcnaplo/theme/colors/dark_desktop.dart';
|
||||
import 'package:filcnaplo/theme/colors/dark_mobile.dart';
|
||||
import 'package:filcnaplo/theme/colors/light_desktop.dart';
|
||||
import 'package:filcnaplo/theme/colors/light_mobile.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class AppColors {
|
||||
static ThemeAppColors of(BuildContext context) =>
|
||||
fromBrightness(Theme.of(context).brightness);
|
||||
|
||||
static ThemeAppColors fromBrightness(Brightness brightness) {
|
||||
if (Platform.isAndroid || Platform.isIOS) {
|
||||
switch (brightness) {
|
||||
case Brightness.light:
|
||||
return LightMobileAppColors();
|
||||
case Brightness.dark:
|
||||
return DarkMobileAppColors();
|
||||
}
|
||||
} else {
|
||||
switch (brightness) {
|
||||
case Brightness.light:
|
||||
return LightDesktopAppColors();
|
||||
case Brightness.dark:
|
||||
return DarkDesktopAppColors();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
abstract class ThemeAppColors {
|
||||
final Color shadow = const Color(0x00000000);
|
||||
final Color text = const Color(0x00000000);
|
||||
final Color background = const Color(0x00000000);
|
||||
final Color highlight = const Color(0x00000000);
|
||||
final Color red = const Color(0x00000000);
|
||||
final Color orange = const Color(0x00000000);
|
||||
final Color yellow = const Color(0x00000000);
|
||||
final Color green = const Color(0x00000000);
|
||||
final Color filc = const Color(0x00000000);
|
||||
final Color teal = const Color(0x00000000);
|
||||
final Color blue = const Color(0x00000000);
|
||||
final Color indigo = const Color(0x00000000);
|
||||
final Color purple = const Color(0x00000000);
|
||||
final Color pink = const Color(0x00000000);
|
||||
// new default grade colors
|
||||
final Color gradeFive = const Color(0x00000000);
|
||||
final Color gradeFour = const Color(0x00000000);
|
||||
final Color gradeThree = const Color(0x00000000);
|
||||
final Color gradeTwo = const Color(0x00000000);
|
||||
final Color gradeOne = const Color(0x00000000);
|
||||
}
|
||||
44
filcnaplo/lib/theme/colors/dark_desktop.dart
Normal file
44
filcnaplo/lib/theme/colors/dark_desktop.dart
Normal file
@@ -0,0 +1,44 @@
|
||||
import 'package:filcnaplo/theme/colors/colors.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class DarkDesktopAppColors implements ThemeAppColors {
|
||||
@override
|
||||
final shadow = const Color(0x00000000);
|
||||
@override
|
||||
final text = Colors.white;
|
||||
@override
|
||||
final background = const Color.fromARGB(255, 42, 42, 42);
|
||||
@override
|
||||
final highlight = const Color.fromARGB(255, 46, 48, 50);
|
||||
@override
|
||||
final red = const Color(0xffFF453A);
|
||||
@override
|
||||
final orange = const Color(0xffFF9F0A);
|
||||
@override
|
||||
final yellow = const Color(0xffFFD60A);
|
||||
@override
|
||||
final green = const Color(0xff32D74B);
|
||||
@override
|
||||
final filc = const Color(0xff3d7bf4);
|
||||
@override
|
||||
final teal = const Color(0xff64D2FF);
|
||||
@override
|
||||
final blue = const Color(0xff0A84FF);
|
||||
@override
|
||||
final indigo = const Color(0xff5E5CE6);
|
||||
@override
|
||||
final purple = const Color(0xffBF5AF2);
|
||||
@override
|
||||
final pink = const Color(0xffFF375F);
|
||||
// new default grade colors
|
||||
@override
|
||||
final gradeFive = const Color(0xff3d7bf4);
|
||||
@override
|
||||
final gradeFour = const Color(0xFF4C3DF4);
|
||||
@override
|
||||
final gradeThree = const Color(0xFF833DF4);
|
||||
@override
|
||||
final gradeTwo = const Color(0xFFAE3DF4);
|
||||
@override
|
||||
final gradeOne = const Color(0xFFF43DAB);
|
||||
}
|
||||
45
filcnaplo/lib/theme/colors/dark_mobile.dart
Normal file
45
filcnaplo/lib/theme/colors/dark_mobile.dart
Normal file
@@ -0,0 +1,45 @@
|
||||
import 'package:filcnaplo/theme/colors/colors.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class DarkMobileAppColors implements ThemeAppColors {
|
||||
@override
|
||||
final shadow = const Color(0x00000000);
|
||||
@override
|
||||
final text = Colors.white;
|
||||
@override
|
||||
final background = const Color(0xff000000);
|
||||
@override
|
||||
final highlight = const Color(0xff141516);
|
||||
@override
|
||||
final red = const Color(0xffFF453A);
|
||||
@override
|
||||
final orange = const Color(0xffFF9F0A);
|
||||
@override
|
||||
final yellow = const Color(0xffFFD60A);
|
||||
@override
|
||||
final green = const Color(0xff32D74B);
|
||||
@override
|
||||
final filc = const Color(0xff3d7bf4);
|
||||
@override
|
||||
final teal = const Color(0xff64D2FF);
|
||||
@override
|
||||
final blue = const Color(0xff0A84FF);
|
||||
@override
|
||||
final indigo = const Color(0xff5E5CE6);
|
||||
@override
|
||||
// new default grade colors
|
||||
@override
|
||||
final gradeFive = const Color(0xff3d7bf4);
|
||||
@override
|
||||
final gradeFour = const Color(0xFF4C3DF4);
|
||||
@override
|
||||
final gradeThree = const Color(0xFF833DF4);
|
||||
@override
|
||||
final gradeTwo = const Color(0xFFAE3DF4);
|
||||
@override
|
||||
final gradeOne = const Color(0xFFF43DAB);
|
||||
@override
|
||||
final purple = const Color(0xffBF5AF2);
|
||||
@override
|
||||
final pink = const Color(0xffFF375F);
|
||||
}
|
||||
44
filcnaplo/lib/theme/colors/light_desktop.dart
Normal file
44
filcnaplo/lib/theme/colors/light_desktop.dart
Normal file
@@ -0,0 +1,44 @@
|
||||
import 'package:filcnaplo/theme/colors/colors.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class LightDesktopAppColors implements ThemeAppColors {
|
||||
@override
|
||||
final shadow = const Color(0xffE8E8E8);
|
||||
@override
|
||||
final text = Colors.black;
|
||||
@override
|
||||
final background = const Color(0xffF4F9FF);
|
||||
@override
|
||||
final highlight = const Color(0xffFFFFFF);
|
||||
@override
|
||||
final red = const Color(0xffFF3B30);
|
||||
@override
|
||||
final orange = const Color(0xffFF9500);
|
||||
@override
|
||||
final yellow = const Color(0xffFFCC00);
|
||||
@override
|
||||
final green = const Color(0xff34C759);
|
||||
@override
|
||||
final filc = const Color(0xff3d7bf4);
|
||||
@override
|
||||
final teal = const Color(0xff5AC8FA);
|
||||
@override
|
||||
final blue = const Color(0xff007AFF);
|
||||
@override
|
||||
final indigo = const Color(0xff5856D6);
|
||||
@override
|
||||
final purple = const Color(0xffAF52DE);
|
||||
@override
|
||||
final pink = const Color(0xffFF2D55);
|
||||
// new default grade colors
|
||||
@override
|
||||
final gradeFive = const Color(0xff3d7bf4);
|
||||
@override
|
||||
final gradeFour = const Color(0xFF4C3DF4);
|
||||
@override
|
||||
final gradeThree = const Color(0xFF833DF4);
|
||||
@override
|
||||
final gradeTwo = const Color(0xFFAE3DF4);
|
||||
@override
|
||||
final gradeOne = const Color(0xFFF43DAB);
|
||||
}
|
||||
44
filcnaplo/lib/theme/colors/light_mobile.dart
Normal file
44
filcnaplo/lib/theme/colors/light_mobile.dart
Normal file
@@ -0,0 +1,44 @@
|
||||
import 'package:filcnaplo/theme/colors/colors.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class LightMobileAppColors implements ThemeAppColors {
|
||||
@override
|
||||
final shadow = const Color(0xffE8E8E8);
|
||||
@override
|
||||
final text = const Color(0xFF000000);
|
||||
@override
|
||||
final background = const Color(0xffF4F9FF);
|
||||
@override
|
||||
final highlight = const Color(0xffFFFFFF);
|
||||
@override
|
||||
final red = const Color(0xffFF3B30);
|
||||
@override
|
||||
final orange = const Color(0xffFF9500);
|
||||
@override
|
||||
final yellow = const Color(0xffFFCC00);
|
||||
@override
|
||||
final green = const Color(0xff34C759);
|
||||
@override
|
||||
final filc = const Color(0xff3d7bf4);
|
||||
@override
|
||||
final teal = const Color(0xff5AC8FA);
|
||||
@override
|
||||
final blue = const Color(0xff007AFF);
|
||||
@override
|
||||
final indigo = const Color(0xff5856D6);
|
||||
@override
|
||||
final purple = const Color(0xffAF52DE);
|
||||
@override
|
||||
final pink = const Color(0xffFF2D55);
|
||||
// new default grade colors
|
||||
@override
|
||||
final gradeFive = const Color(0xff3d7bf4);
|
||||
@override
|
||||
final gradeFour = const Color(0xFF4C3DF4);
|
||||
@override
|
||||
final gradeThree = const Color(0xFF833DF4);
|
||||
@override
|
||||
final gradeTwo = const Color(0xFFAE3DF4);
|
||||
@override
|
||||
final gradeOne = const Color(0xFFF43DAB);
|
||||
}
|
||||
18
filcnaplo/lib/theme/observer.dart
Normal file
18
filcnaplo/lib/theme/observer.dart
Normal file
@@ -0,0 +1,18 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class ThemeModeObserver extends ChangeNotifier {
|
||||
ThemeMode _themeMode;
|
||||
bool _updateNavbarColor;
|
||||
ThemeMode get themeMode => _themeMode;
|
||||
bool get updateNavbarColor => _updateNavbarColor;
|
||||
|
||||
ThemeModeObserver({ThemeMode initialTheme = ThemeMode.system, bool updateNavbarColor = true})
|
||||
: _themeMode = initialTheme,
|
||||
_updateNavbarColor = updateNavbarColor;
|
||||
|
||||
void changeTheme(ThemeMode mode, {bool updateNavbarColor = true}) {
|
||||
_themeMode = mode;
|
||||
_updateNavbarColor = updateNavbarColor;
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
160
filcnaplo/lib/theme/theme.dart
Normal file
160
filcnaplo/lib/theme/theme.dart
Normal file
@@ -0,0 +1,160 @@
|
||||
import 'package:filcnaplo/models/settings.dart';
|
||||
import 'package:filcnaplo/theme/colors/accent.dart';
|
||||
import 'package:filcnaplo/theme/colors/colors.dart';
|
||||
import 'package:filcnaplo/theme/observer.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:material_color_utilities/material_color_utilities.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class AppTheme {
|
||||
// Dev note: All of these could be constant variables, but this is better for
|
||||
// development (you don't have to hot-restart)
|
||||
|
||||
static const String _fontFamily = "Montserrat";
|
||||
|
||||
static Color? _paletteAccentLight(CorePalette? palette) => palette != null ? Color(palette.primary.get(70)) : null;
|
||||
static Color? _paletteHighlightLight(CorePalette? palette) => palette != null ? Color(palette.neutral.get(100)) : null;
|
||||
static Color? _paletteBackgroundLight(CorePalette? palette) => palette != null ? Color(palette.neutral.get(95)) : null;
|
||||
|
||||
static Color? _paletteAccentDark(CorePalette? palette) => palette != null ? Color(palette.primary.get(80)) : null;
|
||||
static Color? _paletteBackgroundDark(CorePalette? palette) => palette != null ? Color(palette.neutralVariant.get(10)) : null;
|
||||
static Color? _paletteHighlightDark(CorePalette? palette) => palette != null ? Color(palette.neutralVariant.get(20)) : null;
|
||||
|
||||
// Light Theme
|
||||
static ThemeData lightTheme(BuildContext context, {CorePalette? palette}) {
|
||||
var lightColors = AppColors.fromBrightness(Brightness.light);
|
||||
final settings = Provider.of<SettingsProvider>(context, listen: false);
|
||||
AccentColor accentColor = settings.accentColor;
|
||||
final customAccentColor = accentColor == AccentColor.custom ? settings.customAccentColor : null;
|
||||
Color accent = customAccentColor ?? accentColorMap[accentColor] ?? const Color(0x00000000);
|
||||
|
||||
if (accentColor == AccentColor.adaptive) {
|
||||
if (palette != null) accent = _paletteAccentLight(palette)!;
|
||||
} else {
|
||||
palette = null;
|
||||
}
|
||||
|
||||
Color backgroundColor =
|
||||
(accentColor == AccentColor.custom ? settings.customBackgroundColor : _paletteBackgroundLight(palette)) ?? lightColors.background;
|
||||
Color highlightColor =
|
||||
(accentColor == AccentColor.custom ? settings.customHighlightColor : _paletteHighlightLight(palette)) ?? lightColors.highlight;
|
||||
|
||||
return ThemeData(
|
||||
brightness: Brightness.light,
|
||||
useMaterial3: true,
|
||||
fontFamily: _fontFamily,
|
||||
scaffoldBackgroundColor: backgroundColor,
|
||||
primaryColor: lightColors.filc,
|
||||
dividerColor: const Color(0x00000000),
|
||||
colorScheme: ColorScheme(
|
||||
primary: accent,
|
||||
onPrimary: (accent.computeLuminance() > 0.5 ? Colors.black : Colors.white).withOpacity(.9),
|
||||
secondary: accent,
|
||||
onSecondary: (accent.computeLuminance() > 0.5 ? Colors.black : Colors.white).withOpacity(.9),
|
||||
background: highlightColor,
|
||||
onBackground: Colors.black.withOpacity(.9),
|
||||
brightness: Brightness.light,
|
||||
error: lightColors.red,
|
||||
onError: Colors.white.withOpacity(.9),
|
||||
surface: highlightColor,
|
||||
onSurface: Colors.black.withOpacity(.9),
|
||||
),
|
||||
shadowColor: lightColors.shadow.withOpacity(.5),
|
||||
appBarTheme: AppBarTheme(backgroundColor: backgroundColor),
|
||||
indicatorColor: accent,
|
||||
iconTheme: IconThemeData(color: lightColors.text.withOpacity(.75)),
|
||||
navigationBarTheme: NavigationBarThemeData(
|
||||
indicatorColor: accent.withOpacity(accentColor == AccentColor.adaptive ? 0.4 : 0.8),
|
||||
iconTheme: MaterialStateProperty.all(IconThemeData(color: lightColors.text)),
|
||||
backgroundColor: highlightColor,
|
||||
labelTextStyle: MaterialStateProperty.all(TextStyle(
|
||||
fontSize: 13.0,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: lightColors.text.withOpacity(0.8),
|
||||
)),
|
||||
labelBehavior: NavigationDestinationLabelBehavior.alwaysShow,
|
||||
height: 76.0,
|
||||
),
|
||||
sliderTheme: SliderThemeData(
|
||||
inactiveTrackColor: accent.withOpacity(.3),
|
||||
),
|
||||
progressIndicatorTheme: ProgressIndicatorThemeData(color: accent),
|
||||
expansionTileTheme: ExpansionTileThemeData(iconColor: accent),
|
||||
cardColor: highlightColor,
|
||||
bottomNavigationBarTheme: BottomNavigationBarThemeData(
|
||||
backgroundColor: Provider.of<ThemeModeObserver>(context, listen: false).updateNavbarColor ? backgroundColor : null,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// Dark Theme
|
||||
static ThemeData darkTheme(BuildContext context, {CorePalette? palette}) {
|
||||
var darkColors = AppColors.fromBrightness(Brightness.dark);
|
||||
final settings = Provider.of<SettingsProvider>(context, listen: false);
|
||||
AccentColor accentColor = settings.accentColor;
|
||||
final customAccentColor = accentColor == AccentColor.custom ? settings.customAccentColor : null;
|
||||
Color accent = customAccentColor ?? accentColorMap[accentColor] ?? const Color(0x00000000);
|
||||
|
||||
if (accentColor == AccentColor.adaptive) {
|
||||
if (palette != null) accent = _paletteAccentDark(palette)!;
|
||||
} else {
|
||||
palette = null;
|
||||
}
|
||||
|
||||
Color backgroundColor =
|
||||
(accentColor == AccentColor.custom ? settings.customBackgroundColor : _paletteBackgroundDark(palette)) ?? darkColors.background;
|
||||
Color highlightColor =
|
||||
(accentColor == AccentColor.custom ? settings.customHighlightColor : _paletteHighlightDark(palette)) ?? darkColors.highlight;
|
||||
|
||||
return ThemeData(
|
||||
brightness: Brightness.dark,
|
||||
useMaterial3: true,
|
||||
fontFamily: _fontFamily,
|
||||
scaffoldBackgroundColor: backgroundColor,
|
||||
primaryColor: darkColors.filc,
|
||||
dividerColor: const Color(0x00000000),
|
||||
colorScheme: ColorScheme(
|
||||
primary: accent,
|
||||
onPrimary: (accent.computeLuminance() > 0.5 ? Colors.black : Colors.white).withOpacity(.9),
|
||||
secondary: accent,
|
||||
onSecondary: (accent.computeLuminance() > 0.5 ? Colors.black : Colors.white).withOpacity(.9),
|
||||
background: highlightColor,
|
||||
onBackground: Colors.white.withOpacity(.9),
|
||||
brightness: Brightness.dark,
|
||||
error: darkColors.red,
|
||||
onError: Colors.black.withOpacity(.9),
|
||||
surface: highlightColor,
|
||||
onSurface: Colors.white.withOpacity(.9),
|
||||
),
|
||||
shadowColor: highlightColor.withOpacity(.5), //darkColors.shadow,
|
||||
appBarTheme: AppBarTheme(backgroundColor: backgroundColor),
|
||||
indicatorColor: accent,
|
||||
iconTheme: IconThemeData(color: darkColors.text.withOpacity(.75)),
|
||||
navigationBarTheme: NavigationBarThemeData(
|
||||
indicatorColor: accent.withOpacity(accentColor == AccentColor.adaptive ? 0.4 : 0.8),
|
||||
iconTheme: MaterialStateProperty.all(IconThemeData(color: darkColors.text)),
|
||||
backgroundColor: highlightColor,
|
||||
labelTextStyle: MaterialStateProperty.all(TextStyle(
|
||||
fontSize: 13.0,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: darkColors.text.withOpacity(0.8),
|
||||
)),
|
||||
labelBehavior: NavigationDestinationLabelBehavior.alwaysShow,
|
||||
height: 76.0,
|
||||
),
|
||||
sliderTheme: SliderThemeData(
|
||||
inactiveTrackColor: accent.withOpacity(.3),
|
||||
),
|
||||
progressIndicatorTheme: ProgressIndicatorThemeData(color: accent),
|
||||
expansionTileTheme: ExpansionTileThemeData(iconColor: accent),
|
||||
cardColor: highlightColor,
|
||||
chipTheme: ChipThemeData(
|
||||
backgroundColor: accent.withOpacity(.2),
|
||||
elevation: 1,
|
||||
),
|
||||
bottomNavigationBarTheme: BottomNavigationBarThemeData(
|
||||
backgroundColor: Provider.of<ThemeModeObserver>(context, listen: false).updateNavbarColor ? backgroundColor : null,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user