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(
|
d35a4e87
liangchengyou
feat:磨耳朵功能UI
|
17
18
19
|
create: (context) => HomeBloc(PageController(
initialPage: 0,
)),
|
60e47f7c
liangchengyou
feat:课程选择功能
|
20
21
22
23
24
25
26
27
|
child: _HomePageView(),
);
}
}
class _HomePageView extends StatelessWidget {
void _headerActionEvent(HeaderActionType type) {
if (type == HeaderActionType.video) {
|
9d080046
liangchengyou
feat:视频跟读逻辑
|
28
|
Navigator.of(AppRouter.context).pushNamed(AppRouteName.reAfter);
|
60e47f7c
liangchengyou
feat:课程选择功能
|
29
30
31
|
} else if (type == HeaderActionType.phase) {
Navigator.of(AppRouter.context).pushNamed(AppRouteName.lesson);
} else if (type == HeaderActionType.listen) {
|
d35a4e87
liangchengyou
feat:磨耳朵功能UI
|
32
33
|
Navigator.of(AppRouter.context).pushNamed(AppRouteName.listen);
} else if (type == HeaderActionType.shop) {
|
d1d32220
liangchengyou
feat:兑换课程+购买记录
|
34
|
Navigator.of(AppRouter.context).pushNamed(AppRouteName.shop);
|
056970d8
Key
feat: api
|
35
36
|
} else if (type == HeaderActionType.user) {
Navigator.of(AppRouter.context).pushNamed(AppRouteName.user);
|
60e47f7c
liangchengyou
feat:课程选择功能
|
37
|
} else {
|
624214d0
liangchengyou
feat:看题选字/选图UI和部分逻辑
|
38
|
// Navigator.of(AppRouter.context).pushNamed(AppRouteName.topicPic);
|
119ba920
liangchengyou
feat:视频播放器
|
39
|
// Navigator.of(AppRouter.context).pushNamed(AppRouteName.topicWord);
|
95e3448c
liangchengyou
feat:听音选图/选字
|
40
41
|
// Navigator.of(AppRouter.context).pushNamed(AppRouteName.lookVideo);
// Navigator.of(AppRouter.context).pushNamed(AppRouteName.voicePic);
|
725dc3f2
liangchengyou
feat:语音问答界面UI
|
42
43
|
// Navigator.of(AppRouter.context).pushNamed(AppRouteName.voiceWord);
Navigator.of(AppRouter.context).pushNamed(AppRouteName.voiceAnswer);
|
60e47f7c
liangchengyou
feat:课程选择功能
|
44
45
46
47
48
49
50
|
}
}
@override
Widget build(BuildContext context) {
return BlocListener<HomeBloc,HomeState>(
listener: (context, state){},
|
d35a4e87
liangchengyou
feat:磨耳朵功能UI
|
51
|
child: _homeView(),
|
95edef4f
liangchengyou
feat:更新适配代码
|
52
53
|
);
}
|
d35a4e87
liangchengyou
feat:磨耳朵功能UI
|
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
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:更新代码
|
71
|
child: ListView.builder(
|
d35a4e87
liangchengyou
feat:磨耳朵功能UI
|
72
|
itemCount: 10,
|
65e33ae8
liangchengyou
feat:更新代码
|
73
74
|
scrollDirection: Axis.horizontal,
itemBuilder: (BuildContext context, int index){
|
d35a4e87
liangchengyou
feat:磨耳朵功能UI
|
75
|
return const HomeLessonItem();
|
d35a4e87
liangchengyou
feat:磨耳朵功能UI
|
76
|
})
|
d35a4e87
liangchengyou
feat:磨耳朵功能UI
|
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
115
116
|
),
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
|
117
|
}
|