Commit c61b3c1a909cee3732835372efabdf93abe09772

Authored by Key
1 parent c44c20f3

feat: toast_util.dart

fixed: user_page.dart
lib/common/core/app_consts.dart 0 → 100644
  1 +class AppConsts {
  2 + /// 隐私协议
  3 + static const String userPrivacyPolicyUrl =
  4 + 'http://page.kouyuxingqiu.com/%E7%94%A8%E6%88%B7%E6%B3%A8%E5%86%8C%E5%8F%8A%E4%BD%BF%E7%94%A8APP%E9%9A%90%E7%A7%81%E5%8D%8F%E8%AE%AE.html';
  5 +
  6 + /// 儿童隐私协议
  7 + static const String childrenPrivacyPolicyUrl =
  8 + 'https://ishowedu-public-images.ishowedu.com/%E5%8F%A3%E8%AF%AD%E6%98%9F%E7%90%83%E5%84%BF%E7%AB%A5%E9%9A%90%E7%A7%81%E4%BF%9D%E6%8A%A4%E6%94%BF%E7%AD%96_iShowLD%E4%BF%AE%E8%AE%A2_20210913%281%29.html';
  9 +
  10 + /// 与第三方共享协议
  11 + static const String userTermSdkUrl = 'http://page.kouyuxingqiu.com/term_sdk.html';
  12 +}
... ...
lib/pages/home/bloc/home_bloc.dart
1 1 import 'package:flutter/cupertino.dart';
2 2 import 'package:flutter/foundation.dart';
3 3 import 'package:flutter_bloc/flutter_bloc.dart';
4   -import 'package:flutter_easyloading/flutter_easyloading.dart';
5 4 import 'package:wow_english/common/request/dao/home_dao.dart';
6 5 import 'package:wow_english/common/request/exception.dart';
7 6 import 'package:wow_english/models/course_entity.dart';
8 7 // import 'package:wow_english/models/course_lesson_entity.dart';
9 8 import 'package:wow_english/utils/loading.dart';
  9 +import 'package:wow_english/utils/toast_util.dart';
10 10  
11 11 part 'home_event.dart';
12 12 part 'home_state.dart';
... ... @@ -15,6 +15,7 @@ class HomeBloc extends Bloc<HomeEvent, HomeState> {
15 15 final String? moduleId;
16 16  
17 17 CourseEntity? _modelData;
  18 +
18 19 CourseEntity? get modelData => _modelData;
19 20  
20 21 HomeBloc(this.moduleId) : super(HomeInitial()) {
... ... @@ -24,14 +25,13 @@ class HomeBloc extends Bloc<HomeEvent, HomeState> {
24 25 void _requestData(RequestDataEvent event, Emitter<HomeState> emitter) async {
25 26 try {
26 27 await loading(() async {
27   - _modelData = await HomeDao.courseLesson(moduleId: moduleId??'');
  28 + _modelData = await HomeDao.courseLesson(moduleId: moduleId ?? '');
28 29 emitter(HomeDataLoadState());
29 30 });
30 31 } catch (e) {
31 32 if (e is ApiException) {
32   - EasyLoading.showToast(e.message.toString());
  33 + showToast(e.message.toString());
33 34 }
34 35 }
35 36 }
36 37 }
37   -
... ...
lib/pages/home/home_page.dart
1 1 import 'package:flutter/material.dart';
2 2 import 'package:flutter_bloc/flutter_bloc.dart';
3   -import 'package:flutter_easyloading/flutter_easyloading.dart';
4 3 import 'package:flutter_screenutil/flutter_screenutil.dart';
5 4 import 'package:wow_english/common/extension/string_extension.dart';
6 5 import 'package:wow_english/models/course_entity.dart';
... ... @@ -8,6 +7,7 @@ import &#39;package:wow_english/pages/home/widgets/home_bouns_item.dart&#39;;
8 7 import 'package:wow_english/pages/home/widgets/home_tab_header_widget.dart';
9 8 import 'package:wow_english/pages/home/widgets/home_vidoe_item.dart';
10 9 import 'package:wow_english/route/route.dart';
  10 +import 'package:wow_english/utils/toast_util.dart';
11 11  
12 12 import 'bloc/home_bloc.dart';
13 13  
... ... @@ -37,8 +37,7 @@ class _HomePageView extends StatelessWidget {
37 37 } else if (type == HeaderActionType.shop) {
38 38 Navigator.of(AppRouter.context).pushNamed(AppRouteName.shop);
39 39 } else if (type == HeaderActionType.user) {
40   - Navigator.of(AppRouter.context).pushNamed(AppRouteName.topicPic);
41   - // Navigator.of(AppRouter.context).pushNamed(AppRouteName.user);
  40 + Navigator.of(AppRouter.context).pushNamed(AppRouteName.user);
42 41 } else {
43 42 // Navigator.of(AppRouter.context).pushNamed(AppRouteName.topicPic);
44 43 // Navigator.of(AppRouter.context).pushNamed(AppRouteName.topicWord);
... ... @@ -51,19 +50,18 @@ class _HomePageView extends StatelessWidget {
51 50  
52 51 @override
53 52 Widget build(BuildContext context) {
54   - return BlocListener<HomeBloc,HomeState>(
55   - listener: (context, state){},
  53 + return BlocListener<HomeBloc, HomeState>(
  54 + listener: (context, state) {},
56 55 child: _homeView(),
57 56 );
58 57 }
59 58  
60   - Widget _homeView() => BlocBuilder<HomeBloc,HomeState>(
61   - builder: (context, state){
  59 + Widget _homeView() => BlocBuilder<HomeBloc, HomeState>(builder: (context, state) {
62 60 final bloc = BlocProvider.of<HomeBloc>(context);
63 61 return Scaffold(
64 62 body: Container(
65 63 color: Colors.white,
66   - child: Center(
  64 + child: Center(
67 65 child: Column(
68 66 mainAxisAlignment: MainAxisAlignment.spaceBetween,
69 67 children: [
... ... @@ -73,38 +71,38 @@ class _HomePageView extends StatelessWidget {
73 71 },
74 72 ),
75 73 Expanded(
76   - child: ListView.builder(
77   - itemCount: bloc.modelData?.totalCourseLesson,
78   - scrollDirection: Axis.horizontal,
79   - itemBuilder: (BuildContext context, int index){
80   - CourseCourseLessons? data = bloc.modelData?.courseLessons?[index];
81   - if (data?.courseType == 5) {//彩蛋
82   - return GestureDetector(
83   - onTap: (){
84   - if (data!.lock!) {
85   - return;
86   - }
87   - EasyLoading.showToast('点击事件');
88   - },
89   - child: HomeBoundsItem(
90   - imageUrl: data?.coverUrl,
91   - ),
92   - );
93   - } else {
94   - return GestureDetector(
95   - onTap: () {
96   - if (data!.lock!) {
97   - return;
98   - }
99   - EasyLoading.showToast('点击事件');
100   - },
101   - child: HomeVideoItem(
102   - lessons: data,
103   - ),
104   - );
105   - }
106   - })
107   - ),
  74 + child: ListView.builder(
  75 + itemCount: bloc.modelData?.totalCourseLesson,
  76 + scrollDirection: Axis.horizontal,
  77 + itemBuilder: (BuildContext context, int index) {
  78 + CourseCourseLessons? data = bloc.modelData?.courseLessons?[index];
  79 + if (data?.courseType == 5) {
  80 + //彩蛋
  81 + return GestureDetector(
  82 + onTap: () {
  83 + if (data!.lock!) {
  84 + return;
  85 + }
  86 + showToast('点击事件');
  87 + },
  88 + child: HomeBoundsItem(
  89 + imageUrl: data?.coverUrl,
  90 + ),
  91 + );
  92 + } else {
  93 + return GestureDetector(
  94 + onTap: () {
  95 + if (data!.lock!) {
  96 + return;
  97 + }
  98 + showToast('点击事件');
  99 + },
  100 + child: HomeVideoItem(
  101 + lessons: data,
  102 + ),
  103 + );
  104 + }
  105 + })),
108 106 SafeArea(
109 107 child: Padding(
110 108 padding: EdgeInsets.symmetric(horizontal: 13.w),
... ... @@ -120,13 +118,10 @@ class _HomePageView extends StatelessWidget {
120 118 color: Colors.blue,
121 119 borderRadius: BorderRadius.circular(14.5.r),
122 120 ),
123   - padding: EdgeInsets.symmetric(vertical: 8.h,horizontal: 24.w),
  121 + padding: EdgeInsets.symmetric(vertical: 8.h, horizontal: 24.w),
124 122 child: Text(
125 123 '${(bloc.modelData?.nowCourseLesson)}/${bloc.modelData?.totalCourseLesson}',
126   - style: TextStyle(
127   - color: Colors.white,
128   - fontSize: 12.sp
129   - ),
  124 + style: TextStyle(color: Colors.white, fontSize: 12.sp),
130 125 ),
131 126 ),
132 127 Image.asset(
... ...
lib/pages/home/widgets/home_tab_header_widget.dart
... ... @@ -18,8 +18,7 @@ enum HeaderActionType {
18 18 }
19 19  
20 20 class HomeTabHeaderWidget extends StatelessWidget {
21   -
22   - const HomeTabHeaderWidget({super.key, this.actionTap});
  21 + const HomeTabHeaderWidget({super.key, this.actionTap});
23 22  
24 23 final Function(HeaderActionType type)? actionTap;
25 24  
... ... @@ -34,11 +33,7 @@ class HomeTabHeaderWidget extends StatelessWidget {
34 33 children: [
35 34 ScreenUtil().bottomBarHeight.horizontalSpace,
36 35 GestureDetector(
37   - onTap: () {
38   - if(actionTap != null) {
39   - actionTap!(HeaderActionType.user);
40   - }
41   - },
  36 + onTap: () => actionTap?.call(HeaderActionType.user),
42 37 child: Container(
43 38 decoration: BoxDecoration(
44 39 border: Border.all(
... ... @@ -50,14 +45,15 @@ class HomeTabHeaderWidget extends StatelessWidget {
50 45 child: CircleAvatar(
51 46 radius: 21,
52 47 backgroundImage: NetworkImage(
53   - context.read<CacheBloc>().userEntity?.avatarUrl??'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fsafe-img.xhscdn.com%2Fbw1%2Faa1c2213-820a-4223-8757-5f8cee318a28%3FimageView2%2F2%2Fw%2F1080%2Fformat%2Fjpg&refer=http%3A%2F%2Fsafe-img.xhscdn.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1688713226&t=192b18a613683bcdc5bd76f65c9ff032',
  48 + context.read<CacheBloc>().userEntity?.avatarUrl ??
  49 + 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fsafe-img.xhscdn.com%2Fbw1%2Faa1c2213-820a-4223-8757-5f8cee318a28%3FimageView2%2F2%2Fw%2F1080%2Fformat%2Fjpg&refer=http%3A%2F%2Fsafe-img.xhscdn.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1688713226&t=192b18a613683bcdc5bd76f65c9ff032',
54 50 ),
55 51 ),
56 52 ),
57 53 ),
58 54 GestureDetector(
59 55 onTap: () {
60   - if(actionTap != null) {
  56 + if (actionTap != null) {
61 57 actionTap!(HeaderActionType.user);
62 58 }
63 59 },
... ... @@ -67,56 +63,42 @@ class HomeTabHeaderWidget extends StatelessWidget {
67 63 decoration: BoxDecoration(
68 64 color: Colors.white,
69 65 borderRadius: BorderRadius.circular(2),
70   - border: Border.all(
71   - width: 1.0,
72   - color: const Color(0xFF140C10),
73   - style: BorderStyle.solid
74   - ),
  66 + border: Border.all(width: 1.0, color: const Color(0xFF140C10), style: BorderStyle.solid),
75 67 ),
76   - child: Text(
77   - context.read<CacheBloc>().userEntity?.name??'',
78   - style: TextStyle(
79   - color: const Color(0xFF333333),
80   - fontSize: 16.sp
81   - ),
  68 + child: Text(
  69 + context.read<CacheBloc>().userEntity?.name ?? '',
  70 + style: TextStyle(color: const Color(0xFF333333), fontSize: 16.sp),
82 71 ),
83 72 ),
84 73 ),
85 74 20.horizontalSpace,
86 75 const Expanded(
87   - child:Text(
88   - 'learn wow!yellow',
89   - textAlign:TextAlign.left,
90   - style: TextStyle(
91   - color: Colors.white,
92   - fontSize: 30.0
93   - ),
94   - )
95   - ),
  76 + child: Text(
  77 + 'learn wow!yellow',
  78 + textAlign: TextAlign.left,
  79 + style: TextStyle(color: Colors.white, fontSize: 30.0),
  80 + )),
96 81 IconButton(
97   - onPressed: (){
98   - if(actionTap != null) {
  82 + onPressed: () {
  83 + if (actionTap != null) {
99 84 actionTap!(HeaderActionType.video);
100 85 }
101 86 },
102   - icon: Image.asset('video'.assetPng)
103   - ),
  87 + icon: Image.asset('video'.assetPng)),
104 88 IconButton(
105   - onPressed: (){
106   - if(actionTap != null) {
  89 + onPressed: () {
  90 + if (actionTap != null) {
107 91 actionTap!(HeaderActionType.phase);
108 92 }
109 93 },
110   - icon: Image.asset('home'.assetPng)
111   - ),
  94 + icon: Image.asset('home'.assetPng)),
112 95 IconButton(
113   - onPressed: (){
114   - if(actionTap != null) {
  96 + onPressed: () {
  97 + if (actionTap != null) {
115 98 actionTap!(HeaderActionType.listen);
116 99 }
117 100 },
118   - icon: Image.asset('listen'.assetPng)
119   - ),
  101 + icon: Image.asset('listen'.assetPng)),
120 102 // IconButton(
121 103 // onPressed: (){
122 104 // if(actionTap != null) {
... ...
lib/pages/lessons/bloc/lesson_bloc.dart
1 1 import 'package:flutter/cupertino.dart';
2 2 import 'package:flutter_bloc/flutter_bloc.dart';
3   -import 'package:flutter_easyloading/flutter_easyloading.dart';
4 3 import 'package:wow_english/common/request/dao/home_dao.dart';
5 4 import 'package:wow_english/common/request/exception.dart';
6 5 import 'package:wow_english/models/course_module_entity.dart';
7 6 import 'package:wow_english/utils/loading.dart';
  7 +import 'package:wow_english/utils/toast_util.dart';
8 8  
9 9 part 'lesson_event.dart';
10 10 part 'lesson_state.dart';
11 11  
12 12 class LessonBloc extends Bloc<LessonEvent, LessonState> {
13   -
14 13 final int pageIndex;
15 14  
16 15 final PageController pageController;
... ... @@ -23,14 +22,13 @@ class LessonBloc extends Bloc&lt;LessonEvent, LessonState&gt; {
23 22  
24 23 List<CourseModuleEntity?> get listData => _listData;
25 24  
26   - LessonBloc(this.pageIndex,this.pageController) : super(LessonInitial()) {
  25 + LessonBloc(this.pageIndex, this.pageController) : super(LessonInitial()) {
27 26 _currentPageIndex = pageIndex;
28 27 on<PageViewChangeIndexEvent>(_pageIndexChange);
29 28 on<RequestDataEvent>(_requestData);
30 29 }
31 30  
32   -
33   - void _pageIndexChange(PageViewChangeIndexEvent event,Emitter<LessonState> emitter) async {
  31 + void _pageIndexChange(PageViewChangeIndexEvent event, Emitter<LessonState> emitter) async {
34 32 _currentPageIndex = event.index;
35 33 emitter(PageIndexChangeState());
36 34 }
... ... @@ -38,12 +36,12 @@ class LessonBloc extends Bloc&lt;LessonEvent, LessonState&gt; {
38 36 void _requestData(RequestDataEvent event, Emitter<LessonState> emitter) async {
39 37 try {
40 38 await loading(() async {
41   - _listData = await HomeDao.courseModule()??[];
  39 + _listData = await HomeDao.courseModule() ?? [];
42 40 emitter(LessonDataLoadState());
43 41 });
44 42 } catch (e) {
45 43 if (e is ApiException) {
46   - EasyLoading.showToast(e.message??'请求失败,请检查网络连接');
  44 + showToast(e.message ?? '请求失败,请检查网络连接');
47 45 }
48 46 }
49 47 }
... ...
lib/pages/lessons/lesson_page.dart
... ... @@ -56,7 +56,7 @@ class _LessonPageView extends StatelessWidget {
56 56 // icon: Image.asset('shop'.assetPng),
57 57 // color: Colors.white,
58 58 // onPressed: () {
59   - // EasyLoading.showToast('购买');
  59 + // showToast('购买');
60 60 // },
61 61 // )
62 62 // ],
... ... @@ -177,4 +177,4 @@ class _LessonPageView extends StatelessWidget {
177 177 ),
178 178 );
179 179 });
180   -}
181 180 \ No newline at end of file
  181 +}
... ...
lib/pages/listen/bloc/listen_bloc.dart
1   -import 'dart:convert';
2   -
3 1 import 'package:flutter/cupertino.dart';
4 2 import 'package:flutter_bloc/flutter_bloc.dart';
5   -import 'package:flutter_easyloading/flutter_easyloading.dart';
6 3 import 'package:wow_english/common/request/dao/listen_dao.dart';
7 4 import 'package:wow_english/common/request/exception.dart';
8 5 import 'package:wow_english/models/listen_entity.dart';
9 6 import 'package:wow_english/utils/loading.dart';
  7 +import 'package:wow_english/utils/toast_util.dart';
10 8  
11 9 part 'listen_event.dart';
12 10 part 'listen_state.dart';
13 11  
14 12 class ListenBloc extends Bloc<ListenEvent, ListenState> {
15   -
16 13 List<ListenEntity?> _listData = [];
  14 +
17 15 List<ListenEntity?> get listData => _listData;
18 16  
19 17 ListenBloc() : super(ListenInitial()) {
20 18 on<RequestDataEvent>(_requestData);
21 19 }
22 20  
23   -
24   - void _requestData(RequestDataEvent event,Emitter<ListenState> emitter) async {
  21 + void _requestData(RequestDataEvent event, Emitter<ListenState> emitter) async {
25 22 try {
26 23 await loading(() async {
27   - _listData = await ListenDao.listen()??[];
  24 + _listData = await ListenDao.listen() ?? [];
28 25 emitter(RequestListenDataState());
29 26 });
30 27 } catch (e) {
31 28 if (e is ApiException) {
32   - EasyLoading.showToast(e.message??'请求失败,请检查网络连接');
  29 + showToast(e.message ?? '请求失败,请检查网络连接');
33 30 }
34 31 }
35 32 }
36   -
37 33 }
... ...
lib/pages/login/forgetpwd/bloc/forget_pwd_home_bloc.dart
  1 +import 'package:common_utils/common_utils.dart';
1 2 import 'package:flutter/cupertino.dart';
2 3 import 'package:flutter_bloc/flutter_bloc.dart';
3   -import 'package:common_utils/common_utils.dart';
4   -import 'package:flutter_easyloading/flutter_easyloading.dart';
  4 +import 'package:wow_english/utils/toast_util.dart';
5 5  
6 6 part 'forget_pwd_home_event.dart';
7 7 part 'forget_pwd_home_state.dart';
8 8  
9 9 class ForgetPwdHomeBloc extends Bloc<ForgetPwdHomeEvent, ForgetPwdHomeState> {
10   -
11 10 ///是否可以发送验证码
12 11 bool _canSendSms = false;
13 12 bool _canSetPwd = false;
14 13  
15 14 bool get canSendSms => _canSendSms;
  15 +
16 16 bool get canSetPwd => _canSetPwd;
17 17  
18 18 final TextEditingController phoneNumController = TextEditingController();
... ... @@ -57,15 +57,13 @@ class ForgetPwdHomeBloc extends Bloc&lt;ForgetPwdHomeEvent, ForgetPwdHomeState&gt; {
57 57 }
58 58 }
59 59  
60   - void _setPassWord(SetPassWordEvent event,Emitter<ForgetPwdHomeState> emitter) async {
61   - if(!RegexUtil.isMobileExact(phoneNumController.text)) {
62   - EasyLoading.showToast('手机号不正确!');
  60 + void _setPassWord(SetPassWordEvent event, Emitter<ForgetPwdHomeState> emitter) async {
  61 + if (!RegexUtil.isMobileExact(phoneNumController.text)) {
  62 + showToast('手机号不正确!');
63 63 return;
64 64 }
65 65 emitter(SetPwdCheckCodeState());
66 66 }
67 67  
68   - void _sendSmsCode(SendSmsCodeEvent event,Emitter<ForgetPwdHomeState> emitter) async {
69   -
70   - }
  68 + void _sendSmsCode(SendSmsCodeEvent event, Emitter<ForgetPwdHomeState> emitter) async {}
71 69 }
... ...
lib/pages/login/forgetpwd/forget_password_home_page.dart
... ... @@ -4,7 +4,8 @@ import &#39;package:flutter_screenutil/flutter_screenutil.dart&#39;;
4 4 import 'package:wow_english/common/extension/string_extension.dart';
5 5 import 'package:wow_english/common/widgets/textfield_customer_widget.dart';
6 6 import 'package:wow_english/pages/login/loginpage/time_widget.dart';
7   -import 'package:wow_english/route/route.dart';
  7 +import 'package:wow_english/pages/login/setpwd/set_pwd_page.dart';
  8 +import 'package:wow_english/utils/toast_util.dart';
8 9  
9 10 import 'bloc/forget_pwd_home_bloc.dart';
10 11  
... ... @@ -26,15 +27,26 @@ class _ForgetPasswordHomePageView extends StatelessWidget {
26 27 return BlocListener<ForgetPwdHomeBloc, ForgetPwdHomeState>(
27 28 listener: (context, state) {
28 29 if (state is SetPwdCheckCodeState) {
29   - Navigator.of(context).pushNamed(AppRouteName.setPwd,arguments: {'phoneNumber':context.read<ForgetPwdHomeBloc>().phoneNumController.text});
  30 + var bloc = context.read<ForgetPwdHomeBloc>();
  31 + var phoneNum = bloc.phoneNumController.text;
  32 + var smsCode = bloc.checkNumController.text;
  33 + if (phoneNum.isEmpty) {
  34 + '请输入手机号'.toast();
  35 + return;
  36 + }
  37 + if (smsCode.isEmpty) {
  38 + '请输入验证码'.toast();
  39 + return;
  40 + }
  41 + // todo 后续需要改成在当前页面,验证过验证码后,再跳转到设置密码页面
  42 + SetPassWordPage.push(context, SetPwdPageType.changePwd, phoneNum: phoneNum, smsCode: smsCode);
30 43 }
31 44 },
32 45 child: _buildForgetPwdView(),
33 46 );
34 47 }
35 48  
36   - Widget _buildForgetPwdView() => BlocBuilder<ForgetPwdHomeBloc, ForgetPwdHomeState>(
37   - builder: (context, state) {
  49 + Widget _buildForgetPwdView() => BlocBuilder<ForgetPwdHomeBloc, ForgetPwdHomeState>(builder: (context, state) {
38 50 final bloc = BlocProvider.of<ForgetPwdHomeBloc>(context);
39 51 return Scaffold(
40 52 body: Container(
... ... @@ -42,7 +54,7 @@ class _ForgetPasswordHomePageView extends StatelessWidget {
42 54 child: SafeArea(
43 55 child: SingleChildScrollView(
44 56 child: Padding(
45   - padding: EdgeInsets.only(left: 49.w,right: 10.w),
  57 + padding: EdgeInsets.only(left: 49.w, right: 10.w),
46 58 child: Column(
47 59 children: [
48 60 34.verticalSpace,
... ... @@ -56,10 +68,7 @@ class _ForgetPasswordHomePageView extends StatelessWidget {
56 68 12.5.horizontalSpace,
57 69 Text(
58 70 '修改密码\n请输入您的手机号和验证码吧',
59   - style: TextStyle(
60   - fontSize: 16.sp,
61   - color: const Color(0xFF666666)
62   - ),
  71 + style: TextStyle(fontSize: 16.sp, color: const Color(0xFF666666)),
63 72 )
64 73 ],
65 74 ),
... ... @@ -68,62 +77,59 @@ class _ForgetPasswordHomePageView extends StatelessWidget {
68 77 children: [
69 78 Expanded(
70 79 child: Column(
  80 + children: [
  81 + 44.5.verticalSpace,
  82 + Row(
71 83 children: [
72   - 44.5.verticalSpace,
73   - Row(
74   - children: [
75   - Image.asset(
76   - 'phone'.assetPng,
77   - height: 45.h,
78   - width: 35.w,
79   - ),
80   - 15.horizontalSpace,
81   - Expanded(
82   - child: TextFieldCustomerWidget(
83   - height: 50.h,
84   - hitText: '请输入当前手机号',
85   - textInputType: TextInputType.phone,
86   - bgImageName: 'Input_layer_up',
87   - onChangeValue: (String value) {
88   - bloc.add(PhoneNumChangeEvent());
89   - },
90   - controller: bloc.phoneNumController,
91   - )
92   - )
93   - ],
  84 + Image.asset(
  85 + 'phone'.assetPng,
  86 + height: 45.h,
  87 + width: 35.w,
94 88 ),
95   - 11.5.verticalSpace,
96   - Row(
97   - mainAxisAlignment: MainAxisAlignment.spaceBetween,
98   - children: [
99   - Image.asset(
100   - 'lock'.assetPng,
101   - height: 34.h,
102   - width: 31.w,
103   - ),
104   - 18.5.horizontalSpace,
105   - Expanded(
106   - child: TextFieldCustomerWidget(
107   - hitText: '请输入验证码',
108   - bgImageName: 'Input_layer_down',
109   - onChangeValue: (String value) {
110   - bloc.add(CheckCodeChangeEvent());
111   - },
112   - textInputType: TextInputType.emailAddress,
113   - controller: bloc.checkNumController,
114   - )
115   - ),
116   - 16.5.horizontalSpace,
117   - TimerWidget(
118   - pageType: 1,
119   - canSendSms: bloc.canSendSms,
120   - sendSmsEvent: () => bloc.add(SendSmsCodeEvent()),
121   - )
122   - ],
  89 + 15.horizontalSpace,
  90 + Expanded(
  91 + child: TextFieldCustomerWidget(
  92 + height: 50.h,
  93 + hitText: '请输入当前手机号',
  94 + textInputType: TextInputType.phone,
  95 + bgImageName: 'Input_layer_up',
  96 + onChangeValue: (String value) {
  97 + bloc.add(PhoneNumChangeEvent());
  98 + },
  99 + controller: bloc.phoneNumController,
  100 + ))
  101 + ],
  102 + ),
  103 + 11.5.verticalSpace,
  104 + Row(
  105 + mainAxisAlignment: MainAxisAlignment.spaceBetween,
  106 + children: [
  107 + Image.asset(
  108 + 'lock'.assetPng,
  109 + height: 34.h,
  110 + width: 31.w,
  111 + ),
  112 + 18.5.horizontalSpace,
  113 + Expanded(
  114 + child: TextFieldCustomerWidget(
  115 + hitText: '请输入验证码',
  116 + bgImageName: 'Input_layer_down',
  117 + onChangeValue: (String value) {
  118 + bloc.add(CheckCodeChangeEvent());
  119 + },
  120 + textInputType: TextInputType.emailAddress,
  121 + controller: bloc.checkNumController,
  122 + )),
  123 + 16.5.horizontalSpace,
  124 + TimerWidget(
  125 + pageType: 1,
  126 + canSendSms: bloc.canSendSms,
  127 + sendSmsEvent: () => bloc.add(SendSmsCodeEvent()),
123 128 )
124 129 ],
125 130 )
126   - ),
  131 + ],
  132 + )),
127 133 2.verticalSpace,
128 134 Image.asset(
129 135 'steven_bride'.assetPng,
... ... @@ -141,22 +147,13 @@ class _ForgetPasswordHomePageView extends StatelessWidget {
141 147 child: Container(
142 148 decoration: BoxDecoration(
143 149 image: DecorationImage(
144   - image: AssetImage(
145   - bloc.canSetPwd?'login_enter'.assetPng:'login_enter_dis'.assetPng
146   - ),
147   - fit: BoxFit.fill
148   - ),
149   - ),
150   - padding: EdgeInsets.symmetric(
151   - horizontal: 28.w,
152   - vertical: 14.h
  150 + image: AssetImage(bloc.canSetPwd ? 'login_enter'.assetPng : 'login_enter_dis'.assetPng),
  151 + fit: BoxFit.fill),
153 152 ),
  153 + padding: EdgeInsets.symmetric(horizontal: 28.w, vertical: 14.h),
154 154 child: Text(
155 155 '确定',
156   - style: TextStyle(
157   - fontSize: 16.sp,
158   - color: Colors.white
159   - ),
  156 + style: TextStyle(fontSize: 16.sp, color: Colors.white),
160 157 ),
161 158 ),
162 159 )
... ... @@ -167,6 +164,5 @@ class _ForgetPasswordHomePageView extends StatelessWidget {
167 164 ),
168 165 ),
169 166 );
170   - }
171   - );
172   -}
173 167 \ No newline at end of file
  168 + });
  169 +}
... ...
lib/pages/login/loginpage/bloc/login_bloc.dart
... ... @@ -2,12 +2,12 @@ import &#39;package:common_utils/common_utils.dart&#39;;
2 2 import 'package:flutter/cupertino.dart';
3 3 import 'package:flutter/foundation.dart';
4 4 import 'package:flutter_bloc/flutter_bloc.dart';
5   -import 'package:flutter_easyloading/flutter_easyloading.dart';
6 5 import 'package:wow_english/common/extension/string_extension.dart';
7 6 import 'package:wow_english/common/request/dao/user_dao.dart';
8 7 import 'package:wow_english/common/request/exception.dart';
9 8 import 'package:wow_english/models/user_entity.dart';
10 9 import 'package:wow_english/utils/loading.dart';
  10 +import 'package:wow_english/utils/toast_util.dart';
11 11  
12 12 part 'login_event.dart';
13 13 part 'login_state.dart';
... ... @@ -59,20 +59,19 @@ class LoginBloc extends Bloc&lt;LoginEvent, LoginState&gt; {
59 59 void _requestLoginApi(RequestLoginEvent event, Emitter<LoginState> emitter) async {
60 60 var phoneNumber = phoneNumController.text;
61 61 if (phoneNumber.isEmpty) {
62   - EasyLoading.showToast('号码不能为空');
  62 + showToast('号码不能为空');
63 63 return;
64 64 }
65 65  
66 66 var checkNumber = checkNumController.text;
67 67 if (checkNumber.isEmpty) {
68 68 var text = _isSmsLoginType ? '密码' : '验证码';
69   - EasyLoading.showToast('$text不能为空');
  69 + showToast('$text不能为空');
70 70 return;
71 71 }
72 72 var checkKey = _isSmsLoginType ? 'smsCode' : 'password';
73 73 var type = _isSmsLoginType ? 'sms_code' : 'pwd';
74 74  
75   -
76 75 try {
77 76 await loading(() async {
78 77 var user = await UserDao.login(phoneNumber, type, checkKey, checkNumber);
... ... @@ -85,7 +84,7 @@ class LoginBloc extends Bloc&lt;LoginEvent, LoginState&gt; {
85 84 if (kDebugMode) {
86 85 print(e);
87 86 }
88   - EasyLoading.showToast('登陆失败${(e as ApiException?)?.message?.prefixColon}');
  87 + showToast('登陆失败${(e as ApiException?)?.message?.prefixColon}');
89 88 }
90 89 }
91 90  
... ... @@ -93,7 +92,7 @@ class LoginBloc extends Bloc&lt;LoginEvent, LoginState&gt; {
93 92 void _requestSmsCodeApi(RequestSmsCodeEvent event, Emitter<LoginState> emitter) async {
94 93 final phoneNumber = phoneNumController.text;
95 94 if (!RegexUtil.isMobileExact(phoneNumber)) {
96   - EasyLoading.showToast('请检查手机号');
  95 + showToast('请检查手机号');
97 96 return;
98 97 }
99 98 try {
... ... @@ -105,7 +104,7 @@ class LoginBloc extends Bloc&lt;LoginEvent, LoginState&gt; {
105 104 if (kDebugMode) {
106 105 print(e);
107 106 }
108   - EasyLoading.showToast('获取验证码失败${(e as ApiException?)?.message?.prefixColon}');
  107 + showToast('获取验证码失败${(e as ApiException?)?.message?.prefixColon}');
109 108 }
110 109 }
111 110  
... ...
lib/pages/login/loginpage/login_page.dart
... ... @@ -3,6 +3,7 @@ import &#39;package:flutter/material.dart&#39;;
3 3 import 'package:flutter_bloc/flutter_bloc.dart';
4 4 import 'package:flutter_screenutil/flutter_screenutil.dart';
5 5 import 'package:wow_english/common/blocs/cachebloc/cache_bloc.dart';
  6 +import 'package:wow_english/common/core/app_consts.dart';
6 7 import 'package:wow_english/common/extension/string_extension.dart';
7 8 import 'package:wow_english/common/widgets/textfield_customer_widget.dart';
8 9 import 'package:wow_english/pages/login/loginpage/time_widget.dart';
... ... @@ -104,7 +105,7 @@ class _LoginPageView extends StatelessWidget {
104 105 recognizer: TapGestureRecognizer()
105 106 ..onTap = () {
106 107 Navigator.of(context).pushNamed(AppRouteName.webView, arguments: {
107   - 'urlStr': 'http://page.kouyuxingqiu.com/%E7%94%A8%E6%88%B7%E6%B3%A8%E5%86%8C%E5%8F%8A%E4%BD%BF%E7%94%A8APP%E9%9A%90%E7%A7%81%E5%8D%8F%E8%AE%AE.html',
  108 + 'urlStr': AppConsts.userPrivacyPolicyUrl,
108 109 'webViewTitle': '用户隐私协议'
109 110 });
110 111 }),
... ...
lib/pages/login/setpwd/bloc/set_pwd_bloc.dart
1 1 import 'package:flutter/cupertino.dart';
2 2 import 'package:flutter_bloc/flutter_bloc.dart';
3 3  
  4 +import '../set_pwd_page.dart';
  5 +
4 6 part 'set_pwd_event.dart';
5 7 part 'set_pwd_state.dart';
6 8  
7 9 class SetPwdBloc extends Bloc<SetPwdEvent, SetPwdState> {
8 10  
9 11 final String? phoneNumber;
10   - final String? code;
11   - final int? type;
  12 + final String? smsCode;
  13 + late final SetPwdPageType pageType;
12 14  
13 15 final TextEditingController passWordFirstController = TextEditingController();
14 16 final TextEditingController passWordSecondController = TextEditingController();
... ... @@ -35,7 +37,7 @@ class SetPwdBloc extends Bloc&lt;SetPwdEvent, SetPwdState&gt; {
35 37  
36 38 bool get ensure => _passwordCheck && _passwordEnsure;
37 39  
38   - SetPwdBloc(this.phoneNumber, this.code, this.type) : super(SetPwdInitial()) {
  40 + SetPwdBloc(this.phoneNumber, this.smsCode, this.pageType) : super(SetPwdInitial()) {
39 41 on<PwdEnsureEvent>(_pwdEnsureTextChange);
40 42 on<PwdCheckEvent>(_pwdCheckTextChange);
41 43 on<SetPasswordEvent>(_setPassword);
... ...
lib/pages/login/setpwd/set_pwd_page.dart
... ... @@ -7,27 +7,49 @@ import &#39;package:wow_english/route/route.dart&#39;;
7 7  
8 8 import 'bloc/set_pwd_bloc.dart';
9 9  
  10 +enum SetPwdPageType {
  11 + /// 第一次设置密码
  12 + setPwd,
  13 +
  14 + /// 忘记重设密码,必传手机号和验证码
  15 + resetPwd,
  16 +
  17 + /// 修改密码
  18 + changePwd,
  19 +}
10 20  
11 21 class SetPassWordPage extends StatelessWidget {
12   - const SetPassWordPage({super.key,this.phoneNum,this.code,this.type});
  22 + const SetPassWordPage({super.key, this.phoneNum, this.smsCode, required this.pageType});
  23 +
  24 + final SetPwdPageType pageType;
13 25 final String? phoneNum;
14   - final String? code;
15   - final int? type;
  26 + final String? smsCode;
16 27  
17 28 @override
18 29 Widget build(BuildContext context) {
19 30 return BlocProvider(
20   - create: (context) => SetPwdBloc(phoneNum,code,type),
  31 + create: (context) => SetPwdBloc(phoneNum, smsCode, pageType),
21 32 child: _SetPassWordPageView(),
22 33 );
23 34 }
  35 +
  36 + static push(BuildContext context, SetPwdPageType pageType, {String? phoneNum, String? smsCode}) {
  37 + Navigator.of(context).pushNamed(AppRouteName.setPwd, arguments: {
  38 + 'pageType': pageType,
  39 + 'phoneNum': phoneNum,
  40 + 'smsCode': smsCode,
  41 + });
  42 + }
24 43 }
25 44  
26 45 class _SetPassWordPageView extends StatelessWidget {
  46 + late final SetPwdBloc bloc;
  47 +
27 48 @override
28 49 Widget build(BuildContext context) {
  50 + bloc = BlocProvider.of<SetPwdBloc>(context);
29 51 return BlocListener<SetPwdBloc, SetPwdState>(
30   - listener: (context, s){
  52 + listener: (context, s) {
31 53 if (s is PasswordSetSuccessState) {
32 54 Navigator.of(context).pushNamedAndRemoveUntil(AppRouteName.home, (route) => false);
33 55 }
... ... @@ -36,9 +58,22 @@ class _SetPassWordPageView extends StatelessWidget {
36 58 );
37 59 }
38 60  
39   - Widget _buildSetPwdView() => BlocBuilder<SetPwdBloc, SetPwdState>(
40   - builder: (context, state) {
41   - final bloc = BlocProvider.of<SetPwdBloc>(context);
  61 + String _getTipsText() {
  62 + String text = '';
  63 +
  64 + switch (bloc.pageType) {
  65 + case SetPwdPageType.setPwd:
  66 + text = '欢迎登录wow english\n接下来请设置一下您的密码吧!';
  67 + break;
  68 + case SetPwdPageType.resetPwd:
  69 + case SetPwdPageType.changePwd:
  70 + text = '修改密码\n接下来请设置一下您的新密码吧!';
  71 + break;
  72 + }
  73 + return text;
  74 + }
  75 +
  76 + Widget _buildSetPwdView() => BlocBuilder<SetPwdBloc, SetPwdState>(builder: (context, state) {
42 77 return Scaffold(
43 78 body: Container(
44 79 color: Colors.white,
... ... @@ -59,11 +94,8 @@ class _SetPassWordPageView extends StatelessWidget {
59 94 ),
60 95 12.5.horizontalSpace,
61 96 Text(
62   - '欢迎登录wow english\n接下来请设置一下您的密码吧!',
63   - style: TextStyle(
64   - fontSize: 16.5.sp,
65   - color: const Color(0xFF666666)
66   - ),
  97 + _getTipsText(),
  98 + style: TextStyle(fontSize: 16.5.sp, color: const Color(0xFF666666)),
67 99 )
68 100 ],
69 101 ),
... ... @@ -79,20 +111,19 @@ class _SetPassWordPageView extends StatelessWidget {
79 111 children: [
80 112 Expanded(
81 113 child: TextFieldCustomerWidget(
82   - height: 55.h,
83   - hitText: '请输入八位以上密码',
84   - bgImageName: 'Input_layer_up',
85   - controller: bloc.passWordFirstController,
86   - obscureText: true,
87   - textInputType: TextInputType.emailAddress,
88   - onChangeValue: (String value) => bloc.add(PwdEnsureEvent()),
89   - )
90   - ),
  114 + height: 55.h,
  115 + hitText: '请输入八位以上密码',
  116 + bgImageName: 'Input_layer_up',
  117 + controller: bloc.passWordFirstController,
  118 + obscureText: true,
  119 + textInputType: TextInputType.emailAddress,
  120 + onChangeValue: (String value) => bloc.add(PwdEnsureEvent()),
  121 + )),
91 122 10.horizontalSpace,
92 123 Opacity(
93   - opacity: bloc.showPwdIcon?1:0,
  124 + opacity: bloc.showPwdIcon ? 1 : 0,
94 125 child: Image.asset(
95   - bloc.passwordEnsure?'login_pass'.assetPng:'login_error'.assetPng,
  126 + bloc.passwordEnsure ? 'login_pass'.assetPng : 'login_error'.assetPng,
96 127 height: 30,
97 128 width: 30,
98 129 ),
... ... @@ -109,20 +140,19 @@ class _SetPassWordPageView extends StatelessWidget {
109 140 children: [
110 141 Expanded(
111 142 child: TextFieldCustomerWidget(
112   - height: 55.h,
113   - hitText: '请再次输入相同密码',
114   - bgImageName: 'Input_layer_up',
115   - obscureText: true,
116   - textInputType: TextInputType.emailAddress,
117   - controller: bloc.passWordSecondController,
118   - onChangeValue: (String value) => bloc.add(PwdCheckEvent()),
119   - )
120   - ),
  143 + height: 55.h,
  144 + hitText: '请再次输入相同密码',
  145 + bgImageName: 'Input_layer_up',
  146 + obscureText: true,
  147 + textInputType: TextInputType.emailAddress,
  148 + controller: bloc.passWordSecondController,
  149 + onChangeValue: (String value) => bloc.add(PwdCheckEvent()),
  150 + )),
121 151 10.horizontalSpace,
122 152 Opacity(
123   - opacity: bloc.showCheckPwdIcon?1:0,
  153 + opacity: bloc.showCheckPwdIcon ? 1 : 0,
124 154 child: Image.asset(
125   - bloc.passwordCheck?'login_pass'.assetPng:'login_error'.assetPng,
  155 + bloc.passwordCheck ? 'login_pass'.assetPng : 'login_error'.assetPng,
126 156 height: 30,
127 157 width: 30,
128 158 ),
... ... @@ -134,10 +164,7 @@ class _SetPassWordPageView extends StatelessWidget {
134 164 offstage: bloc.passwordCheck,
135 165 child: Text(
136 166 '请确认两次输入的密码是否一致',
137   - style: TextStyle(
138   - fontSize: 16.sp,
139   - color: const Color(0xFF333333)
140   - ),
  167 + style: TextStyle(fontSize: 16.sp, color: const Color(0xFF333333)),
141 168 ),
142 169 ),
143 170 Row(
... ... @@ -154,21 +181,13 @@ class _SetPassWordPageView extends StatelessWidget {
154 181 decoration: BoxDecoration(
155 182 image: DecorationImage(
156 183 image: AssetImage(
157   - bloc.ensure?'login_enter'.assetPng:'login_enter_dis'.assetPng
158   - ),
159   - fit: BoxFit.fill
160   - ),
161   - ),
162   - padding: EdgeInsets.symmetric(
163   - horizontal: 28.w,
164   - vertical: 14.h
  184 + bloc.ensure ? 'login_enter'.assetPng : 'login_enter_dis'.assetPng),
  185 + fit: BoxFit.fill),
165 186 ),
  187 + padding: EdgeInsets.symmetric(horizontal: 28.w, vertical: 14.h),
166 188 child: Text(
167 189 '确定',
168   - style: TextStyle(
169   - color: Colors.white,
170   - fontSize: 16.sp
171   - ),
  190 + style: TextStyle(color: Colors.white, fontSize: 16.sp),
172 191 ),
173 192 ),
174 193 ),
... ... @@ -194,6 +213,5 @@ class _SetPassWordPageView extends StatelessWidget {
194 213 ),
195 214 ),
196 215 );
197   - }
198   - );
199   -}
200 216 \ No newline at end of file
  217 + });
  218 +}
... ...
lib/pages/repeatafter/bloc/repeat_after_bloc.dart
1 1 import 'package:flutter/cupertino.dart';
2 2 import 'package:flutter_bloc/flutter_bloc.dart';
3   -import 'package:flutter_easyloading/flutter_easyloading.dart';
4 3 import 'package:wow_english/common/request/dao/listen_dao.dart';
5 4 import 'package:wow_english/common/request/exception.dart';
6 5 import 'package:wow_english/models/follow_read_entity.dart';
7 6 import 'package:wow_english/utils/loading.dart';
  7 +import 'package:wow_english/utils/toast_util.dart';
8 8  
9 9 part 'repeat_after_event.dart';
10 10 part 'repeat_after_state.dart';
11 11  
12 12 class RepeatAfterBloc extends Bloc<RepeatAfterEvent, RepeatAfterState> {
13   -
14 13 List<FollowReadEntity?> _listData = [];
  14 +
15 15 List<FollowReadEntity?> get listData => _listData;
16 16  
17 17 RepeatAfterBloc() : super(RepeatAfterInitial()) {
18 18 on<RequestDataEvent>(_requestData);
19 19 }
20 20  
21   -
22 21 void _requestData(RequestDataEvent event, Emitter<RepeatAfterState> emitter) async {
23 22 try {
24 23 await loading(() async {
25   - _listData = await ListenDao.followRead()??[];
  24 + _listData = await ListenDao.followRead() ?? [];
26 25 emitter(RequestDataState());
27 26 });
28 27 } catch (e) {
29 28 if (e is ApiException) {
30   - EasyLoading.showToast(e.message??'请求失败,请检查网络连接');
  29 + showToast(e.message ?? '请求失败,请检查网络连接');
31 30 }
32 31 }
33 32 }
... ...
lib/pages/repeatafter/repeat_after_page.dart
1 1 import 'package:flutter/material.dart';
2 2 import 'package:flutter_bloc/flutter_bloc.dart';
3   -import 'package:flutter_easyloading/flutter_easyloading.dart';
4 3 import 'package:wow_english/common/widgets/we_app_bar.dart';
5 4 import 'package:wow_english/models/follow_read_entity.dart';
6 5 import 'package:wow_english/pages/repeatafter/widgets/repeat_after_item.dart';
  6 +import 'package:wow_english/utils/toast_util.dart';
7 7  
8 8 import 'bloc/repeat_after_bloc.dart';
9 9  
... ... @@ -25,7 +25,7 @@ class _RepeatAfterPageView extends StatelessWidget {
25 25 return BlocListener<RepeatAfterBloc, RepeatAfterState>(
26 26 listener: (context, state) {
27 27 if (state is RequestDataState) {
28   - EasyLoading.showToast('网络请求结束');
  28 + showToast('网络请求结束');
29 29 }
30 30 },
31 31 child: _repeatAfterView(),
... ... @@ -33,32 +33,29 @@ class _RepeatAfterPageView extends StatelessWidget {
33 33 }
34 34  
35 35 Widget _repeatAfterView() => BlocBuilder<RepeatAfterBloc, RepeatAfterState>(
36   - builder: (context, state) {
37   - final bloc = BlocProvider.of<RepeatAfterBloc>(context);
38   - return Scaffold(
39   - appBar: const WEAppBar(
40   - titleText: '视频跟读',
41   - centerTitle: false,
42   - ),
43   - body: SafeArea(
44   - child: Container(
45   - alignment: Alignment.center,
46   - child: ListView.builder(
47   - itemCount: bloc.listData.length,
48   - scrollDirection: Axis.horizontal,
49   - itemBuilder: (BuildContext context,int index){
50   - FollowReadEntity? entity = bloc.listData[index];
51   - return RepeatAfterItem(
52   - tapEvent: () {
53   -
54   - },
55   - entity: entity,
56   - );
57   - }),
58   - ),
59   - ),
  36 + builder: (context, state) {
  37 + final bloc = BlocProvider.of<RepeatAfterBloc>(context);
  38 + return Scaffold(
  39 + appBar: const WEAppBar(
  40 + titleText: '视频跟读',
  41 + centerTitle: false,
  42 + ),
  43 + body: SafeArea(
  44 + child: Container(
  45 + alignment: Alignment.center,
  46 + child: ListView.builder(
  47 + itemCount: bloc.listData.length,
  48 + scrollDirection: Axis.horizontal,
  49 + itemBuilder: (BuildContext context, int index) {
  50 + FollowReadEntity? entity = bloc.listData[index];
  51 + return RepeatAfterItem(
  52 + tapEvent: () {},
  53 + entity: entity,
  54 + );
  55 + }),
  56 + ),
  57 + ),
  58 + );
  59 + },
60 60 );
61   - },
62   - );
63 61 }
64   -
... ...
lib/pages/shop/exchane/exchange_lesson_page.dart
1 1 import 'package:flutter/material.dart';
2 2 import 'package:flutter_bloc/flutter_bloc.dart';
3   -import 'package:flutter_easyloading/flutter_easyloading.dart';
4 3 import 'package:flutter_screenutil/flutter_screenutil.dart';
5 4 import 'package:wow_english/common/extension/string_extension.dart';
6 5 import 'package:wow_english/common/widgets/textfield_customer_widget.dart';
7 6 import 'package:wow_english/route/route.dart';
  7 +import 'package:wow_english/utils/toast_util.dart';
8 8  
9 9 import 'bloc/exchange_lesson_bloc.dart';
10 10  
... ... @@ -23,11 +23,11 @@ class ExchangeLessonPage extends StatelessWidget {
23 23 class _ExchangeLessonPage extends StatelessWidget {
24 24 @override
25 25 Widget build(BuildContext context) {
26   - return BlocListener<ExchangeLessonBloc,ExchangeLessonState>(
27   - listener: (context, state){
  26 + return BlocListener<ExchangeLessonBloc, ExchangeLessonState>(
  27 + listener: (context, state) {
28 28 if (state is CheckCodeResultState) {
29   - String title = state.result?'兑换成功':'兑换失败';
30   - EasyLoading.showToast(title);
  29 + String title = state.result ? '兑换成功' : '兑换失败';
  30 + showToast(title);
31 31 Navigator.of(context).pushNamed(AppRouteName.exList);
32 32 }
33 33 },
... ... @@ -35,8 +35,7 @@ class _ExchangeLessonPage extends StatelessWidget {
35 35 );
36 36 }
37 37  
38   - Widget _exchangeLessonPageView() => BlocBuilder<ExchangeLessonBloc,ExchangeLessonState>(
39   - builder: (context, state){
  38 + Widget _exchangeLessonPageView() => BlocBuilder<ExchangeLessonBloc, ExchangeLessonState>(builder: (context, state) {
40 39 final bloc = BlocProvider.of<ExchangeLessonBloc>(context);
41 40 return Scaffold(
42 41 resizeToAvoidBottomInset: false,
... ... @@ -47,9 +46,7 @@ class _ExchangeLessonPage extends StatelessWidget {
47 46 children: [
48 47 10.5.verticalSpace,
49 48 Padding(
50   - padding: EdgeInsets.symmetric(
51   - horizontal: 15.w
52   - ),
  49 + padding: EdgeInsets.symmetric(horizontal: 15.w),
53 50 child: Row(
54 51 mainAxisAlignment: MainAxisAlignment.spaceBetween,
55 52 crossAxisAlignment: CrossAxisAlignment.start,
... ... @@ -62,7 +59,7 @@ class _ExchangeLessonPage extends StatelessWidget {
62 59 ),
63 60 color: Colors.white,
64 61 onPressed: () {
65   - Navigator.pop(context);
  62 + Navigator.pop(context);
66 63 },
67 64 ),
68 65 Image.asset(
... ... @@ -70,9 +67,7 @@ class _ExchangeLessonPage extends StatelessWidget {
70 67 width: 139.w,
71 68 height: 81.h,
72 69 ),
73   - SizedBox.fromSize(
74   - size: const Size(40.0, 40.0)
75   - )
  70 + SizedBox.fromSize(size: const Size(40.0, 40.0))
76 71 ],
77 72 ),
78 73 ),
... ... @@ -102,19 +97,13 @@ class _ExchangeLessonPage extends StatelessWidget {
102 97 child: Container(
103 98 decoration: BoxDecoration(
104 99 image: DecorationImage(
105   - image: AssetImage(
106   - bloc.checkCode ? 'ex_sure'.assetPng:'ex_dis'.assetPng
107   - ),
108   - fit: BoxFit.fill
109   - ),
  100 + image: AssetImage(bloc.checkCode ? 'ex_sure'.assetPng : 'ex_dis'.assetPng),
  101 + fit: BoxFit.fill),
110 102 ),
111   - padding: EdgeInsets.symmetric(horizontal:27.w,vertical: 14.h),
  103 + padding: EdgeInsets.symmetric(horizontal: 27.w, vertical: 14.h),
112 104 child: Text(
113 105 '兑换',
114   - style: TextStyle(
115   - fontSize: 16.sp,
116   - color: Colors.white
117   - ),
  106 + style: TextStyle(fontSize: 16.sp, color: Colors.white),
118 107 ),
119 108 ),
120 109 )
... ... @@ -130,4 +119,4 @@ class _ExchangeLessonPage extends StatelessWidget {
130 119 ),
131 120 );
132 121 });
133   -}
134 122 \ No newline at end of file
  123 +}
... ...
lib/pages/shop/home/shop_home_page.dart
1 1 import 'package:flutter/material.dart';
2 2 import 'package:flutter_bloc/flutter_bloc.dart';
3   -import 'package:flutter_easyloading/flutter_easyloading.dart';
4 3 import 'package:flutter_screenutil/flutter_screenutil.dart';
5 4 import 'package:wow_english/common/extension/string_extension.dart';
6 5 import 'package:wow_english/common/widgets/we_app_bar.dart';
7 6 import 'package:wow_english/pages/shop/home/widgets/lesson_card_item.dart';
8 7 import 'package:wow_english/route/route.dart';
  8 +import 'package:wow_english/utils/toast_util.dart';
9 9  
10 10 import 'bloc/shop_home_bloc.dart';
11 11  
... ... @@ -24,59 +24,58 @@ class ShopHomePage extends StatelessWidget {
24 24 class _ShopHomeView extends StatelessWidget {
25 25 @override
26 26 Widget build(BuildContext context) {
27   - return BlocListener<ShopHomeBloc,ShopHomeState>(
  27 + return BlocListener<ShopHomeBloc, ShopHomeState>(
28 28 listener: (context, state) {},
29 29 child: _shopHomeWidget(),
30 30 );
31 31 }
32 32  
33   - Widget _shopHomeWidget() => BlocBuilder<ShopHomeBloc,ShopHomeState>(builder: (context, state){
34   - return Scaffold(
35   - appBar: WEAppBar(
36   - actions: [
37   - IconButton(
38   - icon: Image.asset(
39   - 'check_lesson'.assetPng,
40   - width: 40,
41   - height: 40,
42   - ),
43   - color: Colors.white,
44   - onPressed: () {
45   - Navigator.of(context).pushNamed(AppRouteName.exLesson);
46   - },
  33 + Widget _shopHomeWidget() => BlocBuilder<ShopHomeBloc, ShopHomeState>(builder: (context, state) {
  34 + return Scaffold(
  35 + appBar: WEAppBar(
  36 + actions: [
  37 + IconButton(
  38 + icon: Image.asset(
  39 + 'check_lesson'.assetPng,
  40 + width: 40,
  41 + height: 40,
  42 + ),
  43 + color: Colors.white,
  44 + onPressed: () {
  45 + Navigator.of(context).pushNamed(AppRouteName.exLesson);
  46 + },
  47 + ),
  48 + IconButton(
  49 + icon: Image.asset(
  50 + 'shop'.assetPng,
  51 + width: 40,
  52 + height: 40,
  53 + ),
  54 + color: Colors.white,
  55 + onPressed: () {
  56 + showToast('购前须知');
  57 + },
  58 + )
  59 + ],
47 60 ),
48   - IconButton(
49   - icon: Image.asset(
50   - 'shop'.assetPng,
51   - width: 40,
52   - height: 40,
  61 + body: Center(
  62 + child: Padding(
  63 + padding: EdgeInsets.symmetric(vertical: 25.h, horizontal: 25.w),
  64 + child: GridView.builder(
  65 + itemCount: 4,
  66 + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
  67 + crossAxisCount: 2,
  68 + childAspectRatio: 2,
  69 + mainAxisSpacing: 14.h,
  70 + crossAxisSpacing: 4.5.w,
  71 + ),
  72 + itemBuilder: (BuildContext context, int index) {
  73 + return LessonCardItem(onTap: () {
  74 + showToast('购买');
  75 + });
  76 + }),
53 77 ),
54   - color: Colors.white,
55   - onPressed: () {
56   - EasyLoading.showToast('购前须知');
57   - },
58   - )
59   - ],
60   - ),
61   - body: Center(
62   - child: Padding(
63   - padding: EdgeInsets.symmetric(vertical: 25.h,horizontal: 25.w),
64   - child: GridView.builder(
65   - itemCount: 4,
66   - gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
67   - crossAxisCount: 2,
68   - childAspectRatio: 2,
69   - mainAxisSpacing: 14.h,
70   - crossAxisSpacing : 4.5.w,
71   - ),
72   - itemBuilder: (BuildContext context,int index){
73   - return LessonCardItem(
74   - onTap: (){
75   - EasyLoading.showToast('购买');
76   - });
77   - }),
78   - ),
79   - ),
80   - );
81   - });
82   -}
83 78 \ No newline at end of file
  79 + ),
  80 + );
  81 + });
  82 +}
... ...
lib/pages/user/bloc/user_bloc.dart
1   -import 'package:bloc/bloc.dart';
2   -import 'package:meta/meta.dart';
  1 +import 'package:flutter_bloc/flutter_bloc.dart';
3 2 import 'package:wow_english/common/request/dao/user_dao.dart';
4 3  
5 4 part 'user_event.dart';
... ... @@ -7,13 +6,10 @@ part &#39;user_state.dart&#39;;
7 6  
8 7 class UserBloc extends Bloc<UserEvent, UserState> {
9 8 UserBloc() : super(UserInitial()) {
10   - on<UserLogout>(_test);
11   - on<UserEvent>((event, emit) {
12   - // TODO: implement event handler
13   - });
  9 + on<UserLogout>(_logout);
14 10 }
15 11  
16   - void _test(UserLogout event, Emitter<UserState> emitter) async {
  12 + void _logout(UserLogout event, Emitter<UserState> emitter) async {
17 13 print('UserBloc._test, event: $event, emitter: $emitter');
18 14 await UserDao.logout();
19 15 }
... ...
lib/pages/user/bloc/user_event.dart
1 1 part of 'user_bloc.dart';
2 2  
3   -@immutable
4   -abstract class UserEvent {}
  3 +sealed class UserEvent {}
5 4  
6 5 class UserStarted extends UserEvent {}
7 6  
... ...
lib/pages/user/bloc/user_state.dart
1 1 part of 'user_bloc.dart';
2 2  
3   -@immutable
4   -abstract class UserState {}
  3 +sealed class UserState {}
5 4  
6 5 class UserInitial extends UserState {}
  6 +
  7 +class UserInfoUpdated extends UserState {}
... ...
lib/pages/user/user_page.dart
... ... @@ -2,12 +2,14 @@ import &#39;package:flutter/material.dart&#39;;
2 2 import 'package:flutter_bloc/flutter_bloc.dart';
3 3 import 'package:flutter_screenutil/flutter_screenutil.dart';
4 4 import 'package:wow_english/common/blocs/cachebloc/cache_bloc.dart';
  5 +import 'package:wow_english/common/core/app_consts.dart';
5 6 import 'package:wow_english/common/core/assets_const.dart';
6   -import 'package:wow_english/common/widgets/ow_image_widget.dart';
7 7 import 'package:wow_english/common/widgets/we_app_bar.dart';
8 8 import 'package:wow_english/models/user_entity.dart';
  9 +import 'package:wow_english/pages/login/setpwd/set_pwd_page.dart';
9 10 import 'package:wow_english/pages/user/bloc/user_bloc.dart';
10 11 import 'package:wow_english/route/route.dart';
  12 +import 'package:wow_english/utils/image_util.dart';
11 13  
12 14 class UserPage extends StatelessWidget {
13 15 const UserPage({super.key});
... ... @@ -26,152 +28,162 @@ class _UserView extends StatelessWidget {
26 28  
27 29 @override
28 30 Widget build(BuildContext context) {
29   - final cacheBloc = BlocProvider.of<CacheBloc>(context);
30   - final userBloc = BlocProvider.of<UserBloc>(context);
31   - UserEntity user = cacheBloc.userEntity!;
  31 + return _pageWidget();
  32 + }
32 33  
33   - // 常规按钮的字体样式
34   - final textStyle21sp = TextStyle(
35   - //fontWeight: FontWeight.w600,
36   - color: const Color(0xFF333333),
37   - fontSize: 21.sp,
38   - );
  34 + Widget _pageWidget() => BlocBuilder<UserBloc, UserState>(
  35 + /*buildWhen: (previous, current) {
  36 + return current != previous;
  37 + },*/
  38 + builder: (context, state) {
  39 + final cacheBloc = BlocProvider.of<CacheBloc>(context);
  40 + UserEntity user = cacheBloc.userEntity!;
  41 + final userBloc = BlocProvider.of<UserBloc>(context);
39 42  
40   - // 常规按钮的样式
41   - var normalButtonStyle = ButtonStyle(
42   - side: MaterialStateProperty.all(BorderSide(color: const Color(0xFF140C10), width: 1.5)),
43   - shape: MaterialStateProperty.all(RoundedRectangleBorder(borderRadius: BorderRadius.circular(15.r))),
44   - minimumSize: MaterialStateProperty.all(Size(double.infinity, 58.h)),
45   - backgroundColor: MaterialStateProperty.all(Colors.white),
46   - );
47   - return Scaffold(
48   - backgroundColor: Colors.white,
49   - appBar: const WEAppBar(),
50   - body: SingleChildScrollView(
51   - //padding: EdgeInsets.symmetric(horizontal: 17.w),
52   - padding: EdgeInsets.only(left: 17.w, right: 17.w, top: 10.h, bottom: 22.h),
53   - child: Column(
54   - mainAxisAlignment: MainAxisAlignment.center,
55   - children: <Widget>[
56   - Container(child: Image.asset(AssetsConst.wowLogo), constraints: BoxConstraints(maxHeight: 196.h)),
57   - 30.verticalSpace,
58   - Row(
59   - mainAxisAlignment: MainAxisAlignment.spaceBetween,
60   - children: [
61   - CircleAvatar(
62   - radius: 40.r,
63   - backgroundColor: Color(0xFF140C10),
64   - /*child: CircleAvatar(
65   - radius: 38.5.r,
66   - backgroundImage: ImageUtil.getImageProviderOnDefault(user.avatarUrl),
67   - ),*/
68   - child: ClipOval(
69   - child: OwImageWidget(name: user.avatarUrl ?? AssetsConst.wowLogo),
70   - )),
71   - 32.horizontalSpace,
72   - Expanded(
73   - child: Column(
74   - children: [
75   - Row(
76   - children: [
77   - LimitedBox(
78   - maxWidth: 220.w,
79   - child: Text(
80   - user.name,
81   - //'1231231231312312312312312312312312312312312312312',
82   - style: textStyle21sp,
83   - overflow: TextOverflow.ellipsis,
84   - ),
85   - ),
86   - 14.horizontalSpace,
87   - Text(
88   - user.getGenderString(),
89   - style: textStyle21sp,
90   - ),
91   - 14.horizontalSpace,
92   - Offstage(
93   - offstage: user.effectiveDate == null,
94   - child: Image.asset(
95   - AssetsConst.icVip,
96   - height: 18.h,
97   - ),
98   - )
99   - ],
  43 + // 常规按钮的字体样式
  44 + final textStyle21sp = TextStyle(
  45 + //fontWeight: FontWeight.w600,
  46 + color: const Color(0xFF333333),
  47 + fontSize: 21.sp,
  48 + );
  49 +
  50 + // 常规按钮的样式
  51 + var normalButtonStyle = ButtonStyle(
  52 + side: MaterialStateProperty.all(BorderSide(color: const Color(0xFF140C10), width: 1.5.w)),
  53 + shape: MaterialStateProperty.all(RoundedRectangleBorder(borderRadius: BorderRadius.circular(15.r))),
  54 + minimumSize: MaterialStateProperty.all(Size(double.infinity, 58.h)),
  55 + backgroundColor: MaterialStateProperty.all(Colors.white),
  56 + );
  57 +
  58 + return Scaffold(
  59 + backgroundColor: Colors.white,
  60 + appBar: const WEAppBar(),
  61 + body: SingleChildScrollView(
  62 + padding: EdgeInsets.only(left: 17.w, right: 17.w, top: 10.h, bottom: 22.h),
  63 + child: Column(
  64 + mainAxisAlignment: MainAxisAlignment.center,
  65 + children: <Widget>[
  66 + // banner
  67 + Container(child: Image.asset(AssetsConst.wowLogo), constraints: BoxConstraints(maxHeight: 196.h)),
  68 + 30.verticalSpace,
  69 + Row(
  70 + mainAxisAlignment: MainAxisAlignment.spaceBetween,
  71 + children: [
  72 + CircleAvatar(
  73 + radius: 40.r,
  74 + backgroundColor: Color(0xFF140C10),
  75 + child: CircleAvatar(
  76 + radius: 38.5.r,
  77 + backgroundImage: ImageUtil.getImageProviderOnDefault(user.avatarUrl),
100 78 ),
101   - Offstage(
102   - offstage: user.effectiveDate == null,
103   - child: Row(
  79 + /*child: ClipOval(
  80 + child: OwImageWidget(name: user.avatarUrl ?? AssetsConst.wowLogo, fit: BoxFit.contain,),
  81 + )*/
  82 + ),
  83 + 32.horizontalSpace,
  84 + Expanded(
  85 + child: Column(
  86 + children: [
  87 + Row(
104 88 children: [
  89 + LimitedBox(
  90 + maxWidth: 220.w,
  91 + child: Text(
  92 + user.name,
  93 + //'1231231231312312312312312312312312312312312312312',
  94 + style: textStyle21sp,
  95 + overflow: TextOverflow.ellipsis,
  96 + ),
  97 + ),
  98 + 14.horizontalSpace,
105 99 Text(
106   - "${user.effectiveDate} 到期",
107   - style: TextStyle(
108   - color: const Color(0xFFE11212),
109   - fontSize: 17.sp,
  100 + user.getGenderString(),
  101 + style: textStyle21sp,
  102 + ),
  103 + 14.horizontalSpace,
  104 + Offstage(
  105 + offstage: user.effectiveDate == null,
  106 + child: Image.asset(
  107 + AssetsConst.icVip,
  108 + height: 18.h,
110 109 ),
111 110 )
112 111 ],
113 112 ),
114   - )
115   - ],
116   - )),
117   - TextButton(
118   - child: Text(
119   - "修改个人信息>",
120   - style: textStyle21sp,
  113 + Offstage(
  114 + offstage: user.effectiveDate == null,
  115 + child: Row(
  116 + children: [
  117 + Text(
  118 + "${user.effectiveDate} 到期",
  119 + style: TextStyle(
  120 + color: const Color(0xFFE11212),
  121 + fontSize: 17.sp,
  122 + ),
  123 + )
  124 + ],
  125 + ),
  126 + )
  127 + ],
  128 + )),
  129 + TextButton(
  130 + child: Text(
  131 + "修改个人信息>",
  132 + style: textStyle21sp,
  133 + ),
  134 + onPressed: () {},
  135 + )
  136 + ],
121 137 ),
122   - onPressed: () {},
123   - )
124   - ],
125   - ),
126   - 30.verticalSpace,
127   - OutlinedButton(
128   - onPressed: () => {},
129   - style: normalButtonStyle,
130   - child: Text(
131   - "修改密码",
132   - style: textStyle21sp,
133   - ),
134   - ),
135   - 12.verticalSpace,
136   - OutlinedButton(
137   - onPressed: () => {},
138   - style: normalButtonStyle,
139   - child: Text(
140   - "兑换课程",
141   - style: textStyle21sp,
142   - )),
143   - 12.verticalSpace,
144   - OutlinedButton(
145   - onPressed: () => {
146   - Navigator.of(context).pushNamed(AppRouteName.webView, arguments: {
147   - 'urlStr': 'http://page.kouyuxingqiu.com/%E7%94%A8%E6%88%B7%E6%B3%A8%E5%86%8C%E5%8F%8A%E4%BD%BF%E7%94%A8APP%E9%9A%90%E7%A7%81%E5%8D%8F%E8%AE%AE.html',
148   - 'webViewTitle': '隐私协议'
149   - })
150   - },
151   - style: normalButtonStyle,
152   - child: Text(
153   - "隐私协议",
154   - style: textStyle21sp,
155   - )),
156   - 30.verticalSpace,
157   - OutlinedButton(
158   - onPressed: () => {userBloc.add(UserLogout())},
159   - style: ButtonStyle(
160   - side: MaterialStateProperty.all(BorderSide(color: const Color(0xFF140C10), width: 1.5)),
161   - shape: MaterialStateProperty.all(RoundedRectangleBorder(borderRadius: BorderRadius.circular(15.r))),
162   - minimumSize: MaterialStateProperty.all(Size(295.w, 40.h)),
163   - backgroundColor: MaterialStateProperty.all(Color(0xFFFBB621)),
164   - ),
165   - child: Text(
166   - "退出登陆",
167   - style: TextStyle(
168   - //fontWeight: FontWeight.w600,
169   - color: Colors.white,
170   - fontSize: 17.sp,
  138 + 30.verticalSpace,
  139 + OutlinedButton(
  140 + onPressed: () => SetPassWordPage.push(context, SetPwdPageType.changePwd),
  141 + style: normalButtonStyle,
  142 + child: Text(
  143 + "修改密码",
  144 + style: textStyle21sp,
  145 + ),
171 146 ),
172   - )),
173   - ],
174   - ),
175   - ));
176   - }
  147 + 12.verticalSpace,
  148 + OutlinedButton(
  149 + onPressed: () => {},
  150 + style: normalButtonStyle,
  151 + child: Text(
  152 + "兑换课程",
  153 + style: textStyle21sp,
  154 + )),
  155 + 12.verticalSpace,
  156 + OutlinedButton(
  157 + onPressed: () => {
  158 + Navigator.of(context).pushNamed(AppRouteName.webView,
  159 + arguments: {'urlStr': AppConsts.userPrivacyPolicyUrl, 'webViewTitle': '隐私协议'})
  160 + },
  161 + style: normalButtonStyle,
  162 + child: Text(
  163 + "隐私协议",
  164 + style: textStyle21sp,
  165 + )),
  166 + 30.verticalSpace,
  167 + OutlinedButton(
  168 + onPressed: () => {userBloc.add(UserLogout())},
  169 + style: ButtonStyle(
  170 + side: MaterialStateProperty.all(BorderSide(color: const Color(0xFF140C10), width: 1.5)),
  171 + shape: MaterialStateProperty.all(
  172 + RoundedRectangleBorder(borderRadius: BorderRadius.circular(15.r))),
  173 + minimumSize: MaterialStateProperty.all(Size(295.w, 40.h)),
  174 + backgroundColor: MaterialStateProperty.all(Color(0xFFFBB621)),
  175 + ),
  176 + child: Text(
  177 + "退出登陆",
  178 + style: TextStyle(
  179 + //fontWeight: FontWeight.w600,
  180 + color: Colors.white,
  181 + fontSize: 17.sp,
  182 + ),
  183 + )),
  184 + ],
  185 + ),
  186 + ));
  187 + },
  188 + );
177 189 }
... ...
lib/route/route.dart
... ... @@ -24,6 +24,8 @@ class AppRouteName {
24 24 static const String login = 'login';
25 25 static const String home = 'home';
26 26 static const String fogPwd = 'fogPwd';
  27 +
  28 + /// 设置密码,修改密码;不要自己调用,使用[SetPassWordPage.push]方法
27 29 static const String setPwd = 'setPwd';
28 30 static const String webView = 'webView';
29 31 static const String lesson = 'lesson';
... ... @@ -39,7 +41,9 @@ class AppRouteName {
39 41 static const String voiceAnswer = 'voiceAnswer';
40 42 static const String user = 'user';
41 43 static const String lookVideo = 'lookVideo';
42   - static const String reading = 'reading'; ///绘本
  44 + static const String reading = 'reading';
  45 +
  46 + ///绘本
43 47 static const String tab = '/';
44 48 }
45 49  
... ... @@ -64,7 +68,10 @@ class AppRouter {
64 68 if (settings.arguments != null) {
65 69 moduleId = (settings.arguments as Map)['moduleId'] as String;
66 70 }
67   - return CupertinoPageRoute(builder: (_) => HomePage(moduleId: moduleId,));
  71 + return CupertinoPageRoute(
  72 + builder: (_) => HomePage(
  73 + moduleId: moduleId,
  74 + ));
68 75 case AppRouteName.fogPwd:
69 76 return CupertinoPageRoute(builder: (_) => const ForgetPasswordHomePage());
70 77 case AppRouteName.lesson:
... ... @@ -86,10 +93,22 @@ class AppRouter {
86 93 case AppRouteName.lookVideo:
87 94 final videoUrl = (settings.arguments as Map)['videoUrl'] as String;
88 95 final title = (settings.arguments as Map)['title'] as String?;
89   - return CupertinoPageRoute(builder: (_) => LookVideoPage(videoUrl: videoUrl,typeTitle: title,));
  96 + return CupertinoPageRoute(
  97 + builder: (_) => LookVideoPage(
  98 + videoUrl: videoUrl,
  99 + typeTitle: title,
  100 + ));
90 101 case AppRouteName.setPwd:
91   - final phoneNum = (settings.arguments as Map)['phoneNumber'] as String;
92   - return CupertinoPageRoute(builder: (_) => SetPassWordPage(phoneNum: phoneNum));
  102 + var map = settings.arguments as Map;
  103 + final phoneNum = map['phoneNumber'] as String?;
  104 + final smsCode = map['smsCode'] as String?;
  105 + final pageType = map['pageType'] as SetPwdPageType;
  106 + return CupertinoPageRoute(
  107 + builder: (_) => SetPassWordPage(
  108 + phoneNum: phoneNum,
  109 + smsCode: smsCode,
  110 + pageType: pageType,
  111 + ));
93 112 case AppRouteName.webView:
94 113 final urlStr = (settings.arguments as Map)['urlStr'] as String;
95 114 final webViewTitle = (settings.arguments as Map)['webViewTitle'] as String;
... ...
lib/utils/toast_util.dart 0 → 100644
  1 +import 'package:flutter_easyloading/flutter_easyloading.dart';
  2 +
  3 +void showToast(
  4 + String msg, {
  5 + Duration? duration,
  6 + bool? dismissOnTap,
  7 +}) {
  8 + EasyLoading.showToast(msg, duration: duration, dismissOnTap: dismissOnTap);
  9 +}
  10 +
  11 +extension ToastExtension on String {
  12 + void toast({
  13 + Duration? duration,
  14 + bool? dismissOnTap,
  15 + }) {
  16 + showToast(this, duration: duration, dismissOnTap: dismissOnTap);
  17 + }
  18 +}
... ...