import 'package:flutter/material.dart'; import 'package:flutter/scheduler.dart'; class CustomColor { static const Color white = Color(0xFFFFFFFF); static const Color background = Color.fromRGBO(249, 250, 251, 1); static const Color fontBlack = Color(0xDE000000); static const Color logoBlue = Color(0xFF245f97); static const Color textFieldBackground = Color(0x1E000000); static const Color hintColor = Color(0x99000000); static const Color greyCaption = Color.fromRGBO(74, 102, 112, 1); static const Color statusBarColor = Color(0x1e000000); static const Color greyCardBackground = Color.fromRGBO(240, 244, 247, 1); static const Color greyCardRadius = Color.fromRGBO(233, 236, 239, 1); } class ThemeProvider extends ChangeNotifier { ThemeMode themeMode = ThemeMode.system; bool get isDarkMode { if (themeMode == ThemeMode.system) { final brightness = SchedulerBinding.instance.window.platformBrightness; return brightness == Brightness.dark; } else { return themeMode == ThemeMode.dark; } } void toggleTheme({required bool isOn}) { themeMode = isOn ? ThemeMode.dark : ThemeMode.light; notifyListeners(); } } ThemeData lightTheme = ThemeData( // Default brightness and colors. brightness: Brightness.light, scaffoldBackgroundColor: Colors.white, primaryColor: CustomColor.logoBlue, backgroundColor: CustomColor.background, // Default font family. fontFamily: 'Roboto', // Default TextTheme. Use this to specify the default // text styling for headlines, titles, bodies of text, and etc. textTheme: const TextTheme( headline1: TextStyle( fontSize: 20.0, fontWeight: FontWeight.bold, color: CustomColor.fontBlack, ), headline2: TextStyle( fontSize: 18.0, fontWeight: FontWeight.bold, color: CustomColor.fontBlack, ), bodyText1: TextStyle( fontSize: 16.0, color: CustomColor.fontBlack, overflow: TextOverflow.clip), bodyText2: TextStyle( fontSize: 16.0, color: CustomColor.hintColor, overflow: TextOverflow.clip), caption: TextStyle( fontSize: 12.0, color: CustomColor.greyCaption, overflow: TextOverflow.clip), button: TextStyle( color: CustomColor.white, fontFamily: 'Roboto', fontWeight: FontWeight.w500, fontSize: 14, letterSpacing: 2, ), ), colorScheme: const ColorScheme.light().copyWith(secondary: Colors.cyan[600]), ); ThemeData darkTheme = ThemeData( // Default brightness and colors. brightness: Brightness.dark, scaffoldBackgroundColor: Colors.grey.shade900, primaryColor: CustomColor.logoBlue, // Default font family. fontFamily: 'Roboto', // Default TextTheme. Use this to specify the default // text styling for headlines, titles, bodies of text, and etc. textTheme: const TextTheme( headline1: TextStyle( fontSize: 20.0, fontWeight: FontWeight.bold, color: CustomColor.fontBlack, ), headline2: TextStyle( fontSize: 18.0, fontWeight: FontWeight.bold, color: CustomColor.fontBlack, ), bodyText1: TextStyle(fontSize: 16.0, color: CustomColor.fontBlack), bodyText2: TextStyle(fontSize: 16.0, color: CustomColor.hintColor), button: TextStyle( color: CustomColor.white, fontFamily: 'Roboto', fontWeight: FontWeight.w500, fontSize: 14, letterSpacing: 2, ), ), colorScheme: const ColorScheme.dark().copyWith(secondary: Colors.cyan[600]), );