Browse Source

资料编辑的popup修改

ios
ZHR007 4 months ago
parent
commit
162220f88d
2 changed files with 116 additions and 45 deletions
  1. 34
      lib/network/rtc_api.g.dart
  2. 127
      lib/pages/mine/edit_info_page.dart

34
lib/network/rtc_api.g.dart

@ -433,6 +433,40 @@ class _RtcApi implements RtcApi {
return httpResponse;
}
@override
Future<HttpResponse<BaseResponse<dynamic>>> costImGift(
Map<String, dynamic> data,
) async {
final _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _headers = <String, dynamic>{};
final _data = <String, dynamic>{};
_data.addAll(data);
final _options = _setStreamType<HttpResponse<BaseResponse<dynamic>>>(
Options(method: 'POST', headers: _headers, extra: _extra)
.compose(
_dio.options,
'dating-agency-chat-audio/user/cost/im-gift',
queryParameters: queryParameters,
data: _data,
)
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
);
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
late BaseResponse<dynamic> _value;
try {
_value = BaseResponse<dynamic>.fromJson(
_result.data!,
(json) => json as dynamic,
);
} on Object catch (e, s) {
errorLogger?.logError(e, s, _options);
rethrow;
}
final httpResponse = HttpResponse(_value, _result);
return httpResponse;
}
RequestOptions _setStreamType<T>(RequestOptions requestOptions) {
if (T != dynamic &&
!(requestOptions.responseType == ResponseType.bytes ||

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(12.0),
topRight: Radius.circular(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