95edef4f
liangchengyou
feat:更新适配代码
|
1
|
import 'package:flutter/material.dart';
|
60e47f7c
liangchengyou
feat:课程选择功能
|
2
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
d35a4e87
liangchengyou
feat:磨耳朵功能UI
|
3
4
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:wow_english/common/extension/string_extension.dart';
|
4b358e22
liangchengyou
feat:调整文件结构
|
5
6
|
import 'package:wow_english/pages/home/widgets/home_lesson_item_widget.dart';
import 'package:wow_english/pages/home/widgets/home_tab_header_widget.dart';
|
60e47f7c
liangchengyou
feat:课程选择功能
|
7
|
import 'package:wow_english/route/route.dart';
|
95edef4f
liangchengyou
feat:更新适配代码
|
8
|
|
4b358e22
liangchengyou
feat:调整文件结构
|
9
10
|
import 'bloc/home_bloc.dart';
|
95edef4f
liangchengyou
feat:更新适配代码
|
11
12
13
14
15
|
class HomePage extends StatelessWidget {
const HomePage({super.key});
@override
Widget build(BuildContext context) {
|
60e47f7c
liangchengyou
feat:课程选择功能
|
16
|
return BlocProvider(
|
13e6d11d
liangchengyou
feat:首页课程模块接口
|
17
|
create: (context) => HomeBloc()..requestData(),
|
60e47f7c
liangchengyou
feat:课程选择功能
|
18
19
20
21
22
23
24
25
|
child: _HomePageView(),
);
}
}
class _HomePageView extends StatelessWidget {
void _headerActionEvent(HeaderActionType type) {
if (type == HeaderActionType.video) {
|
9d080046
liangchengyou
feat:视频跟读逻辑
|
26
|
Navigator.of(AppRouter.context).pushNamed(AppRouteName.reAfter);
|
60e47f7c
liangchengyou
feat:课程选择功能
|
27
28
29
|
} else if (type == HeaderActionType.phase) {
Navigator.of(AppRouter.context).pushNamed(AppRouteName.lesson);
} else if (type == HeaderActionType.listen) {
|
d35a4e87
liangchengyou
feat:磨耳朵功能UI
|
30
31
|
Navigator.of(AppRouter.context).pushNamed(AppRouteName.listen);
} else if (type == HeaderActionType.shop) {
|
d1d32220
liangchengyou
feat:兑换课程+购买记录
|
32
|
Navigator.of(AppRouter.context).pushNamed(AppRouteName.shop);
|
056970d8
Key
feat: api
|
33
34
|
} else if (type == HeaderActionType.user) {
Navigator.of(AppRouter.context).pushNamed(AppRouteName.user);
|
60e47f7c
liangchengyou
feat:课程选择功能
|
35
|
} else {
|
624214d0
liangchengyou
feat:看题选字/选图UI和部分逻辑
|
36
|
// Navigator.of(AppRouter.context).pushNamed(AppRouteName.topicPic);
|
119ba920
liangchengyou
feat:视频播放器
|
37
|
// Navigator.of(AppRouter.context).pushNamed(AppRouteName.topicWord);
|
95e3448c
liangchengyou
feat:听音选图/选字
|
38
39
|
// Navigator.of(AppRouter.context).pushNamed(AppRouteName.lookVideo);
// Navigator.of(AppRouter.context).pushNamed(AppRouteName.voicePic);
|
725dc3f2
liangchengyou
feat:语音问答界面UI
|
40
41
|
// Navigator.of(AppRouter.context).pushNamed(AppRouteName.voiceWord);
Navigator.of(AppRouter.context).pushNamed(AppRouteName.voiceAnswer);
|
60e47f7c
liangchengyou
feat:课程选择功能
|
42
43
44
45
46
47
48
|
}
}
@override
Widget build(BuildContext context) {
return BlocListener<HomeBloc,HomeState>(
listener: (context, state){},
|
d35a4e87
liangchengyou
feat:磨耳朵功能UI
|
49
|
child: _homeView(),
|
95edef4f
liangchengyou
feat:更新适配代码
|
50
51
|
);
}
|
d35a4e87
liangchengyou
feat:磨耳朵功能UI
|
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
Widget _homeView() => BlocBuilder<HomeBloc,HomeState>(
builder: (context, state){
final bloc = BlocProvider.of<HomeBloc>(context);
return Scaffold(
body: Container(
color: Colors.white,
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
HomeTabHeaderWidget(
actionTap: (HeaderActionType type) {
_headerActionEvent(type);
},
),
Expanded(
|
65e33ae8
liangchengyou
feat:更新代码
|
69
|
child: ListView.builder(
|
d35a4e87
liangchengyou
feat:磨耳朵功能UI
|
70
|
itemCount: 10,
|
65e33ae8
liangchengyou
feat:更新代码
|
71
72
|
scrollDirection: Axis.horizontal,
itemBuilder: (BuildContext context, int index){
|
d35a4e87
liangchengyou
feat:磨耳朵功能UI
|
73
|
return const HomeLessonItem();
|
d35a4e87
liangchengyou
feat:磨耳朵功能UI
|
74
|
})
|
d35a4e87
liangchengyou
feat:磨耳朵功能UI
|
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
|
),
SafeArea(
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 13.w),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
SizedBox(
height: 47.h,
width: 80.w,
),
Container(
decoration: BoxDecoration(
color: Colors.blue,
borderRadius: BorderRadius.circular(14.5.r),
),
padding: EdgeInsets.symmetric(vertical: 8.h,horizontal: 24.w),
child: Text(
'3/67',
style: TextStyle(
color: Colors.white,
fontSize: 12.sp
),
),
),
Image.asset(
'blue-positive'.assetPng,
height: 47.h,
width: 80.w,
),
],
),
),
)
],
),
),
),
);
});
|
056970d8
Key
feat: api
|
115
|
}
|