Commit 7652f70133e79e0dd3940b3630d89496dc4bfc1b

Authored by liangchengyou
1 parent 9d080046

feat:课程购买UI逻辑

lib/app/app.dart
... ... @@ -31,6 +31,7 @@ class App extends StatelessWidget {
31 31 builder: (context,child) => ResponsiveBreakpoints(
32 32 breakpoints: const [
33 33 Breakpoint(start: 0, end: 450, name: MOBILE),
  34 + Breakpoint(start: 0, end: 450, name: PHONE),
34 35 Breakpoint(start: 451, end: 800, name: TABLET),
35 36 Breakpoint(start: 801, end: 1920, name: DESKTOP),
36 37 Breakpoint(start: 1921, end: double.infinity, name: '4K'),
... ...
lib/home/home_page.dart
... ... @@ -70,9 +70,6 @@ class _HomePageView extends StatelessWidget {
70 70 },
71 71 itemBuilder: (BuildContext context,int index){
72 72 return const HomeLessonItem();
73   - // return Container(
74   - // color:index%2==0?Colors.red:Colors.blue
75   - // );
76 73 })
77 74 ,
78 75 ),
... ...
lib/home/widgets/home_tab_header_widget.dart
... ... @@ -24,7 +24,7 @@ class HomeTabHeaderWidget extends StatelessWidget {
24 24 @override
25 25 Widget build(BuildContext context) {
26 26 return Container(
27   - height: 45.h,
  27 + height: 45,
28 28 width: double.infinity,
29 29 color: Colors.purple,
30 30 padding: EdgeInsets.symmetric(horizontal: 9.5.w),
... ... @@ -71,11 +71,11 @@ class HomeTabHeaderWidget extends StatelessWidget {
71 71 style: BorderStyle.solid
72 72 ),
73 73 ),
74   - child: const Text(
  74 + child: Text(
75 75 'franky',
76 76 style: TextStyle(
77   - color: Color(0xFF333333),
78   - fontSize: 16
  77 + color: const Color(0xFF333333),
  78 + fontSize: 16.sp
79 79 ),
80 80 ),
81 81 ),
... ...
lib/listen/listen_page.dart
... ... @@ -39,7 +39,7 @@ class _ListenPageView extends StatelessWidget {
39 39 return ListView.builder(
40 40 itemCount: 10,
41 41 scrollDirection: Axis.horizontal,
42   - padding: EdgeInsets.symmetric(horizontal: 30.w,vertical: 36.h),
  42 + padding: EdgeInsets.symmetric(horizontal: 30.w,vertical: 30.h),
43 43 itemBuilder: (BuildContext context,int index){
44 44 return ListenItemWidget(
45 45 isLock: (index < 5),
... ...
lib/practice/chosetopic/topicpicture/bloc/topic_picture_bloc.dart 0 → 100644
  1 +import 'dart:async';
  2 +
  3 +import 'package:bloc/bloc.dart';
  4 +import 'package:meta/meta.dart';
  5 +
  6 +part 'topic_picture_event.dart';
  7 +part '../topic_picture_state.dart';
  8 +
  9 +class TopicPictureBloc extends Bloc<TopicPictureEvent, TopicPictureState> {
  10 + TopicPictureBloc() : super(TopicPictureInitial()) {
  11 + on<TopicPictureEvent>((event, emit) {
  12 + // TODO: implement event handler
  13 + });
  14 + }
  15 +}
... ...
lib/practice/chosetopic/topicpicture/bloc/topic_picture_event.dart 0 → 100644
  1 +part of 'topic_picture_bloc.dart';
  2 +
  3 +@immutable
  4 +abstract class TopicPictureEvent {}
... ...
lib/practice/chosetopic/topicpicture/bloc/topic_picture_page.dart 0 → 100644
  1 +import 'package:flutter/material.dart';
  2 +
  3 +class TopicPicturePage extends StatelessWidget {
  4 + const TopicPicturePage({super.key});
  5 +
  6 + @override
  7 + Widget build(BuildContext context) {
  8 + // TODO: implement build
  9 + throw UnimplementedError();
  10 + }
  11 +}
0 12 \ No newline at end of file
... ...
lib/practice/chosetopic/topicpicture/topic_picture_state.dart 0 → 100644
  1 +part of 'bloc/topic_picture_bloc.dart';
  2 +
  3 +@immutable
  4 +abstract class TopicPictureState {}
  5 +
  6 +class TopicPictureInitial extends TopicPictureState {}
... ...
lib/shop/exchangelist/widgets/exchange_list_item.dart
... ... @@ -31,8 +31,8 @@ class ExchangeListItem extends StatelessWidget {
31 31 child: Row(
32 32 children: [
33 33 Container(
34   - width: 70,
35   - height: 70,
  34 + width: 70.w,
  35 + height: 70.h,
36 36 decoration: BoxDecoration(
37 37 borderRadius: BorderRadius.circular(5.r),
38 38 border: Border.all(
... ... @@ -47,7 +47,7 @@ class ExchangeListItem extends StatelessWidget {
47 47 17.horizontalSpace,
48 48 Expanded(
49 49 child: Column(
50   - mainAxisAlignment: MainAxisAlignment.center,
  50 + mainAxisAlignment: MainAxisAlignment.spaceAround,
51 51 children: [
52 52 Row(
53 53 children: [
... ...
lib/shop/home/shop_home_page.dart
... ... @@ -6,6 +6,7 @@ import &#39;package:wow_english/common/extension/string_extension.dart&#39;;
6 6 import 'package:wow_english/common/widgets/we_app_bar.dart';
7 7 import 'package:wow_english/route/route.dart';
8 8 import 'package:wow_english/shop/home/bloc/shop_home_bloc.dart';
  9 +import 'package:wow_english/shop/home/widgets/lesson_card_item.dart';
9 10  
10 11 class ShopHomePage extends StatelessWidget {
11 12 const ShopHomePage({super.key});
... ... @@ -56,6 +57,25 @@ class _ShopHomeView extends StatelessWidget {
56 57 )
57 58 ],
58 59 ),
  60 + body: Center(
  61 + child: Padding(
  62 + padding: EdgeInsets.symmetric(vertical: 25.h,horizontal: 25.w),
  63 + child: GridView.builder(
  64 + itemCount: 4,
  65 + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
  66 + crossAxisCount: 2,
  67 + childAspectRatio: 2,
  68 + mainAxisSpacing: 14.h,
  69 + crossAxisSpacing : 4.5.w,
  70 + ),
  71 + itemBuilder: (BuildContext context,int index){
  72 + return LessonCardItem(
  73 + onTap: (){
  74 + EasyLoading.showToast('购买');
  75 + });
  76 + }),
  77 + ),
  78 + ),
59 79 );
60 80 });
61 81 }
62 82 \ No newline at end of file
... ...
lib/shop/home/widgets/lesson_card_item.dart 0 → 100644
  1 +import 'package:flutter/material.dart';
  2 +import 'package:flutter_screenutil/flutter_screenutil.dart';
  3 +
  4 +class LessonCardItem extends StatelessWidget {
  5 + const LessonCardItem({super.key, required this.onTap});
  6 +
  7 + final Function() onTap;
  8 +
  9 + @override
  10 + Widget build(BuildContext context) {
  11 + return Container(
  12 + decoration: BoxDecoration(
  13 + borderRadius: BorderRadius.circular(10.r),
  14 + color: Colors.blue,
  15 + border: Border.all(
  16 + width: 1.0,
  17 + color: Colors.black
  18 + )
  19 + // image: DecorationImage(
  20 + // image: AssetImage(
  21 + // ''.assetPng,
  22 + // ),
  23 + // fit: BoxFit.fill
  24 + // )
  25 + ),
  26 + padding: EdgeInsets.symmetric(horizontal: 16.w,vertical: 16.h),
  27 + child: Row(
  28 + mainAxisAlignment: MainAxisAlignment.spaceBetween,
  29 + children: [
  30 + Container(
  31 + width: 124.w,
  32 + decoration: BoxDecoration(
  33 + border: Border.all(
  34 + width: 1.0,
  35 + color: const Color(0xFF333333),
  36 + ),
  37 + image: const DecorationImage(
  38 + fit: BoxFit.fill,
  39 + image: NetworkImage('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'),
  40 + )
  41 + ),
  42 + ),
  43 + 21.5.horizontalSpace,
  44 + Expanded(
  45 + child: Column(
  46 + mainAxisAlignment: MainAxisAlignment.spaceBetween,
  47 + crossAxisAlignment: CrossAxisAlignment.end,
  48 + children: [
  49 + Text(
  50 + 'Wow English 课程年卡',
  51 + softWrap: true,
  52 + textAlign: TextAlign.left,
  53 + style: TextStyle(
  54 + fontSize: 12.sp,
  55 + color: const Color(0xFF333333)
  56 + ),
  57 + ),
  58 + RichText(
  59 + text: TextSpan(
  60 + children:[
  61 + TextSpan(
  62 + text: '¥',
  63 + style: TextStyle(
  64 + fontSize: 21.sp,
  65 + color: const Color(0xFFF51A1A),
  66 + )
  67 + ),
  68 + TextSpan(
  69 + text: '998',
  70 + style: TextStyle(
  71 + fontSize: 40.sp,
  72 + color: const Color(0xFFF51A1A),
  73 + ),
  74 + )
  75 + ]
  76 + ),
  77 + ),
  78 + GestureDetector(
  79 + onTap: () {
  80 + onTap();
  81 + },
  82 + child: Container(
  83 + decoration: BoxDecoration(
  84 + color: const Color(0xFFF5C51F),
  85 + borderRadius: BorderRadius.circular(5.r),
  86 + border: Border.all(
  87 + color: const Color(0xFF333333),
  88 + width: 1.0,
  89 + )
  90 + ),
  91 + padding: EdgeInsets.symmetric(
  92 + vertical: 1.h,
  93 + horizontal: 26.5.w,
  94 + ),
  95 + child: Text(
  96 + '立即购买',
  97 + style: TextStyle(
  98 + fontSize: 10.sp,
  99 + color: const Color(0xFF333333)
  100 + ),
  101 + ),
  102 + ),
  103 + )
  104 + ],
  105 + ),
  106 + )
  107 + ],
  108 + ),
  109 + );
  110 + }
  111 +}
0 112 \ No newline at end of file
... ...