价格 销量筛选

hmxc
章文轩 3 years ago
parent dcbf791fad
commit 51e476b74d

@ -11,6 +11,7 @@ const kPrimaryColor = Color(0xFFFFC40C);
const kDarkPrimaryColor = Color(0xFFFF8200); const kDarkPrimaryColor = Color(0xFFFF8200);
const kDangerColor = Color(0xFFFF3B30); const kDangerColor = Color(0xFFFF3B30);
const kDarkSubColor = Color(0xFF979797); const kDarkSubColor = Color(0xFF979797);
const kBalckSubColor = Color(0xFF000000);
class BaseStyle { class BaseStyle {
/// ///

@ -158,6 +158,98 @@ class _MarketPageState extends State<MarketPage>
} }
Widget _buildBody(BuildContext context) { Widget _buildBody(BuildContext context) {
final normalTypeButton = MaterialButton(
onPressed: () {
_orderType = OrderType.NORMAL;
priceIcon = CupertinoIcons.chevron_up_chevron_down;
setState(() {});
},
child: Text(
'综合',
style: TextStyle(
color:
_orderType == OrderType.NORMAL ? kBalckSubColor : ktextPrimary,
fontSize: _orderType == OrderType.NORMAL ? 32.sp : 28.sp,
fontWeight: _orderType == OrderType.NORMAL
?FontWeight.bold
: FontWeight.normal,
),
),
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 ? kBalckSubColor : ktextPrimary,
fontSize: _orderType == OrderType.SALES ? 32.sp : 28.sp,
fontWeight: _orderType == OrderType.SALES
?FontWeight.bold
: FontWeight.normal,
),
),
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
? kBalckSubColor
: ktextPrimary,
fontSize: _orderType == OrderType.PRICE_HIGH ||
_orderType == OrderType.PRICE_LOW
? 32.sp
: 28.sp,
fontWeight: _orderType == OrderType.PRICE_HIGH ||
_orderType == OrderType.PRICE_LOW
?FontWeight.bold
: FontWeight.normal,
),
),
Icon(
priceIcon,
size: 32.w,
color: _orderType == OrderType.PRICE_HIGH ||
_orderType == OrderType.PRICE_LOW
? kBalckSubColor
: ktextPrimary,
),
],
),
height: 80.w,
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
);
return CustomScrollView( return CustomScrollView(
controller: _sliverListController, controller: _sliverListController,
slivers: <Widget>[ slivers: <Widget>[
@ -174,7 +266,7 @@ class _MarketPageState extends State<MarketPage>
bottom: PreferredSize( bottom: PreferredSize(
preferredSize: Size.fromHeight(tabBarHeight), preferredSize: Size.fromHeight(tabBarHeight),
child: _goodsTitle() child: _goodsTitle( normalTypeButton, salesTypeButton, priceButton,)
)), )),
SliverPadding( SliverPadding(
padding: EdgeInsets.all(10.w), padding: EdgeInsets.all(10.w),
@ -752,7 +844,7 @@ class _MarketPageState extends State<MarketPage>
_goodsTitle(){ _goodsTitle(Widget normalTypeButton,Widget salesTypeButton,Widget priceButton,){
return Container( return Container(
height: 90.w, height: 90.w,
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
@ -762,150 +854,14 @@ class _MarketPageState extends State<MarketPage>
Container( Container(
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
height: 60.w, height: 60.w,
child:
TabBar(
onTap: (index) {
// _presenter.fetchList(_category.id, 0, _sortType);
setState(() {});
},
isScrollable: true,
labelPadding: EdgeInsets.zero,
controller: _tabController,
labelColor: Color(0xFFF9F9F9),
indicatorPadding: EdgeInsets.symmetric(horizontal: 40.w),
indicatorSize: TabBarIndicatorSize.label,
unselectedLabelColor: Colors.black54,
labelStyle: TextStyle(color: Colors.black54),
indicatorColor: Color(0xFFE52E2E),
tabs: _tabItems()),
),
);
}
List<Widget> _tabItems() {
return [_tabItemComprehensive(0,'综合推荐'),_tabItemSalesVolume(1,'销量'),_tabItemPrice(2,'价格')];
}
_tabItemComprehensive(int index,String text) {
bool isChoose = index == _tabController.index;
// Color textColor = index == _tabController.index
// ? getCurrentThemeColor()
// : Colors.black.withOpacity(0.9);
return Tab(
child: GestureDetector(
onTap: (){
_orderType = OrderType.NORMAL;
priceIcon = CupertinoIcons.chevron_up_chevron_down;
setState(() {});
},
child: Container(
alignment: Alignment.center,
width: 150.w,
// color: Colors.white,
color: Color(0xFFF9F9F9),
padding: EdgeInsets.only(left: 10.w, right: 10.w),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
text,
style: TextStyle(
fontWeight: isChoose?FontWeight.bold:FontWeight.normal,
fontSize: isChoose?32.sp:28.sp,
color: isChoose?Color(0xFF000000):Color(0xFF666666)),
),
],
),
),
),
);
}
_tabItemSalesVolume(int index,String text) {
bool isChoose = index == _tabController.index;
// Color textColor = index == _tabController.index
// ? getCurrentThemeColor()
// : Colors.black.withOpacity(0.9);
return Tab(
child: GestureDetector(
onTap: (){
_orderType = OrderType.SALES;
priceIcon = CupertinoIcons.chevron_up_chevron_down;
setState(() {});
},
child: Container(
alignment: Alignment.center,
width: 150.w,
// color: Colors.white,
color: Color(0xFFF9F9F9),
padding: EdgeInsets.only(left: 10.w, right: 10.w),
child:Row( child:Row(
children: [ children: [
Text( normalTypeButton,
text, salesTypeButton,
style: TextStyle( priceButton,
fontWeight: isChoose?FontWeight.bold:FontWeight.normal,
fontSize: isChoose?32.sp:28.sp,
color: isChoose?Color(0xFF000000):Color(0xFF666666)),
),
Icon(
priceIcon,
size: 32.w,
color: _orderType == OrderType.PRICE_HIGH ||
_orderType == OrderType.PRICE_LOW
? kDarkPrimaryColor
: ktextPrimary,
),
], ],
), ),
),
),
);
}
_tabItemPrice(int index,String text) {
bool isChoose = index == _tabController.index;
// Color textColor = index == _tabController.index
// ? getCurrentThemeColor()
// : Colors.black.withOpacity(0.9);
return Tab(
child: GestureDetector(
onTap: (){
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: Container(
alignment: Alignment.center,
width: 150.w,
// color: Colors.white,
color: Color(0xFFF9F9F9),
padding: EdgeInsets.only(left: 10.w, right: 10.w),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
text,
style: TextStyle(
fontWeight: isChoose?FontWeight.bold:FontWeight.normal,
fontSize: isChoose?32.sp:28.sp,
color: isChoose?Color(0xFF000000):Color(0xFF666666)),
),
],
),
),
), ),
); );
} }
@ -913,6 +869,10 @@ class _MarketPageState extends State<MarketPage>
@override @override
bool get wantKeepAlive => true; bool get wantKeepAlive => true;
} }

@ -67,7 +67,11 @@ class SearchDetailPageState extends State<SearchDetailPage> {
'综合', '综合',
style: TextStyle( style: TextStyle(
color: color:
_orderType == OrderType.NORMAL ? kDarkPrimaryColor : ktextPrimary, _orderType == OrderType.NORMAL ? kBalckSubColor : ktextPrimary,
fontSize: _orderType == OrderType.NORMAL ? 32.sp : 28.sp,
fontWeight: _orderType == OrderType.NORMAL
?FontWeight.bold
: FontWeight.normal,
), ),
), ),
height: 80.w, height: 80.w,
@ -83,7 +87,11 @@ class SearchDetailPageState extends State<SearchDetailPage> {
'销量', '销量',
style: TextStyle( style: TextStyle(
color: color:
_orderType == OrderType.SALES ? kDarkPrimaryColor : ktextPrimary, _orderType == OrderType.SALES ? kBalckSubColor : ktextPrimary,
fontSize: _orderType == OrderType.SALES ? 32.sp : 28.sp,
fontWeight: _orderType == OrderType.SALES
?FontWeight.bold
: FontWeight.normal,
), ),
), ),
height: 80.w, height: 80.w,
@ -116,8 +124,16 @@ class SearchDetailPageState extends State<SearchDetailPage> {
style: TextStyle( style: TextStyle(
color: _orderType == OrderType.PRICE_HIGH || color: _orderType == OrderType.PRICE_HIGH ||
_orderType == OrderType.PRICE_LOW _orderType == OrderType.PRICE_LOW
? kDarkPrimaryColor ? kBalckSubColor
: ktextPrimary, : ktextPrimary,
fontSize: _orderType == OrderType.PRICE_HIGH ||
_orderType == OrderType.PRICE_LOW
? 32.sp
: 28.sp,
fontWeight: _orderType == OrderType.PRICE_HIGH ||
_orderType == OrderType.PRICE_LOW
?FontWeight.bold
: FontWeight.normal,
), ),
), ),
Icon( Icon(
@ -125,7 +141,7 @@ class SearchDetailPageState extends State<SearchDetailPage> {
size: 32.w, size: 32.w,
color: _orderType == OrderType.PRICE_HIGH || color: _orderType == OrderType.PRICE_HIGH ||
_orderType == OrderType.PRICE_LOW _orderType == OrderType.PRICE_LOW
? kDarkPrimaryColor ? kBalckSubColor
: ktextPrimary, : ktextPrimary,
), ),
], ],

@ -85,13 +85,20 @@ class SearchGoodsPageState extends State<SearchGoodsPage> {
onPressed: () { onPressed: () {
_orderType = OrderType.NORMAL; _orderType = OrderType.NORMAL;
priceIcon = CupertinoIcons.chevron_up_chevron_down; priceIcon = CupertinoIcons.chevron_up_chevron_down;
orderBySalesVolume = null;
orderByPrice = null;
_refreshController1.callRefresh();
setState(() {}); setState(() {});
}, },
child: Text( child: Text(
'综合', '综合',
style: TextStyle( style: TextStyle(
color: color:
_orderType == OrderType.NORMAL ? kDarkPrimaryColor : ktextPrimary, _orderType == OrderType.NORMAL ? kBalckSubColor : ktextPrimary,
fontSize: _orderType == OrderType.NORMAL ? 32.sp : 28.sp,
fontWeight: _orderType == OrderType.NORMAL
?FontWeight.bold
: FontWeight.normal,
), ),
), ),
height: 80.w, height: 80.w,
@ -100,14 +107,21 @@ class SearchGoodsPageState extends State<SearchGoodsPage> {
final salesTypeButton = MaterialButton( final salesTypeButton = MaterialButton(
onPressed: () { onPressed: () {
_orderType = OrderType.SALES; _orderType = OrderType.SALES;
orderBySalesVolume = 2;
orderByPrice = null;
priceIcon = CupertinoIcons.chevron_up_chevron_down; priceIcon = CupertinoIcons.chevron_up_chevron_down;
_refreshController1.callRefresh();
setState(() {}); setState(() {});
}, },
child: Text( child: Text(
'销量', '销量',
style: TextStyle( style: TextStyle(
color: color:
_orderType == OrderType.SALES ? kDarkPrimaryColor : ktextPrimary, _orderType == OrderType.SALES ? kBalckSubColor : ktextPrimary,
fontSize: _orderType == OrderType.SALES ? 32.sp : 28.sp,
fontWeight: _orderType == OrderType.SALES
?FontWeight.bold
: FontWeight.normal,
), ),
), ),
height: 80.w, height: 80.w,
@ -120,17 +134,24 @@ class SearchGoodsPageState extends State<SearchGoodsPage> {
case OrderType.NORMAL: case OrderType.NORMAL:
case OrderType.SALES: case OrderType.SALES:
_orderType = OrderType.PRICE_HIGH; _orderType = OrderType.PRICE_HIGH;
orderByPrice = 1;
orderBySalesVolume = null;
priceIcon = CupertinoIcons.chevron_up; priceIcon = CupertinoIcons.chevron_up;
break; break;
case OrderType.PRICE_HIGH: case OrderType.PRICE_HIGH:
_orderType = OrderType.PRICE_LOW; _orderType = OrderType.PRICE_LOW;
orderByPrice = 2;
orderBySalesVolume = null;
priceIcon = CupertinoIcons.chevron_down; priceIcon = CupertinoIcons.chevron_down;
break; break;
case OrderType.PRICE_LOW: case OrderType.PRICE_LOW:
_orderType = OrderType.PRICE_HIGH; _orderType = OrderType.PRICE_HIGH;
orderByPrice = 1;
orderBySalesVolume = null;
priceIcon = CupertinoIcons.chevron_up; priceIcon = CupertinoIcons.chevron_up;
break; break;
} }
_refreshController1.callRefresh();
setState(() {}); setState(() {});
}, },
child: Row( child: Row(
@ -140,8 +161,16 @@ class SearchGoodsPageState extends State<SearchGoodsPage> {
style: TextStyle( style: TextStyle(
color: _orderType == OrderType.PRICE_HIGH || color: _orderType == OrderType.PRICE_HIGH ||
_orderType == OrderType.PRICE_LOW _orderType == OrderType.PRICE_LOW
? kDarkPrimaryColor ? kBalckSubColor
: ktextPrimary, : ktextPrimary,
fontSize: _orderType == OrderType.PRICE_HIGH ||
_orderType == OrderType.PRICE_LOW
? 32.sp
: 28.sp,
fontWeight: _orderType == OrderType.PRICE_HIGH ||
_orderType == OrderType.PRICE_LOW
?FontWeight.bold
: FontWeight.normal,
), ),
), ),
Icon( Icon(
@ -149,7 +178,7 @@ class SearchGoodsPageState extends State<SearchGoodsPage> {
size: 32.w, size: 32.w,
color: _orderType == OrderType.PRICE_HIGH || color: _orderType == OrderType.PRICE_HIGH ||
_orderType == OrderType.PRICE_LOW _orderType == OrderType.PRICE_LOW
? kDarkPrimaryColor ? kBalckSubColor
: ktextPrimary, : ktextPrimary,
), ),
], ],

Loading…
Cancel
Save