mirror of
https://github.com/MaidFoundation/maid.git
synced 2023-12-01 22:17:36 +03:00
update themes
This commit is contained in:
@@ -6,7 +6,7 @@ import 'package:maid/providers/session.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:maid/pages/desktop_home.dart';
|
||||
import 'package:maid/static/memory_manager.dart';
|
||||
import 'package:maid/static/theme.dart';
|
||||
import 'package:maid/providers/theme.dart';
|
||||
import 'package:maid/pages/mobile_home.dart';
|
||||
|
||||
void main() {
|
||||
@@ -57,8 +57,8 @@ class MaidAppState extends State<MaidApp> {
|
||||
return MaterialApp(
|
||||
debugShowCheckedModeBanner: false,
|
||||
title: 'Maid',
|
||||
theme: lightTheme,
|
||||
darkTheme: darkTheme,
|
||||
theme: ThemeProvider.lightTheme(),
|
||||
darkTheme: ThemeProvider.darkTheme(),
|
||||
themeMode: themeProvider.themeMode,
|
||||
home: homePage
|
||||
);
|
||||
|
||||
153
lib/providers/theme.dart
Normal file
153
lib/providers/theme.dart
Normal file
@@ -0,0 +1,153 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class ThemeProvider extends ChangeNotifier {
|
||||
ThemeMode _themeMode = ThemeMode.dark;
|
||||
|
||||
ThemeMode get themeMode => _themeMode;
|
||||
|
||||
bool get isDarkMode => _themeMode == ThemeMode.dark;
|
||||
|
||||
void toggleTheme() {
|
||||
_themeMode = _themeMode == ThemeMode.dark ? ThemeMode.light : ThemeMode.dark;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
static ThemeData lightTheme() {
|
||||
return genericTheme(
|
||||
Colors.white,
|
||||
Colors.grey.shade300,
|
||||
Colors.black,
|
||||
Colors.blue,
|
||||
Colors.blue.shade900,
|
||||
const Color.fromARGB(255, 100, 20, 20),
|
||||
);
|
||||
}
|
||||
|
||||
static ThemeData darkTheme() {
|
||||
return genericTheme(
|
||||
Colors.grey.shade900,
|
||||
Colors.grey.shade800,
|
||||
Colors.white,
|
||||
Colors.blue,
|
||||
Colors.blue.shade900,
|
||||
const Color.fromARGB(255, 100, 20, 20),
|
||||
);
|
||||
}
|
||||
|
||||
static ThemeData genericTheme(
|
||||
Color background,
|
||||
Color primary,
|
||||
Color onPrimary,
|
||||
Color secondary,
|
||||
Color tertiary,
|
||||
Color inversePrimary,
|
||||
) {
|
||||
return ThemeData(
|
||||
iconTheme: IconThemeData(color: onPrimary),
|
||||
textTheme: TextTheme(
|
||||
titleLarge: TextStyle(
|
||||
color: onPrimary,
|
||||
fontSize: 30.0,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
titleMedium: TextStyle(
|
||||
color: onPrimary,
|
||||
fontSize: 15.0,
|
||||
),
|
||||
titleSmall: TextStyle(
|
||||
color: onPrimary,
|
||||
fontSize: 20.0,
|
||||
),
|
||||
bodyMedium: TextStyle(
|
||||
color: onPrimary,
|
||||
fontSize: 15.0,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
labelLarge: TextStyle(
|
||||
color: onPrimary,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
appBarTheme: AppBarTheme(
|
||||
backgroundColor: background,
|
||||
foregroundColor: onPrimary,
|
||||
titleTextStyle: TextStyle(
|
||||
color: onPrimary,
|
||||
fontSize: 20.0,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
iconTheme: IconThemeData(color: onPrimary),
|
||||
),
|
||||
drawerTheme: DrawerThemeData(
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.only(
|
||||
topRight: Radius.circular(20), bottomRight: Radius.circular(20)),
|
||||
),
|
||||
backgroundColor: background),
|
||||
dropdownMenuTheme: DropdownMenuThemeData(
|
||||
textStyle: TextStyle(
|
||||
color: onPrimary,
|
||||
fontSize: 20.0,
|
||||
),
|
||||
inputDecorationTheme: InputDecorationTheme(
|
||||
contentPadding: const EdgeInsets.symmetric(
|
||||
horizontal: 20.0, vertical: 15.0), // Padding inside the TextField
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(30.0),
|
||||
borderSide: BorderSide.none,
|
||||
),
|
||||
labelStyle: const TextStyle(
|
||||
fontWeight: FontWeight.normal, color: Colors.grey, fontSize: 15.0),
|
||||
hintStyle: TextStyle(
|
||||
fontWeight: FontWeight.normal, color: onPrimary, fontSize: 15.0),
|
||||
fillColor: primary,
|
||||
filled: true,
|
||||
floatingLabelBehavior: FloatingLabelBehavior.never,
|
||||
),
|
||||
),
|
||||
scaffoldBackgroundColor: background,
|
||||
textSelectionTheme: TextSelectionThemeData(
|
||||
selectionHandleColor: secondary,
|
||||
selectionColor: tertiary,
|
||||
),
|
||||
inputDecorationTheme: InputDecorationTheme(
|
||||
contentPadding: const EdgeInsets.symmetric(
|
||||
horizontal: 20.0, vertical: 15.0), // Padding inside the TextField
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(30.0),
|
||||
borderSide: BorderSide.none,
|
||||
),
|
||||
labelStyle: const TextStyle(
|
||||
fontWeight: FontWeight.normal, color: Colors.grey, fontSize: 15.0),
|
||||
hintStyle: TextStyle(
|
||||
fontWeight: FontWeight.normal, color: onPrimary, fontSize: 15.0),
|
||||
fillColor: primary,
|
||||
filled: true,
|
||||
floatingLabelBehavior: FloatingLabelBehavior.never,
|
||||
),
|
||||
dialogTheme: DialogTheme(
|
||||
backgroundColor: background,
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(20.0))),
|
||||
titleTextStyle: TextStyle(
|
||||
color: onPrimary,
|
||||
fontSize: 20.0,
|
||||
),
|
||||
),
|
||||
sliderTheme: SliderThemeData(
|
||||
activeTrackColor: tertiary,
|
||||
inactiveTrackColor: primary,
|
||||
thumbColor: secondary,
|
||||
overlayColor: tertiary,
|
||||
),
|
||||
colorScheme: ColorScheme.dark(
|
||||
background: background,
|
||||
primary: primary,
|
||||
onPrimary: onPrimary,
|
||||
secondary: secondary,
|
||||
tertiary: tertiary,
|
||||
inversePrimary: const Color.fromARGB(255, 100, 20, 20),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,231 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class ThemeProvider extends ChangeNotifier {
|
||||
ThemeMode _themeMode = ThemeMode.dark;
|
||||
|
||||
ThemeMode get themeMode => _themeMode;
|
||||
|
||||
bool get isDarkMode => _themeMode == ThemeMode.dark;
|
||||
|
||||
void toggleTheme() {
|
||||
_themeMode = _themeMode == ThemeMode.dark ? ThemeMode.light : ThemeMode.dark;
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
|
||||
ThemeData lightTheme = ThemeData(
|
||||
iconTheme: const IconThemeData(color: Colors.black),
|
||||
textTheme: const TextTheme(
|
||||
titleLarge: TextStyle(
|
||||
color: Colors.black,
|
||||
fontSize: 30.0,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
titleMedium: TextStyle(
|
||||
color: Colors.black,
|
||||
fontSize: 15.0,
|
||||
),
|
||||
titleSmall: TextStyle(
|
||||
color: Colors.black,
|
||||
fontSize: 20.0,
|
||||
),
|
||||
bodyMedium: TextStyle(
|
||||
color: Colors.black,
|
||||
fontSize: 15.0,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
labelLarge: TextStyle(
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
appBarTheme: AppBarTheme(
|
||||
backgroundColor: Colors.grey.shade200,
|
||||
foregroundColor: Colors.black,
|
||||
titleTextStyle: const TextStyle(
|
||||
color: Colors.black,
|
||||
fontSize: 20.0,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
iconTheme: const IconThemeData(color: Colors.black),
|
||||
),
|
||||
drawerTheme: const DrawerThemeData(
|
||||
shape:RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.only(
|
||||
topRight: Radius.circular(20),
|
||||
bottomRight: Radius.circular(20)),
|
||||
),
|
||||
backgroundColor: Colors.white),
|
||||
dropdownMenuTheme: DropdownMenuThemeData(
|
||||
textStyle: const TextStyle(
|
||||
color: Colors.black,
|
||||
fontSize: 20.0,
|
||||
),
|
||||
inputDecorationTheme: InputDecorationTheme(
|
||||
contentPadding: const EdgeInsets.symmetric(
|
||||
horizontal: 20.0, vertical: 15.0), // Padding inside the TextField
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(30.0),
|
||||
borderSide: BorderSide.none,
|
||||
),
|
||||
labelStyle: const TextStyle(
|
||||
fontWeight: FontWeight.normal, color: Colors.black, fontSize: 15.0),
|
||||
hintStyle: const TextStyle(
|
||||
fontWeight: FontWeight.normal, color: Colors.grey, fontSize: 15.0),
|
||||
fillColor: Colors.grey.shade300,
|
||||
filled: true,
|
||||
floatingLabelBehavior: FloatingLabelBehavior.never,
|
||||
),
|
||||
),
|
||||
scaffoldBackgroundColor: Colors.white,
|
||||
textSelectionTheme: TextSelectionThemeData(
|
||||
selectionHandleColor: Colors.blue,
|
||||
selectionColor: Colors.blue.shade800,
|
||||
),
|
||||
inputDecorationTheme: InputDecorationTheme(
|
||||
contentPadding: const EdgeInsets.symmetric(
|
||||
horizontal: 20.0, vertical: 15.0), // Padding inside the TextField
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(30.0),
|
||||
borderSide: BorderSide.none,
|
||||
),
|
||||
labelStyle: const TextStyle(
|
||||
fontWeight: FontWeight.normal, color: Colors.black, fontSize: 15.0),
|
||||
hintStyle: const TextStyle(
|
||||
fontWeight: FontWeight.normal, color: Colors.grey, fontSize: 15.0),
|
||||
fillColor: Colors.grey.shade300,
|
||||
filled: true,
|
||||
floatingLabelBehavior: FloatingLabelBehavior.never,
|
||||
),
|
||||
dialogTheme: DialogTheme(
|
||||
backgroundColor: Colors.grey.shade300,
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(20.0))),
|
||||
titleTextStyle: const TextStyle(
|
||||
color: Colors.black,
|
||||
fontSize: 20.0,
|
||||
),
|
||||
),
|
||||
sliderTheme: SliderThemeData(
|
||||
activeTrackColor: Colors.blue.shade800,
|
||||
inactiveTrackColor: Colors.white,
|
||||
thumbColor: Colors.blue,
|
||||
overlayColor: Colors.blue.shade800,
|
||||
),
|
||||
colorScheme: ColorScheme.light(
|
||||
background: Colors.white,
|
||||
primary: Colors.grey.shade300,
|
||||
onPrimary: Colors.black,
|
||||
secondary: Colors.blue,
|
||||
tertiary: Colors.blue.shade900,
|
||||
inversePrimary: const Color.fromARGB(255, 100, 20, 20),
|
||||
)
|
||||
);
|
||||
|
||||
ThemeData darkTheme = ThemeData(
|
||||
iconTheme: const IconThemeData(color: Colors.white),
|
||||
textTheme: const TextTheme(
|
||||
titleLarge: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 30.0,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
titleMedium: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 15.0,
|
||||
),
|
||||
titleSmall: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 20.0,
|
||||
),
|
||||
bodyMedium: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 15.0,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
labelLarge: TextStyle(
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
appBarTheme: AppBarTheme(
|
||||
backgroundColor: Colors.grey.shade900,
|
||||
foregroundColor: Colors.white,
|
||||
titleTextStyle: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 20.0,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
iconTheme: const IconThemeData(color: Colors.white),
|
||||
),
|
||||
drawerTheme: DrawerThemeData(
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.only(
|
||||
topRight: Radius.circular(20), bottomRight: Radius.circular(20)),
|
||||
),
|
||||
backgroundColor: Colors.grey.shade900),
|
||||
dropdownMenuTheme: DropdownMenuThemeData(
|
||||
textStyle: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 20.0,
|
||||
),
|
||||
inputDecorationTheme: InputDecorationTheme(
|
||||
contentPadding: const EdgeInsets.symmetric(
|
||||
horizontal: 20.0, vertical: 15.0), // Padding inside the TextField
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(30.0),
|
||||
borderSide: BorderSide.none,
|
||||
),
|
||||
labelStyle: const TextStyle(
|
||||
fontWeight: FontWeight.normal, color: Colors.grey, fontSize: 15.0),
|
||||
hintStyle: const TextStyle(
|
||||
fontWeight: FontWeight.normal, color: Colors.white, fontSize: 15.0),
|
||||
fillColor: Colors.grey.shade800,
|
||||
filled: true,
|
||||
floatingLabelBehavior: FloatingLabelBehavior.never,
|
||||
),
|
||||
),
|
||||
scaffoldBackgroundColor: Colors.grey.shade900,
|
||||
textSelectionTheme: TextSelectionThemeData(
|
||||
selectionHandleColor: Colors.blue,
|
||||
selectionColor: Colors.blue.shade800,
|
||||
),
|
||||
inputDecorationTheme: InputDecorationTheme(
|
||||
contentPadding: const EdgeInsets.symmetric(
|
||||
horizontal: 20.0, vertical: 15.0), // Padding inside the TextField
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(30.0),
|
||||
borderSide: BorderSide.none,
|
||||
),
|
||||
labelStyle: const TextStyle(
|
||||
fontWeight: FontWeight.normal, color: Colors.grey, fontSize: 15.0),
|
||||
hintStyle: const TextStyle(
|
||||
fontWeight: FontWeight.normal, color: Colors.white, fontSize: 15.0),
|
||||
fillColor: Colors.grey.shade800,
|
||||
filled: true,
|
||||
floatingLabelBehavior: FloatingLabelBehavior.never,
|
||||
),
|
||||
dialogTheme: DialogTheme(
|
||||
backgroundColor: Colors.grey.shade900,
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(20.0))),
|
||||
titleTextStyle: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 20.0,
|
||||
),
|
||||
),
|
||||
sliderTheme: SliderThemeData(
|
||||
activeTrackColor: Colors.blue.shade800,
|
||||
inactiveTrackColor: Colors.grey.shade800,
|
||||
thumbColor: Colors.blue,
|
||||
overlayColor: Colors.blue.shade800,
|
||||
),
|
||||
colorScheme: ColorScheme.dark(
|
||||
background: Colors.grey.shade900,
|
||||
primary: Colors.grey.shade800,
|
||||
onPrimary: Colors.white,
|
||||
secondary: Colors.blue,
|
||||
tertiary: Colors.blue.shade900,
|
||||
inversePrimary: const Color.fromARGB(255, 100, 20, 20),
|
||||
),
|
||||
);
|
||||
@@ -1,6 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:maid/static/logger.dart';
|
||||
import 'package:maid/static/theme.dart';
|
||||
import 'package:maid/providers/theme.dart';
|
||||
import 'package:maid/widgets/chat_widgets/code_box.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
Reference in New Issue
Block a user