123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145 |
- import 'package:flutter/material.dart';
- import 'package:flutter_wallet/tools/YSTools.dart';
- import 'package:provider/provider.dart';
- final ThemeData lightTheme = ThemeData(
- primaryColor: const Color(0xFFF1F1F1),
- cardColor: Colors.white,
- canvasColor: const Color(0xFFF6F6F6),
- dividerColor: const Color(0xFFE6E0E0),
- indicatorColor: Colors.black,
- disabledColor: Colors.black54,
- shadowColor: Colors.black45,
- primaryColorDark: const Color(0xFF4C4A5A),
- primaryColorLight: const Color(0xFF9F9F9F),
- textTheme: TextTheme(
- titleMedium: TextStyle(fontSize: zsp(14),color: const Color(0xFF4C4A5A)),
- titleLarge: TextStyle(fontSize: zsp(21),color: const Color(0xFF4C4A5A)),
- titleSmall: TextStyle(fontSize: zsp(12),color: const Color(0xFF9F9F9F)),
- bodyMedium: TextStyle(fontSize: zsp(14),color: Colors.white),
- bodyLarge: TextStyle(fontSize: zsp(21),color: Colors.white),
- bodySmall: TextStyle(fontSize: zsp(12),color: Colors.white),
- headlineMedium: TextStyle(fontSize: zsp(18),color: Colors.white),
- labelMedium: TextStyle(fontSize: zsp(14),color: const Color(0xFF969799)),
- labelLarge: TextStyle(fontSize: zsp(21),color: const Color(0xFF969799)),
- labelSmall: TextStyle(fontSize: zsp(12),color: const Color(0xFF969799)),
- displayMedium: TextStyle(fontSize: zsp(14),color: Colors.black),
- displayLarge: TextStyle(fontSize: zsp(21),color: Colors.black),
- displaySmall: TextStyle(fontSize: zsp(12),color: Colors.black),
- ),
- tabBarTheme: const TabBarTheme(
- unselectedLabelColor: Color(0xFF9F9F9F),
- labelColor: Colors.black,
- dividerColor: Color(0xFFF6F6F6)
- ),
- hintColor: Colors.black,
- );
- final ThemeData darkTheme = ThemeData(
- primaryColor: const Color(0xFF212123),
- cardColor: const Color(0xFF212123),
- canvasColor: const Color(0xFFF6F6F6),
- dividerColor: const Color(0xFFE6E0E0),
- indicatorColor: Colors.white,
- disabledColor: Colors.black54,
- shadowColor: Colors.black45,
- primaryColorDark: const Color(0xFF4C4A5A),
- primaryColorLight: const Color(0xFF9F9F9F),
- textTheme: TextTheme(
- titleMedium: TextStyle(fontSize: zsp(14),color: Colors.white),
- titleLarge: TextStyle(fontSize: zsp(21),color: Colors.white),
- titleSmall: TextStyle(fontSize: zsp(12),color: Colors.white),
- bodyMedium: TextStyle(fontSize: zsp(14),color: Colors.white),
- bodyLarge: TextStyle(fontSize: zsp(21),color: Colors.white),
- bodySmall: TextStyle(fontSize: zsp(12),color: Colors.white),
- headlineMedium: TextStyle(fontSize: zsp(18),color: Colors.white),
- labelMedium: TextStyle(fontSize: zsp(14),color: const Color(0xFF969799)),
- labelLarge: TextStyle(fontSize: zsp(21),color: const Color(0xFF969799)),
- labelSmall: TextStyle(fontSize: zsp(12),color: const Color(0xFF969799)),
- displayMedium: TextStyle(fontSize: zsp(14),color: Colors.black),
- displayLarge: TextStyle(fontSize: zsp(21),color: Colors.black),
- displaySmall: TextStyle(fontSize: zsp(12),color: Colors.black),
- ),
- tabBarTheme: const TabBarTheme(
- unselectedLabelColor: Color(0xFF9F9F9F),
- labelColor: Colors.black,
- dividerColor: Color(0xFF212123)
- ),
- hintColor: Colors.black,
- );
- class ThemeManager with ChangeNotifier {
- ThemeData themeData = darkTheme;
- ThemeData get value => themeData;
- setTheme(ThemeData theme) {
- themeData = theme;
- notifyListeners();
- }
- }
- setThemFunc(BuildContext context,ThemeData data) {
- final themeManager = Provider.of<ThemeManager>(context, listen: false);
- themeManager.setTheme(data);
- }
- class YSColors{
- static TextStyle titleStyle(BuildContext context) => TextStyle(fontSize: zsp(18),color: Theme.of(context).textTheme.titleLarge?.color,
- fontWeight: FontWeight.normal,decoration: TextDecoration.none);
- static TextStyle title2Style(BuildContext context) => TextStyle(fontSize: zsp(18),color: Theme.of(context).textTheme.bodyLarge?.color,
- fontWeight: FontWeight.normal,decoration: TextDecoration.none);
- static TextStyle title3Style(BuildContext context) => TextStyle(fontSize: zsp(18),color: Theme.of(context).textTheme.labelLarge?.color,
- fontWeight: FontWeight.normal,decoration: TextDecoration.none);
- static TextStyle title4Style(BuildContext context) => TextStyle(fontSize: zsp(18),color: Theme.of(context).textTheme.displayLarge?.color,
- fontWeight: FontWeight.normal,decoration: TextDecoration.none);
- static TextStyle contentStyle(BuildContext context) => TextStyle(fontSize: zsp(14),color: Theme.of(context).textTheme.titleMedium?.color,
- fontWeight: FontWeight.normal,decoration: TextDecoration.none);
- static TextStyle content2Style(BuildContext context) => TextStyle(fontSize: zsp(14),color: Theme.of(context).textTheme.bodyMedium?.color,
- fontWeight: FontWeight.normal,decoration: TextDecoration.none);
- static TextStyle content3Style(BuildContext context) => TextStyle(fontSize: zsp(14),color: Theme.of(context).textTheme.labelMedium?.color,
- fontWeight: FontWeight.normal,decoration: TextDecoration.none);
- static TextStyle content4Style(BuildContext context) => TextStyle(fontSize: zsp(14),color: Theme.of(context).textTheme.displayMedium?.color,
- fontWeight: FontWeight.normal,decoration: TextDecoration.none);
- static TextStyle subStyle(BuildContext context) => TextStyle(fontSize: zsp(12),color: Theme.of(context).textTheme.titleSmall?.color,
- fontWeight: FontWeight.normal,decoration: TextDecoration.none);
- static TextStyle sub2Style(BuildContext context) => TextStyle(fontSize: zsp(12),color: Theme.of(context).textTheme.bodySmall?.color,
- fontWeight: FontWeight.normal,decoration: TextDecoration.none);
- static TextStyle sub3Style(BuildContext context) => TextStyle(fontSize: zsp(12),color: Theme.of(context).textTheme.labelSmall?.color,
- fontWeight: FontWeight.normal,decoration: TextDecoration.none);
- static TextStyle sub4Style(BuildContext context) => TextStyle(fontSize: zsp(12),color: Theme.of(context).textTheme.displaySmall?.color,
- fontWeight: FontWeight.normal,decoration: TextDecoration.none);
- static backgroundColor(BuildContext context) => Theme.of(context).primaryColor;
- static containColor(BuildContext context) => Theme.of(context).cardColor;
- static contain2Color(BuildContext context) => Theme.of(context).canvasColor;
- static unSelectedColor(BuildContext context) => Theme.of(context).tabBarTheme.unselectedLabelColor;
- static selectedColor(BuildContext context) => Theme.of(context).tabBarTheme.labelColor;
- static tabColor(BuildContext context) => Theme.of(context).tabBarTheme.dividerColor;
- static lineColor(BuildContext context) => Theme.of(context).dividerColor;
- static shadowColor(BuildContext context) => Theme.of(context).shadowColor;
- static alertColor(BuildContext context) => Theme.of(context).disabledColor;
- static buttonColor(BuildContext context) => Theme.of(context).hintColor;
- static TextStyle buttonStyle(BuildContext context) => TextStyle(fontSize: zsp(18),color: Theme.of(context).textTheme.headlineMedium?.color);
- static sColor(BuildContext context) => Theme.of(context).primaryColorDark;
- static uColor(BuildContext context) => Theme.of(context).primaryColorLight;
- static iconColor(BuildContext context) => Theme.of(context).indicatorColor;
- static String imageStyle(BuildContext context,String name){
- String path = 'images/$name.png';
- if(Theme.of(context).primaryColor != const Color(0xFFF1F1F1)){
- path = 'images/$name.png';
- }
- return path;
- }
- }
- // static titleStyle(BuildContext context) => Theme.of(context).textTheme.titleLarge;
- // static title2Style(BuildContext context) => Theme.of(context).textTheme.bodyLarge;
- // static title3Style(BuildContext context) => Theme.of(context).textTheme.labelLarge;
- // static contentStyle(BuildContext context) => Theme.of(context).textTheme.titleMedium;
- // static content2Style(BuildContext context) => Theme.of(context).textTheme.bodyMedium;
- // static content3Style(BuildContext context) => Theme.of(context).textTheme.labelMedium;
- // static subStyle(BuildContext context) => Theme.of(context).textTheme.titleSmall;
- // static sub2Style(BuildContext context) => Theme.of(context).textTheme.bodySmall;
- // static sub3Style(BuildContext context) => Theme.of(context).textTheme.labelSmall;
- // static buttonStyle(BuildContext context) => Theme.of(context).textTheme.headlineMedium;
|