152 lines
6.0 KiB
Dart
152 lines
6.0 KiB
Dart
|
import 'package:flutter/material.dart';
|
||
|
import 'package:sk_base_mobile/util/screen_adaper_util.dart';
|
||
|
|
||
|
class AppTheme {
|
||
|
AppTheme._();
|
||
|
static const Color primaryColor = Color(0xFFC89607);
|
||
|
static const Color onPrimaryColor = Color(0xFFFEFEFE);
|
||
|
static const Color primaryColorLight = Color.fromARGB(255, 255, 206, 70);
|
||
|
static const Color primaryColorDark = Color.fromARGB(255, 163, 120, 0);
|
||
|
static const Color primaryTextColorWithBg = Color(0x00000000);
|
||
|
static const Color secondPrimaryColor = Color(0xFFc12a3a);
|
||
|
static const Color secondPrimaryColorLight = Color.fromARGB(255, 230, 79, 94);
|
||
|
static const Color secondPrimaryColorDark = Color.fromARGB(255, 141, 12, 25);
|
||
|
static const Color secondPrimaryTextColorWithBg = Color(0xFFFFFFFF);
|
||
|
static const Color white = Color(0xFFFFFFFF);
|
||
|
static const Color nearlyWhite = Color(0xFFFEFEFE);
|
||
|
static const Color black = Color(0xFF000000);
|
||
|
static const Color nearlyBlack = Color(0xFF213333);
|
||
|
static const Color grey = Color.fromARGB(255, 138, 138, 138);
|
||
|
static const Color snackbarErrorBackgroudColor = Colors.red;
|
||
|
static const Color snackbarSuccessBackgroudColor = Colors.green;
|
||
|
static const Color snackbarWarningBackgroudColor = Colors.orange;
|
||
|
static Color barrierColor = Colors.black.withOpacity(0.5);
|
||
|
static const String fontName = 'NotoSans';
|
||
|
static const Color activeNavigationBarColor = primaryColor;
|
||
|
static const Color notActiveNavigationBarColor = Colors.grey;
|
||
|
static const Color dangerColor = Colors.red;
|
||
|
static const Color dividerColor = Color.fromARGB(255, 224, 224, 224);
|
||
|
static const Color appbarBgColor = AppTheme.primaryColor;
|
||
|
static const Color scaffoldBackgroundColor = Color(0XFFe9f0fd);
|
||
|
static const Color inputFillColor = Color(0xFFf5f8ff);
|
||
|
}
|
||
|
|
||
|
final theme = ThemeData(
|
||
|
platform: TargetPlatform.iOS,
|
||
|
primarySwatch: MaterialColor(AppTheme.primaryColor.value, const {
|
||
|
50: AppTheme.primaryColorLight,
|
||
|
100: AppTheme.primaryColorLight,
|
||
|
200: AppTheme.primaryColorLight,
|
||
|
300: AppTheme.primaryColorLight,
|
||
|
400: AppTheme.primaryColorLight,
|
||
|
500: AppTheme.primaryColor,
|
||
|
600: AppTheme.primaryColorDark,
|
||
|
700: AppTheme.primaryColorDark,
|
||
|
800: AppTheme.primaryColorDark,
|
||
|
900: AppTheme.primaryColorDark,
|
||
|
}),
|
||
|
primaryColorLight: AppTheme.primaryColorLight,
|
||
|
fontFamily: AppTheme.fontName,
|
||
|
textButtonTheme: TextButtonThemeData(
|
||
|
style: ButtonStyle(
|
||
|
textStyle: MaterialStateProperty.all<TextStyle>(TextStyle(
|
||
|
fontSize: ScreenAdaper.height(26),
|
||
|
)), // 设置文本样式为白色
|
||
|
foregroundColor:
|
||
|
MaterialStateProperty.all<Color>(AppTheme.primaryColor), // 设置文本颜色为红色
|
||
|
)),
|
||
|
floatingActionButtonTheme: const FloatingActionButtonThemeData(
|
||
|
backgroundColor: AppTheme.primaryColorLight,
|
||
|
),
|
||
|
dialogTheme: const DialogTheme(
|
||
|
elevation: 0.2,
|
||
|
backgroundColor: AppTheme.nearlyWhite,
|
||
|
),
|
||
|
dialogBackgroundColor: AppTheme.nearlyWhite,
|
||
|
colorScheme: ColorScheme.fromSeed(
|
||
|
onPrimary: AppTheme.onPrimaryColor,
|
||
|
seedColor: AppTheme.primaryColor,
|
||
|
primary: AppTheme.primaryColor),
|
||
|
datePickerTheme: DatePickerThemeData(
|
||
|
confirmButtonStyle: ButtonStyle(
|
||
|
textStyle: MaterialStateProperty.resolveWith<TextStyle?>(
|
||
|
(Set<MaterialState> states) {
|
||
|
return TextStyle(color: AppTheme.primaryColor);
|
||
|
},
|
||
|
),
|
||
|
),
|
||
|
todayBorder: const BorderSide(color: AppTheme.primaryColor),
|
||
|
todayBackgroundColor: MaterialStateProperty.resolveWith<Color?>(
|
||
|
(Set<MaterialState> states) {
|
||
|
if (states.contains(MaterialState.selected)) {
|
||
|
return AppTheme.primaryColor;
|
||
|
}
|
||
|
return null;
|
||
|
},
|
||
|
),
|
||
|
// rangeSelectionBackgroundColor: AppTheme.primaryColor,
|
||
|
dayBackgroundColor: MaterialStateProperty.resolveWith<Color?>(
|
||
|
(Set<MaterialState> states) {
|
||
|
if (states.contains(MaterialState.selected)) {
|
||
|
return AppTheme.primaryColor;
|
||
|
}
|
||
|
return null;
|
||
|
},
|
||
|
),
|
||
|
),
|
||
|
visualDensity: VisualDensity.adaptivePlatformDensity,
|
||
|
primaryColor: AppTheme.primaryColor,
|
||
|
primaryColorDark: AppTheme.primaryColorDark,
|
||
|
textTheme: TextTheme(bodySmall: TextStyle(fontSize: ScreenAdaper.height(26))),
|
||
|
progressIndicatorTheme:
|
||
|
const ProgressIndicatorThemeData(color: AppTheme.primaryColor),
|
||
|
dividerColor: AppTheme.dividerColor,
|
||
|
cardColor: AppTheme.white,
|
||
|
scaffoldBackgroundColor: AppTheme.scaffoldBackgroundColor,
|
||
|
bottomNavigationBarTheme: BottomNavigationBarThemeData(
|
||
|
backgroundColor: AppTheme.nearlyWhite,
|
||
|
unselectedLabelStyle: TextStyle(fontSize: ScreenAdaper.height(20)),
|
||
|
selectedLabelStyle: TextStyle(fontSize: ScreenAdaper.height(20)),
|
||
|
selectedItemColor: AppTheme.primaryColor),
|
||
|
tabBarTheme: const TabBarTheme(
|
||
|
indicator: BoxDecoration(
|
||
|
border:
|
||
|
Border(bottom: BorderSide(width: 3, color: AppTheme.primaryColorDark)),
|
||
|
)),
|
||
|
textSelectionTheme: const TextSelectionThemeData(
|
||
|
selectionHandleColor: AppTheme.primaryColorLight,
|
||
|
cursorColor: AppTheme.primaryColorLight, // 这里是你想要的颜色
|
||
|
),
|
||
|
appBarTheme: AppBarTheme(
|
||
|
centerTitle: true,
|
||
|
iconTheme: const IconThemeData(color: Colors.white),
|
||
|
backgroundColor: AppTheme.appbarBgColor,
|
||
|
titleTextStyle: TextStyle(
|
||
|
color: Colors.white,
|
||
|
fontSize: ScreenAdaper.height(30),
|
||
|
fontWeight: FontWeight.bold),
|
||
|
),
|
||
|
inputDecorationTheme: InputDecorationTheme(
|
||
|
floatingLabelStyle: TextStyle(
|
||
|
color: AppTheme.primaryColor,
|
||
|
fontSize: ScreenAdaper.height(30),
|
||
|
),
|
||
|
hintStyle: TextStyle(
|
||
|
color: AppTheme.grey,
|
||
|
fontSize: ScreenAdaper.height(25),
|
||
|
),
|
||
|
fillColor: Colors.transparent,
|
||
|
filled: true,
|
||
|
labelStyle: TextStyle(
|
||
|
fontSize: ScreenAdaper.height(25),
|
||
|
),
|
||
|
border: OutlineInputBorder(
|
||
|
borderRadius: BorderRadius.circular(ScreenAdaper.sp(15))),
|
||
|
focusedBorder: OutlineInputBorder(
|
||
|
borderRadius: BorderRadius.circular(ScreenAdaper.sp(15)),
|
||
|
borderSide: const BorderSide(
|
||
|
color: AppTheme.primaryColorLight, width: 2), // 选中时的边框颜色和宽度
|
||
|
),
|
||
|
),
|
||
|
);
|