Browse Source

搜索排序更改

zyh
w-R 3 years ago
parent
commit
f01670bd9b
  1. 94
      lib/store/shopping/shopping_home/search_page.dart

94
lib/store/shopping/shopping_home/search_page.dart

@ -39,6 +39,7 @@ class _SearchPage extends State<SearchPage> with AutomaticKeepAliveClientMixin,
List<String> historySearch = [];
FocusNode _focusNode = FocusNode();
bool hasFocus = true;
int priceOrder = 0;
@override
void didChangeMetrics() {
@ -145,6 +146,8 @@ class _SearchPage extends State<SearchPage> with AutomaticKeepAliveClientMixin,
await minService.findMiNiGroupList({
"id":widget.arguments["storeId"],
"searchKey" :text,
"sortType":optionIndex == 0 ? "" : (optionIndex == 1) ? productListBeans[0].sellCount : productListBeans[0].price,
"asc":optionIndex == 0 ? "" :(priceOrder == 2) ? true:""
}).catchError((error) {
}).catchError((error) {
refreshController.refreshFailed();
@ -243,11 +246,16 @@ class _SearchPage extends State<SearchPage> with AutomaticKeepAliveClientMixin,
child: TextField(
focusNode:_focusNode,
textInputAction: TextInputAction.search,
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: Color(0xFF292929),
),
onEditingComplete: () {
// startLocation();
},
controller: editingController,
cursorHeight: 30.h,
// cursorHeight: 30.h,
decoration: InputDecoration(
contentPadding: EdgeInsets.symmetric(
vertical: 12.h,
@ -271,46 +279,6 @@ class _SearchPage extends State<SearchPage> with AutomaticKeepAliveClientMixin,
),
),
)
// Container(
// height: 30.h,
// margin: EdgeInsets.fromLTRB(0.w, 0, 8.w, 0.h),
// padding: EdgeInsets.fromLTRB(12.w, 7.h, 0, 0.h),
// decoration: BoxDecoration(
// color: Colors.white,
// borderRadius: BorderRadius.circular(18),
// boxShadow: [
// BoxShadow(
// color: Colors.black.withAlpha(12),
// offset: Offset(0, 3),
// blurRadius: 14,
// spreadRadius: 0,
// ),
// ],
// ),
// child: GestureDetector(
// onTap: () {},
// child: Row(
// children: [
// Icon(
// Icons.search,
// size: 16,
// color: Color(0xFFABACAB),
// ),
// SizedBox(
// width: 3.w,
// ),
// Text(
// "前进麦味",
// style: TextStyle(
// fontSize: 12.sp,
// fontWeight: MyFontWeight.regular,
// color: Color(0xFF727272),
// ),
// ),
// ],
// ),
// ),
// )
),
Container(
alignment: Alignment.center,
@ -548,6 +516,7 @@ class _SearchPage extends State<SearchPage> with AutomaticKeepAliveClientMixin,
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(child:
RoundButton(
padding: EdgeInsets.only(left: 4, right: 4),
height: 29.h,
@ -557,7 +526,8 @@ class _SearchPage extends State<SearchPage> with AutomaticKeepAliveClientMixin,
radius: 4,
backgroup: Color(0xFFF5F5F5),
fontSize: 12.sp,
),
),)
],
),
);
@ -573,12 +543,13 @@ class _SearchPage extends State<SearchPage> with AutomaticKeepAliveClientMixin,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
GestureDetector(
onTap: () {
setState(() {
optionIndex = 0;
appletGoods(widget.arguments["searchKey"]);
});
},
child: Text(
@ -598,6 +569,7 @@ class _SearchPage extends State<SearchPage> with AutomaticKeepAliveClientMixin,
onTap: () {
setState(() {
optionIndex = 1;
appletGoods(widget.arguments["searchKey"]);
});
},
child: Text(
@ -617,6 +589,8 @@ class _SearchPage extends State<SearchPage> with AutomaticKeepAliveClientMixin,
onTap: () {
setState(() {
optionIndex = 2;
priceOrder = 1;
appletGoods(widget.arguments["searchKey"]);
});
},
child: Row(
@ -633,11 +607,37 @@ class _SearchPage extends State<SearchPage> with AutomaticKeepAliveClientMixin,
: Color(0xFF4D4D4D),
),
),
Image.asset(
"assets/image/jg.png",
width: 16,
height: 16,
Column(
children: [
GestureDetector(
onTap: (){
priceOrder = 1;
appletGoods(widget.arguments["searchKey"]);
},
child:Icon(
Icons.arrow_drop_up,
color: (optionIndex == 2 && priceOrder == 1) ? Color(0xFF33A061) : Color(0xFF4D4D4D),
size: 16,
),
),
GestureDetector(
onTap: (){
priceOrder = 2;
appletGoods(widget.arguments["searchKey"]);
},
child:Icon(
Icons.arrow_drop_down,
color: (optionIndex == 2 && priceOrder == 2) ? Color(0xFF33A061) : Color(0xFF4D4D4D),
size: 16,
),
)
],
)
// Image.asset(
// "assets/image/jg.png",
// width: 16,
// height: 16,
// ),
],
),
),

Loading…
Cancel
Save