LCOV - code coverage report
Current view: top level - src - theme.dart (source / functions) Hit Total Coverage
Test: lcov.info Lines: 24 31 77.4 %
Date: 2020-12-04 18:41:24 Functions: 0 0 -

          Line data    Source code
       1             : import 'package:flutter/material.dart';
       2             : import 'package:google_fonts/google_fonts.dart';
       3             : 
       4             : class _PalThemeLightColors {
       5             :   static const Color dark = Color(0xFF03045E);
       6             :   static const Color black = Color(0xFF292931);
       7             :   static const Color blue = Color(0xFF0077B6);
       8             :   static const Color lightBlue = Color(0xFF00B4D8);
       9             :   static const Color cyan = Color(0xFF90E0EF);
      10             :   static const Color aqua = Color(0xFFCAF0F8);
      11             :   static const Color red = Color(0xFFeB5160);
      12             :   static const Color white = Color(0xFFFAFEFF);
      13             :   static const Color gray = Color(0xFF4F4E57);
      14             : 
      15             :   static const Gradient gradient1 = const LinearGradient(
      16             :     begin: Alignment.topCenter,
      17             :     end: Alignment.bottomCenter,
      18             :     colors: <Color>[
      19             :       white,
      20             :       aqua,
      21             :     ],
      22             :   );
      23             :   static const Gradient gradient2 = const LinearGradient(
      24             :     begin: Alignment.topCenter,
      25             :     end: Alignment.bottomCenter,
      26             :     colors: <Color>[
      27             :       Color(0xFF0D055E),
      28             :       Color(0xFF2C77B6),
      29             :     ],
      30             :   );
      31             : }
      32             : 
      33             : class _PalThemeColors {
      34             :   final Color dark;
      35             : 
      36             :   final Color black;
      37             : 
      38             :   final Color color1, color2, color3, color4, color5;
      39             : 
      40             :   final Color accent;
      41             : 
      42             :   final Color light;
      43             : 
      44             :   final Gradient bottomNavEditorGradient;
      45             : 
      46             :   final Gradient settingsSilverGradient;
      47             : 
      48           0 :   const _PalThemeColors._({
      49             :     this.dark,
      50             :     this.black,
      51             :     this.color1,
      52             :     this.color2,
      53             :     this.color3,
      54             :     this.color4,
      55             :     this.color5,
      56             :     this.accent,
      57             :     this.light,
      58             :     this.bottomNavEditorGradient,
      59             :     this.settingsSilverGradient,
      60             :   });
      61             : 
      62          25 :   factory _PalThemeColors.light() => const _PalThemeColors._(
      63             :         dark: _PalThemeLightColors.dark,
      64             :         color1: _PalThemeLightColors.blue,
      65             :         black: _PalThemeLightColors.black,
      66             :         color2: _PalThemeLightColors.lightBlue,
      67             :         color3: _PalThemeLightColors.cyan,
      68             :         color4: _PalThemeLightColors.aqua,
      69             :         color5: _PalThemeLightColors.gray,
      70             :         light: _PalThemeLightColors.white,
      71             :         accent: _PalThemeLightColors.red,
      72             :         bottomNavEditorGradient: _PalThemeLightColors.gradient1,
      73             :         settingsSilverGradient: _PalThemeLightColors.gradient2,
      74             :       );
      75             : }
      76             : 
      77             : /// use this to let all app get our custom theme from context
      78             : /// we have more colors than pure material
      79             : class PalTheme extends InheritedWidget {
      80             :   final PalThemeData theme;
      81             : 
      82          25 :   PalTheme({
      83             :     this.theme,
      84             :     Key key,
      85             :     @required Widget child,
      86           0 :   })  : assert(child != null),
      87          25 :         super(key: key, child: child);
      88             : 
      89          24 :   static PalThemeData of(BuildContext context) =>
      90          48 :       context.dependOnInheritedWidgetOfExactType<PalTheme>().theme;
      91             : 
      92           0 :   @override
      93             :   bool updateShouldNotify(PalTheme old) {
      94             :     return false;
      95             :   }
      96             : }
      97             : 
      98             : class PalThemeData {
      99             :   _PalThemeColors colors;
     100             : 
     101          25 :   PalThemeData._(_PalThemeColors colors) {
     102          25 :     this.colors = colors;
     103             :   }
     104             : 
     105          75 :   factory PalThemeData.light() => PalThemeData._(_PalThemeColors.light());
     106             : 
     107          22 :   ThemeData buildTheme() {
     108          22 :     final ThemeData base = ThemeData.light();
     109             : 
     110             :     const Color dark = Color(0xFF000767);
     111             :     const Color blue = Color(0xFF3681bd); // ignore: unused_local_variable
     112             :     const Color lightBlue = Color(0xFF53bbdc);// ignore: unused_local_variable
     113             :     const Color cyan = Color(0xFFa1e3f1);// ignore: unused_local_variable
     114             :     const Color aqua = Color(0xFF90E0EF);
     115             :     const Color red = Color(0xFFe7636a);// ignore: unused_local_variable
     116             :     const Color black = Color(0xFF292931);// ignore: unused_local_variable
     117             : 
     118          22 :     return base.copyWith(
     119             :       accentColor: dark,
     120             :       accentColorBrightness: Brightness.dark,
     121             :       primaryColor: aqua,
     122             :       primaryColorDark: dark,
     123             :       primaryColorLight: aqua,
     124             :       primaryColorBrightness: Brightness.dark,
     125          44 :       buttonTheme: base.buttonTheme.copyWith(
     126             :         buttonColor: aqua,
     127             :         textTheme: ButtonTextTheme.primary,
     128             :       ),
     129          22 :       inputDecorationTheme: InputDecorationTheme(
     130          66 :         labelStyle: TextStyle(color: colors.color1),
     131          66 :         helperStyle: TextStyle(color: colors.color1),
     132          88 :         hintStyle: TextStyle(color: colors.dark.withAlpha(60)),
     133          22 :         enabledBorder: OutlineInputBorder(
     134          22 :           borderSide: BorderSide(
     135          44 :             color: colors.color1,
     136             :           ),
     137             :         ),
     138             :       ),
     139          22 :       floatingActionButtonTheme: FloatingActionButtonThemeData(
     140             :           backgroundColor: aqua, foregroundColor: dark),
     141             :       scaffoldBackgroundColor: Colors.white,
     142             :       cardColor: Colors.white,
     143             :       textSelectionColor: Colors.white,
     144             :       backgroundColor: Colors.white,
     145          44 :       textTheme: GoogleFonts.montserratTextTheme().apply(
     146             :         bodyColor: dark,
     147             :         displayColor: dark,
     148             :       ),
     149             :     );
     150             :   }
     151             : 
     152           0 :   Gradient get bottomNavEditorGradient => colors.bottomNavEditorGradient;
     153             : 
     154           3 :   Gradient get settingsSilverGradient => colors.settingsSilverGradient;
     155             : 
     156           0 :   Color get highlightColor => colors.color4;
     157             : 
     158          15 :   Color get toolbarBackgroundColor => colors.color5;
     159             : 
     160          18 :   Color get floatingBubbleBackgroundColor => colors.color1;
     161             : 
     162           0 :   Color get simpleHelperBackgroundColor => colors.black;
     163             : 
     164           0 :   Color get simpleHelperFontColor => Color(0xFFFAFEFF);
     165             : }

Generated by: LCOV version 1.14