155 lines
5.0 KiB
Dart
155 lines
5.0 KiB
Dart
// ignore_for_file: prefer_const_constructors
|
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:get/get.dart';
|
|
import 'package:get_storage/get_storage.dart';
|
|
|
|
class ThemseServices {
|
|
final box = GetStorage();
|
|
final key = 'isDarkMode';
|
|
|
|
saveThemeToBox(bool isDarkMode) => box.write(key, isDarkMode);
|
|
|
|
bool loadThemeFromBox() => box.read(key) ?? true;
|
|
ThemeMode get theme => loadThemeFromBox() ? ThemeMode.dark : ThemeMode.light;
|
|
void switchTheme() {
|
|
Get.changeThemeMode(loadThemeFromBox() ? ThemeMode.light : ThemeMode.dark);
|
|
saveThemeToBox(!loadThemeFromBox());
|
|
}
|
|
}
|
|
|
|
class ColorConstants {
|
|
static const kPrimaryColor = Color(0xFFBBF046);
|
|
static const kWhite = Color(0xFFffffff);
|
|
static const kBlack = Color(0xFF000000);
|
|
static const kErroColor = Color(0xFFE90000);
|
|
|
|
static const periodsColor = Color(0xFFE24747);
|
|
}
|
|
|
|
abstract class AppColors {
|
|
static const kPrimaryColor = Color(0xFFBBF046);
|
|
static const kWhite = Color(0xFFffffff);
|
|
static const kBlack = Color(0xFF000000);
|
|
static const kErroColor = Color(0xFFE90000);
|
|
|
|
static const primary = Color(0xffCC9900);
|
|
static const secondary = Color(0xFFF40000);
|
|
// static const accent = Color(0xFFD6755B);
|
|
static const textDark = Color(0xFF000000);
|
|
static const textLigth = Color(0xFFffffff);
|
|
// static const textFaded = Color(0xFF9899A5);
|
|
static const iconLight = Color(0xFF000000);
|
|
static const iconDark = textLigth;
|
|
static const textHighlight = secondary;
|
|
static const cardLight = Color(0xFFF9FAFE);
|
|
static const cardDark = Color(0xFF303334);
|
|
}
|
|
|
|
abstract class _LightColors {
|
|
static const background = Color(0xffffffff);
|
|
// static const card = background;
|
|
}
|
|
|
|
abstract class _DarkColors {
|
|
static const background = Color(0xFF000000);
|
|
static const card = AppColors.cardDark;
|
|
}
|
|
|
|
/// Reference to the application theme.
|
|
abstract class AppTheme {
|
|
// static const accentColor = AppColors.accent;
|
|
static final visualDensity = VisualDensity.adaptivePlatformDensity;
|
|
|
|
/// Light theme and its settings.
|
|
static ThemeData light() => ThemeData(
|
|
appBarTheme: const AppBarTheme(
|
|
backgroundColor: ColorConstants.kWhite,
|
|
// backgroundColor: Colors.transparent,
|
|
// elevation: 0,
|
|
),
|
|
bottomNavigationBarTheme: const BottomNavigationBarThemeData(
|
|
backgroundColor: ColorConstants.kWhite,
|
|
),
|
|
brightness: Brightness.light,
|
|
fontFamily: 'SFPRO',
|
|
// accentColor: accentColor,
|
|
visualDensity: visualDensity,
|
|
// iconTheme: IconThemeData(
|
|
// color: Colors.black
|
|
// ),
|
|
// backgroundColor: const Color(0xffffffff),
|
|
// textTheme:GoogleFonts.mulishTextTheme().apply(bodyColor: AppColors.textDark),
|
|
// textTheme: TextTheme(
|
|
// headline1:
|
|
// const TextStyle(fontSize: 28.0).apply(color: AppColors.textDark),
|
|
// ),
|
|
drawerTheme: DrawerThemeData(
|
|
backgroundColor: Colors.white,
|
|
),
|
|
scaffoldBackgroundColor: _LightColors.background,
|
|
// cardColor: _LightColors.card,
|
|
primaryColor: Colors.red,
|
|
primaryTextTheme: const TextTheme(
|
|
titleLarge: TextStyle(color: AppColors.textDark),
|
|
),
|
|
iconTheme: const IconThemeData(color: AppColors.iconLight),
|
|
colorScheme: const ColorScheme.light()
|
|
.copyWith(background: _LightColors.background),
|
|
);
|
|
|
|
/// Dark theme and its settings.
|
|
static ThemeData dark() => ThemeData(
|
|
appBarTheme:
|
|
AppBarTheme(backgroundColor: Color.fromARGB(255, 16, 16, 16)),
|
|
brightness: Brightness.dark,
|
|
fontFamily: 'SFPRO',
|
|
// accentColor: accentColor,
|
|
visualDensity: visualDensity,
|
|
bottomNavigationBarTheme: const BottomNavigationBarThemeData(
|
|
backgroundColor: Color(0xff1C1B1B),
|
|
),
|
|
// iconTheme: IconThemeData(
|
|
// color: Colors.white
|
|
// ),
|
|
|
|
// textTheme: GoogleFonts.interTextTheme().apply(bodyColor: AppColors.textLigth),
|
|
// backgroundColor: _DarkColors.background,
|
|
drawerTheme: DrawerThemeData(
|
|
backgroundColor: const Color(0xff212121),
|
|
),
|
|
colorScheme: const ColorScheme.dark(),
|
|
scaffoldBackgroundColor: _DarkColors.background,
|
|
cardColor: _DarkColors.card,
|
|
primaryColor: const Color(0xff000000),
|
|
primaryTextTheme: const TextTheme(
|
|
titleLarge: TextStyle(color: AppColors.textLigth),
|
|
),
|
|
iconTheme: const IconThemeData(color: AppColors.iconDark),
|
|
);
|
|
}
|
|
|
|
// theme end===============
|
|
|
|
class QuizTextStyles {
|
|
// static final brightness = Get.theme.brightness;
|
|
static TextStyle heading = TextStyle(
|
|
fontFamily: "SFPRO",
|
|
fontWeight: FontWeight.w400,
|
|
color: ColorConstants.kWhite,
|
|
fontSize: 17,
|
|
);
|
|
static const TextStyle body = TextStyle(
|
|
fontFamily: "SFPRO",
|
|
fontWeight: FontWeight.w300,
|
|
color: Color(0xFFD9D9D9),
|
|
fontSize: 14,
|
|
);
|
|
static const TextStyle label = TextStyle(
|
|
fontFamily: "SFPRO",
|
|
fontWeight: FontWeight.w700,
|
|
color: Color(0xFFBBF046),
|
|
fontSize: 17,
|
|
);
|
|
}
|