|
|
|
@ -39,50 +39,89 @@ class _EditInfoPageState extends State<EditInfoPage> { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
void _showAvatarPopup(EditInfoController controller, int type){ |
|
|
|
Navigator.of(Get.context!).push( |
|
|
|
TDSlidePopupRoute( |
|
|
|
slideTransitionFrom: SlideTransitionFrom.bottom, |
|
|
|
builder: (context) { |
|
|
|
return Container( |
|
|
|
height: type == 1 ? 490 : 176, |
|
|
|
decoration: BoxDecoration( |
|
|
|
color: Colors.white, |
|
|
|
borderRadius: BorderRadius.only( |
|
|
|
topLeft: Radius.circular(12.0), |
|
|
|
topRight: Radius.circular(12.0), |
|
|
|
), |
|
|
|
), |
|
|
|
child: Column( |
|
|
|
children: [ |
|
|
|
if(type == 1)const SizedBox(height: 4), |
|
|
|
if(type == 1)CachedNetworkImage(imageUrl: 'https://dating-agency-prod.oss-cn-shenzhen.aliyuncs.com/1A437A945667.jpg', width: 375, height: 314), |
|
|
|
if(type == 1)const TDDivider(), |
|
|
|
ClipRRect( |
|
|
|
borderRadius: BorderRadius.only( |
|
|
|
topLeft: Radius.circular(type == 1 ? 0 : 12.0), |
|
|
|
topRight: Radius.circular(type == 1 ? 0 : 12.0), |
|
|
|
), |
|
|
|
child: TDCell( |
|
|
|
arrow: false, |
|
|
|
titleWidget: Center( |
|
|
|
child: Text('拍照', style: TextStyle(fontSize: 16.w, color: const Color.fromRGBO(51, 51, 51, 1))), |
|
|
|
), |
|
|
|
style: TDCellStyle( |
|
|
|
padding: EdgeInsets.all(TDTheme.of(context).spacer16), |
|
|
|
clickBackgroundColor: TDTheme.of(context).bgColorContainerHover, |
|
|
|
cardBorderRadius: BorderRadius.only( |
|
|
|
topLeft: Radius.circular(type == 1 ? 0 : 12.0), |
|
|
|
topRight: Radius.circular(type == 1 ? 0 : 12.0), |
|
|
|
) |
|
|
|
), |
|
|
|
onClick: (cell) async{ |
|
|
|
Navigator.pop(context); |
|
|
|
await controller.handleCameraCapture(type); |
|
|
|
}, |
|
|
|
), |
|
|
|
), |
|
|
|
const TDDivider(), |
|
|
|
TDCell( |
|
|
|
arrow: false, |
|
|
|
titleWidget: Center( |
|
|
|
child: Text('从相册选择'), |
|
|
|
), |
|
|
|
onClick: (cell) async{ |
|
|
|
Navigator.pop(context); |
|
|
|
if(type == 1 || 9 - controller.imgList.length == 1){ |
|
|
|
await controller.handleGallerySelection(type); |
|
|
|
} else { |
|
|
|
if(controller.imgList.length >= 9){ |
|
|
|
|
|
|
|
// 显示头像选择选项 |
|
|
|
void _showAvatarOptions(EditInfoController controller, int type) { |
|
|
|
showCupertinoModalPopup( |
|
|
|
context: Get.context!, |
|
|
|
builder: (context) => CupertinoActionSheet( |
|
|
|
title: Text(type == 1 ? '选择头像' : "选择相册"), |
|
|
|
message: type == 1 ? CachedNetworkImage(imageUrl: 'https://dating-agency-prod.oss-cn-shenzhen.aliyuncs.com/1A437A945667.jpg', width: 375, height: 314) : null, |
|
|
|
actions: <Widget>[ |
|
|
|
if(type == 1) CupertinoActionSheetAction( |
|
|
|
child: const Text('拍照'), |
|
|
|
onPressed: () async { |
|
|
|
Navigator.pop(context); |
|
|
|
await controller.handleCameraCapture(type); |
|
|
|
}, |
|
|
|
), |
|
|
|
CupertinoActionSheetAction( |
|
|
|
child: const Text('从相册选择'), |
|
|
|
onPressed: () async { |
|
|
|
Navigator.pop(context); |
|
|
|
if(type == 1 || 9 - controller.imgList.length == 1){ |
|
|
|
await controller.handleGallerySelection(type); |
|
|
|
} else { |
|
|
|
if(controller.imgList.length >= 9){ |
|
|
|
|
|
|
|
SmartDialog.showToast('超出数量限制,请先删除再尝试上传'); |
|
|
|
return; |
|
|
|
} |
|
|
|
await controller.handleMultiGallerySelection(type); |
|
|
|
} |
|
|
|
}, |
|
|
|
), |
|
|
|
], |
|
|
|
cancelButton: CupertinoActionSheetAction( |
|
|
|
child: const Text('取消'), |
|
|
|
isDestructiveAction: true, |
|
|
|
onPressed: () { |
|
|
|
Navigator.pop(context); |
|
|
|
}, |
|
|
|
), |
|
|
|
), |
|
|
|
SmartDialog.showToast('超出数量限制,请先删除再尝试上传'); |
|
|
|
return; |
|
|
|
} |
|
|
|
await controller.handleMultiGallerySelection(type); |
|
|
|
} |
|
|
|
}, |
|
|
|
), |
|
|
|
Expanded( |
|
|
|
child: Container( |
|
|
|
color: Color(0xFFF3F3F3), |
|
|
|
), |
|
|
|
), |
|
|
|
TDCell( |
|
|
|
arrow: false, |
|
|
|
titleWidget: Center( |
|
|
|
child: Text('取消'), |
|
|
|
), |
|
|
|
onClick: (cell){ |
|
|
|
Navigator.pop(context); |
|
|
|
}, |
|
|
|
), |
|
|
|
], |
|
|
|
), |
|
|
|
); |
|
|
|
}), |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
// 显示日期选择器 |
|
|
|
Future _showDatePicker(EditInfoController controller) async { |
|
|
|
// 计算最小和最大日期 |
|
|
|
@ -180,8 +219,6 @@ class _EditInfoPageState extends State<EditInfoPage> { |
|
|
|
margin: EdgeInsets.only(right: 14.w), |
|
|
|
child: InkWell( |
|
|
|
onTap: (){ |
|
|
|
// context.pushNamed(RouteNames.payHistory); |
|
|
|
|
|
|
|
controller.goPreview(); |
|
|
|
}, |
|
|
|
child: Text( |
|
|
|
@ -297,7 +334,7 @@ class _EditInfoPageState extends State<EditInfoPage> { |
|
|
|
SmartDialog.showToast('当前头像正在审核中,请勿重复提交'); |
|
|
|
return; |
|
|
|
} |
|
|
|
_showAvatarOptions(controller, 1); |
|
|
|
_showAvatarPopup(controller, 1); |
|
|
|
}), |
|
|
|
SizedBox(height: 20.w,), |
|
|
|
Container( |
|
|
|
@ -401,7 +438,7 @@ class _EditInfoPageState extends State<EditInfoPage> { |
|
|
|
), |
|
|
|
), |
|
|
|
).onTap(() { |
|
|
|
_showAvatarOptions(controller, 2); |
|
|
|
_showAvatarPopup(controller, 2); |
|
|
|
}) |
|
|
|
], |
|
|
|
), |
|
|
|
|