guru_sdk/guru_ui/example/lib/theme/example_theme.dart

206 lines
8.9 KiB
Dart
Raw Permalink Normal View History

import 'package:daily_challenge/ui/pages/award/trophy_exhibit_widget.dart';
import 'package:daily_challenge/ui/pages/calendar/challenge_calendar_page.dart';
import 'package:daily_challenge/ui/pages/congratulations/congratulations_page.dart';
import 'package:example/theme/assetbar/custom_asset_bar_theme.dart';
import 'package:example/theme/button/custom_standard_button_theme.dart';
import 'package:flutter/material.dart';
import 'package:guru_widgets/theme/guru_theme.dart';
import 'package:guru_widgets/assetbar/guru_asset_bar.dart';
import 'package:guru_widgets/banner/purchase_banner.dart';
import 'package:guru_widgets/gem_overlay/guru_gem_overlay.dart';
import 'tabbar/custom_tab_bar_theme.dart';
/// Created by KernelTea on 2021/12/14
mixin GuruAssetBarThemeMixin {
static const GuruAssetBarStyle joker = GuruAssetBarStyle.create("joker");
}
class ExampleThemes {
static const _primaryColor = Color(0xFF7B6CDC);
static ThemeData get theme => defaultLightTheme;
static GuruThemeData defaultGuruTheme = GuruThemeData(
iconScheme: const GuruIconScheme(
dialogCloseIcon: "assets/images/ic_close.png",
closeIcon: "assets/images/ic_close.png",
entranceIcon: "assets/images/arrow.png",
switchOffIcon: "assets/images/off.png",
switchOnIcon: "assets/images/on.png",
adsVideoIcon: "assets/images/ic_ads.png",
leftArrowIcon: "assets/images/ic_arrow_left.png",
rightArrowIcon: "assets/images/ic_arrow_right.png",
backIcon: "assets/images/ic_back.png",
tipsIcon: "assets/images/ic_tips.png"),
colorScheme: const GuruColorScheme(
primaryColor: _primaryColor,
secondaryColor: Color(0xffa2a2a2),
primaryContentColor: Colors.white,
secondaryContentColor: white40,
backgroundColor: Color(0xFF121212),
containerColor: Color(0xFF1D1D1D),
overlayColors: GuruOverlayColorScheme(
backgroundColor: Colors.white,
textColor: _primaryColor,
expressiveColor: Colors.black)),
buttonTheme: CustomStandardButtonTheme(),
dialogTheme: const GuruDialogTheme(
titleColor: Color(0xFF181B36),
subtitleColor: Color(0xFF6C6D71),
summaryColor: Colors.black,
backgroundColor: Colors.white),
appBarTheme: const GuruAppBarTheme(backgroundColor: Colors.blue),
tabBarTheme: const GuruTabBarTheme(
backgroundColor: Color(0xFFF1F1F1),
selectedColor: Colors.white,
selectedBackgroundColor: Color(0xFF5067ED),
unSelctedColor: Color(0x66000000),
unSelectedBackgroundColor: Colors.transparent,
indicator: CustomTabBarDecoration()),
navigationBarTheme: const GuruNavigationBarTheme(
backgroundColor: Colors.white,
selectedColor: Color(0xFF5067ED),
unSelctedColor: Colors.black26),
assetBarTheme: const GuruAssetBarTheme(styles: {
GuruAssetBarStyle.igc: GuruAssetBarStyleTheme(
"assets/images/ic_coin.png",
backgroundDecoration: CustomAssetBarDecoration(),
balanceColor: Colors.white,
trailingIcon: "assets/images/ic_add.png"),
GuruAssetBarThemeMixin.joker: GuruAssetBarStyleTheme(
sizeSpec: GuruAssetBarSizeSpec.s2,
"assets/images/ic_coin.png",
backgroundDecoration:
GuruAssetBarSolidDecoration(color: Colors.blueGrey, sizeSpec: GuruAssetBarSizeSpec.s2),
balanceColor: Colors.black,
trailingIcon: "assets/images/ic_add.png"),
}),
sliderBarTheme: const GuruSliderBarTheme(
anchorIcon: 'assets/images/slider_bar/pic_select.png',
curve: Cubic(.71,.1,.29,.9),
duration: Duration(milliseconds: 1400)
),
gemsOverlayTheme: const GuruGemsOverlayTheme(
icon: "assets/images/ic_coin.png"
),
customTheme: GuruCustomTheme(themes: [
ChallengeCalendarTheme(
primaryColor: Colors.blue,
dateTextColor: Colors.black,
selectedDateTextColor: Colors.white,
disabledDateTextColor: Colors.grey.withOpacity(0.65),
daysOfWeekTextColor: const Color(0xFF999999),
calendarBackgroundColor: Colors.white,
animatedTrophyBackground: LottieAsset(
"assets/lottie/animated_trophy_bg.json",
const Duration(seconds: 14)),
closeIcon: "assets/images/close.png",
markerIcon: "assets/images/ic_crown.png",
nextMonthArrowIcon:
"assets/images/daily_challenge/ic_arrow_right.png",
previousMonthArrowIcon:
"assets/images/daily_challenge/ic_arrow_left.png",
awardIcon: "assets/images/daily_challenge/ic_awards.png"),
TrophyExhibitTheme(
yearColor: Colors.black,
monthNameColor: Colors.black,
headerGradient: const LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [Color(0xFFE9ECFF), Colors.white],
)),
CongratulationTheme(
summaryColor: Colors.white,
buttonStyle: CustomStandardButtonTheme.collectTrophy,
animatedTrophyBackground: LottieAsset(
"assets/lottie/congrats_trophy_bg.json",
const Duration(seconds: 14))),
const PurchaseBannerTheme(
removeAdsBackGround: 'assets/images/pic_radial_light.png',
removeAdsImage: 'assets/images/pic_remove_ads.png'
),
]));
static ThemeData defaultLightTheme = ThemeData(
brightness: Brightness.light,
primaryColor: _primaryColor,
fontFamily: "EncodeSansExpanded",
dialogBackgroundColor: const Color(0xFFFFFEFC),
canvasColor: Colors.transparent,
backgroundColor: Colors.white,
scaffoldBackgroundColor: Colors.white,
unselectedWidgetColor: _primaryColor,
/* timePickerTheme: TimePickerThemeData(
// dayPeriodColor: Colors.green,
entryModeIconColor: Colors.deepPurple,
hourMinuteColor: Colors.blueAccent,
hourMinuteTextColor: Colors.orangeAccent,
),*/
radioTheme: RadioThemeData(
overlayColor:
MaterialStateProperty.all(_primaryColor.withOpacity(0.3)),
fillColor: MaterialStateProperty.all(_primaryColor)),
switchTheme: SwitchThemeData(
thumbColor: MaterialStateColor.resolveWith((Set<MaterialState> states) {
if (states.contains(MaterialState.selected)) {
return _primaryColor;
}
return Colors.white;
}),
trackColor: MaterialStateColor.resolveWith((Set<MaterialState> states) {
if (states.contains(MaterialState.selected)) {
return _primaryColor.withOpacity(0.2);
}
return const Color(0xFFB9B9B9);
}),
overlayColor:
MaterialStateColor.resolveWith((Set<MaterialState> states) {
if (states.contains(MaterialState.selected)) {
return _primaryColor.withOpacity(0.2);
}
return Colors.black12;
}),
),
iconTheme: const IconThemeData(color: Colors.black));
static const FontWeight fwThin = FontWeight.w100; // 纤细体
static const FontWeight fwExtraLight = FontWeight.w200; // 加细体
static const FontWeight fwLight = FontWeight.w300; // 细体
static const FontWeight fwRegular = FontWeight.w400; // 常规体
static const FontWeight fwMedium = FontWeight.w500; // 中黑体
static const FontWeight fwSemiBold = FontWeight.w600; // 中粗体
static const FontWeight fwBold = FontWeight.w700; // 粗体
static const FontWeight fwExtraBold = FontWeight.w800; // 加粗体
static const FontWeight fwBlack = FontWeight.w900; // 黑体
static const Color white17 = Color(0x23FFFFFF);
static const Color white22 = Color(0x38FFFFFF);
static const Color white40 = Color(0x66FFFFFF);
static const Color white44 = Color(0x70FFFFFF);
static const Color white48 = Color(0x7AFFFFFF);
static const Color white50 = Color(0x7FFFFFFF);
static const Color white60 = Color(0x99FFFFFF);
static const Color white70 = Colors.white70;
static const Color white80 = Color(0xCCFFFFFF);
static const Color white90 = Color(0xE5FFFFFF);
static const Color white94 = Color(0xF0FFFFFF);
static const Color black17 = Color(0x23000000);
static const Color black22 = Color(0x38000000);
static const Color black40 = Color(0x66000000);
static const Color black44 = Color(0x70000000);
static const Color black48 = Color(0x7A000000);
static const Color black50 = Color(0x7F000000);
static const Color black60 = Color(0x99000000);
static const Color black70 = Color(0xB3000000);
static const Color black80 = Color(0xCC000000);
static const Color black90 = Color(0xE5000000);
static const Color black94 = Color(0xF0000000);
static TextStyle mergeTextStyle(BuildContext context, TextStyle style) {
return DefaultTextStyle.of(context).style.merge(style);
}
}