瀏覽代碼

0119 修复个人信息的出生日期选择

tags/0.0.4+4^2
23028876916@qq.com 3 年之前
父節點
當前提交
85a0002924
共有 2 個文件被更改,包括 27 次插入41 次删除
  1. +13
    -27
      lib/pages/mine_detail_page/mine_detail_page.dart
  2. +14
    -14
      lib/widgets/others/action_date_alert/action_date_alert.dart

+ 13
- 27
lib/pages/mine_detail_page/mine_detail_page.dart 查看文件

@@ -120,9 +120,7 @@ class _MineDetailContainerState extends State<_MineDetailContainer> {
_createItem(
'出生日期',
birthday > 0
? DateFormat('yyyy-MM-dd').format(
DateTime.fromMillisecondsSinceEpoch(
birthday * 1000))
? DateFormat('yyyy-MM-dd').format(DateTime.fromMillisecondsSinceEpoch(birthday * 1000))
: user?.birthday ?? '', onTap: () {
_selectBrithday();
}),
@@ -130,16 +128,13 @@ class _MineDetailContainerState extends State<_MineDetailContainer> {
_createItem(
'注册时间',
registTime > 0
? DateFormat('yyyy-MM-dd').format(
DateTime.fromMillisecondsSinceEpoch(
registTime * 1000))
? DateFormat('yyyy-MM-dd').format(DateTime.fromMillisecondsSinceEpoch(registTime * 1000))
: user?.registerTime ?? ''),
Padding( padding: const EdgeInsets.only(top: 8),child: _createItem('填写微信号', user?.is_upload_wx == '1' ? '已上传' : '未上传微信号与二维码',
onTap: (){
Padding(
padding: const EdgeInsets.only(top: 8),
child: _createItem('填写微信号', user?.is_upload_wx == '1' ? '已上传' : '未上传微信号与二维码', onTap: () {
Navigator.push(context, CupertinoPageRoute(builder: (_) => UploadWeChatPage()));
}))
],
),
);
@@ -148,6 +143,7 @@ class _MineDetailContainerState extends State<_MineDetailContainer> {

// 头像
Widget _creteHeader(MineDetailModel user, {VoidCallback onTap}) {
// Logger.log("头像:" + user?.avatar);
return GestureDetector(
child: Container(
height: 140,
@@ -160,9 +156,7 @@ class _MineDetailContainerState extends State<_MineDetailContainer> {
width: 80,
height: 80,
margin: EdgeInsets.only(top: 15),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(40),
color: Colors.black12),
decoration: BoxDecoration(borderRadius: BorderRadius.circular(40), color: Colors.black12),
child: ClipRRect(
borderRadius: BorderRadius.circular(40),
child: CachedNetworkImage(
@@ -196,10 +190,7 @@ class _MineDetailContainerState extends State<_MineDetailContainer> {
Expanded(
child: Text(
title ?? '',
style: TextStyle(
fontSize: 13,
color: Color(0xff333333),
fontWeight: FontWeight.bold),
style: TextStyle(fontSize: 13, color: Color(0xff333333), fontWeight: FontWeight.bold),
),
),
Text(
@@ -223,8 +214,7 @@ class _MineDetailContainerState extends State<_MineDetailContainer> {
);
}

Widget _createInput(String title, TextEditingController controller,
{VoidCallback onTap}) {
Widget _createInput(String title, TextEditingController controller, {VoidCallback onTap}) {
return GestureDetector(
child: Container(
padding: EdgeInsets.only(left: 12.5, right: 12.5),
@@ -235,10 +225,7 @@ class _MineDetailContainerState extends State<_MineDetailContainer> {
Expanded(
child: Text(
title ?? '',
style: TextStyle(
fontSize: 13,
color: Color(0xff333333),
fontWeight: FontWeight.bold),
style: TextStyle(fontSize: 13, color: Color(0xff333333), fontWeight: FontWeight.bold),
),
),
Expanded(
@@ -325,8 +312,7 @@ class _MineDetailContainerState extends State<_MineDetailContainer> {
toolbarWidgetColor: Colors.white,
initAspectRatio: CropAspectRatioPreset.original,
lockAspectRatio: true),
iosUiSettings: IOSUiSettings(
minimumAspectRatio: 1.0, aspectRatioLockEnabled: true));
iosUiSettings: IOSUiSettings(minimumAspectRatio: 1.0, aspectRatioLockEnabled: true));
if (cropperFile == null) {
return;
}
@@ -360,13 +346,13 @@ class _MineDetailContainerState extends State<_MineDetailContainer> {
builder: (context) {
return ActionDateAlert(
title: '选择出生日期',
maxTimeNew: "max",
);
},
isScrollControlled: false,
backgroundColor: Colors.transparent);
if (dateTime != null) {
String timeStamp =
(dateTime.millisecondsSinceEpoch / 1000).ceil().toString();
String timeStamp = (dateTime.millisecondsSinceEpoch / 1000).ceil().toString();
_bloc.updateUser(birthday: timeStamp);
}
}


+ 14
- 14
lib/widgets/others/action_date_alert/action_date_alert.dart 查看文件

@@ -7,13 +7,11 @@ class ActionDateAlert extends StatefulWidget {
final String title;
final TextStyle normalStyle;
final TextStyle selectedStyle;
final String maxTimeNew;

const ActionDateAlert({Key key, this.title, this.normalStyle, this.selectedStyle,this.maxTimeNew}) : super(key: key);


const ActionDateAlert({
Key key,
this.title,
this.normalStyle,
this.selectedStyle,
}) : super(key: key);

@override
State<StatefulWidget> createState() => _ActionDateAlert();
@@ -38,9 +36,7 @@ class _ActionDateAlert extends State<ActionDateAlert> {
margin: EdgeInsets.all(0),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(10),
topRight: Radius.circular(10))),
borderRadius: BorderRadius.only(topLeft: Radius.circular(10), topRight: Radius.circular(10))),
child: Column(
children: <Widget>[
widget.title == null || widget.title == ''
@@ -59,17 +55,14 @@ class _ActionDateAlert extends State<ActionDateAlert> {
child: Center(
child: Text(
widget.title,
style: TextStyle(
fontSize: 13,
color: Colors.black.withAlpha(180)),
style: TextStyle(fontSize: 13, color: Colors.black.withAlpha(180)),
),
),
),
FlatButton(
child: Text(
'完成',
style: TextStyle(
color: HexColor.fromHex('#E52425')),
style: TextStyle(color: HexColor.fromHex('#E52425')),
),
onPressed: () {
Navigator.pop(context, _dateTime);
@@ -93,7 +86,14 @@ class _ActionDateAlert extends State<ActionDateAlert> {
}

Widget _createContent(BuildContext context) {
DateTime maxTime;
if(!EmptyUtil.isEmpty(widget.maxTimeNew) && widget.maxTimeNew=="max"){
maxTime=DateTime.now();
}else{
maxTime=DateTime.parse("2100-12-31 23:59:59");
}
return DatePickerWidget(
maxDateTime: maxTime,
initialDateTime: _dateTime,
onChange: (dataTime, list) {
_dateTime = dataTime;


Loading…
取消
儲存