import 'package:flutter/material.dart';
import 'package:guru_widgets/theme/guru_theme.dart';

/// Created by Haoyi on 2021/12/14

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"),
    colorScheme: const GuruColorScheme(
        primaryColor: _primaryColor,
        secondaryColor: _primaryColor,
        primaryContentColor: Colors.white,
        secondaryContentColor: white40,
        backgroundColor: Color(0xFF121212),
        containerColor: Color(0xFF1D1D1D)),
  );

  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),
      buttonColor: _primaryColor);

  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);
  }
}
