4
4
import 'package:flex_color_scheme/flex_color_scheme.dart' ;
5
5
import 'package:flutter/material.dart' ;
6
6
import 'package:google_fonts/google_fonts.dart' ;
7
- import 'package:ht_preferences_client/ht_preferences_client .dart' ; // Added for FontSize
7
+ import 'package:ht_shared/ht_shared .dart' ;
8
8
9
9
// --- Common Sub-theme Settings ---
10
10
// Defines customizations for various components, shared between light/dark themes.
@@ -33,17 +33,19 @@ const FlexSubThemesData _commonSubThemesData = FlexSubThemesData(
33
33
// Helper function to apply common text theme customizations
34
34
TextTheme _customizeTextTheme (
35
35
TextTheme baseTextTheme, {
36
- required FontSize appFontSize , // Added parameter
36
+ required AppTextScaleFactor appTextScaleFactor , // Added parameter
37
37
}) {
38
38
// Define font size factors
39
39
double factor;
40
- switch (appFontSize ) {
41
- case FontSize .small:
40
+ switch (appTextScaleFactor ) {
41
+ case AppTextScaleFactor .small:
42
42
factor = 0.85 ;
43
- case FontSize .large:
43
+ case AppTextScaleFactor .large:
44
44
factor = 1.15 ;
45
- case FontSize .medium:
45
+ case AppTextScaleFactor .medium:
46
46
factor = 1.0 ;
47
+ case AppTextScaleFactor .extraLarge:
48
+ factor = 1.3 ; // Define factor for extraLarge
47
49
}
48
50
49
51
// Helper to apply factor safely
@@ -118,10 +120,10 @@ TextTheme Function([TextTheme?]) _getGoogleFontTextTheme(String? fontFamily) {
118
120
119
121
/// Defines the application's light theme using FlexColorScheme.
120
122
///
121
- /// Takes the active [scheme] , [appFontSize ] , and optional [fontFamily] .
123
+ /// Takes the active [scheme] , [appTextScaleFactor ] , and optional [fontFamily] .
122
124
ThemeData lightTheme ({
123
125
required FlexScheme scheme,
124
- required FontSize appFontSize , // Added parameter
126
+ required AppTextScaleFactor appTextScaleFactor , // Added parameter
125
127
String ? fontFamily,
126
128
}) {
127
129
final textThemeGetter = _getGoogleFontTextTheme (fontFamily);
@@ -130,18 +132,21 @@ ThemeData lightTheme({
130
132
return FlexThemeData .light (
131
133
scheme: scheme,
132
134
fontFamily: fontFamily,
133
- // Pass appFontSize to customizeTextTheme
134
- textTheme: _customizeTextTheme (baseTextTheme, appFontSize: appFontSize),
135
+ // Pass appTextScaleFactor to customizeTextTheme
136
+ textTheme: _customizeTextTheme (
137
+ baseTextTheme,
138
+ appTextScaleFactor: appTextScaleFactor,
139
+ ),
135
140
subThemesData: _commonSubThemesData,
136
141
);
137
142
}
138
143
139
144
/// Defines the application's dark theme using FlexColorScheme.
140
145
///
141
- /// Takes the active [scheme] , [appFontSize ] , and optional [fontFamily] .
146
+ /// Takes the active [scheme] , [appTextScaleFactor ] , and optional [fontFamily] .
142
147
ThemeData darkTheme ({
143
148
required FlexScheme scheme,
144
- required FontSize appFontSize , // Added parameter
149
+ required AppTextScaleFactor appTextScaleFactor , // Added parameter
145
150
String ? fontFamily,
146
151
}) {
147
152
final textThemeGetter = _getGoogleFontTextTheme (fontFamily);
@@ -152,8 +157,11 @@ ThemeData darkTheme({
152
157
return FlexThemeData .dark (
153
158
scheme: scheme,
154
159
fontFamily: fontFamily,
155
- // Pass appFontSize to customizeTextTheme
156
- textTheme: _customizeTextTheme (baseTextTheme, appFontSize: appFontSize),
160
+ // Pass appTextScaleFactor to customizeTextTheme
161
+ textTheme: _customizeTextTheme (
162
+ baseTextTheme,
163
+ appTextScaleFactor: appTextScaleFactor,
164
+ ),
157
165
subThemesData: _commonSubThemesData,
158
166
);
159
167
}
0 commit comments