Browse Source
商品列表板块数据需求待确认,接口已确认,数据暂未对接; 流水日期选择已优化完成; 商品下架页面对接完成; 商品上下架接口已确认,为对接; 刷新时接口请求失败的状态更改;wr_2023_business
wurong
1 year ago
15 changed files with 562 additions and 215 deletions
@ -0,0 +1,121 @@
|
||||
import 'package:flutter/material.dart'; |
||||
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
||||
import 'package:widgetpicker/widgetpicker.dart'; |
||||
|
||||
import '../../generated/l10n.dart'; |
||||
import '../../utils/font_weight.dart'; |
||||
|
||||
class DatePickerWidget extends StatelessWidget { |
||||
final _years = List.generate((DateTime.now().year - 2019 +1), (i) => "${i + 2019}年"); |
||||
final _months = List.generate(12, (i) => "${i + 1}月"); |
||||
final showChange; |
||||
|
||||
DatePickerWidget({this.showChange = true}); |
||||
|
||||
@override |
||||
Widget build(BuildContext context) { |
||||
bool monOn = true; |
||||
String _currentYear = "${DateTime.now().year.toString()}年"; |
||||
String _currentMonth = "${DateTime.now().month.toString()}月"; |
||||
String _currentTimeStr = |
||||
"${_currentYear.replaceAll("年", "")}-${_currentMonth.length == 2 ? "0${_currentMonth.replaceAll("月", "")}" : _currentMonth.replaceAll("月", "")}"; |
||||
return StatefulBuilder(builder: (context1, state) { |
||||
return Container( |
||||
height: 260.h, |
||||
decoration: BoxDecoration( |
||||
color: Colors.white, |
||||
borderRadius: BorderRadius.only( |
||||
topLeft: Radius.circular(8), |
||||
topRight: Radius.circular(8), |
||||
), |
||||
), |
||||
child: Column( |
||||
children: [ |
||||
Container( |
||||
height: 50.h, |
||||
child: Row( |
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
||||
crossAxisAlignment: CrossAxisAlignment.center, |
||||
children: [ |
||||
InkWell( |
||||
onTap: () { |
||||
Navigator.of(context).pop(); |
||||
}, |
||||
child: Container( |
||||
child: Text( |
||||
S.of(context).quxiao, |
||||
style: TextStyle( |
||||
fontSize: 16, |
||||
fontWeight: MyFontWeight.semi_bold, |
||||
color: Colors.black), |
||||
), |
||||
margin: EdgeInsets.only(left: 6), |
||||
padding: EdgeInsets.all(10), |
||||
), |
||||
), |
||||
InkWell( |
||||
onTap: () { |
||||
Navigator.of(context).pop(_currentTimeStr); |
||||
}, |
||||
child: Container( |
||||
child: Text( |
||||
S.of(context).queren, |
||||
style: TextStyle( |
||||
fontSize: 16, |
||||
fontWeight: MyFontWeight.semi_bold, |
||||
color:Color(0xFF30415B)), |
||||
), |
||||
margin: EdgeInsets.only(left: 6), |
||||
padding: EdgeInsets.all(10), |
||||
), |
||||
), |
||||
], |
||||
), |
||||
), |
||||
Container( |
||||
height: 2.h, |
||||
color: Color(0xFFF4F4F4), |
||||
), |
||||
Expanded(child: Container( |
||||
child: |
||||
Row( |
||||
mainAxisAlignment: MainAxisAlignment.center, |
||||
children: [ |
||||
WidgetPicker( |
||||
value: _currentYear, |
||||
options: _years, |
||||
textStyle: TextStyle( |
||||
fontSize: 16.sp, color: Color(0xFFDDDDDD),), |
||||
selectedTextStyle: |
||||
TextStyle(fontSize: 16.sp, color: Colors.black,fontWeight: MyFontWeight.medium), |
||||
onChanged: (value) => state(() => { |
||||
_currentYear = value, |
||||
_currentTimeStr = monOn |
||||
? "${_currentYear.replaceAll("年", "")}-${_currentMonth.length == 2 ? "0${_currentMonth.replaceAll("月", "")}" : _currentMonth.replaceAll("月", "")}" |
||||
: "${_currentYear.replaceAll("年", "")}" |
||||
}), |
||||
), |
||||
if (monOn) |
||||
WidgetPicker( |
||||
value: _currentMonth, |
||||
options: _months, |
||||
textStyle: TextStyle( |
||||
fontSize: 16.sp, color: Color(0xFFDDDDDD)), |
||||
selectedTextStyle: |
||||
TextStyle(fontSize: 16.sp, color: Colors.black,fontWeight: MyFontWeight.medium), |
||||
onChanged: (value) => state(() => { |
||||
_currentMonth = value, |
||||
_currentTimeStr = monOn |
||||
? "${_currentYear.replaceAll("年", "")}-${_currentMonth.length == 2 ? "0${_currentMonth.replaceAll("月", "")}" : _currentMonth.replaceAll("月", "")}" |
||||
: "${_currentYear.replaceAll("年", "")}" |
||||
}), |
||||
), |
||||
], |
||||
), |
||||
)), |
||||
], |
||||
), |
||||
); |
||||
}); |
||||
} |
||||
} |
Loading…
Reference in new issue