diff --git a/lib/network/rtc_api.g.dart b/lib/network/rtc_api.g.dart index 5aa117a..febd393 100644 --- a/lib/network/rtc_api.g.dart +++ b/lib/network/rtc_api.g.dart @@ -433,6 +433,40 @@ class _RtcApi implements RtcApi { return httpResponse; } + @override + Future>> costImGift( + Map data, + ) async { + final _extra = {}; + final queryParameters = {}; + final _headers = {}; + final _data = {}; + _data.addAll(data); + final _options = _setStreamType>>( + 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>(_options); + late BaseResponse _value; + try { + _value = BaseResponse.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(RequestOptions requestOptions) { if (T != dynamic && !(requestOptions.responseType == ResponseType.bytes || diff --git a/lib/pages/mine/edit_info_page.dart b/lib/pages/mine/edit_info_page.dart index b26e7e5..1522b91 100644 --- a/lib/pages/mine/edit_info_page.dart +++ b/lib/pages/mine/edit_info_page.dart @@ -39,50 +39,89 @@ class _EditInfoPageState extends State { } + 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: [ - 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 { 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 { SmartDialog.showToast('当前头像正在审核中,请勿重复提交'); return; } - _showAvatarOptions(controller, 1); + _showAvatarPopup(controller, 1); }), SizedBox(height: 20.w,), Container( @@ -401,7 +438,7 @@ class _EditInfoPageState extends State { ), ), ).onTap(() { - _showAvatarOptions(controller, 2); + _showAvatarPopup(controller, 2); }) ], ),