更新商品搜索页

hmxc
小赖 4 years ago
parent fb423a7e61
commit c23e186969

@ -1,3 +1,5 @@
import 'package:aku_community/ui/market/search/search_goods_page.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
@ -30,6 +32,12 @@ class _MarketPageState extends State<MarketPage>
super.build(context); super.build(context);
final mediaWidth = MediaQuery.of(context).size.width; final mediaWidth = MediaQuery.of(context).size.width;
return BeeScaffold( return BeeScaffold(
leading: IconButton(
icon: Icon(CupertinoIcons.search),
onPressed: () {
Get.to(() => SearchGoodsPage());
},
),
title: '商城', title: '商城',
actions: [ actions: [
MaterialButton( MaterialButton(

@ -0,0 +1,146 @@
import 'package:aku_community/base/base_style.dart';
import 'package:aku_community/ui/market/goods/goods_card.dart';
import 'package:aku_community/widget/bee_scaffold.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:aku_community/utils/headers.dart';
import 'package:waterfall_flow/waterfall_flow.dart';
enum OrderType {
NORMAL,
SALES,
PRICE_HIGH,
PRICE_LOW,
}
class SearchGoodsPage extends StatefulWidget {
SearchGoodsPage({Key? key}) : super(key: key);
@override
SearchGoodsPageState createState() => SearchGoodsPageState();
}
class SearchGoodsPageState extends State<SearchGoodsPage> {
TextEditingController _editingController = TextEditingController();
OrderType _orderType = OrderType.NORMAL;
IconData priceIcon = CupertinoIcons.chevron_up_chevron_down;
@override
Widget build(BuildContext context) {
final normalTypeButton = MaterialButton(
onPressed: () {
_orderType = OrderType.NORMAL;
priceIcon = CupertinoIcons.chevron_up_chevron_down;
setState(() {});
},
child: Text(
'综合',
style: TextStyle(
color:
_orderType == OrderType.NORMAL ? kDarkPrimaryColor : ktextPrimary,
),
),
height: 80.w,
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
);
final salesTypeButton = MaterialButton(
onPressed: () {
_orderType = OrderType.SALES;
priceIcon = CupertinoIcons.chevron_up_chevron_down;
setState(() {});
},
child: Text(
'销量',
style: TextStyle(
color:
_orderType == OrderType.SALES ? kDarkPrimaryColor : ktextPrimary,
),
),
height: 80.w,
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
);
final priceButton = MaterialButton(
onPressed: () {
switch (_orderType) {
case OrderType.NORMAL:
case OrderType.SALES:
_orderType = OrderType.PRICE_HIGH;
priceIcon = CupertinoIcons.chevron_up;
break;
case OrderType.PRICE_HIGH:
_orderType = OrderType.PRICE_LOW;
priceIcon = CupertinoIcons.chevron_down;
break;
case OrderType.PRICE_LOW:
_orderType = OrderType.PRICE_HIGH;
priceIcon = CupertinoIcons.chevron_up;
break;
}
setState(() {});
},
child: Row(
children: [
Text(
'价格',
style: TextStyle(
color: _orderType == OrderType.PRICE_HIGH ||
_orderType == OrderType.PRICE_LOW
? kDarkPrimaryColor
: ktextPrimary,
),
),
Icon(
priceIcon,
size: 32.w,
color: _orderType == OrderType.PRICE_HIGH ||
_orderType == OrderType.PRICE_LOW
? kDarkPrimaryColor
: ktextPrimary,
),
],
),
height: 80.w,
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
);
return BeeScaffold(
title: Padding(
padding: EdgeInsets.symmetric(vertical: 12.w),
child: TextField(
controller: _editingController,
decoration: InputDecoration(
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(40),
),
filled: true,
fillColor: Color(0xFFF3F3F3),
isDense: true,
prefixIcon: Icon(CupertinoIcons.search),
),
),
),
//TODO
// appBarBottom: PreferredSize(
// child: Row(
// children: [
// normalTypeButton,
// salesTypeButton,
// priceButton,
// ],
// ),
// 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();
},
itemCount: 10,
),
);
}
}

@ -5,7 +5,7 @@ import 'package:aku_community/constants/app_theme.dart';
import 'package:aku_community/widget/bee_back_button.dart'; import 'package:aku_community/widget/bee_back_button.dart';
class BeeScaffold extends StatelessWidget { class BeeScaffold extends StatelessWidget {
final String? title; final dynamic? title;
final Widget? body; final Widget? body;
/// appbar background color /// appbar background color

Loading…
Cancel
Save