From 68b47e2939d51569972baaa02bb7b3d1bf32021c Mon Sep 17 00:00:00 2001 From: laiiihz Date: Mon, 10 May 2021 09:38:07 +0800 Subject: [PATCH] update goods detail page --- lib/ui/market/goods/goods_card.dart | 2 +- lib/ui/market/goods/goods_detail_page.dart | 6 +++++- lib/ui/market/goods/goods_tab_list_view.dart | 9 ++++++++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/lib/ui/market/goods/goods_card.dart b/lib/ui/market/goods/goods_card.dart index 2d874a2f..33ca2ddf 100644 --- a/lib/ui/market/goods/goods_card.dart +++ b/lib/ui/market/goods/goods_card.dart @@ -15,7 +15,7 @@ class GoodsCard extends StatelessWidget { color: Colors.white, elevation: 0, padding: EdgeInsets.zero, - onPressed: () => Get.to(() => GoodsDetailPage()), + onPressed: () => Get.to(() => GoodsDetailPage(id: 0)), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ diff --git a/lib/ui/market/goods/goods_detail_page.dart b/lib/ui/market/goods/goods_detail_page.dart index d742f19e..d27c61a1 100644 --- a/lib/ui/market/goods/goods_detail_page.dart +++ b/lib/ui/market/goods/goods_detail_page.dart @@ -2,8 +2,12 @@ import 'package:flutter/material.dart'; import 'package:aku_community/widget/bee_scaffold.dart'; +///商品详情页面 class GoodsDetailPage extends StatefulWidget { - GoodsDetailPage({Key? key}) : super(key: key); + ///商品ID + final int id; + + GoodsDetailPage({Key? key, required this.id}) : super(key: key); @override _GoodsDetailPageState createState() => _GoodsDetailPageState(); diff --git a/lib/ui/market/goods/goods_tab_list_view.dart b/lib/ui/market/goods/goods_tab_list_view.dart index 949e5f35..970688ac 100644 --- a/lib/ui/market/goods/goods_tab_list_view.dart +++ b/lib/ui/market/goods/goods_tab_list_view.dart @@ -1,6 +1,8 @@ +import 'package:aku_community/ui/market/goods/goods_detail_page.dart'; import 'package:flutter/material.dart'; import 'package:flutter_easyrefresh/easy_refresh.dart'; +import 'package:get/get.dart'; import 'package:waterfall_flow/waterfall_flow.dart'; import 'package:aku_community/constants/api.dart'; @@ -35,7 +37,12 @@ class _GoodsTabListViewState extends State ), itemBuilder: (context, index) { final GoodsItem item = items[index]; - return Text(item.title); + return MaterialButton( + onPressed: () { + Get.to(() => GoodsDetailPage(id: widget.model.id)); + }, + child: Text(item.title), + ); }, itemCount: items.length, );