Commit ad8454ca292c4cbd8f4794ae89c6c37140cb2c19
1 parent
8988aa69
feat:调整模型
Showing
3 changed files
with
46 additions
and
39 deletions
lib/pages/home/bloc/home_bloc.dart
| ... | ... | @@ -24,8 +24,7 @@ class HomeBloc extends Bloc<HomeEvent, HomeState> { |
| 24 | 24 | Future<void> requestData() async { |
| 25 | 25 | try { |
| 26 | 26 | await loading(() async { |
| 27 | - await HomeDao.courseLesson(moduleId: moduleId??''); | |
| 28 | - // _modelData = await HomeDao.courseLesson(moduleId: moduleId??''); | |
| 27 | + _modelData = await HomeDao.courseLesson(moduleId: moduleId??''); | |
| 29 | 28 | emit(HomeDataLoadState()); |
| 30 | 29 | }); |
| 31 | 30 | } catch (e) { | ... | ... |
lib/pages/home/home_page.dart
| ... | ... | @@ -72,7 +72,7 @@ class _HomePageView extends StatelessWidget { |
| 72 | 72 | ), |
| 73 | 73 | Expanded( |
| 74 | 74 | child: ListView.builder( |
| 75 | - itemCount: 0, | |
| 75 | + itemCount: bloc.modelData?.totalCourseLesson, | |
| 76 | 76 | scrollDirection: Axis.horizontal, |
| 77 | 77 | itemBuilder: (BuildContext context, int index){ |
| 78 | 78 | String? title = bloc.modelData?.courseLessons?[index]?.name; | ... | ... |
lib/pages/home/widgets/home_vidoe_item.dart
| ... | ... | @@ -10,45 +10,53 @@ class HomeVideoItem extends StatelessWidget { |
| 10 | 10 | |
| 11 | 11 | @override |
| 12 | 12 | Widget build(BuildContext context) { |
| 13 | - return Container( | |
| 14 | - height: 202.h, | |
| 15 | - width: 165.w, | |
| 16 | - padding: EdgeInsets.symmetric(horizontal: 16.w,vertical: 12.h), | |
| 17 | - decoration: BoxDecoration( | |
| 18 | - image: DecorationImage( | |
| 19 | - image: AssetImage(''.assetPng) | |
| 20 | - ) | |
| 21 | - ), | |
| 22 | - child: Column( | |
| 23 | - children: [ | |
| 24 | - Container( | |
| 25 | - decoration: BoxDecoration( | |
| 26 | - border: Border.all( | |
| 27 | - width: 2, | |
| 28 | - color: const Color(0xFF140C10), | |
| 29 | - ), | |
| 30 | - borderRadius: BorderRadius.circular(6) | |
| 13 | + return Padding( | |
| 14 | + padding: EdgeInsets.symmetric(horizontal: 12.w), | |
| 15 | + child: Container( | |
| 16 | + width: 165.w, | |
| 17 | + padding: EdgeInsets.symmetric(horizontal: 16.w,vertical: 24.h), | |
| 18 | + decoration: BoxDecoration( | |
| 19 | + image: DecorationImage( | |
| 20 | + image: AssetImage('gendubeij'.assetPng), | |
| 31 | 21 | ), |
| 32 | - child: Image.network(lessons?.coverUrl??''), | |
| 33 | - ), | |
| 34 | - Container( | |
| 35 | - decoration: BoxDecoration( | |
| 36 | - border: Border.all( | |
| 37 | - width: 2, | |
| 38 | - color: const Color(0xFF140C10), | |
| 22 | + ), | |
| 23 | + child: Column( | |
| 24 | + mainAxisAlignment: MainAxisAlignment.spaceAround, | |
| 25 | + children: [ | |
| 26 | + Expanded( | |
| 27 | + child: Container( | |
| 28 | + decoration: BoxDecoration( | |
| 29 | + border: Border.all( | |
| 30 | + width: 2, | |
| 31 | + color: const Color(0xFF140C10), | |
| 32 | + ), | |
| 33 | + borderRadius: BorderRadius.circular(6) | |
| 34 | + ), | |
| 35 | + child: Image.network( | |
| 36 | + lessons?.coverUrl??'', | |
| 37 | + fit: BoxFit.fill, | |
| 38 | + ), | |
| 39 | + )), | |
| 40 | + 24.verticalSpace, | |
| 41 | + Container( | |
| 42 | + decoration: BoxDecoration( | |
| 43 | + border: Border.all( | |
| 44 | + width: 2, | |
| 45 | + color: const Color(0xFF140C10), | |
| 46 | + ), | |
| 47 | + borderRadius: BorderRadius.circular(6) | |
| 48 | + ), | |
| 49 | + padding: EdgeInsets.symmetric(horizontal: 10.w), | |
| 50 | + child: Text( | |
| 51 | + lessons?.name??'', | |
| 52 | + style: TextStyle( | |
| 53 | + fontSize: 25.sp, | |
| 54 | + color: const Color(0xFF333333) | |
| 39 | 55 | ), |
| 40 | - borderRadius: BorderRadius.circular(6) | |
| 41 | - ), | |
| 42 | - padding: EdgeInsets.symmetric(horizontal: 10.w,vertical: 8.h), | |
| 43 | - child: Text( | |
| 44 | - lessons?.name??'', | |
| 45 | - style: TextStyle( | |
| 46 | - fontSize: 25.sp, | |
| 47 | - color: const Color(0xFF333333) | |
| 48 | 56 | ), |
| 49 | - ), | |
| 50 | - ) | |
| 51 | - ], | |
| 57 | + ) | |
| 58 | + ], | |
| 59 | + ), | |
| 52 | 60 | ), |
| 53 | 61 | ); |
| 54 | 62 | } | ... | ... |