60 lines
1.7 KiB
Dart
60 lines
1.7 KiB
Dart
import 'package:fluent_ui/fluent_ui.dart';
|
|
import 'package:flutter/foundation.dart';
|
|
import 'package:system_theme/system_theme.dart';
|
|
|
|
enum NavigationIndicators { sticky, end }
|
|
|
|
class AppTheme extends ChangeNotifier {
|
|
AccentColor? _color;
|
|
AccentColor get color => _color ?? systemAccentColor;
|
|
set color(AccentColor color) {
|
|
_color = color;
|
|
notifyListeners();
|
|
}
|
|
|
|
ThemeMode _mode = ThemeMode.system;
|
|
ThemeMode get mode => _mode;
|
|
set mode(ThemeMode mode) {
|
|
_mode = mode;
|
|
notifyListeners();
|
|
}
|
|
|
|
PaneDisplayMode _displayMode = PaneDisplayMode.compact;
|
|
PaneDisplayMode get displayMode => _displayMode;
|
|
set displayMode(PaneDisplayMode displayMode) {
|
|
_displayMode = displayMode;
|
|
notifyListeners();
|
|
}
|
|
|
|
NavigationIndicators _indicator = NavigationIndicators.sticky;
|
|
NavigationIndicators get indicator => _indicator;
|
|
set indicator(NavigationIndicators indicator) {
|
|
_indicator = indicator;
|
|
notifyListeners();
|
|
}
|
|
|
|
TextDirection _textDirection = TextDirection.ltr;
|
|
TextDirection get textDirection => _textDirection;
|
|
set textDirection(TextDirection direction) {
|
|
_textDirection = direction;
|
|
notifyListeners();
|
|
}
|
|
}
|
|
|
|
AccentColor get systemAccentColor {
|
|
if ((defaultTargetPlatform == TargetPlatform.windows ||
|
|
defaultTargetPlatform == TargetPlatform.android) &&
|
|
!kIsWeb) {
|
|
return AccentColor.swatch({
|
|
'darkest': SystemTheme.accentColor.darkest,
|
|
'darker': SystemTheme.accentColor.darker,
|
|
'dark': SystemTheme.accentColor.dark,
|
|
'normal': SystemTheme.accentColor.accent,
|
|
'light': SystemTheme.accentColor.light,
|
|
'lighter': SystemTheme.accentColor.lighter,
|
|
'lightest': SystemTheme.accentColor.lightest,
|
|
});
|
|
}
|
|
return Colors.blue;
|
|
}
|