You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mohemm-flutter-moe/lib/theme/app_theme.dart

78 lines
3.6 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:mohem_flutter_app/classes/colors.dart';
import 'package:mohem_flutter_app/theme/colors.dart';
class AppTheme {
static ThemeData getTheme(isArabic) => ThemeData(
fontFamily: isArabic ? 'Cairo' : 'Poppins',
visualDensity: VisualDensity.adaptivePlatformDensity,
brightness: Brightness.light,
pageTransitionsTheme: const PageTransitionsTheme(
builders: {
TargetPlatform.android: ZoomPageTransitionsBuilder(),
TargetPlatform.iOS: CupertinoPageTransitionsBuilder(),
},
),
hintColor: Colors.grey[400],
disabledColor: Colors.grey[300],
scaffoldBackgroundColor: MyColors.backgroundColor,
textSelectionTheme: const TextSelectionThemeData(cursorColor: Colors.grey, selectionColor: Color.fromRGBO(80, 100, 253, 0.5), selectionHandleColor: Colors.grey),
canvasColor: Colors.white,
highlightColor: Colors.grey[100]!.withOpacity(0.4),
splashColor: Colors.transparent,
primaryColor: primaryColor,
primaryColorDark: primaryColor,
indicatorColor: secondaryColor,
bottomSheetTheme: const BottomSheetThemeData(
backgroundColor: Color(0xFFE0E0E0),
),
primaryTextTheme: const TextTheme(
bodyText2: TextStyle(color: Colors.white),
),
iconTheme: const IconThemeData(color: MyColors.darkIconColor),
textTheme: const TextTheme(
bodyText1: TextStyle(color: Colors.black, letterSpacing: 0.6),
headline1: TextStyle(color: Colors.white, letterSpacing: 0.6),
headline2: TextStyle(color: Colors.white, letterSpacing: 0.6),
),
floatingActionButtonTheme: const FloatingActionButtonThemeData(highlightElevation: 2, disabledElevation: 0, elevation: 2),
appBarTheme: AppBarTheme(
color: const Color(0xff515A5D),
elevation: 0.0,
actionsIconTheme: IconThemeData(
color: Colors.grey[800],
), systemOverlayStyle: SystemUiOverlayStyle.dark,
), checkboxTheme: CheckboxThemeData(
fillColor: MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {
if (states.contains(MaterialState.disabled)) { return null; }
if (states.contains(MaterialState.selected)) { return secondaryColor; }
return null;
}),
), radioTheme: RadioThemeData(
fillColor: MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {
if (states.contains(MaterialState.disabled)) { return null; }
if (states.contains(MaterialState.selected)) { return secondaryColor; }
return null;
}),
), switchTheme: SwitchThemeData(
thumbColor: MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {
if (states.contains(MaterialState.disabled)) { return null; }
if (states.contains(MaterialState.selected)) { return secondaryColor; }
return null;
}),
trackColor: MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {
if (states.contains(MaterialState.disabled)) { return null; }
if (states.contains(MaterialState.selected)) { return secondaryColor; }
return null;
}),
), colorScheme: ColorScheme.fromSwatch(accentColor: MyColors.backgroundColor).copyWith( background: const Color.fromRGBO(255, 255, 255, 1)).copyWith(error: const Color.fromRGBO(235, 80, 60, 1.0)),
);
}
extension ExtendedRevoCheckTheme on TextTheme {
//add custom styles and colors here
//taken from https://medium.com/@crizantlai/flutter-how-to-extend-themedata-b5b987a95bb5
TextStyle get price => const TextStyle(color: Colors.redAccent);
}