2023-07-10 17:50:31 +08:00
|
|
|
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:get/get.dart';
|
|
|
|
|
import 'app_colors.dart';
|
|
|
|
|
import 'app_style.dart';
|
|
|
|
|
|
|
|
|
|
class AppTheme {
|
|
|
|
|
|
|
|
|
|
static bool get isDarkMode => Get.isDarkMode;
|
|
|
|
|
|
|
|
|
|
static ThemeData get appThemeData => ThemeData(
|
|
|
|
|
// fontFamily: ,
|
|
|
|
|
primaryColor: AppColors.primaryTopColor,
|
|
|
|
|
navigationBarTheme: navigationBarThemeData,
|
|
|
|
|
checkboxTheme: checkBoxThemeData,
|
|
|
|
|
textButtonTheme: textButtonThemeData,
|
|
|
|
|
outlinedButtonTheme: outlinedButtonThemeData,
|
|
|
|
|
buttonTheme: buttonThemeData,
|
|
|
|
|
elevatedButtonTheme: elevatedButtonThemeData,
|
|
|
|
|
scaffoldBackgroundColor: Colors.transparent,
|
|
|
|
|
dialogBackgroundColor: AppColors.dialogBgColor,
|
|
|
|
|
// inputDecorationTheme: inputDecorationTheme,
|
|
|
|
|
dividerTheme: dividerTheme,
|
|
|
|
|
bottomNavigationBarTheme: bottomNavigationBarThemeData,
|
|
|
|
|
switchTheme: switchThemeData,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
static SwitchThemeData get switchThemeData => SwitchThemeData(
|
|
|
|
|
trackColor: MaterialStateProperty.resolveWith((states){
|
|
|
|
|
if(states.contains(MaterialState.selected)){
|
|
|
|
|
return AppColors.switchTrackSelectedColor;
|
|
|
|
|
}
|
|
|
|
|
return AppColors.switchTrackUnselectedColor;
|
|
|
|
|
}),
|
|
|
|
|
thumbColor: MaterialStateProperty.resolveWith((states){
|
|
|
|
|
if(states.contains(MaterialState.selected)){
|
|
|
|
|
return AppColors.switchThumbColor;
|
|
|
|
|
}
|
|
|
|
|
return AppColors.switchThumbColor;
|
|
|
|
|
}),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
static NavigationBarThemeData get navigationBarThemeData => const NavigationBarThemeData(
|
|
|
|
|
backgroundColor: Colors.transparent,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
static BottomNavigationBarThemeData get bottomNavigationBarThemeData => BottomNavigationBarThemeData(
|
|
|
|
|
elevation: 0,
|
|
|
|
|
backgroundColor: Colors.transparent,
|
|
|
|
|
selectedItemColor: AppColors.buttonEnableColor,
|
|
|
|
|
unselectedItemColor: AppColors.buttonEnableTextColor,
|
|
|
|
|
selectedLabelStyle: AppStyle.textStyle(
|
|
|
|
|
fontSize: 10,
|
|
|
|
|
),
|
|
|
|
|
unselectedLabelStyle: AppStyle.textStyle(
|
|
|
|
|
fontSize: 11,
|
|
|
|
|
),
|
|
|
|
|
selectedIconTheme: bottomBarSelectedIconTheme,
|
|
|
|
|
unselectedIconTheme: bottomBarUnselectedIconTheme,
|
|
|
|
|
landscapeLayout: BottomNavigationBarLandscapeLayout.centered,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
static IconThemeData get bottomBarSelectedIconTheme => const IconThemeData(
|
|
|
|
|
size: 20,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
static IconThemeData get bottomBarUnselectedIconTheme => const IconThemeData(
|
|
|
|
|
size: 21,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
static DividerThemeData get dividerTheme => DividerThemeData(
|
|
|
|
|
color: AppColors.dividerColor,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
static InputDecorationTheme get inputDecorationTheme => InputDecorationTheme(
|
|
|
|
|
hintStyle: AppStyle.textFieldHintTextStyle,
|
|
|
|
|
enabledBorder: AppStyle.textFieldEnableBorder,
|
|
|
|
|
focusedBorder: AppStyle.textFieldFocusBorder,
|
|
|
|
|
border: AppStyle.textFieldEnableBorder,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
static AppBarTheme get appBarTheme => AppBarTheme(
|
|
|
|
|
backgroundColor: Colors.transparent,
|
|
|
|
|
iconTheme: IconThemeData(
|
|
|
|
|
color: AppColors.appBarIconColor,
|
|
|
|
|
),
|
|
|
|
|
elevation: 0.0,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
static CheckboxThemeData get checkBoxThemeData => CheckboxThemeData(
|
|
|
|
|
fillColor: MaterialStateProperty.resolveWith((states) {
|
|
|
|
|
if(states.contains(MaterialState.selected)){
|
|
|
|
|
return AppColors.checkBoxSelectedColor;
|
|
|
|
|
}
|
|
|
|
|
return AppColors.checkBoxUnselectedColor;
|
|
|
|
|
}),
|
|
|
|
|
overlayColor: MaterialStateProperty.resolveWith((states) => AppColors.checkBoxOverlayColor),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
static ElevatedButtonThemeData get elevatedButtonThemeData => ElevatedButtonThemeData(
|
|
|
|
|
style: AppStyle.elevatedButtonButtonStyle,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
static TextButtonThemeData get textButtonThemeData => TextButtonThemeData(
|
|
|
|
|
style: AppStyle.textButtonStyle,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
static OutlinedButtonThemeData get outlinedButtonThemeData => OutlinedButtonThemeData(
|
|
|
|
|
style: AppStyle.outlinedButtonButtonStyle,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
static ButtonThemeData get buttonThemeData => const ButtonThemeData(
|
|
|
|
|
textTheme: ButtonTextTheme.primary,
|
|
|
|
|
shape: RoundedRectangleBorder(
|
|
|
|
|
borderRadius: BorderRadius.all(Radius.circular(16.0))
|
|
|
|
|
),
|
|
|
|
|
height: 90,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class NoShadowScrollBehavior extends ScrollBehavior {
|
2024-10-15 14:24:35 +08:00
|
|
|
const NoShadowScrollBehavior({this.axisDirection = AxisDirection.up}):super();
|
2023-07-10 17:50:31 +08:00
|
|
|
|
|
|
|
|
final AxisDirection axisDirection;
|
|
|
|
|
@override
|
|
|
|
|
Widget buildOverscrollIndicator(BuildContext context, Widget child, ScrollableDetails details) {
|
|
|
|
|
return GlowingOverscrollIndicator(axisDirection: axisDirection, color: Colors.red,showTrailing: false,showLeading: false,child: child,);
|
|
|
|
|
}
|
|
|
|
|
}
|