Commit e5c9e98fe7e9b58db796760342d672c0aea83416
1 parent
1e7094e3
feat:首页模块颜色
Showing
13 changed files
with
87 additions
and
71 deletions
lib/generated/json/course_entity.g.dart
@@ -23,6 +23,10 @@ CourseEntity $CourseEntityFromJson(Map<String, dynamic> json) { | @@ -23,6 +23,10 @@ CourseEntity $CourseEntityFromJson(Map<String, dynamic> json) { | ||
23 | if (totalCourseLesson != null) { | 23 | if (totalCourseLesson != null) { |
24 | courseEntity.totalCourseLesson = totalCourseLesson; | 24 | courseEntity.totalCourseLesson = totalCourseLesson; |
25 | } | 25 | } |
26 | + final String? courseModuleThemeColor = jsonConvert.convert<String>(json['courseModuleThemeColor']); | ||
27 | + if (courseModuleThemeColor != null) { | ||
28 | + courseEntity.courseModuleThemeColor = courseModuleThemeColor; | ||
29 | + } | ||
26 | return courseEntity; | 30 | return courseEntity; |
27 | } | 31 | } |
28 | 32 | ||
@@ -33,6 +37,7 @@ Map<String, dynamic> $CourseEntityToJson(CourseEntity entity) { | @@ -33,6 +37,7 @@ Map<String, dynamic> $CourseEntityToJson(CourseEntity entity) { | ||
33 | data['nowCourseModuleId'] = entity.nowCourseModuleId; | 37 | data['nowCourseModuleId'] = entity.nowCourseModuleId; |
34 | data['nowCourseModuleName'] = entity.nowCourseModuleName; | 38 | data['nowCourseModuleName'] = entity.nowCourseModuleName; |
35 | data['totalCourseLesson'] = entity.totalCourseLesson; | 39 | data['totalCourseLesson'] = entity.totalCourseLesson; |
40 | + data['courseModuleThemeColor'] = entity.courseModuleThemeColor; | ||
36 | return data; | 41 | return data; |
37 | } | 42 | } |
38 | 43 | ||
@@ -86,10 +91,6 @@ CourseCourseLessons $CourseCourseLessonsFromJson(Map<String, dynamic> json) { | @@ -86,10 +91,6 @@ CourseCourseLessons $CourseCourseLessonsFromJson(Map<String, dynamic> json) { | ||
86 | if (status != null) { | 91 | if (status != null) { |
87 | courseCourseLessons.status = status; | 92 | courseCourseLessons.status = status; |
88 | } | 93 | } |
89 | - final String? courseModuleThemeColor = jsonConvert.convert<String>(json['courseModuleThemeColor']); | ||
90 | - if (courseModuleThemeColor != null) { | ||
91 | - courseCourseLessons.courseModuleThemeColor = courseModuleThemeColor; | ||
92 | - } | ||
93 | return courseCourseLessons; | 94 | return courseCourseLessons; |
94 | } | 95 | } |
95 | 96 | ||
@@ -107,6 +108,5 @@ Map<String, dynamic> $CourseCourseLessonsToJson(CourseCourseLessons entity) { | @@ -107,6 +108,5 @@ Map<String, dynamic> $CourseCourseLessonsToJson(CourseCourseLessons entity) { | ||
107 | data['name'] = entity.name; | 108 | data['name'] = entity.name; |
108 | data['sortOrder'] = entity.sortOrder; | 109 | data['sortOrder'] = entity.sortOrder; |
109 | data['status'] = entity.status; | 110 | data['status'] = entity.status; |
110 | - data['courseModuleThemeColor'] = entity.courseModuleThemeColor; | ||
111 | return data; | 111 | return data; |
112 | } | 112 | } |
113 | \ No newline at end of file | 113 | \ No newline at end of file |
lib/generated/json/course_module_entity.g.dart
@@ -59,6 +59,11 @@ CourseModuleEntity $CourseModuleEntityFromJson(Map<String, dynamic> json) { | @@ -59,6 +59,11 @@ CourseModuleEntity $CourseModuleEntityFromJson(Map<String, dynamic> json) { | ||
59 | if (status != null) { | 59 | if (status != null) { |
60 | courseModuleEntity.status = status; | 60 | courseModuleEntity.status = status; |
61 | } | 61 | } |
62 | + | ||
63 | + final String? courseModuleThemeColor = jsonConvert.convert<String>(json['courseModuleThemeColor']); | ||
64 | + if (courseModuleThemeColor != null) { | ||
65 | + courseModuleEntity.courseModuleThemeColor = courseModuleThemeColor; | ||
66 | + } | ||
62 | return courseModuleEntity; | 67 | return courseModuleEntity; |
63 | } | 68 | } |
64 | 69 | ||
@@ -78,5 +83,6 @@ Map<String, dynamic> $CourseModuleEntityToJson(CourseModuleEntity entity) { | @@ -78,5 +83,6 @@ Map<String, dynamic> $CourseModuleEntityToJson(CourseModuleEntity entity) { | ||
78 | data['picUrl'] = entity.picUrl; | 83 | data['picUrl'] = entity.picUrl; |
79 | data['sortOrder'] = entity.sortOrder; | 84 | data['sortOrder'] = entity.sortOrder; |
80 | data['status'] = entity.status; | 85 | data['status'] = entity.status; |
86 | + data['courseModuleThemeColor'] = entity.courseModuleThemeColor; | ||
81 | return data; | 87 | return data; |
82 | } | 88 | } |
83 | \ No newline at end of file | 89 | \ No newline at end of file |
lib/models/course_entity.dart
@@ -9,6 +9,7 @@ class CourseEntity { | @@ -9,6 +9,7 @@ class CourseEntity { | ||
9 | int? nowCourseModuleId; | 9 | int? nowCourseModuleId; |
10 | String? nowCourseModuleName; | 10 | String? nowCourseModuleName; |
11 | int? totalCourseLesson; | 11 | int? totalCourseLesson; |
12 | + String? courseModuleThemeColor; | ||
12 | 13 | ||
13 | CourseEntity(); | 14 | CourseEntity(); |
14 | 15 | ||
@@ -36,7 +37,6 @@ class CourseCourseLessons { | @@ -36,7 +37,6 @@ class CourseCourseLessons { | ||
36 | String? name; | 37 | String? name; |
37 | int? sortOrder; | 38 | int? sortOrder; |
38 | int? status; | 39 | int? status; |
39 | - String? courseModuleThemeColor; | ||
40 | 40 | ||
41 | CourseCourseLessons(); | 41 | CourseCourseLessons(); |
42 | 42 |
lib/models/course_module_entity.dart
lib/pages/home/home_page.dart
@@ -8,6 +8,7 @@ import 'package:wow_english/pages/home/widgets/home_bouns_item.dart'; | @@ -8,6 +8,7 @@ import 'package:wow_english/pages/home/widgets/home_bouns_item.dart'; | ||
8 | import 'package:wow_english/pages/home/widgets/home_tab_header_widget.dart'; | 8 | import 'package:wow_english/pages/home/widgets/home_tab_header_widget.dart'; |
9 | import 'package:wow_english/pages/home/widgets/home_vidoe_item.dart'; | 9 | import 'package:wow_english/pages/home/widgets/home_vidoe_item.dart'; |
10 | import 'package:wow_english/route/route.dart'; | 10 | import 'package:wow_english/route/route.dart'; |
11 | +import 'package:wow_english/utils/color_util.dart'; | ||
11 | import 'package:wow_english/utils/toast_util.dart'; | 12 | import 'package:wow_english/utils/toast_util.dart'; |
12 | 13 | ||
13 | import 'bloc/home_bloc.dart'; | 14 | import 'bloc/home_bloc.dart'; |
@@ -88,13 +89,14 @@ class _HomePageView extends StatelessWidget { | @@ -88,13 +89,14 @@ class _HomePageView extends StatelessWidget { | ||
88 | mainAxisAlignment: MainAxisAlignment.spaceBetween, | 89 | mainAxisAlignment: MainAxisAlignment.spaceBetween, |
89 | children: [ | 90 | children: [ |
90 | HomeTabHeaderWidget( | 91 | HomeTabHeaderWidget( |
92 | + themColor: bloc.modelData?.courseModuleThemeColor, | ||
91 | actionTap: (HeaderActionType type) { | 93 | actionTap: (HeaderActionType type) { |
92 | _headerActionEvent(type); | 94 | _headerActionEvent(type); |
93 | }, | 95 | }, |
94 | ), | 96 | ), |
95 | Expanded( | 97 | Expanded( |
96 | child: ListView.builder( | 98 | child: ListView.builder( |
97 | - itemCount: bloc.modelData?.totalCourseLesson, | 99 | + itemCount: bloc.modelData?.totalCourseLesson??0, |
98 | scrollDirection: Axis.horizontal, | 100 | scrollDirection: Axis.horizontal, |
99 | itemBuilder: (BuildContext context, int index) { | 101 | itemBuilder: (BuildContext context, int index) { |
100 | CourseCourseLessons? data = bloc.modelData?.courseLessons?[index]; | 102 | CourseCourseLessons? data = bloc.modelData?.courseLessons?[index]; |
@@ -133,6 +135,7 @@ class _HomePageView extends StatelessWidget { | @@ -133,6 +135,7 @@ class _HomePageView extends StatelessWidget { | ||
133 | bloc.add(RequestVideoLessonEvent(data.id!,data.courseType!)); | 135 | bloc.add(RequestVideoLessonEvent(data.id!,data.courseType!)); |
134 | }, | 136 | }, |
135 | child: HomeVideoItem( | 137 | child: HomeVideoItem( |
138 | + themColor: bloc.modelData?.courseModuleThemeColor, | ||
136 | lessons: data, | 139 | lessons: data, |
137 | ), | 140 | ), |
138 | ); | 141 | ); |
@@ -150,12 +153,12 @@ class _HomePageView extends StatelessWidget { | @@ -150,12 +153,12 @@ class _HomePageView extends StatelessWidget { | ||
150 | ), | 153 | ), |
151 | Container( | 154 | Container( |
152 | decoration: BoxDecoration( | 155 | decoration: BoxDecoration( |
153 | - color: Colors.blue, | 156 | + color: HexColor(bloc.modelData?.courseModuleThemeColor??''), |
154 | borderRadius: BorderRadius.circular(14.5.r), | 157 | borderRadius: BorderRadius.circular(14.5.r), |
155 | ), | 158 | ), |
156 | padding: EdgeInsets.symmetric(vertical: 8.h, horizontal: 24.w), | 159 | padding: EdgeInsets.symmetric(vertical: 8.h, horizontal: 24.w), |
157 | child: Text( | 160 | child: Text( |
158 | - '${(bloc.modelData?.nowCourseLesson)}/${bloc.modelData?.totalCourseLesson}', | 161 | + '${(bloc.modelData?.nowCourseLesson??0)}/${bloc.modelData?.totalCourseLesson??0}', |
159 | style: TextStyle(color: Colors.white, fontSize: 12.sp), | 162 | style: TextStyle(color: Colors.white, fontSize: 12.sp), |
160 | ), | 163 | ), |
161 | ), | 164 | ), |
lib/pages/home/widgets/home_tab_header_widget.dart
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; | @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; | ||
2 | import 'package:flutter_screenutil/flutter_screenutil.dart'; | 2 | import 'package:flutter_screenutil/flutter_screenutil.dart'; |
3 | import 'package:wow_english/common/core/user_util.dart'; | 3 | import 'package:wow_english/common/core/user_util.dart'; |
4 | import 'package:wow_english/common/extension/string_extension.dart'; | 4 | import 'package:wow_english/common/extension/string_extension.dart'; |
5 | +import 'package:wow_english/utils/color_util.dart'; | ||
5 | import 'package:wow_english/utils/image_util.dart'; | 6 | import 'package:wow_english/utils/image_util.dart'; |
6 | 7 | ||
7 | enum HeaderActionType { | 8 | enum HeaderActionType { |
@@ -18,8 +19,9 @@ enum HeaderActionType { | @@ -18,8 +19,9 @@ enum HeaderActionType { | ||
18 | } | 19 | } |
19 | 20 | ||
20 | class HomeTabHeaderWidget extends StatelessWidget { | 21 | class HomeTabHeaderWidget extends StatelessWidget { |
21 | - const HomeTabHeaderWidget({super.key, this.actionTap}); | 22 | + const HomeTabHeaderWidget({super.key, this.actionTap, this.themColor}); |
22 | 23 | ||
24 | + final String? themColor; | ||
23 | final Function(HeaderActionType type)? actionTap; | 25 | final Function(HeaderActionType type)? actionTap; |
24 | 26 | ||
25 | @override | 27 | @override |
@@ -27,7 +29,7 @@ class HomeTabHeaderWidget extends StatelessWidget { | @@ -27,7 +29,7 @@ class HomeTabHeaderWidget extends StatelessWidget { | ||
27 | return Container( | 29 | return Container( |
28 | height: 45, | 30 | height: 45, |
29 | width: double.infinity, | 31 | width: double.infinity, |
30 | - color: Colors.purple, | 32 | + color: HexColor(themColor??''), |
31 | padding: EdgeInsets.symmetric(horizontal: 9.5.w), | 33 | padding: EdgeInsets.symmetric(horizontal: 9.5.w), |
32 | child: Row( | 34 | child: Row( |
33 | children: [ | 35 | children: [ |
lib/pages/home/widgets/home_vidoe_item.dart
@@ -3,10 +3,12 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; | @@ -3,10 +3,12 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
3 | import 'package:wow_english/common/extension/string_extension.dart'; | 3 | import 'package:wow_english/common/extension/string_extension.dart'; |
4 | import 'package:wow_english/common/widgets/ow_image_widget.dart'; | 4 | import 'package:wow_english/common/widgets/ow_image_widget.dart'; |
5 | import 'package:wow_english/models/course_entity.dart'; | 5 | import 'package:wow_english/models/course_entity.dart'; |
6 | +import 'package:wow_english/utils/color_util.dart'; | ||
6 | 7 | ||
7 | class HomeVideoItem extends StatelessWidget { | 8 | class HomeVideoItem extends StatelessWidget { |
8 | - const HomeVideoItem({super.key, this.lessons}); | 9 | + const HomeVideoItem({super.key, this.lessons, this.themColor}); |
9 | 10 | ||
11 | + final String? themColor; | ||
10 | final CourseCourseLessons? lessons; | 12 | final CourseCourseLessons? lessons; |
11 | 13 | ||
12 | @override | 14 | @override |
@@ -46,6 +48,7 @@ class HomeVideoItem extends StatelessWidget { | @@ -46,6 +48,7 @@ class HomeVideoItem extends StatelessWidget { | ||
46 | width: 2, | 48 | width: 2, |
47 | color: const Color(0xFF140C10), | 49 | color: const Color(0xFF140C10), |
48 | ), | 50 | ), |
51 | + color: HexColor(themColor??''), | ||
49 | borderRadius: BorderRadius.circular(6) | 52 | borderRadius: BorderRadius.circular(6) |
50 | ), | 53 | ), |
51 | padding: EdgeInsets.symmetric(horizontal: 10.w), | 54 | padding: EdgeInsets.symmetric(horizontal: 10.w), |
lib/pages/lessons/lesson_page.dart
@@ -43,7 +43,7 @@ class _LessonPageView extends StatelessWidget { | @@ -43,7 +43,7 @@ class _LessonPageView extends StatelessWidget { | ||
43 | appBar: WEAppBar( | 43 | appBar: WEAppBar( |
44 | leading: IconButton( | 44 | leading: IconButton( |
45 | onPressed: (){ | 45 | onPressed: (){ |
46 | - Navigator.pop(context); | 46 | + popPage(); |
47 | }, | 47 | }, |
48 | icon: Image.asset( | 48 | icon: Image.asset( |
49 | 'back'.assetPng, | 49 | 'back'.assetPng, |
lib/pages/lessons/widgets/lesson_item_widget.dart
@@ -3,6 +3,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; | @@ -3,6 +3,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
3 | import 'package:wow_english/common/extension/string_extension.dart'; | 3 | import 'package:wow_english/common/extension/string_extension.dart'; |
4 | import 'package:wow_english/common/widgets/ow_image_widget.dart'; | 4 | import 'package:wow_english/common/widgets/ow_image_widget.dart'; |
5 | import 'package:wow_english/models/course_module_entity.dart'; | 5 | import 'package:wow_english/models/course_module_entity.dart'; |
6 | +import 'package:wow_english/utils/color_util.dart'; | ||
6 | 7 | ||
7 | class LessonItemWidget extends StatelessWidget { | 8 | class LessonItemWidget extends StatelessWidget { |
8 | const LessonItemWidget({super.key, required this.isSelected, this.model, this.onClickEvent}); | 9 | const LessonItemWidget({super.key, required this.isSelected, this.model, this.onClickEvent}); |
@@ -59,7 +60,7 @@ class LessonItemWidget extends StatelessWidget { | @@ -59,7 +60,7 @@ class LessonItemWidget extends StatelessWidget { | ||
59 | 10.verticalSpace, | 60 | 10.verticalSpace, |
60 | Container( | 61 | Container( |
61 | decoration: BoxDecoration( | 62 | decoration: BoxDecoration( |
62 | - color: Colors.red, | 63 | + color: HexColor(model?.courseModuleThemeColor??'#FFC0C3E7'), |
63 | borderRadius: BorderRadius.circular(6.r), | 64 | borderRadius: BorderRadius.circular(6.r), |
64 | border: Border.all( | 65 | border: Border.all( |
65 | color: const Color(0xFF333333), | 66 | color: const Color(0xFF333333), |
lib/pages/user/information/user_information_page.dart
@@ -40,12 +40,11 @@ class _UserInformationView extends StatelessWidget { | @@ -40,12 +40,11 @@ class _UserInformationView extends StatelessWidget { | ||
40 | } | 40 | } |
41 | 41 | ||
42 | class _UserInformationContentView extends StatelessWidget { | 42 | class _UserInformationContentView extends StatelessWidget { |
43 | - const _UserInformationContentView({super.key}); | ||
44 | 43 | ||
45 | void _openModifyPage(BuildContext context, ModifyUserInformationType type) { | 44 | void _openModifyPage(BuildContext context, ModifyUserInformationType type) { |
46 | Log.d('_openModifyPage($type)'); | 45 | Log.d('_openModifyPage($type)'); |
47 | // 暂时关闭修改,修复后打开 | 46 | // 暂时关闭修改,修复后打开 |
48 | - //ModifyUserInformationPage.push(context, type); | 47 | + // ModifyUserInformationPage.push(context, type); |
49 | } | 48 | } |
50 | 49 | ||
51 | @override | 50 | @override |
lib/pages/user/modify/modify_user_information_page.dart
@@ -79,7 +79,7 @@ class ModifyUserInformationPage extends StatelessWidget { | @@ -79,7 +79,7 @@ class ModifyUserInformationPage extends StatelessWidget { | ||
79 | alignment: Alignment.center, | 79 | alignment: Alignment.center, |
80 | width: 90.w, | 80 | width: 90.w, |
81 | height: 44.h, | 81 | height: 44.h, |
82 | - decoration: BoxDecoration( | 82 | + decoration: const BoxDecoration( |
83 | image: DecorationImage(image: AssetImage(AssetsConst.bgButtonBlue), fit: BoxFit.fill), | 83 | image: DecorationImage(image: AssetImage(AssetsConst.bgButtonBlue), fit: BoxFit.fill), |
84 | ), | 84 | ), |
85 | child: Text( | 85 | child: Text( |
@@ -120,54 +120,9 @@ class ModifyUserInformationPage extends StatelessWidget { | @@ -120,54 +120,9 @@ class ModifyUserInformationPage extends StatelessWidget { | ||
120 | if (type == ModifyUserInformationType.gender) { | 120 | if (type == ModifyUserInformationType.gender) { |
121 | return Row( | 121 | return Row( |
122 | children: <Widget>[ | 122 | children: <Widget>[ |
123 | - SizedBox( | ||
124 | - width: 100.w, | ||
125 | - child: RadioListTile( | ||
126 | - title: Text( | ||
127 | - '男', | ||
128 | - style: TextStyle( | ||
129 | - fontWeight: FontWeight.w700, | ||
130 | - color: const Color(0xFF333333), | ||
131 | - fontSize: 21.sp, | ||
132 | - ), | ||
133 | - ), | ||
134 | - activeColor: const Color(0xFF0E89BA), | ||
135 | - value: 0, | ||
136 | - //selected: user.gender == 0, | ||
137 | - groupValue: userBloc.tempGender, | ||
138 | - onChanged: (value) { | ||
139 | - Log.d('男value = $value'); | ||
140 | - if (value != null) { | ||
141 | - userBloc.tempGender = value; | ||
142 | - } | ||
143 | - userBloc.add(UserUIUpdate(type)); | ||
144 | - }, | ||
145 | - ), | ||
146 | - ), | ||
147 | - SizedBox( | ||
148 | - width: 100.w, | ||
149 | - child: RadioListTile<int>( | ||
150 | - //selected: user.gender == 1, | ||
151 | - title: Text( | ||
152 | - '女', | ||
153 | - style: TextStyle( | ||
154 | - fontWeight: FontWeight.w700, | ||
155 | - color: const Color(0xFF333333), | ||
156 | - fontSize: 21.sp, | ||
157 | - ), | ||
158 | - ), | ||
159 | - activeColor: const Color(0xFF0E89BA), | ||
160 | - value: 1, | ||
161 | - groupValue: userBloc.tempGender, | ||
162 | - onChanged: (int? value) { | ||
163 | - Log.d('女value = $value'); | ||
164 | - if (value != null) { | ||
165 | - userBloc.tempGender = value; | ||
166 | - } | ||
167 | - userBloc.add(UserUIUpdate(type)); | ||
168 | - }, | ||
169 | - ), | ||
170 | - ), | 123 | + _buildSexWidget('男', true), |
124 | + 70.horizontalSpace, | ||
125 | + _buildSexWidget('女', false) | ||
171 | ], | 126 | ], |
172 | ); | 127 | ); |
173 | } | 128 | } |
@@ -203,4 +158,34 @@ class ModifyUserInformationPage extends StatelessWidget { | @@ -203,4 +158,34 @@ class ModifyUserInformationPage extends StatelessWidget { | ||
203 | },*/ | 158 | },*/ |
204 | ); | 159 | ); |
205 | } | 160 | } |
161 | + | ||
162 | + Widget _buildSexWidget(String title,bool isSelect) { | ||
163 | + return Row( | ||
164 | + children: [ | ||
165 | + Container( | ||
166 | + width: 21.h, | ||
167 | + height: 21.h, | ||
168 | + padding: EdgeInsets.all(4.h), | ||
169 | + decoration: BoxDecoration( | ||
170 | + borderRadius: BorderRadius.circular(21.r), | ||
171 | + border: Border.all( | ||
172 | + color: const Color(0xFF140C10), | ||
173 | + width: 1.5 | ||
174 | + ) | ||
175 | + ), | ||
176 | + child: Offstage( | ||
177 | + offstage:!isSelect, | ||
178 | + child: ClipRRect( | ||
179 | + borderRadius: BorderRadius.circular(13.r), | ||
180 | + child: Container( | ||
181 | + color: Colors.blue, | ||
182 | + ), | ||
183 | + ), | ||
184 | + ), | ||
185 | + ), | ||
186 | + 5.horizontalSpace, | ||
187 | + Text(title) | ||
188 | + ], | ||
189 | + ); | ||
190 | + } | ||
206 | } | 191 | } |
lib/pages/user/user_page.dart
@@ -137,14 +137,14 @@ class _UserView extends StatelessWidget { | @@ -137,14 +137,14 @@ class _UserView extends StatelessWidget { | ||
137 | style: textStyle21sp, | 137 | style: textStyle21sp, |
138 | ), | 138 | ), |
139 | onPressed: () { | 139 | onPressed: () { |
140 | - Navigator.of(AppRouter.context).pushNamed(AppRouteName.userInformation); | 140 | + pushNamed(AppRouteName.userInformation); |
141 | }, | 141 | }, |
142 | ) | 142 | ) |
143 | ], | 143 | ], |
144 | ), | 144 | ), |
145 | 30.verticalSpace, | 145 | 30.verticalSpace, |
146 | OutlinedButton( | 146 | OutlinedButton( |
147 | - onPressed: () => Navigator.of(context).pushNamed(AppRouteName.fogPwd), | 147 | + onPressed: () => pushNamed(AppRouteName.fogPwd), |
148 | style: normalButtonStyle, | 148 | style: normalButtonStyle, |
149 | child: Text( | 149 | child: Text( |
150 | "修改密码", | 150 | "修改密码", |
@@ -153,7 +153,7 @@ class _UserView extends StatelessWidget { | @@ -153,7 +153,7 @@ class _UserView extends StatelessWidget { | ||
153 | ), | 153 | ), |
154 | 12.verticalSpace, | 154 | 12.verticalSpace, |
155 | OutlinedButton( | 155 | OutlinedButton( |
156 | - onPressed: () => Navigator.of(context).pushNamed(AppRouteName.exLesson), | 156 | + onPressed: () => pushNamed(AppRouteName.exLesson), |
157 | style: normalButtonStyle, | 157 | style: normalButtonStyle, |
158 | child: Text( | 158 | child: Text( |
159 | "兑换课程", | 159 | "兑换课程", |
@@ -161,9 +161,8 @@ class _UserView extends StatelessWidget { | @@ -161,9 +161,8 @@ class _UserView extends StatelessWidget { | ||
161 | )), | 161 | )), |
162 | 12.verticalSpace, | 162 | 12.verticalSpace, |
163 | OutlinedButton( | 163 | OutlinedButton( |
164 | - onPressed: () => { | ||
165 | - Navigator.of(context).pushNamed(AppRouteName.webView, | ||
166 | - arguments: {'urlStr': AppConsts.userPrivacyPolicyUrl, 'webViewTitle': '隐私协议'}) | 164 | + onPressed: () { |
165 | + pushNamed(AppRouteName.webView,arguments: {'urlStr': AppConsts.userPrivacyPolicyUrl, 'webViewTitle': '隐私协议'}); | ||
167 | }, | 166 | }, |
168 | style: normalButtonStyle, | 167 | style: normalButtonStyle, |
169 | child: Text( | 168 | child: Text( |
lib/utils/color_util.dart
0 → 100644
1 | +import 'dart:ui'; | ||
2 | + | ||
3 | +class HexColor extends Color { | ||
4 | + static int _getColorFromHex(String hexColor) { | ||
5 | + if (hexColor.isEmpty) { | ||
6 | + hexColor = '#FFC0C3E7'; | ||
7 | + } | ||
8 | + hexColor = hexColor.toUpperCase().replaceAll("#", ""); | ||
9 | + hexColor = hexColor.replaceAll('0X', ''); | ||
10 | + if (hexColor.length == 6) { | ||
11 | + hexColor = "FF$hexColor"; | ||
12 | + } | ||
13 | + return int.parse(hexColor, radix: 16); | ||
14 | + } | ||
15 | + | ||
16 | + HexColor(final String hexColor) : super(_getColorFromHex(hexColor)); | ||
17 | +} | ||
0 | \ No newline at end of file | 18 | \ No newline at end of file |