circle_app/circle_app/lib/app/dialog/UnlockCallDialog.dart

269 lines
11 KiB
Dart
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:get/get.dart';
import 'package:get/get_state_manager/src/simple/get_controllers.dart';
import '../../common/Widgets/open_vip_tip/logic.dart';
import '../../network/api.dart';
import '../../network/dio_manager.dart';
import '../../util/PaymentUtils.dart';
import '../../util/util.dart';
class UnlockCallDialog extends GetxController {
RxBool isZfbPrice = true.obs;
String circleId = "";
void showUnlockBottomSheet(String id) {
circleId = id;
Get.bottomSheet(
Scaffold(
backgroundColor: Colors.transparent,
body: Container(
width: Get.width,
height: Get.height,
child: Center(
child: Container(
width: 339.sp,
height: 330.sp,
decoration: BoxDecoration(
image: DecorationImage(
fit: BoxFit.fill,
image: AssetImage(getCircleImage('add_tip_bg')))),
child: Stack(
alignment: Alignment.center,
children: [
Positioned(
top: 5.sp,
right: 12.sp,
child: GestureDetector(
onTap: () {
Get.back();
},
child: Image.asset(
getCircleImage('close'),
width: 24.sp,
),
)),
Positioned(
top: 24.sp,
child: Text(
'解锁圈子才能发布喊话',
style:
TextStyle(color: Colors.white, fontSize: 16.sp),
)),
Positioned(
left: 17.sp,
top: 64.sp,
child: Text(
'为什么要解锁圈子?',
style:
TextStyle(color: Colors.white, fontSize: 16.sp),
)),
Positioned(
top: 98.sp,
child: Container(
width: 339.sp,
padding: EdgeInsets.only(left: 17.sp, right: 17.sp),
child: Text(
'为打造纯净的社交环境,更好地服务大家,基于以下几方面考虑:1、平台升级为全天24小时人工审核保证用户真实避免骗子、酒托、虚假人士等扰乱平台 ;2、杜绝未入圈用户随意骚扰或影响已入圈;3、谢绝只会白嫖的猎奇人士。',
style: TextStyle(
color: Color.fromRGBO(247, 250, 250, 0.8),
fontSize: 12.sp)),
)),
Platform.isIOS
? Container(
height: 1,
width: 1,
)
: Positioned(
bottom: 108.sp,
child: Container(
margin: EdgeInsets.only(top: 24.0.sp),
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
GestureDetector(
onTap: () {
isZfbPrice.value = true;
update();
},
child: Row(
children: [
Obx(() => Image.asset(
isZfbPrice.value
? getMineImage("icon_pay_select")
: getMineImage(
"icon_pay_is_no_select"),
width: 20.0.sp,
height: 20.0.sp,
))
,
SizedBox(width: 8.0.sp),
Image.asset(
getMineImage('icon_cooperate_ali'),
width: 20.0.sp,
height: 20.0.sp,
),
SizedBox(width: 4.0.sp),
Text(
'支付宝支付',
style: TextStyle(
color: const Color(0xFFF7FAFA),
fontSize: 14.0.sp,
),
),
SizedBox(width: 4.0.sp),
Image.asset(
getMineImage(
'icon_recommend_pay_way'),
width: 32.0.sp,
height: 16.0.sp,
),
],
),
),
SizedBox(width: 24.0.sp),
GestureDetector(
onTap: () {
isZfbPrice.value = false;
update();
},
child: Row(
children: [
Obx(() => Image.asset(
!isZfbPrice.value
? getMineImage("icon_pay_select")
: getMineImage(
"icon_pay_is_no_select"),
width: 20.0.sp,
height: 20.0.sp,
))
,
SizedBox(width: 8.0.sp),
Image.asset(
getMineImage('icon_cooperate_wx'),
width: 20.0.sp,
height: 20.0.sp,
),
SizedBox(width: 4.0.sp),
Text(
'微信支付',
style: TextStyle(
color: const Color(0xFFF7FAFA),
fontSize: 14.0.sp,
),
),
],
),
),
],
),
),
),
Positioned(
bottom: 18.sp,
child: GestureDetector(
onTap: () {
if (Platform.isIOS) {
} else {
startPayment();
// unlockingPayment(numbers[0].id, (payResult) {});
}
},
child: Container(
width: 168.sp,
height: 42.sp,
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(21.sp),
gradient: const LinearGradient(
begin: Alignment.centerLeft,
end: Alignment.centerRight,
colors: [
Color(0xff0AFCFF),
Color(0xffD739EA)
])),
child: Text(
'立即解锁',
style: TextStyle(
color: Colors.white, fontSize: 16.sp),
),
),
)),
Positioned(
bottom: 72.sp,
child: Container(
child: Row(
children: [
Text(
'¥18',
style: TextStyle(
color: Color(0xffE845FF),
fontSize: 16.sp,
fontWeight: FontWeight.w600),
),
SizedBox(
width: 2.sp,
),
Text(
'(原价60)',
style: TextStyle(
color: Colors.white70,
fontSize: 16.sp,
fontWeight: FontWeight.w400,
decoration: TextDecoration.lineThrough,
decorationColor: Colors.white70,
),
),
],
),
))
],
),
),
),
),
),
isScrollControlled: true,
enableDrag: false);
}
startPayment() async {
SmartDialog.showLoading();
if (isZfbPrice.value) {
var data = await DioManager.instance.post(
url: Api.postAliPayOrder,
params: {"product_id": circleId, "type": 1});
var bean = BaseResponse<PayUrlBean>.fromJson(
data, (data) => PayUrlBean.fromJson(data));
if (bean.isSuccess()) {
openAliPay(bean.data.payUrl, (isSuccess, errorMsg) {
Get.back();
});
} else {
showOKToast(bean.msg);
}
} else {
var data = await DioManager.instance.post(
url: Api.postWxOrder,
params: {"product_id": circleId, "type": 1});
var bean = BaseResponse<PaymentData>.fromJson(
data, (data) => PaymentData.fromJson(data));
if (bean.isSuccess()) {
openWxPay(bean.data, (bool isSuccess, String? errorMessage) {
Get.back();
});
} else {
showOKToast(bean.msg);
}
}
SmartDialog.dismiss();
}
}