价格 销量筛选

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

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

@ -158,6 +158,98 @@ class _MarketPageState extends State<MarketPage>
}
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(
controller: _sliverListController,
slivers: <Widget>[
@ -174,7 +266,7 @@ class _MarketPageState extends State<MarketPage>
bottom: PreferredSize(
preferredSize: Size.fromHeight(tabBarHeight),
child: _goodsTitle()
child: _goodsTitle( normalTypeButton, salesTypeButton, priceButton,)
)),
SliverPadding(
padding: EdgeInsets.all(10.w),
@ -752,7 +844,7 @@ class _MarketPageState extends State<MarketPage>
_goodsTitle(){
_goodsTitle(Widget normalTypeButton,Widget salesTypeButton,Widget priceButton,){
return Container(
height: 90.w,
alignment: Alignment.centerLeft,
@ -762,153 +854,21 @@ class _MarketPageState extends State<MarketPage>
Container(
alignment: Alignment.centerLeft,
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)),
),
],
),
child:Row(
children: [
normalTypeButton,
salesTypeButton,
priceButton,
],
),
),
);
}
_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(
children: [
Text(
text,
style: TextStyle(
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)),
),
],
),
),
),
);
}

@ -67,7 +67,11 @@ class SearchDetailPageState extends State<SearchDetailPage> {
'综合',
style: TextStyle(
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,
@ -83,7 +87,11 @@ class SearchDetailPageState extends State<SearchDetailPage> {
'销量',
style: TextStyle(
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,
@ -115,17 +123,25 @@ class SearchDetailPageState extends State<SearchDetailPage> {
'价格',
style: TextStyle(
color: _orderType == OrderType.PRICE_HIGH ||
_orderType == OrderType.PRICE_LOW
? kDarkPrimaryColor
_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
? kDarkPrimaryColor
_orderType == OrderType.PRICE_LOW
? kBalckSubColor
: ktextPrimary,
),
],

@ -85,13 +85,20 @@ class SearchGoodsPageState extends State<SearchGoodsPage> {
onPressed: () {
_orderType = OrderType.NORMAL;
priceIcon = CupertinoIcons.chevron_up_chevron_down;
orderBySalesVolume = null;
orderByPrice = null;
_refreshController1.callRefresh();
setState(() {});
},
child: Text(
'综合',
style: TextStyle(
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,
@ -100,14 +107,21 @@ class SearchGoodsPageState extends State<SearchGoodsPage> {
final salesTypeButton = MaterialButton(
onPressed: () {
_orderType = OrderType.SALES;
orderBySalesVolume = 2;
orderByPrice = null;
priceIcon = CupertinoIcons.chevron_up_chevron_down;
_refreshController1.callRefresh();
setState(() {});
},
child: Text(
'销量',
style: TextStyle(
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,
@ -120,17 +134,24 @@ class SearchGoodsPageState extends State<SearchGoodsPage> {
case OrderType.NORMAL:
case OrderType.SALES:
_orderType = OrderType.PRICE_HIGH;
orderByPrice = 1;
orderBySalesVolume = null;
priceIcon = CupertinoIcons.chevron_up;
break;
case OrderType.PRICE_HIGH:
_orderType = OrderType.PRICE_LOW;
orderByPrice = 2;
orderBySalesVolume = null;
priceIcon = CupertinoIcons.chevron_down;
break;
case OrderType.PRICE_LOW:
_orderType = OrderType.PRICE_HIGH;
orderByPrice = 1;
orderBySalesVolume = null;
priceIcon = CupertinoIcons.chevron_up;
break;
}
_refreshController1.callRefresh();
setState(() {});
},
child: Row(
@ -139,17 +160,25 @@ class SearchGoodsPageState extends State<SearchGoodsPage> {
'价格',
style: TextStyle(
color: _orderType == OrderType.PRICE_HIGH ||
_orderType == OrderType.PRICE_LOW
? kDarkPrimaryColor
_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
? kDarkPrimaryColor
_orderType == OrderType.PRICE_LOW
? kBalckSubColor
: ktextPrimary,
),
],

Loading…
Cancel
Save