From 85a0002924153a76cc983662e27452ac0651c574 Mon Sep 17 00:00:00 2001 From: "23028876916@qq.com" Date: Tue, 19 Jan 2021 19:02:28 +0800 Subject: [PATCH] =?UTF-8?q?0119=20=20=E4=BF=AE=E5=A4=8D=E4=B8=AA=E4=BA=BA?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E7=9A=84=E5=87=BA=E7=94=9F=E6=97=A5=E6=9C=9F?= =?UTF-8?q?=E9=80=89=E6=8B=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mine_detail_page/mine_detail_page.dart | 40 ++++++------------- .../action_date_alert/action_date_alert.dart | 28 ++++++------- 2 files changed, 27 insertions(+), 41 deletions(-) diff --git a/lib/pages/mine_detail_page/mine_detail_page.dart b/lib/pages/mine_detail_page/mine_detail_page.dart index 125a661..13705f1 100644 --- a/lib/pages/mine_detail_page/mine_detail_page.dart +++ b/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); } } diff --git a/lib/widgets/others/action_date_alert/action_date_alert.dart b/lib/widgets/others/action_date_alert/action_date_alert.dart index 4f7e4de..3a396aa 100644 --- a/lib/widgets/others/action_date_alert/action_date_alert.dart +++ b/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 createState() => _ActionDateAlert(); @@ -38,9 +36,7 @@ class _ActionDateAlert extends State { 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.title == null || widget.title == '' @@ -59,17 +55,14 @@ class _ActionDateAlert extends State { 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 { } 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;