Browse Source

代码整理

gjh 1 day ago
parent
commit
71f3aec0cc
2 changed files with 4 additions and 8 deletions
  1. 3 6
      lib/pages/history/history_page.dart
  2. 1 2
      lib/widget/main_button.dart

+ 3 - 6
lib/pages/history/history_page.dart

@@ -90,24 +90,21 @@ class _HistoryPageState extends ConsumerState<HistoryPage> {
90
     return Container(
90
     return Container(
91
       padding: EdgeInsets.symmetric(horizontal: 20.w, vertical: 15.h),
91
       padding: EdgeInsets.symmetric(horizontal: 20.w, vertical: 15.h),
92
       decoration: BoxDecoration(
92
       decoration: BoxDecoration(
93
-          color: Theme.of(context).colorScheme.surfaceContainerHigh,
93
+          color: context.surfaceContainerHighColor,
94
           borderRadius: BorderRadius.circular(15.r)),
94
           borderRadius: BorderRadius.circular(15.r)),
95
       child: Column(
95
       child: Column(
96
         crossAxisAlignment: CrossAxisAlignment.start,
96
         crossAxisAlignment: CrossAxisAlignment.start,
97
         children: [
97
         children: [
98
           Text(
98
           Text(
99
             getS().freeConsultation,
99
             getS().freeConsultation,
100
-            style: Theme.of(context)
101
-                .textTheme
102
-                .titleMedium
103
-                ?.copyWith(fontWeight: FontWeight.bold),
100
+            style: context.titleMedium?.copyWith(fontWeight: FontWeight.bold),
104
           ),
101
           ),
105
           SizedBox(
102
           SizedBox(
106
             height: 10.h,
103
             height: 10.h,
107
           ),
104
           ),
108
           Text(
105
           Text(
109
             getS().electricityHospitalConsultationDesc,
106
             getS().electricityHospitalConsultationDesc,
110
-            style: Theme.of(context).textTheme.bodySmall,
107
+            style: context.bodySmall,
111
           ),
108
           ),
112
           SizedBox(
109
           SizedBox(
113
             height: 10.h,
110
             height: 10.h,

+ 1 - 2
lib/widget/main_button.dart

@@ -55,8 +55,7 @@ class MainButton extends StatelessWidget {
55
                 padding: buttonPadding == null
55
                 padding: buttonPadding == null
56
                     ? null
56
                     ? null
57
                     : WidgetStatePropertyAll(buttonPadding),
57
                     : WidgetStatePropertyAll(buttonPadding),
58
-                backgroundColor:
59
-                    WidgetStatePropertyAll(Theme.of(context).primaryColor),
58
+                backgroundColor: WidgetStatePropertyAll(context.primaryColor),
60
                 minimumSize: minimumSize == null
59
                 minimumSize: minimumSize == null
61
                     ? null
60
                     ? null
62
                     : WidgetStatePropertyAll(minimumSize),
61
                     : WidgetStatePropertyAll(minimumSize),