张萌 4 years ago
commit 793b71ecd3

@ -264,6 +264,9 @@ class _Market {
///app4
String get hotTop => '/user/shop/findTopGoods';
///app
String get search => '/user/shop/goodsSearch';
}
class _Upload {

@ -1,3 +1,4 @@
import 'package:aku_community/models/market/goods_item.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
@ -7,7 +8,8 @@ import 'package:aku_community/ui/market/goods/goods_detail_page.dart';
import 'package:aku_community/utils/headers.dart';
class GoodsCard extends StatelessWidget {
const GoodsCard({Key? key}) : super(key: key);
final GoodsItem item;
const GoodsCard({Key? key, required this.item}) : super(key: key);
@override
Widget build(BuildContext context) {
@ -37,7 +39,7 @@ class GoodsCard extends StatelessWidget {
alignment: Alignment.centerLeft,
padding: EdgeInsets.symmetric(horizontal: 12.w),
child: Text(
'分别是紫色烦恼则妇女色泽封闭周四鹅u部分紫色部分',
item.recommend,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: Colors.white,
@ -55,7 +57,7 @@ class GoodsCard extends StatelessWidget {
vertical: 20.w,
),
child: Text(
'袁隆平水稻大米精选 56kg唇齿流香 无常有机稻花 无常有机稻花',
item.title,
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
@ -71,17 +73,18 @@ class GoodsCard extends StatelessWidget {
text: TextSpan(
children: [
TextSpan(
text: '¥123.45 ',
text: '¥${item.sellingPrice} ',
style: TextStyle(
color: Colors.red,
fontSize: 28.sp,
),
),
TextSpan(
text: '123已付款',
text: '${item.markingPrice}',
style: TextStyle(
color: ktextSubColor,
fontSize: 20.sp,
decoration: TextDecoration.lineThrough,
),
),
],

@ -1,14 +1,14 @@
import 'package:aku_community/ui/market/goods/goods_detail_page.dart';
import 'package:aku_community/ui/market/goods/goods_card.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';
import 'package:aku_community/models/market/goods_item.dart';
import 'package:aku_community/models/market/market_category_model.dart';
import 'package:aku_community/pages/things_page/widget/bee_list_view.dart';
import 'package:aku_community/utils/headers.dart';
class GoodsTabListView extends StatefulWidget {
final MarketCategoryModel model;
@ -32,17 +32,13 @@ class _GoodsTabListViewState extends State<GoodsTabListView>
model.tableList?.map((e) => GoodsItem.fromJson(e)).toList() ?? [],
builder: (items) {
return WaterfallFlow.builder(
padding: EdgeInsets.all(32.w),
gridDelegate: SliverWaterfallFlowDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
),
itemBuilder: (context, index) {
final GoodsItem item = items[index];
return MaterialButton(
onPressed: () {
Get.to(() => GoodsDetailPage(id: widget.model.id));
},
child: Text(item.title),
);
return GoodsCard(item: item);
},
itemCount: items.length,
);

@ -1,5 +1,9 @@
import 'package:aku_community/constants/api.dart';
import 'package:aku_community/models/market/goods_item.dart';
import 'package:aku_community/pages/things_page/widget/bee_list_view.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:waterfall_flow/waterfall_flow.dart';
@ -26,6 +30,14 @@ class SearchGoodsPageState extends State<SearchGoodsPage> {
TextEditingController _editingController = TextEditingController();
OrderType _orderType = OrderType.NORMAL;
IconData priceIcon = CupertinoIcons.chevron_up_chevron_down;
EasyRefreshController _refreshController = EasyRefreshController();
@override
void dispose() {
_refreshController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
final normalTypeButton = MaterialButton(
@ -108,6 +120,10 @@ class SearchGoodsPageState extends State<SearchGoodsPage> {
title: Padding(
padding: EdgeInsets.symmetric(vertical: 12.w),
child: TextField(
onEditingComplete: () {
setState(() {});
_refreshController.callRefresh();
},
controller: _editingController,
decoration: InputDecoration(
border: OutlineInputBorder(
@ -131,17 +147,27 @@ class SearchGoodsPageState extends State<SearchGoodsPage> {
// ),
// preferredSize: Size.fromHeight(80.w),
// ),
body: WaterfallFlow.builder(
padding: EdgeInsets.all(32.w),
gridDelegate: SliverWaterfallFlowDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
mainAxisSpacing: 20.w,
crossAxisSpacing: 20.w,
),
itemBuilder: (context, index) {
return GoodsCard();
body: BeeListView(
path: API.market.search,
controller: _refreshController,
extraParams: {'searchName': _editingController.text},
convert: (model) =>
model.tableList!.map((e) => GoodsItem.fromJson(e)).toList(),
builder: (items) {
return WaterfallFlow.builder(
padding: EdgeInsets.all(32.w),
gridDelegate: SliverWaterfallFlowDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
mainAxisSpacing: 20.w,
crossAxisSpacing: 20.w,
),
itemBuilder: (context, index) {
final item = items[index];
return GoodsCard(item: item);
},
itemCount: items.length,
);
},
itemCount: 10,
),
);
}

Loading…
Cancel
Save