| d1d32220  liangchengyou
 
feat:兑换课程+购买记录 | 1
2 |   import 'package:flutter/material.dart';
  import 'package:flutter_bloc/flutter_bloc.dart';
 | 
| d1d32220  liangchengyou
 
feat:兑换课程+购买记录 | 3
4
5 |   import 'package:flutter_screenutil/flutter_screenutil.dart';
  import 'package:wow_english/common/extension/string_extension.dart';
  import 'package:wow_english/common/widgets/we_app_bar.dart';
 | 
| 07599105  吴启风
 
feat:商品列表请求&路由 | 6 |   import 'package:wow_english/pages/shop/home/widgets/product_item.dart';
 | 
| d1d32220  liangchengyou
 
feat:兑换课程+购买记录 | 7 |   import 'package:wow_english/route/route.dart';
 | 
| c61b3c1a  Key
 
feat: toast_util.... | 8 |   import 'package:wow_english/utils/toast_util.dart';
 | 
| 4b358e22  liangchengyou
 
feat:调整文件结构 | 9
10 |   
  import 'bloc/shop_home_bloc.dart';
 | 
| d1d32220  liangchengyou
 
feat:兑换课程+购买记录 | 11
12
13
14
15
16
17 |   
  class ShopHomePage extends StatelessWidget {
    const ShopHomePage({super.key});
  
    @override
    Widget build(BuildContext context) {
      return BlocProvider(
 | 
| 07599105  吴启风
 
feat:商品列表请求&路由 | 18 |         create: (context) => ShopHomeBloc()..add(RequestDataEvent()),
 | 
| d1d32220  liangchengyou
 
feat:兑换课程+购买记录 | 19
20
21
22
23
24
25
26 |         child: _ShopHomeView(),
      );
    }
  }
  
  class _ShopHomeView extends StatelessWidget {
    @override
    Widget build(BuildContext context) {
 | 
| c61b3c1a  Key
 
feat: toast_util.... | 27 |       return BlocListener<ShopHomeBloc, ShopHomeState>(
 | 
| d1d32220  liangchengyou
 
feat:兑换课程+购买记录 | 28
29
30
31
32 |         listener: (context, state) {},
        child: _shopHomeWidget(),
      );
    }
  
 | 
| 07599105  吴启风
 
feat:商品列表请求&路由 | 33
34
35 |     Widget _shopHomeWidget() =>
        BlocBuilder<ShopHomeBloc, ShopHomeState>(builder: (context, state) {
          final bloc = BlocProvider.of<ShopHomeBloc>(context);
 | 
| c61b3c1a  Key
 
feat: toast_util.... | 36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61 |           return Scaffold(
            appBar: WEAppBar(
              actions: [
                IconButton(
                  icon: Image.asset(
                    'check_lesson'.assetPng,
                    width: 40,
                    height: 40,
                  ),
                  color: Colors.white,
                  onPressed: () {
                    Navigator.of(context).pushNamed(AppRouteName.exLesson);
                  },
                ),
                IconButton(
                  icon: Image.asset(
                    'shop'.assetPng,
                    width: 40,
                    height: 40,
                  ),
                  color: Colors.white,
                  onPressed: () {
                    showToast('购前须知');
                  },
                )
              ],
 | 
| d1d32220  liangchengyou
 
feat:兑换课程+购买记录 | 62 |             ),
 | 
| c61b3c1a  Key
 
feat: toast_util.... | 63
64 |             body: Center(
              child: Padding(
 | 
| 98670c0d  吴启风
 
feat:练习顶部页码居中显示 | 65 |                 padding: EdgeInsets.symmetric(vertical: 24.h, horizontal: 24.w),
 | 
| c61b3c1a  Key
 
feat: toast_util.... | 66 |                 child: GridView.builder(
 | 
| 07599105  吴启风
 
feat:商品列表请求&路由 | 67 |                     itemCount: bloc.productDatas.length,
 | 
| c61b3c1a  Key
 
feat: toast_util.... | 68
69
70 |                     gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
                      crossAxisCount: 2,
                      childAspectRatio: 2,
 | 
| 2101b1cc  吴启风
 
feat:购买页ui优化 | 71
72 |                       mainAxisSpacing: 16.h,
                      crossAxisSpacing: 12.w,
 | 
| c61b3c1a  Key
 
feat: toast_util.... | 73
74 |                     ),
                    itemBuilder: (BuildContext context, int index) {
 | 
| 07599105  吴启风
 
feat:商品列表请求&路由 | 75
76
77
78 |                       final productEntity = bloc.productDatas[index];
                      return ProductItem(onTap: () {
                        pushNamed(AppRouteName.pay, arguments: productEntity);
                      }, entity: productEntity);
 | 
| c61b3c1a  Key
 
feat: toast_util.... | 79 |                     }),
 | 
| d1d32220  liangchengyou
 
feat:兑换课程+购买记录 | 80 |               ),
 | 
| c61b3c1a  Key
 
feat: toast_util.... | 81
82
83
84 |             ),
          );
        });
  }
 |