王子贤 4 months ago
parent
commit
eb3927e83a
2 changed files with 83 additions and 46 deletions
  1. 2
      lib/controller/setting/spread_controller.dart
  2. 127
      lib/pages/mine/edit_info_page.dart

2
lib/controller/setting/spread_controller.dart

@ -144,7 +144,7 @@ class SpreadController extends GetxController with WidgetsBindingObserver {
SmartDialog.showToast('开始支付');
} else {
//
throw Exception(response.data.message ?? '获取数据失败');
SmartDialog.showToast(response.data.message ?? '网络异常');
}
} catch (e) {
print('玫瑰列表获取失败: $e');

127
lib/pages/mine/edit_info_page.dart

@ -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);
})
],
),

Loading…
Cancel
Save