3 Commits bc607da2b3 ... 71f3aec0cc

Autor SHA1 Mensaje Fecha
  gjh 71f3aec0cc 代码整理 hace 1 día
  gjh 16988ed2b7 Merge branch 'develop' into future_打开电力医院小程序 hace 1 día
  gjh 7bd32fa5ee 代码整理,给BuildContext添加样式和颜色的扩展方法,减少获取颜色和文本样式等的代码量 hace 1 día

+ 3 - 2
lib/dialog/app_start_agreement_dialog.dart

@@ -1,3 +1,4 @@
1
+import 'package:eitc_erm_dental_flutter/exts.dart';
1 2
 import 'package:eitc_erm_dental_flutter/funcs.dart';
2 3
 import 'package:eitc_erm_dental_flutter/widget/main_button.dart';
3 4
 import 'package:flutter/gestures.dart';
@@ -23,7 +24,7 @@ class AppStartAgreementDialog extends StatelessWidget {
23 24
                 Text(
24 25
                   getS().permissionDescDialogTitle,
25 26
                   textAlign: TextAlign.center,
26
-                  style: Theme.of(context).textTheme.titleMedium,
27
+                  style: context.titleMedium,
27 28
                 ),
28 29
                 SizedBox(
29 30
                   height: 20.h,
@@ -78,7 +79,7 @@ class AppStartAgreementDialog extends StatelessWidget {
78 79
       BuildContext context, String text, GestureTapCallback onTap) {
79 80
     return TextSpan(
80 81
         text: text,
81
-        style: TextStyle(color: Theme.of(context).colorScheme.primary),
82
+        style: TextStyle(color: context.primaryColor),
82 83
         recognizer: TapGestureRecognizer()..onTap = onTap);
83 84
   }
84 85
 }

+ 4 - 3
lib/dialog/app_update_dialog.dart

@@ -2,6 +2,7 @@ import 'dart:io';
2 2
 
3 3
 import 'package:app_installer/app_installer.dart';
4 4
 import 'package:dio/dio.dart';
5
+import 'package:eitc_erm_dental_flutter/exts.dart';
5 6
 import 'package:eitc_erm_dental_flutter/funcs.dart';
6 7
 import 'package:eitc_erm_dental_flutter/widget/custom_divider.dart';
7 8
 import 'package:eitc_erm_dental_flutter/widget/main_button.dart';
@@ -63,7 +64,7 @@ class _AppUpdateDialogState extends State<AppUpdateDialog> {
63 64
       children: [
64 65
         Text(
65 66
           getS().hasNewVersion,
66
-          style: Theme.of(context).textTheme.titleMedium,
67
+          style: context.titleMedium,
67 68
         ),
68 69
         Text("V${widget.version}"),
69 70
         SizedBox(
@@ -114,7 +115,7 @@ class _AppUpdateDialogState extends State<AppUpdateDialog> {
114 115
       children: [
115 116
         Text(
116 117
           title,
117
-          style: Theme.of(context).textTheme.titleMedium,
118
+          style: context.titleMedium,
118 119
         ),
119 120
         SizedBox(
120 121
           height: 10.h,
@@ -122,7 +123,7 @@ class _AppUpdateDialogState extends State<AppUpdateDialog> {
122 123
         pi.LinearPercentIndicator(
123 124
           percent: _downloadProgress,
124 125
           lineHeight: 15.h,
125
-          progressColor: Theme.of(context).colorScheme.primary,
126
+          progressColor: context.primaryColor,
126 127
           barRadius: Radius.circular(15.h),
127 128
           center: Text(
128 129
             "${(_downloadProgress * 100.0).round()}%",

+ 32 - 0
lib/exts.dart

@@ -1,3 +1,5 @@
1
+import 'package:flutter/material.dart';
2
+
1 3
 extension MapExt<K, V> on Map<K, V> {
2 4
   T? getCheck<T>(K? key) {
3 5
     if (key == null || !containsKey(key)) {
@@ -27,3 +29,33 @@ extension DateTimeExt on DateTime {
27 29
   String get yyyyMMddHHmmss =>
28 30
       "$year-${month < 10 ? "$month".padLeft(2, "0") : month}-$day ${hour < 10 ? "$hour".padLeft(2, "0") : hour}:${minute < 10 ? "$minute".padLeft(2, "0") : minute}:${second < 10 ? "$second".padLeft(2, "0") : second}";
29 31
 }
32
+
33
+extension ContextExt on BuildContext {
34
+  ThemeData get theme => Theme.of(this);
35
+
36
+  TextTheme get textTheme => theme.textTheme;
37
+
38
+  TextStyle? get titleLarge => textTheme.titleLarge;
39
+
40
+  TextStyle? get titleMedium => textTheme.titleMedium;
41
+
42
+  TextStyle? get titleSmall => textTheme.titleSmall;
43
+
44
+  TextStyle? get bodyLarge => textTheme.bodyLarge;
45
+
46
+  TextStyle? get bodyMedium => textTheme.bodyMedium;
47
+
48
+  TextStyle? get bodySmall => textTheme.bodySmall;
49
+
50
+  ColorScheme get colorScheme => theme.colorScheme;
51
+
52
+  Color get primaryColor => colorScheme.primary;
53
+
54
+  Color get onPrimaryColor => colorScheme.onPrimary;
55
+
56
+  Color get surfaceContainerHighColor => colorScheme.surfaceContainerHigh;
57
+
58
+  Color get onSurfaceVariantColor => colorScheme.onSurfaceVariant;
59
+
60
+  Color get onSurfaceColor => colorScheme.onSurface;
61
+}

+ 7 - 9
lib/pages/history/history_page.dart

@@ -3,6 +3,7 @@ import 'dart:io';
3 3
 import 'package:auto_route/auto_route.dart';
4 4
 import 'package:eitc_erm_dental_flutter/app_router.gr.dart';
5 5
 import 'package:eitc_erm_dental_flutter/entity/history_item_info.dart';
6
+import 'package:eitc_erm_dental_flutter/exts.dart';
6 7
 import 'package:eitc_erm_dental_flutter/funcs.dart';
7 8
 import 'package:eitc_erm_dental_flutter/pages/history/vm/history_view_model.dart';
8 9
 import 'package:eitc_erm_dental_flutter/pages/history/widget/history_item_view.dart';
@@ -89,24 +90,21 @@ class _HistoryPageState extends ConsumerState<HistoryPage> {
89 90
     return Container(
90 91
       padding: EdgeInsets.symmetric(horizontal: 20.w, vertical: 15.h),
91 92
       decoration: BoxDecoration(
92
-          color: Theme.of(context).colorScheme.surfaceContainerHigh,
93
+          color: context.surfaceContainerHighColor,
93 94
           borderRadius: BorderRadius.circular(15.r)),
94 95
       child: Column(
95 96
         crossAxisAlignment: CrossAxisAlignment.start,
96 97
         children: [
97 98
           Text(
98 99
             getS().freeConsultation,
99
-            style: Theme.of(context)
100
-                .textTheme
101
-                .titleMedium
102
-                ?.copyWith(fontWeight: FontWeight.bold),
100
+            style: context.titleMedium?.copyWith(fontWeight: FontWeight.bold),
103 101
           ),
104 102
           SizedBox(
105 103
             height: 10.h,
106 104
           ),
107 105
           Text(
108 106
             getS().electricityHospitalConsultationDesc,
109
-            style: Theme.of(context).textTheme.bodySmall,
107
+            style: context.bodySmall,
110 108
           ),
111 109
           SizedBox(
112 110
             height: 10.h,
@@ -211,7 +209,7 @@ class _HistoryPageState extends ConsumerState<HistoryPage> {
211 209
   Widget _getSelectedCount(BuildContext context) {
212 210
     return Consumer(builder: (ctx, ref, _) {
213 211
       bool isSelectedMode = ref.watch(historySelectModeProvider);
214
-      Color primaryColor = Theme.of(context).colorScheme.primary;
212
+      Color primaryColor = context.primaryColor;
215 213
       //如果不用Visibility的方式,当进入选择模式时,GridView会滚到最上面
216 214
       return Visibility(
217 215
           visible: isSelectedMode,
@@ -302,7 +300,7 @@ class _HistoryPageState extends ConsumerState<HistoryPage> {
302 300
         children: [
303 301
           Text(
304 302
             getS().photo,
305
-            style: Theme.of(context).textTheme.titleMedium,
303
+            style: context.titleMedium,
306 304
           ),
307 305
           SizedBox(
308 306
             height: 10.h,
@@ -313,7 +311,7 @@ class _HistoryPageState extends ConsumerState<HistoryPage> {
313 311
           ),
314 312
           Text(
315 313
             getS().video,
316
-            style: Theme.of(context).textTheme.titleMedium,
314
+            style: context.titleMedium,
317 315
           ),
318 316
           SizedBox(
319 317
             height: 10.h,

+ 3 - 8
lib/pages/history/widget/history_view_title.dart

@@ -1,5 +1,6 @@
1 1
 import 'dart:io';
2 2
 
3
+import 'package:eitc_erm_dental_flutter/exts.dart';
3 4
 import 'package:eitc_erm_dental_flutter/funcs.dart';
4 5
 import 'package:flutter/material.dart';
5 6
 
@@ -25,10 +26,7 @@ class HistoryViewTitle extends StatelessWidget {
25 26
             ),
26 27
             Text(
27 28
               name ?? "",
28
-              style: Theme.of(context)
29
-                  .textTheme
30
-                  .titleMedium
31
-                  ?.copyWith(color: Colors.white),
29
+              style: context.titleMedium?.copyWith(color: Colors.white),
32 30
             ),
33 31
           ],
34 32
         ),
@@ -36,10 +34,7 @@ class HistoryViewTitle extends StatelessWidget {
36 34
             visible: area != null,
37 35
             child: Text(
38 36
               toothAreaTranslate(area ?? ""),
39
-              style: Theme.of(context)
40
-                  .textTheme
41
-                  .titleLarge
42
-                  ?.copyWith(color: Colors.white),
37
+              style: context.titleLarge?.copyWith(color: Colors.white),
43 38
             ))
44 39
       ],
45 40
     );

+ 5 - 4
lib/pages/login/login_page.dart

@@ -1,5 +1,6 @@
1 1
 import 'package:auto_route/auto_route.dart';
2 2
 import 'package:eitc_erm_dental_flutter/app_router.gr.dart';
3
+import 'package:eitc_erm_dental_flutter/exts.dart';
3 4
 import 'package:eitc_erm_dental_flutter/funcs.dart';
4 5
 import 'package:eitc_erm_dental_flutter/pages/login/vm/login_view_model.dart';
5 6
 import 'package:eitc_erm_dental_flutter/pages/patient/vm/patient_view_model.dart';
@@ -63,7 +64,7 @@ class _LoginPageState extends ConsumerState<LoginPage> {
63 64
             Text(
64 65
               getS().registerHint,
65 66
               textAlign: TextAlign.center,
66
-              style: Theme.of(context).textTheme.titleMedium,
67
+              style: context.titleMedium,
67 68
             ),
68 69
             SizedBox(
69 70
               height: 80.h,
@@ -128,7 +129,7 @@ class _LoginPageState extends ConsumerState<LoginPage> {
128 129
                       return Text(
129 130
                         str,
130 131
                         style: TextStyle(
131
-                            color: Theme.of(context).colorScheme.onPrimary,
132
+                            color: context.onPrimaryColor,
132 133
                             fontWeight: FontWeight.bold),
133 134
                       );
134 135
                     },
@@ -165,7 +166,7 @@ class _LoginPageState extends ConsumerState<LoginPage> {
165 166
     return Container(
166 167
       padding: EdgeInsets.symmetric(horizontal: 10.w, vertical: 10.h),
167 168
       decoration: BoxDecoration(
168
-          color: Theme.of(context).colorScheme.surfaceContainerHigh,
169
+          color: context.surfaceContainerHighColor,
169 170
           borderRadius: BorderRadius.circular(8.r)),
170 171
       child: TextField(
171 172
         controller: controller,
@@ -214,7 +215,7 @@ class _LoginPageState extends ConsumerState<LoginPage> {
214 215
   TextSpan getClickTextSpan(String text, GestureTapCallback onTap) {
215 216
     return TextSpan(
216 217
         text: text,
217
-        style: TextStyle(color: Theme.of(context).colorScheme.primary),
218
+        style: TextStyle(color: context.primaryColor),
218 219
         recognizer: TapGestureRecognizer()..onTap = onTap);
219 220
   }
220 221
 

+ 3 - 1
lib/pages/main/main_page.dart

@@ -2,8 +2,10 @@ import 'dart:io';
2 2
 
3 3
 import 'package:auto_route/auto_route.dart';
4 4
 import 'package:eitc_erm_dental_flutter/app_router.gr.dart';
5
+import 'package:eitc_erm_dental_flutter/dialog/app_start_agreement_dialog.dart';
5 6
 import 'package:eitc_erm_dental_flutter/dialog/switch_patient_dialog.dart';
6 7
 import 'package:eitc_erm_dental_flutter/entity/db/local_patient_info.dart';
8
+import 'package:eitc_erm_dental_flutter/exts.dart';
7 9
 import 'package:eitc_erm_dental_flutter/funcs.dart';
8 10
 import 'package:eitc_erm_dental_flutter/global.dart';
9 11
 import 'package:eitc_erm_dental_flutter/pages/main/widget/connected_view.dart';
@@ -88,7 +90,7 @@ class _MainPageState extends ConsumerState<MainPage> {
88 90
   }
89 91
 
90 92
   AppBar _getAppBar() {
91
-    Color color = Theme.of(context).colorScheme.onSurfaceVariant;
93
+    Color color = context.onSurfaceVariantColor;
92 94
     ButtonStyle buttonStyle = ButtonStyle(
93 95
         padding: WidgetStatePropertyAll(EdgeInsets.symmetric(horizontal: 5.w)));
94 96
     TextStyle textStyle = TextStyle(fontSize: 12.sp, color: color);

+ 5 - 7
lib/pages/patient/add_patient_page.dart

@@ -17,12 +17,12 @@ EdgeInsets get _itemPadding =>
17 17
 Widget _getTitleText(BuildContext context, String text) {
18 18
   return Text(
19 19
     text,
20
-    style: Theme.of(context).textTheme.titleMedium,
20
+    style: context.titleMedium,
21 21
   );
22 22
 }
23 23
 
24 24
 TextStyle? _getTextStyle(BuildContext context) {
25
-  return Theme.of(context).textTheme.bodySmall;
25
+  return context.bodySmall;
26 26
 }
27 27
 
28 28
 ///添加咨询人页面
@@ -131,10 +131,8 @@ class _AddPatientPageState extends ConsumerState<AddPatientPage> {
131 131
         border: InputBorder.none,
132 132
         hintText: hint,
133 133
         counterText: "",
134
-        hintStyle: Theme.of(context)
135
-            .textTheme
136
-            .bodySmall
137
-            ?.copyWith(color: Theme.of(context).colorScheme.onSurfaceVariant),
134
+        hintStyle:
135
+            context.bodySmall?.copyWith(color: context.onSurfaceVariantColor),
138 136
       ),
139 137
     );
140 138
   }
@@ -366,7 +364,7 @@ class __RelationSelectorState extends ConsumerState<_RelationSelector> {
366 364
                     child: Text(
367 365
                       relation,
368 366
                       textAlign: TextAlign.center,
369
-                      style: Theme.of(ctx).textTheme.titleMedium,
367
+                      style: ctx.titleMedium,
370 368
                     ),
371 369
                   ),
372 370
                 );

+ 1 - 1
lib/pages/patient/patient_list_page.dart

@@ -57,7 +57,7 @@ class _PatientListPageState extends ConsumerState<PatientListPage> {
57 57
           children: [
58 58
             Text(
59 59
               getS().pleaseSelectPatient,
60
-              style: Theme.of(context).textTheme.titleMedium,
60
+              style: context.titleMedium,
61 61
             ),
62 62
             SizedBox(
63 63
               height: 6.h,

+ 4 - 3
lib/pages/patient/widget/patient_info_bar.dart

@@ -1,4 +1,5 @@
1 1
 import 'package:eitc_erm_dental_flutter/entity/db/local_patient_info.dart';
2
+import 'package:eitc_erm_dental_flutter/exts.dart';
2 3
 import 'package:eitc_erm_dental_flutter/funcs.dart';
3 4
 import 'package:eitc_erm_dental_flutter/global.dart';
4 5
 import 'package:eitc_erm_dental_flutter/pages/patient/vm/patient_view_model.dart';
@@ -60,7 +61,7 @@ class _PatientInfoBarState extends ConsumerState<PatientInfoBar> {
60 61
       padding: EdgeInsets.symmetric(horizontal: 12.w),
61 62
       height: 62.h,
62 63
       decoration: BoxDecoration(
63
-        color: Theme.of(context).colorScheme.surfaceContainerHigh,
64
+        color: context.surfaceContainerHighColor,
64 65
         borderRadius: BorderRadius.circular(8.r),
65 66
       ),
66 67
       child: _getContent(value),
@@ -149,12 +150,12 @@ class _PatientInfoBarState extends ConsumerState<PatientInfoBar> {
149 150
       child: Container(
150 151
         padding: EdgeInsets.symmetric(horizontal: 8.w, vertical: 6.h),
151 152
         decoration: BoxDecoration(
152
-          color: Theme.of(context).colorScheme.primary,
153
+          color: context.primaryColor,
153 154
           borderRadius: BorderRadius.circular(4.r),
154 155
         ),
155 156
         child: Text(
156 157
           text,
157
-          style: TextStyle(color: Theme.of(context).colorScheme.onPrimary),
158
+          style: TextStyle(color: context.onPrimaryColor),
158 159
         ),
159 160
       ),
160 161
     );

+ 6 - 6
lib/pages/patient/widget/patient_list_item.dart

@@ -1,3 +1,4 @@
1
+import 'package:eitc_erm_dental_flutter/exts.dart';
1 2
 import 'package:eitc_erm_dental_flutter/funcs.dart';
2 3
 import 'package:flutter/material.dart';
3 4
 import 'package:flutter_screenutil/flutter_screenutil.dart';
@@ -25,7 +26,7 @@ class PatientListItem extends StatelessWidget {
25 26
       child: Container(
26 27
         padding: EdgeInsets.symmetric(horizontal: 12.w, vertical: 8.h),
27 28
         decoration: BoxDecoration(
28
-            color: Theme.of(context).colorScheme.surfaceContainerHigh,
29
+            color: context.surfaceContainerHighColor,
29 30
             borderRadius: BorderRadius.circular(8.r)),
30 31
         child: Column(
31 32
           crossAxisAlignment: CrossAxisAlignment.start,
@@ -40,15 +41,14 @@ class PatientListItem extends StatelessWidget {
40 41
                   padding:
41 42
                       EdgeInsets.symmetric(horizontal: 10.w, vertical: 1.h),
42 43
                   decoration: BoxDecoration(
43
-                    border: Border.fromBorderSide(BorderSide(
44
-                        color: Theme.of(context).colorScheme.primary)),
44
+                    border: Border.fromBorderSide(
45
+                        BorderSide(color: context.primaryColor)),
45 46
                     borderRadius: BorderRadius.circular(30.r),
46 47
                   ),
47 48
                   child: Text(
48 49
                     relation,
49
-                    style: TextStyle(
50
-                        fontSize: 10.sp,
51
-                        color: Theme.of(context).colorScheme.primary),
50
+                    style:
51
+                        TextStyle(fontSize: 10.sp, color: context.primaryColor),
52 52
                   ),
53 53
                 )
54 54
               ],

+ 4 - 6
lib/pages/settings/delay_shot_settings_page.dart

@@ -1,4 +1,5 @@
1 1
 import 'package:auto_route/annotations.dart';
2
+import 'package:eitc_erm_dental_flutter/exts.dart';
2 3
 import 'package:eitc_erm_dental_flutter/funcs.dart';
3 4
 import 'package:eitc_erm_dental_flutter/sp_util.dart';
4 5
 import 'package:eitc_erm_dental_flutter/widget/custom_divider.dart';
@@ -168,9 +169,7 @@ class _RadioItem extends StatelessWidget {
168 169
   final void Function() onTap;
169 170
 
170 171
   const _RadioItem(
171
-      {required this.text,
172
-      required this.isChecked,
173
-      required this.onTap});
172
+      {required this.text, required this.isChecked, required this.onTap});
174 173
 
175 174
   @override
176 175
   Widget build(BuildContext context) {
@@ -183,8 +182,7 @@ class _RadioItem extends StatelessWidget {
183 182
           children: [
184 183
             Text(
185 184
               text,
186
-              style: TextStyle(
187
-                  color: Theme.of(context).colorScheme.onSurfaceVariant),
185
+              style: TextStyle(color: context.onSurfaceVariantColor),
188 186
             ),
189 187
             const Spacer(),
190 188
             _CheckedIcon(isChecked: isChecked),
@@ -206,7 +204,7 @@ class _CheckedIcon extends StatelessWidget {
206 204
         ? Icon(
207 205
             size: 24.r,
208 206
             Icons.check_circle,
209
-            color: Theme.of(context).colorScheme.primary,
207
+            color: context.primaryColor,
210 208
           )
211 209
         : Icon(
212 210
             size: 24.r,

+ 5 - 4
lib/pages/settings/faqs_page.dart

@@ -1,4 +1,5 @@
1 1
 import 'package:auto_route/annotations.dart';
2
+import 'package:eitc_erm_dental_flutter/exts.dart';
2 3
 import 'package:eitc_erm_dental_flutter/funcs.dart';
3 4
 import 'package:flutter/material.dart';
4 5
 import 'package:flutter_screenutil/flutter_screenutil.dart';
@@ -35,7 +36,7 @@ class FaqsPage extends StatelessWidget {
35 36
           padding: EdgeInsets.symmetric(horizontal: 0.w, vertical: 5.h),
36 37
           child: Text(
37 38
             getS().faq1Title,
38
-            style: Theme.of(context).textTheme.titleSmall,
39
+            style: context.titleSmall,
39 40
           ),
40 41
         ),
41 42
         SizedBox(
@@ -43,16 +44,16 @@ class FaqsPage extends StatelessWidget {
43 44
         ),
44 45
         Text(
45 46
           getS().faq1Desc1,
46
-          style: Theme.of(context).textTheme.bodySmall,
47
+          style: context.bodySmall,
47 48
         ),
48 49
         SizedBox(
49 50
           height: 8.h,
50 51
         ),
51
-        Text(getS().faq1Desc2, style: Theme.of(context).textTheme.bodySmall),
52
+        Text(getS().faq1Desc2, style: context.bodySmall),
52 53
         SizedBox(
53 54
           height: 8.h,
54 55
         ),
55
-        Text(getS().faq1Desc3, style: Theme.of(context).textTheme.bodySmall),
56
+        Text(getS().faq1Desc3, style: context.bodySmall),
56 57
       ],
57 58
     );
58 59
   }

+ 2 - 1
lib/pages/settings/settings_page.dart

@@ -1,5 +1,6 @@
1 1
 import 'package:auto_route/auto_route.dart';
2 2
 import 'package:eitc_erm_dental_flutter/app_router.gr.dart';
3
+import 'package:eitc_erm_dental_flutter/exts.dart';
3 4
 import 'package:eitc_erm_dental_flutter/funcs.dart';
4 5
 import 'package:eitc_erm_dental_flutter/global.dart';
5 6
 import 'package:eitc_erm_dental_flutter/pages/login/vm/login_view_model.dart';
@@ -75,7 +76,7 @@ class _SettingsPageState extends ConsumerState<SettingsPage> {
75 76
                 children: [
76 77
                   Text(
77 78
                     item.name,
78
-                    style: Theme.of(context).textTheme.bodyMedium,
79
+                    style: context.bodyMedium,
79 80
                   ),
80 81
                   const Spacer(),
81 82
                   item.subText.isNotEmpty

+ 3 - 2
lib/pages/upload/upload_page.dart

@@ -3,6 +3,7 @@ import 'dart:io';
3 3
 import 'package:auto_route/annotations.dart';
4 4
 import 'package:dio/dio.dart';
5 5
 import 'package:eitc_erm_dental_flutter/entity/clinic_info.dart';
6
+import 'package:eitc_erm_dental_flutter/exts.dart';
6 7
 import 'package:eitc_erm_dental_flutter/funcs.dart';
7 8
 import 'package:eitc_erm_dental_flutter/global.dart';
8 9
 import 'package:eitc_erm_dental_flutter/http/gzkj_response.dart';
@@ -342,7 +343,7 @@ class _UploadingView extends StatelessWidget {
342 343
         children: [
343 344
           Text(
344 345
             getS().uploadingHint,
345
-            style: Theme.of(context).textTheme.titleMedium,
346
+            style: context.titleMedium,
346 347
           ),
347 348
           SizedBox(
348 349
             height: 40.h,
@@ -353,7 +354,7 @@ class _UploadingView extends StatelessWidget {
353 354
               pi.LinearPercentIndicator(
354 355
                   percent: progress,
355 356
                   lineHeight: 15.h,
356
-                  progressColor: Theme.of(context).colorScheme.primary,
357
+                  progressColor: context.primaryColor,
357 358
                   barRadius: Radius.circular(15.h),
358 359
                   padding: EdgeInsets.zero,
359 360
                   center: Text(

+ 3 - 3
lib/pages/upload/upload_select_clinic_page.dart

@@ -58,7 +58,7 @@ class _UploadSelectClinicPageState extends State<UploadSelectClinicPage> {
58 58
             children: [
59 59
               Text(
60 60
                 getS().pleaseSelectUploadClinic,
61
-                style: Theme.of(context).textTheme.titleLarge,
61
+                style: context.titleLarge,
62 62
               ),
63 63
               SizedBox(
64 64
                 height: 24.h,
@@ -138,7 +138,7 @@ class _UploadSelectClinicPageState extends State<UploadSelectClinicPage> {
138 138
       child: Container(
139 139
         padding: EdgeInsets.symmetric(horizontal: 12.w, vertical: 14.h),
140 140
         decoration: BoxDecoration(
141
-            color: Theme.of(context).colorScheme.surfaceContainerHigh,
141
+            color: context.surfaceContainerHighColor,
142 142
             borderRadius: BorderRadius.circular(8.r)),
143 143
         child: Row(
144 144
           children: [
@@ -154,7 +154,7 @@ class _UploadSelectClinicPageState extends State<UploadSelectClinicPage> {
154 154
   Widget _getList(BuildContext context, List<ClinicInfo> list) {
155 155
     return Container(
156 156
       decoration: BoxDecoration(
157
-          color: Theme.of(context).colorScheme.surfaceContainerHigh,
157
+          color: context.surfaceContainerHighColor,
158 158
           borderRadius: BorderRadius.circular(8.r)),
159 159
       child: ListView.separated(
160 160
           shrinkWrap: true,

+ 2 - 4
lib/pages/view/widget/preview_title.dart

@@ -1,5 +1,6 @@
1 1
 import 'dart:io';
2 2
 
3
+import 'package:eitc_erm_dental_flutter/exts.dart';
3 4
 import 'package:flutter/material.dart';
4 5
 
5 6
 ///预览标题
@@ -23,10 +24,7 @@ class PreviewTitle extends StatelessWidget {
23 24
             ),
24 25
             Text(
25 26
               title ?? "",
26
-              style: Theme.of(context)
27
-                  .textTheme
28
-                  .titleMedium
29
-                  ?.copyWith(color: Colors.white),
27
+              style: context.titleMedium?.copyWith(color: Colors.white),
30 28
             ),
31 29
           ],
32 30
         ),

+ 2 - 2
lib/pages/view/widget/video_operation_view.dart

@@ -1,5 +1,6 @@
1 1
 import 'dart:async';
2 2
 
3
+import 'package:eitc_erm_dental_flutter/exts.dart';
3 4
 import 'package:eitc_erm_dental_flutter/funcs.dart';
4 5
 import 'package:eitc_erm_dental_flutter/sp_util.dart';
5 6
 import 'package:eitc_erm_dental_flutter/widget/count_down_text.dart';
@@ -96,8 +97,7 @@ class _VideoOperationViewState extends State<VideoOperationView> {
96 97
 
97 98
   ///获取倒计时,保持等
98 99
   Widget _getCountHold() {
99
-    TextStyle? style =
100
-        Theme.of(context).textTheme.titleMedium?.copyWith(color: Colors.white);
100
+    TextStyle? style = context.titleMedium?.copyWith(color: Colors.white);
101 101
     return Align(
102 102
       alignment: Alignment.topCenter,
103 103
       child: Padding(

+ 1 - 2
lib/pages/view/widget/video_patient_info_bar.dart

@@ -102,8 +102,7 @@ class _VideoPatientInfoBarState extends State<VideoPatientInfoBar> {
102 102
   Widget _getText(String str) {
103 103
     return Text(
104 104
       str,
105
-      style:
106
-          Theme.of(context).textTheme.bodyMedium?.copyWith(color: Colors.white),
105
+      style: context.bodyMedium?.copyWith(color: Colors.white),
107 106
     );
108 107
   }
109 108
 

+ 2 - 1
lib/widget/counting_button.dart

@@ -1,5 +1,6 @@
1 1
 import 'dart:async';
2 2
 
3
+import 'package:eitc_erm_dental_flutter/exts.dart';
3 4
 import 'package:flutter/material.dart';
4 5
 
5 6
 ///计时按钮
@@ -43,7 +44,7 @@ class _CountingButtonState extends State<CountingButton> {
43 44
         style: widget.buttonStyle ??
44 45
             ButtonStyle(
45 46
                 backgroundColor:
46
-                    WidgetStatePropertyAll(Theme.of(context).primaryColor),
47
+                    WidgetStatePropertyAll(context.primaryColor),
47 48
                 elevation: const WidgetStatePropertyAll(0.0)),
48 49
         child: widget.onGetChild(
49 50
             widget.controller.counter.value, widget.controller.isCounting));

+ 4 - 5
lib/widget/main_button.dart

@@ -1,3 +1,4 @@
1
+import 'package:eitc_erm_dental_flutter/exts.dart';
1 2
 import 'package:flutter/material.dart';
2 3
 
3 4
 ///主要按钮
@@ -44,7 +45,7 @@ class MainButton extends StatelessWidget {
44 45
                 shape: shape == null ? null : WidgetStatePropertyAll(shape)),
45 46
             child: Text(
46 47
               text,
47
-              style: TextStyle(color: Theme.of(context).colorScheme.onSurface),
48
+              style: TextStyle(color: context.onSurfaceColor),
48 49
             ))
49 50
         : ElevatedButton(
50 51
             onPressed: onPressed,
@@ -54,8 +55,7 @@ class MainButton extends StatelessWidget {
54 55
                 padding: buttonPadding == null
55 56
                     ? null
56 57
                     : WidgetStatePropertyAll(buttonPadding),
57
-                backgroundColor:
58
-                    WidgetStatePropertyAll(Theme.of(context).primaryColor),
58
+                backgroundColor: WidgetStatePropertyAll(context.primaryColor),
59 59
                 minimumSize: minimumSize == null
60 60
                     ? null
61 61
                     : WidgetStatePropertyAll(minimumSize),
@@ -68,8 +68,7 @@ class MainButton extends StatelessWidget {
68 68
               text,
69 69
               textAlign: TextAlign.center,
70 70
               style: TextStyle(
71
-                  color: Theme.of(context).colorScheme.onPrimary,
72
-                  fontWeight: FontWeight.bold),
71
+                  color: context.onPrimaryColor, fontWeight: FontWeight.bold),
73 72
             ));
74 73
   }
75 74
 }