mobile_skt/lib/app_theme.dart

152 lines
6.0 KiB
Dart
Raw Normal View History

import 'package:flutter/material.dart';
import 'package:sk_base_mobile/util/screen_adaper_util.dart';
class AppTheme {
AppTheme._();
2024-03-18 15:54:06 +08:00
static const Color primaryColor = Color(0xFFC89607);
2024-04-12 09:56:00 +08:00
static const Color onPrimaryColor = Color(0xFFFEFEFE);
2024-03-19 11:09:07 +08:00
static const Color primaryColorLight = Color.fromARGB(255, 255, 206, 70);
2024-03-19 13:27:42 +08:00
static const Color primaryColorDark = Color.fromARGB(255, 163, 120, 0);
static const Color primaryTextColorWithBg = Color(0x00000000);
2024-03-19 13:27:42 +08:00
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);
2024-03-18 15:54:06 +08:00
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;
2024-03-19 08:59:08 +08:00
static Color barrierColor = Colors.black.withOpacity(0.5);
static const String fontName = 'NotoSans';
2024-03-19 11:09:07 +08:00
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;
2024-04-09 08:31:17 +08:00
static const Color scaffoldBackgroundColor = Color(0XFFe9f0fd);
2024-04-12 09:56:00 +08:00
static const Color inputFillColor = Color(0xFFf5f8ff);
}
final theme = ThemeData(
2024-04-07 17:32:46 +08:00
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,
}),
2024-03-21 14:09:49 +08:00
primaryColorLight: AppTheme.primaryColorLight,
fontFamily: AppTheme.fontName,
2024-03-21 14:09:49 +08:00
textButtonTheme: TextButtonThemeData(
style: ButtonStyle(
2024-04-10 17:08:26 +08:00
textStyle: MaterialStateProperty.all<TextStyle>(TextStyle(
fontSize: ScreenAdaper.height(26),
)), // 设置文本样式为白色
2024-03-21 14:09:49 +08:00
foregroundColor:
MaterialStateProperty.all<Color>(AppTheme.primaryColor), // 设置文本颜色为红色
)),
2024-04-10 17:08:26 +08:00
floatingActionButtonTheme: const FloatingActionButtonThemeData(
2024-04-02 12:24:08 +08:00
backgroundColor: AppTheme.primaryColorLight,
),
2024-04-10 17:08:26 +08:00
dialogTheme: const DialogTheme(
elevation: 0.2,
backgroundColor: AppTheme.nearlyWhite,
),
dialogBackgroundColor: AppTheme.nearlyWhite,
colorScheme: ColorScheme.fromSeed(
2024-04-12 09:56:00 +08:00
onPrimary: AppTheme.onPrimaryColor,
2024-04-10 17:08:26 +08:00
seedColor: AppTheme.primaryColor,
primary: AppTheme.primaryColor),
datePickerTheme: DatePickerThemeData(
confirmButtonStyle: ButtonStyle(
textStyle: MaterialStateProperty.resolveWith<TextStyle?>(
(Set<MaterialState> states) {
2024-04-10 17:08:26 +08:00
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;
},
),
2024-03-21 14:09:49 +08:00
// 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,
2024-04-10 17:08:26 +08:00
textTheme: TextTheme(bodySmall: TextStyle(fontSize: ScreenAdaper.height(26))),
progressIndicatorTheme:
2024-03-18 15:54:06 +08:00
const ProgressIndicatorThemeData(color: AppTheme.primaryColor),
dividerColor: AppTheme.dividerColor,
2024-03-18 15:54:06 +08:00
cardColor: AppTheme.white,
scaffoldBackgroundColor: AppTheme.scaffoldBackgroundColor,
2024-03-19 08:59:08 +08:00
bottomNavigationBarTheme: BottomNavigationBarThemeData(
backgroundColor: AppTheme.nearlyWhite,
2024-03-28 17:18:46 +08:00
unselectedLabelStyle: TextStyle(fontSize: ScreenAdaper.height(20)),
selectedLabelStyle: TextStyle(fontSize: ScreenAdaper.height(20)),
2024-03-19 08:59:08 +08:00
selectedItemColor: AppTheme.primaryColor),
tabBarTheme: const TabBarTheme(
indicator: BoxDecoration(
border:
Border(bottom: BorderSide(width: 3, color: AppTheme.primaryColorDark)),
)),
2024-04-01 17:35:34 +08:00
textSelectionTheme: const TextSelectionThemeData(
selectionHandleColor: AppTheme.primaryColorLight,
cursorColor: AppTheme.primaryColorLight, // 这里是你想要的颜色
),
appBarTheme: AppBarTheme(
centerTitle: true,
2024-04-01 08:41:52 +08:00
iconTheme: const IconThemeData(color: Colors.white),
backgroundColor: AppTheme.appbarBgColor,
titleTextStyle: TextStyle(
2024-03-27 11:06:01 +08:00
color: Colors.white,
2024-03-28 17:18:46 +08:00
fontSize: ScreenAdaper.height(30),
fontWeight: FontWeight.bold),
),
2024-03-18 15:54:06 +08:00
inputDecorationTheme: InputDecorationTheme(
floatingLabelStyle: TextStyle(
color: AppTheme.primaryColor,
2024-03-28 17:18:46 +08:00
fontSize: ScreenAdaper.height(30),
2024-03-18 15:54:06 +08:00
),
hintStyle: TextStyle(
color: AppTheme.grey,
fontSize: ScreenAdaper.height(25),
),
fillColor: Colors.transparent,
filled: true,
2024-03-18 15:54:06 +08:00
labelStyle: TextStyle(
2024-03-28 17:18:46 +08:00
fontSize: ScreenAdaper.height(25),
2024-03-18 15:54:06 +08:00
),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(ScreenAdaper.sp(15))),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(ScreenAdaper.sp(15)),
borderSide: const BorderSide(
2024-03-18 15:54:06 +08:00
color: AppTheme.primaryColorLight, width: 2), // 选中时的边框颜色和宽度
),
),
);