张萌 4 years ago
commit 793b71ecd3

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

@ -1,3 +1,4 @@
import 'package:aku_community/models/market/goods_item.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.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'; import 'package:aku_community/utils/headers.dart';
class GoodsCard extends StatelessWidget { 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 @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -37,7 +39,7 @@ class GoodsCard extends StatelessWidget {
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
padding: EdgeInsets.symmetric(horizontal: 12.w), padding: EdgeInsets.symmetric(horizontal: 12.w),
child: Text( child: Text(
'分别是紫色烦恼则妇女色泽封闭周四鹅u部分紫色部分', item.recommend,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
color: Colors.white, color: Colors.white,
@ -55,7 +57,7 @@ class GoodsCard extends StatelessWidget {
vertical: 20.w, vertical: 20.w,
), ),
child: Text( child: Text(
'袁隆平水稻大米精选 56kg唇齿流香 无常有机稻花 无常有机稻花', item.title,
maxLines: 2, maxLines: 2,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
@ -71,17 +73,18 @@ class GoodsCard extends StatelessWidget {
text: TextSpan( text: TextSpan(
children: [ children: [
TextSpan( TextSpan(
text: '¥123.45 ', text: '¥${item.sellingPrice} ',
style: TextStyle( style: TextStyle(
color: Colors.red, color: Colors.red,
fontSize: 28.sp, fontSize: 28.sp,
), ),
), ),
TextSpan( TextSpan(
text: '123已付款', text: '${item.markingPrice}',
style: TextStyle( style: TextStyle(
color: ktextSubColor, color: ktextSubColor,
fontSize: 20.sp, 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/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart'; import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:get/get.dart';
import 'package:waterfall_flow/waterfall_flow.dart'; import 'package:waterfall_flow/waterfall_flow.dart';
import 'package:aku_community/constants/api.dart'; import 'package:aku_community/constants/api.dart';
import 'package:aku_community/models/market/goods_item.dart'; import 'package:aku_community/models/market/goods_item.dart';
import 'package:aku_community/models/market/market_category_model.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/pages/things_page/widget/bee_list_view.dart';
import 'package:aku_community/utils/headers.dart';
class GoodsTabListView extends StatefulWidget { class GoodsTabListView extends StatefulWidget {
final MarketCategoryModel model; final MarketCategoryModel model;
@ -32,17 +32,13 @@ class _GoodsTabListViewState extends State<GoodsTabListView>
model.tableList?.map((e) => GoodsItem.fromJson(e)).toList() ?? [], model.tableList?.map((e) => GoodsItem.fromJson(e)).toList() ?? [],
builder: (items) { builder: (items) {
return WaterfallFlow.builder( return WaterfallFlow.builder(
padding: EdgeInsets.all(32.w),
gridDelegate: SliverWaterfallFlowDelegateWithFixedCrossAxisCount( gridDelegate: SliverWaterfallFlowDelegateWithFixedCrossAxisCount(
crossAxisCount: 2, crossAxisCount: 2,
), ),
itemBuilder: (context, index) { itemBuilder: (context, index) {
final GoodsItem item = items[index]; final GoodsItem item = items[index];
return MaterialButton( return GoodsCard(item: item);
onPressed: () {
Get.to(() => GoodsDetailPage(id: widget.model.id));
},
child: Text(item.title),
);
}, },
itemCount: items.length, 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/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:waterfall_flow/waterfall_flow.dart'; import 'package:waterfall_flow/waterfall_flow.dart';
@ -26,6 +30,14 @@ class SearchGoodsPageState extends State<SearchGoodsPage> {
TextEditingController _editingController = TextEditingController(); TextEditingController _editingController = TextEditingController();
OrderType _orderType = OrderType.NORMAL; OrderType _orderType = OrderType.NORMAL;
IconData priceIcon = CupertinoIcons.chevron_up_chevron_down; IconData priceIcon = CupertinoIcons.chevron_up_chevron_down;
EasyRefreshController _refreshController = EasyRefreshController();
@override
void dispose() {
_refreshController.dispose();
super.dispose();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final normalTypeButton = MaterialButton( final normalTypeButton = MaterialButton(
@ -108,6 +120,10 @@ class SearchGoodsPageState extends State<SearchGoodsPage> {
title: Padding( title: Padding(
padding: EdgeInsets.symmetric(vertical: 12.w), padding: EdgeInsets.symmetric(vertical: 12.w),
child: TextField( child: TextField(
onEditingComplete: () {
setState(() {});
_refreshController.callRefresh();
},
controller: _editingController, controller: _editingController,
decoration: InputDecoration( decoration: InputDecoration(
border: OutlineInputBorder( border: OutlineInputBorder(
@ -131,17 +147,27 @@ class SearchGoodsPageState extends State<SearchGoodsPage> {
// ), // ),
// preferredSize: Size.fromHeight(80.w), // preferredSize: Size.fromHeight(80.w),
// ), // ),
body: WaterfallFlow.builder( body: BeeListView(
padding: EdgeInsets.all(32.w), path: API.market.search,
gridDelegate: SliverWaterfallFlowDelegateWithFixedCrossAxisCount( controller: _refreshController,
crossAxisCount: 2, extraParams: {'searchName': _editingController.text},
mainAxisSpacing: 20.w, convert: (model) =>
crossAxisSpacing: 20.w, model.tableList!.map((e) => GoodsItem.fromJson(e)).toList(),
), builder: (items) {
itemBuilder: (context, index) { return WaterfallFlow.builder(
return GoodsCard(); 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