• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

icapps / flutter-template / 12908916411

22 Jan 2025 01:09PM UTC coverage: 59.889% (-3.5%) from 63.402%
12908916411

push

github

web-flow
Merge pull request #351 from icapps/feature/#336-base-screen

Feature/#336 base screen

412 of 612 new or added lines in 62 files covered. (67.32%)

12 existing lines in 7 files now uncovered.

1184 of 1977 relevant lines covered (59.89%)

2.17 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

67.31
/lib/styles/theme_data.dart
1
import 'package:flutter/material.dart';
2
import 'package:flutter_template/di/injectable.dart';
3
import 'package:flutter_template/styles/theme_colors.dart';
4
import 'package:flutter_template/styles/theme_fonts.dart';
5
import 'package:flutter_template/util/theme/theme_config.dart';
6
import 'package:icapps_architecture/icapps_architecture.dart';
7

8
class FlutterTemplateThemeData {
9
  FlutterTemplateThemeData._();
10

11
  static final _darkThemeData = ThemeData(
36✔
12
    fontFamily: ThemeFonts.body,
13
    primaryColor: ThemeColors.primary,
14
    colorScheme: const ColorScheme(
15
      primary: ThemeColors.primary,
16
      primaryContainer: ThemeColors.primaryDark,
17
      onPrimary: ThemeColors.white,
18
      secondary: ThemeColors.accent,
19
      secondaryContainer: ThemeColors.accent,
20
      onSecondary: ThemeColors.white,
21
      surface: ThemeColors.backgroundGrey,
22
      onSurface: ThemeColors.primary,
23
      onError: ThemeColors.primaryDark,
24
      brightness: Brightness.light,
25
      error: ThemeColors.error,
26
    ),
27
    textSelectionTheme: TextSelectionThemeData(
12✔
28
      cursorColor: ThemeColors.accent,
29
      selectionHandleColor: ThemeColors.accent,
30
      selectionColor: ThemeColors.accent.withOpacity(0.4),
12✔
31
    ),
32
    pageTransitionsTheme: PageTransitionsTheme(
12✔
33
      builders: {
12✔
34
        TargetPlatform.iOS: const CupertinoPageTransitionsBuilder(),
35
        TargetPlatform.android: isInTest ? const FadeUpwardsPageTransitionsBuilder() : BaseThemeData.getCorrectPageTransitionBuilder(OsInfo.instance),
12✔
36
      },
37
    ),
38
  );
39

40
  static final _lightThemeData = _darkThemeData.copyWith();
48✔
41

42
  static ThemeData darkTheme(TargetPlatform? targetPlatform) {
10✔
43
    return _darkThemeData.copyWith(platform: targetPlatform);
20✔
44
  }
45

46
  static ThemeData lightTheme(TargetPlatform? targetPlatform) {
12✔
47
    return _lightThemeData.copyWith(platform: targetPlatform);
24✔
48
  }
49
}
50

51
class FlutterTemplateTextTheme {
52
  final TextStyle titleHuge;
53
  final TextStyle titleBig;
54
  final TextStyle titleNormal;
55
  final TextStyle titleSmall;
56

57
  final TextStyle titleListItem;
58

59
  final TextStyle labelButtonBig;
60
  final TextStyle labelButtonSmall;
61

62
  final TextStyle bodyNormal;
63
  final TextStyle bodySmall;
64
  final TextStyle bodyUltraSmall;
65
  final TextStyle infoBodySubHeader;
66
  final TextStyle bodyBig;
67

UNCOV
68
  const FlutterTemplateTextTheme({
×
69
    required this.titleHuge,
70
    required this.titleBig,
71
    required this.titleNormal,
72
    required this.titleSmall,
73
    required this.titleListItem,
74
    required this.labelButtonBig,
75
    required this.labelButtonSmall,
76
    required this.bodyNormal,
77
    required this.bodySmall,
78
    required this.bodyUltraSmall,
79
    required this.infoBodySubHeader,
80
    required this.bodyBig,
81
  });
82
}
83

84
enum FlutterTemplateThemeStyle {
85
  dark,
86
  light,
87
}
88

89
class FlutterTemplateTheme {
90
  final bool isDarkTheme;
91
  final Color text;
92
  final Color lightText;
93
  final Color fadedText;
94
  final Color inverseText;
95
  final Color errorText;
96
  final Color buttonTextDisabled;
97
  final Color primary;
98
  final Color secondary;
99
  final Color accent;
100
  final Color background;
101
  final Color permissionScreenBackground;
102
  final Color inverseBackground;
103
  final Color disabled;
104
  final Color icon;
105
  final Color appBarAction;
106
  final Color inverseIcon;
107
  final Color inverseProgressIndicator;
108
  final Color shadow;
109
  final Color progressIndicator;
110
  final Color buttonColor;
111
  final Color buttonText;
112
  final Color inverseButtonText;
113
  final Color textButtonText;
114
  final Color fillInformative;
115
  final Color cardBackground;
116
  final Color switchBackground;
117

118
  final Color bottomNavbarBackground;
119
  final Color bottomNavbarItemActive;
120
  final Color bottomNavbarItemInactive;
121

122
  final Color inputFieldFill;
123
  final Color inputFieldHint;
124
  final Color inputFieldBorderEnabled;
125
  final Color inputFieldBorderFocused;
126
  final Color inputFieldBorderIdle;
127
  final Color inputFieldCursor;
128

129
  final Color debugTitleBackground;
130

131
  bool get isLightTheme => !isDarkTheme;
2✔
132

133
  static final _instanceDark = FlutterTemplateTheme._(
18✔
134
    isDarkTheme: true,
135
    text: ThemeColors.white,
136
    fadedText: ThemeColors.lightGrey,
137
    inverseText: ThemeColors.black,
138
    errorText: ThemeColors.error,
139
    primary: ThemeColors.primary,
140
    accent: ThemeColors.accent,
141
    secondary: ThemeColors.white,
142
    background: ThemeColors.primary,
143
    permissionScreenBackground: ThemeColors.primary,
144
    inverseBackground: ThemeColors.white,
145
    disabled: ThemeColors.disabledGrey,
146
    icon: ThemeColors.white,
147
    appBarAction: ThemeColors.white,
148
    inverseIcon: ThemeColors.black,
149
    progressIndicator: ThemeColors.primary,
150
    inverseProgressIndicator: ThemeColors.white,
151
    shadow: ThemeColors.shadow,
152
    buttonText: ThemeColors.primary,
153
    inverseButtonText: ThemeColors.white,
154
    buttonTextDisabled: ThemeColors.lightGrey,
155
    buttonColor: ThemeColors.accent,
156
    textButtonText: ThemeColors.white,
157
    bottomNavbarBackground: ThemeColors.darkBackground,
158
    bottomNavbarItemActive: ThemeColors.white,
159
    bottomNavbarItemInactive: ThemeColors.white50,
160
    inputFieldFill: ThemeColors.black,
161
    inputFieldHint: ThemeColors.white50,
162
    inputFieldBorderEnabled: ThemeColors.white50,
163
    inputFieldBorderFocused: ThemeColors.white,
164
    inputFieldBorderIdle: ThemeColors.white50,
165
    inputFieldCursor: ThemeColors.accent,
166
    debugTitleBackground: ThemeColors.white20,
167
    fillInformative: ThemeColors.darkAccent,
168
    cardBackground: ThemeColors.darkBackground,
169
    lightText: ThemeColors.white,
170
    switchBackground: ThemeColors.fadedGrey,
171
  );
172

173
  static final _instanceLight = FlutterTemplateTheme._(
75✔
174
    isDarkTheme: false,
175
    text: ThemeColors.primary,
176
    fadedText: ThemeColors.fadedGrey,
177
    inverseText: ThemeColors.white,
178
    errorText: ThemeColors.error,
179
    primary: ThemeColors.primary,
180
    accent: ThemeColors.accent,
181
    secondary: ThemeColors.black,
182
    background: ThemeColors.backgroundGrey,
183
    permissionScreenBackground: ThemeColors.white,
184
    inverseBackground: ThemeColors.white,
185
    inputFieldFill: ThemeColors.white,
186
    inputFieldHint: ThemeColors.mediumGrey,
187
    disabled: ThemeColors.disabledGrey,
188
    icon: ThemeColors.primary,
189
    appBarAction: ThemeColors.primary,
190
    inverseIcon: ThemeColors.black,
191
    progressIndicator: ThemeColors.primary,
192
    inverseProgressIndicator: ThemeColors.white,
193
    shadow: ThemeColors.shadow,
194
    buttonText: ThemeColors.white,
195
    inverseButtonText: ThemeColors.primary,
196
    buttonTextDisabled: ThemeColors.lightGrey,
197
    buttonColor: ThemeColors.primary,
198
    textButtonText: ThemeColors.primary,
199
    bottomNavbarBackground: ThemeColors.white,
200
    bottomNavbarItemActive: ThemeColors.primary,
201
    bottomNavbarItemInactive: ThemeColors.mediumGrey,
202
    inputFieldBorderEnabled: ThemeColors.mediumGrey,
203
    inputFieldBorderFocused: ThemeColors.primary,
204
    inputFieldBorderIdle: ThemeColors.mediumGrey,
205
    inputFieldCursor: ThemeColors.accent,
206
    debugTitleBackground: ThemeColors.lightGrey,
207
    fillInformative: ThemeColors.lightAccent,
208
    cardBackground: ThemeColors.white,
209
    lightText: ThemeColors.white,
210
    switchBackground: ThemeColors.disabledGrey,
211
  );
212

213
  FlutterTemplateTheme._({
25✔
214
    required this.isDarkTheme,
215
    required this.text,
216
    required this.fadedText,
217
    required this.inverseText,
218
    required this.errorText,
219
    required this.buttonTextDisabled,
220
    required this.primary,
221
    required this.secondary,
222
    required this.accent,
223
    required this.background,
224
    required this.permissionScreenBackground,
225
    required this.inverseBackground,
226
    required this.disabled,
227
    required this.icon,
228
    required this.appBarAction,
229
    required this.inverseIcon,
230
    required this.inverseProgressIndicator,
231
    required this.shadow,
232
    required this.progressIndicator,
233
    required this.buttonColor,
234
    required this.buttonText,
235
    required this.inverseButtonText,
236
    required this.textButtonText,
237
    required this.bottomNavbarBackground,
238
    required this.bottomNavbarItemActive,
239
    required this.bottomNavbarItemInactive,
240
    required this.inputFieldFill,
241
    required this.inputFieldHint,
242
    required this.inputFieldBorderEnabled,
243
    required this.inputFieldBorderFocused,
244
    required this.inputFieldBorderIdle,
245
    required this.inputFieldCursor,
246
    required this.debugTitleBackground,
247
    required this.fillInformative,
248
    required this.cardBackground,
249
    required this.lightText,
250
    required this.switchBackground,
251
  });
252

253
  static FlutterTemplateTheme of(BuildContext context, {bool forceDark = false, bool forceLight = false}) {
25✔
254
    if (forceDark) return _instanceDark;
×
255
    if (forceLight) return _instanceLight;
×
256
    final themeConfigUtil = getIt<ThemeConfigUtil>();
50✔
257

258
    final theme = themeConfigUtil.themeMode;
25✔
259
    if (theme == ThemeMode.dark) {
25✔
260
      return _instanceDark;
6✔
261
    } else if (theme == ThemeMode.light) {
25✔
262
      return _instanceLight;
25✔
263
    }
264
    final brightness = MediaQuery.of(context).platformBrightness;
×
265

266
    if (brightness == Brightness.dark) return _instanceDark;
×
267

268
    return _instanceLight;
×
269
  }
270
}
271

272
extension TextThemeExtension on Color {
NEW
273
  TextStyle get titleHuge => TextStyle(fontSize: 40, color: this, fontFamily: ThemeFonts.title, height: 1.2);
×
274

NEW
275
  TextStyle get titleBig => TextStyle(fontSize: 30, color: this, fontFamily: ThemeFonts.title, height: 1.2);
×
276

277
  TextStyle get titleNormal => TextStyle(fontSize: 24, color: this, fontFamily: ThemeFonts.title);
6✔
278

NEW
279
  TextStyle get titleSmall => TextStyle(fontSize: 18, color: this, fontFamily: ThemeFonts.title);
×
280

NEW
281
  TextStyle get titleListItem => TextStyle(fontSize: 18, color: this, fontFamily: ThemeFonts.title, fontWeight: FontWeight.bold);
×
282

NEW
283
  TextStyle get labelButtonBig => TextStyle(fontSize: 16, color: this, fontFamily: ThemeFonts.button, fontWeight: FontWeight.bold);
×
284

285
  TextStyle get labelButtonSmall => TextStyle(fontSize: 14, color: this, fontFamily: ThemeFonts.button, fontWeight: FontWeight.bold);
10✔
286

287
  TextStyle get bodyBig => TextStyle(fontSize: 18, color: this, fontFamily: ThemeFonts.body);
8✔
288

289
  TextStyle get bodyNormal => TextStyle(fontSize: 16, color: this, fontFamily: ThemeFonts.body);
24✔
290

291
  TextStyle get bodySmall => TextStyle(fontSize: 14, color: this, fontFamily: ThemeFonts.body);
12✔
292

NEW
293
  TextStyle get bodyUltraSmall => TextStyle(fontSize: 12, color: this, fontFamily: ThemeFonts.body);
×
294

NEW
295
  TextStyle get infoBodySubHeader => TextStyle(fontSize: 14, color: this, fontFamily: ThemeFonts.body, fontWeight: FontWeight.w600);
×
296
}
297

298
extension TextStyleExtension on TextStyle {
NEW
299
  TextStyle get medium => copyWith(fontWeight: FontWeight.w400);
×
300

301
  TextStyle get strong => copyWith(fontWeight: FontWeight.w600);
2✔
302

NEW
303
  TextStyle get black => copyWith(fontWeight: FontWeight.w900);
×
304

NEW
305
  TextStyle get underLine => copyWith(decoration: TextDecoration.underline);
×
306

NEW
307
  TextStyle get italic => copyWith(fontStyle: FontStyle.italic);
×
308
}
309

310
extension ShadowsExtension on Color {
311
  List<BoxShadow> get bottomNavShadow => [
2✔
312
        BoxShadow(
1✔
313
          offset: const Offset(0, -29),
314
          spreadRadius: 0,
315
          blurRadius: 29,
316
          color: withOpacity(0.02),
1✔
317
        ),
318
        BoxShadow(
1✔
319
          offset: const Offset(0, -65),
320
          spreadRadius: 0,
321
          blurRadius: 39,
322
          color: withOpacity(0.01),
1✔
323
        ),
324
        BoxShadow(
1✔
325
          offset: const Offset(0, -115),
326
          spreadRadius: 0,
327
          blurRadius: 46,
328
          color: withOpacity(0.01),
1✔
329
        ),
330
      ];
331
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc