Commit e44879c0 authored by skeyboy's avatar skeyboy

同步Android、iOS支付页

parent 5487a56b
......@@ -110,6 +110,9 @@ class UserStore extends GetxController {
}
void logout() {
StorageService.to.remove(STORAGE_USER_TOKEN_KEY);
StorageService.to.remove(STORAGE_USER_PROFILE_KEY);
_profile.value = IntegralEntity(
id: '', token: '', username: '', integral: 0, expireTime: null);
_isLogin.value = false;
......
......@@ -48,9 +48,19 @@ class AndroidPayListController extends GetxController {
@override
void onInit() async {
super.onInit();
await initializedPlugins();
try {
await initializedPlugins();
EasyLoading.show(status: "正在获取套餐中...");
await _getProduct();
state.loadingList = false;
EasyLoading.dismiss();
} catch(e){
state.loadingList = false;
}
// EasyLoading.dismiss();
// await initializedPlugins();
// new 对象
......@@ -110,6 +120,9 @@ class AndroidPayListController extends GetxController {
// print(goodsList);
state.items.addAll(goodsList);
EasyLoading.dismiss();
if(goodsList.isNotEmpty) {
state.setSelectedItem = goodsList.first;
}
} catch (e) {
print(e);
EasyLoading.dismiss();
......@@ -130,13 +143,12 @@ class AndroidPayListController extends GetxController {
}
void requestPurchase() async {
Vibrate.feedback(FeedbackType.selection);
Vibrate.feedback(FeedbackType.impact);
// print("${item.productId}");
EasyLoading.show(status: '支付中...');
// List<String> newList = list.where((element) => element.compareTo('b') > 0).toList(); // ['c', 'd']
final actSelected = state.items
.firstWhere((element) => element.appleProductId == state.selected);
final actSelected = state.selectedItem;
String orderInfo = await NewsAPI.doPay({
"goodsId": "${actSelected.id}",
......
......@@ -2,7 +2,19 @@ import 'package:chart/common/entities/good.dart';
import 'package:flutter_inapp_purchase/flutter_inapp_purchase.dart';
import 'package:get/get.dart';
import '../../../common/entities/good.dart';
class AndroidPayListState {
final _loadingList = false.obs;
set loadingList(value) => _loadingList.value = value;
get loadingList => _loadingList.value;
final _loading = false.obs;
set loading(value) => _loading.value = value;
get loading => _loading.value;
// title
final _title = "".obs;
set title(value) => this._title.value = value;
......@@ -12,5 +24,9 @@ class AndroidPayListState {
set selected(value) => _selected.value = value;
get selected => _selected.value;
final _selectedItem = GoodEntity(id: 0).obs;
set setSelectedItem(value) => _selectedItem.value = value;
get selectedItem => _selectedItem.value;
RxList<GoodEntity> items = <GoodEntity>[].obs;
}
......@@ -20,47 +20,48 @@ class AndroidPayListPage extends GetView<AndroidPayListController> {
@override
Widget build(BuildContext context) {
final c = Get.put(AndroidPayListController());
return Scaffold(
// appBar: transparentAppBar(
// title: Text(
// "套餐选择",
// style: TextStyle(
// color: AppColors.primaryElementText,
// fontFamily: 'Montserrat',
// fontSize: 18,
// fontWeight: FontWeight.w600,
// ),
// ),
// leading: IconButton(
// tooltip: '返回上一页',
// icon: const Icon(
// Icons.arrow_back,
// color: AppColors.primaryElementText,
// ),
// onPressed: () async {
// // Get.back();
// // Get.offAll(ApplicationPage());
// // await Get.off(ApplicationPage());
// // Get.toNamed(AppRoutes.Application);
// Get.back();
// // await Get.toNamed();
// // Navigator.of(context).pop();
// //_nextPage(-1);
// },
// ),
// ),
// _buildView
body: Container(
width: double.infinity,
return Container(
// color: Colors.amber,
height: double.infinity,
// padding: EdgeInsets.symmetric(horizontal: 20),
// width: Get.width,
decoration: BoxDecoration(
image: DecorationImage(
image: Image.asset("assets/images/bg1.png").image,
image: Image.asset("assets/images/background.png").image,
fit: BoxFit.cover),
),
child: _buildView()),
child: Scaffold(
appBar: AppBar(
elevation: 0,
backgroundColor: const Color.fromARGB(0, 0, 0, 0),
title: Text("订阅中心"),
// actions: <Widget>[
// GestureDetector(
// onTap: () {
// // controller.restorePurchases();
// },
// child: Container(
// padding: EdgeInsets.only(right: 10),
// child: Center(
// child: Text("恢复购买"),
// )),
// )
// ],
),
backgroundColor: const Color.fromARGB(0, 0, 0, 0),
body: _buildView()
// Container(
// // child: Text("12312"),
// // width: double.infinity,
// // height: double.infinity,
// // // padding: EdgeInsets.symmetric(horizontal: 20),
// // decoration: BoxDecoration(
// // image: DecorationImage(
// // image: Image.asset("assets/images/bg1.png").image,
// // fit: BoxFit.cover),
// // ),
// // child:
// ),
),
);
}
}
import 'package:flutter/material.dart';
import 'package:flutter_barrage/flutter_barrage.dart';
import 'package:flutter_vibrate/flutter_vibrate.dart';
import 'package:get/get.dart';
import 'package:glassy/glassy_button.dart';
......@@ -6,6 +7,9 @@ import 'package:glassy/glassy_card.dart';
import 'package:glassy/glassy_config.dart';
import 'package:gradient_widgets/gradient_widgets.dart';
import '../../../../common/routers/names.dart';
import '../../../../common/store/user.dart';
import '../../pay_list/widgets/marquee.dart';
import '../index.dart';
const color = Color(0xff8AFBFF);
......@@ -14,337 +18,596 @@ const color = Color(0xff8AFBFF);
class PayItemWidget extends GetView<AndroidPayListController> {
@override
Widget build(BuildContext context) {
return Container(
padding: EdgeInsets.only(top: 40, bottom: 40),
child: Column(
// Random random = new Random();
// List<Bullet> bullets = [];
// List<Bullet> bullets = List<Bullet>.generate(1000, (i) {
// final showTime = random.nextInt(60000); // in 60s
// return Bullet(child: Text('$i-$showTime'), showTime: showTime);
// });
final barrageWallController = BarrageWallController();
final textEditingController = TextEditingController();
// final textEditingController = TextEditingController();
final c = Get.put(UserStore());
return Column(
children: [
Container(
// padding: EdgeInsets.all(0),
// color: Colors.red,
height: Get.mediaQuery.size.height * 0.35,
child: Stack(
// ignore: prefer_const_literals_to_create_immutables
Expanded(
child: ListView(
children: [
Align(
alignment: Alignment.topRight,
child: InkWell(
onTap: () => Get.back(),
Obx(() => c.profile.expireTime == null
? const Center(
child: Text(
"您还不是 VIP 会员",
style: TextStyle(
color: Color.fromARGB(255, 160, 165, 184),
fontSize: 14,
),
),
)
// 那俄语呢 那他的反义词呢
: Align(
alignment: Alignment.center,
child: Container(
// color: Colors.amber,
padding: EdgeInsets.symmetric(
horizontal: 20, vertical: 20),
child: Icon(
Icons.close_outlined,
color: Colors.white,
),
)),
padding:
EdgeInsets.symmetric(horizontal: 20, vertical: 0),
child: RichText(
textAlign: TextAlign.center,
text: TextSpan(children: [
const TextSpan(
text: '您的VIP会员资格将于',
style: TextStyle(
color: Color.fromARGB(255, 160, 165, 184),
fontSize: 14,
),
// ignore: prefer_const_constructors
Align(
alignment: Alignment.centerLeft,
child: Image(
image: AssetImage("assets/images/left.png"),
width: Get.mediaQuery.size.height * 0.17,
),
// child: Container(
// width: getRelativeHeight(0.13),
// height: getRelativeHeight(0.13),
// decoration: BoxDecoration(
// border:
// Border.all(width: 15, color: circleColor.withOpacity(0.6)),
// shape: BoxShape.circle,
// ),
// ),
TextSpan(
text:
" ${c.profile.expireTime.year}-${c.profile.expireTime.month}-${c.profile.expireTime.day} "),
const TextSpan(
text: '过期,如果您是自动续费会员将会在过期日前一天自动续费。',
style: TextStyle(
color: Color.fromARGB(255, 160, 165, 184),
fontSize: 14,
),
Align(
alignment: Alignment.center,
child: Image(
image: AssetImage("assets/images/center.png"),
width: Get.mediaQuery.size.height * 0.21,
),
// child: Container(
// width: getRelativeHeight(0.11),
// height: getRelativeHeight(0.11),
// decoration: BoxDecoration(
// border:
// Border.all(width: 15, color: circleColor.withOpacity(0.25)),
// shape: BoxShape.circle,
// ),
// ),
),
Align(
alignment: Alignment.centerRight,
child: Image(
image: AssetImage("assets/images/you.png"),
width: Get.mediaQuery.size.height * 0.17,
),
// child: Container(
// width: getRelativeHeight(0.11),
// height: getRelativeHeight(0.11),
// decoration: BoxDecoration(
// border:
// Border.all(width: 15, color: circleColor.withOpacity(0.17)),
// shape: BoxShape.circle,
// ),
// Text(
// "您的VIP会员资格将于" +
// "${c.profile.expireTime.year}-${c.profile.expireTime.month}-${c.profile.expireTime.day}" +
// "过期,如果您是自动续费会员将会在过期日前一天自动续费。",
// textAlign: TextAlign.center,
// style: TextStyle(
// color: color,
// fontSize: 14,
// ),
// )
])),
),
],
)),
Expanded(
child: Container(
padding: EdgeInsets.all(10),
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Icon(Icons.send, color: color),
Text(" 选择自己需要的套餐",
style: TextStyle(color: color, fontSize: 20))
],
MarqueeView(
child: Row(children: [
_buildText('手机用户159****0542购买了按周订阅套餐'),
_buildText('手机用户136****1949购买了按年订阅套餐'),
_buildText('手机用户159****1252购买了按月订阅套餐'),
_buildText('手机用户176****1429购买了按周订阅套餐'),
_buildText('手机用户158****8953购买了按月订阅套餐'),
_buildText('手机用户139****2752购买了按年订阅套餐'),
_buildText('手机用户130****5959购买了按季订阅套餐'),
_buildText('手机用户158****6048购买了按月订阅套餐'),
_buildText('手机用户136****8962购买了按年订阅套餐'),
]),
),
Container(
margin: EdgeInsets.only(top: 20),
padding: EdgeInsets.only(left: 10),
height: Get.mediaQuery.size.height * 0.14,
Padding(
padding: EdgeInsets.symmetric(horizontal: 20),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Obx(
() => Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: controller.state.items.length == 0
? []
: controller.state.items
.firstWhere((element) =>
element.appleProductId ==
controller.state.selected)
.goodsDesc!
.split('、')
.map(
(item) => Row(
// crossAxisAlignment
Image(
image: Image.asset('assets/images/vip-2.png').image,
width: Get.width * 0.4,
),
Image(
image: Image.asset('assets/images/vip-1.png').image,
width: Get.width * 0.2,
)
],
),
),
Container(
margin: const EdgeInsets.all(10),
decoration: const BoxDecoration(
// Color.argb(255, 40, 40, 57)
color: Color.fromARGB(255, 40, 40, 57),
borderRadius: BorderRadius.all(Radius.circular(10))),
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 10),
child: Column(children: [
Column(
children: [
Icon(Icons.check, color: color),
Text(item,
style: TextStyle(
color: color, fontSize: 16))
Row(children: const [
Image(
image: AssetImage("assets/images/message.png"),
width: 30.0),
SizedBox(
width: 10,
),
Text('无限制AI消息回复')
]),
const SizedBox(
height: 10,
),
const Text(
'最新模型,消息秒回,超出人类智慧秒杀所有人工智能。',
style:
TextStyle(color: Color.fromARGB(255, 160, 165, 184)),
)
],
),
const SizedBox(
height: 20,
),
Column(
children: [
Row(children: const [
Image(
image: AssetImage("assets/images/project.png"),
width: 30.0),
SizedBox(
width: 10,
),
Text('最卷的 AI打工人')
]),
const SizedBox(
height: 10,
),
const Text(
'你的工作 AI写作大师 帮你完成,查资料,写计划,写报告,想灵感,写总结统统搞定。',
style:
TextStyle(color: Color.fromARGB(255, 160, 165, 184)),
)
.toList(),
],
),
const SizedBox(
height: 20,
),
// Obx(() => controller.state.selected ==
// 'com.wudi.app.60stars'
// ? Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// mainAxisAlignment:
// MainAxisAlignment.spaceAround,
// children: [
// Row(
// // crossAxisAlignment
// children: [
// Icon(Icons.check, color: color),
// Text("3022次提问机会",
// style: TextStyle(
// color: color, fontSize: 16))
// ],
// ),
// Row(
// children: [
// Icon(Icons.check, color: color),
// Text("解锁所有高级功能",
// style: TextStyle(
// color: color, fontSize: 16))
// ],
// )
// ],
// )
// : controller.state.selected ==
// 'com.wudi.app.monthly_pass'
// ? Column(
// crossAxisAlignment:
// CrossAxisAlignment.start,
// mainAxisAlignment:
// MainAxisAlignment.spaceAround,
// children: [
// Row(
// // crossAxisAlignment
// children: [
// Icon(Icons.check, color: color),
// Text("月卡会员",
// style: TextStyle(
// color: color, fontSize: 16))
// ],
// ),
// Row(
// children: [
// Icon(Icons.check, color: color),
// Text("无限聊天",
// style: TextStyle(
// color: color, fontSize: 16))
// ],
// ),
// Row(
// children: [
// Icon(Icons.check, color: color),
// Text("解锁所有高级功能",
// style: TextStyle(
// color: color, fontSize: 16))
// ],
// )
// ],
// )
// : Column(
// crossAxisAlignment:
// CrossAxisAlignment.start,
// mainAxisAlignment:
// MainAxisAlignment.spaceAround,
// children: [
// Row(
// // crossAxisAlignment
// children: [
// Icon(Icons.check, color: color),
// Text("周卡会员",
// style: TextStyle(
// color: color, fontSize: 16))
// ],
// ),
// Row(
// children: [
// Icon(Icons.check, color: color),
// Text("无限聊天",
// style: TextStyle(
// color: color, fontSize: 16))
// ],
// ),
// Row(
// children: [
// Icon(Icons.check, color: color),
// Text("解锁所有高级功能",
// style: TextStyle(
// color: color, fontSize: 16))
// ],
// )
// ],
// )),
Column(
children: [
Row(children: const [
Image(
image: AssetImage("assets/images/center-1.png"),
width: Get.mediaQuery.size.height * 0.17,
image: AssetImage("assets/images/office.png"),
width: 30.0),
SizedBox(
width: 10,
),
Text('您的私人助理')
]),
const SizedBox(
height: 10,
),
const Text(
'学习,医疗,法律,旅游,翻译等任何生活问题 AI写作大师都能随时化身最专业的助手替您解决一切。',
style:
TextStyle(color: Color.fromARGB(255, 160, 165, 184)),
)
],
),
]),
),
Obx(() => Container(
margin: EdgeInsets.only(top: 20),
child: Row(
// final String? productId;
// final String? price;
// final String? currency;
// final String? localizedPrice;
// final String? title;
// final String? description;
// final String? introductoryPrice;
Obx(
() => Container(
width: Get.width,
height: 150,
margin: const EdgeInsets.all(10),
child: ListView(
shrinkWrap: true,
scrollDirection: Axis.horizontal,
children: controller.state.items
.asMap()
.keys
.map(
(item) => Expanded(
.map((element) => Container(
margin: const EdgeInsets.only(right: 20),
child: InkWell(
borderRadius: BorderRadius.circular(10),
onTap: () {
Vibrate.feedback(
FeedbackType.selection);
controller.state.selected = controller
.state
.items[item]
.appleProductId!;
//
// c.requestPurchase(item);
/// 增加选中事件
controller.state.setSelectedItem = element;
Vibrate.feedback(FeedbackType.impact);
},
child: GlassyCard(
config: GlassyConfig(
backgroundColor: controller
.state
.items[item]
.appleProductId! ==
controller.state.selected
? color
: Colors.grey),
child: Container(
height: 100,
padding: EdgeInsets.only(
top: 16,
left: 16,
right: 16,
bottom: 16),
// color: Colors.pink,
child: Ink(
padding: const EdgeInsets.symmetric(
horizontal: 15, vertical: 20),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
// border: ,Color.argb(255, 62, 67, 95)
border: Border.all(
width: 1,
color: (controller.state.selectedItem
.id ??
0) ==
(element.id ?? 0)
? const Color.fromARGB(0, 0, 0, 0)
: const Color.fromARGB(
255, 90, 82, 91)),
gradient: LinearGradient(
colors:
(controller.state.selectedItem.id ??
0) ==
(element.id ?? 0)
? [
const Color.fromARGB(
255, 247, 222, 127),
const Color.fromARGB(
255, 246, 204, 135),
const Color.fromARGB(
255, 242, 189, 138)
]
: [
Color(0xFF3d3f54),
Color(0xFF333450),
Color(0xFF2b2b4d)
],
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
)),
child: Column(
children: [
Text(
element.goodsName!,
style: TextStyle(
fontWeight: FontWeight.bold,
color: controller.state.selectedItem.id ==
element.id
? Color.fromARGB(255, 23, 17, 7)
: Colors.white),
),
Text(
'¥${element.amount!}',
style: TextStyle(
fontWeight: FontWeight.bold,
color: controller.state.selectedItem.id ==
element.id
? Color.fromARGB(255, 230, 31, 32)
: Color.fromARGB(
255, 241, 197, 131)),
),
Container(
width: Get.width * 0.6,
child: Text(
element.goodsDesc!,
style: TextStyle(
fontWeight: FontWeight.bold,
color: controller.state.selectedItem.id ==
element.id
? Color.fromARGB(255, 230, 31, 32)
: Color.fromARGB(
255, 241, 197, 131)),
),
),
// Text(
// '¥${(double.parse(element.goodsDesc!) * 1.2).toStringAsFixed(2)}',
// style: TextStyle(
// color:
// Color.fromARGB(255, 140, 145, 151),
// decoration: TextDecoration.combine([
// // TextDecoration.underline,
// TextDecoration.lineThrough
// ]),
// ),
// ),
// Text('限时特惠',
// style: TextStyle(
// color: controller.state.selectedItem ==
// element.id
// ? Color.fromARGB(255, 230, 31, 32)
// : Color.fromARGB(
// 255, 169, 171, 196),
// decoration: TextDecoration.combine([
// // TextDecoration.underline,
// // TextDecoration.lineThrough
// ]),
// ))
],
mainAxisAlignment:
MainAxisAlignment
.spaceAround,
MainAxisAlignment.spaceBetween,
),
),
),
))
.toList(),
),
),
),
Container(
margin: const EdgeInsets.only(top: 10, bottom: 10),
padding: const EdgeInsets.symmetric(horizontal: 10),
child: Column(
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
width: 4,
height: 20,
decoration: const BoxDecoration(
color: Color.fromARGB(255, 99, 208, 243),
borderRadius: BorderRadius.all(Radius.circular(5)),
),
),
const SizedBox(
width: 10,
),
const Text('用户评论')
],
),
Container(
padding: EdgeInsets.all(10),
child: Column(
children: [
Row(children: [
Image(
width: 40,
image: Image.asset(
'assets/images/account_header.png')
.image),
SizedBox(
width: 10,
),
Text("182****1411"),
SizedBox(
width: 10,
),
Container(
padding: EdgeInsets.symmetric(
vertical: 6, horizontal: 10),
decoration: BoxDecoration(
color: Color.fromARGB(255, 53, 45, 55),
borderRadius:
BorderRadius.all(Radius.circular(40))),
// diamond
child: Row(
children: [
Icon(
Icons.diamond_outlined,
size: 16,
color: Color.fromARGB(255, 246, 226, 145),
),
SizedBox(
width: 5,
),
Text(
'${controller.state.items[item].amount!}',
'年度会员',
style: TextStyle(
color: Colors.white),
color: Color.fromARGB(
255, 246, 226, 145)),
)
],
))
]),
Container(
height: 1,
color: Color.fromARGB(255, 39, 40, 56),
margin: EdgeInsets.symmetric(vertical: 10),
),
Text(
"${controller.state.items[item].goodsName!}",
maxLines: 2,
overflow: TextOverflow.clip,
'作为公司小编,每天写文章很头疼,偶然发现这个软件,提高了我的工作效率。太赞了!',
style: TextStyle(
color: Colors.white),
color: Color.fromARGB(255, 161, 161, 176)),
)
],
)),
))),
Container(
padding: const EdgeInsets.all(10),
child: Column(
children: [
Row(children: [
ClipRRect(
borderRadius: BorderRadius.circular(40),
child: Image.asset('assets/images/dog.jpg',
width: 40, height: 40),
),
const SizedBox(
width: 10,
),
const Text("130****5675"),
const SizedBox(
width: 10,
),
Container(
padding: const EdgeInsets.symmetric(
vertical: 6, horizontal: 10),
decoration: const BoxDecoration(
color: Color.fromARGB(255, 53, 45, 55),
borderRadius:
BorderRadius.all(Radius.circular(40))),
// diamond
child: Row(
children: const [
Icon(
Icons.diamond_outlined,
size: 16,
color: Color.fromARGB(255, 246, 226, 145),
),
SizedBox(
width: 5,
),
Text(
'年度会员',
style: TextStyle(
color: Color.fromARGB(
255, 246, 226, 145)),
)
.toList(),
],
))
]),
Container(
height: 1,
color: Color.fromARGB(255, 39, 40, 56),
margin: EdgeInsets.symmetric(vertical: 10),
),
const Text(
'用它来制定旅游计划真的很不错,以前出去玩要做十天半个月的攻略,现在分分钟搞定。',
style: TextStyle(
color: Color.fromARGB(255, 161, 161, 176)),
)
],
)),
// GlassyButton(onPressed: () {}, child: Text("GradientButton"))
Expanded(
child: Container(
margin: EdgeInsets.only(top: 20),
child: GradientButton(
child: Text('购买'),
increaseHeightBy: 15.00,
increaseWidthBy: 200.00,
callback: controller.requestPurchase,
gradient: Gradients.cosmicFusion,
shadowColor:
Gradients.backToFuture.colors.last.withOpacity(0.25),
Container(
padding: EdgeInsets.all(10),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Row(children: [
ClipRRect(
borderRadius: BorderRadius.circular(40),
child: Image.asset('assets/images/feature-3.png',
width: 40, height: 40),
),
const SizedBox(
width: 10,
),
const Text("135****1903"),
const SizedBox(
width: 10,
),
Container(
padding: const EdgeInsets.symmetric(
vertical: 6, horizontal: 10),
decoration: const BoxDecoration(
color: Color.fromARGB(255, 53, 45, 55),
borderRadius:
BorderRadius.all(Radius.circular(40))),
// diamond
child: Row(
children: const [
Icon(
Icons.diamond_outlined,
size: 16,
color: Color.fromARGB(255, 246, 226, 145),
),
SizedBox(
width: 5,
),
Text(
'年度会员',
style: TextStyle(
color: Color.fromARGB(
255, 246, 226, 145)),
)
],
))
]),
Container(
height: 1,
color: const Color.fromARGB(255, 39, 40, 56),
margin: const EdgeInsets.symmetric(vertical: 10),
),
const Text(
'和软件聊天真的很有趣,它可以回答我的问题,并且让我感觉修在和一个真正的人交谈一样。',
style: TextStyle(
color: Color.fromARGB(255, 161, 161, 176)),
)
],
))
],
),
),
Container(
width: Get.width * 0.9,
margin: EdgeInsets.all(20),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
// Container(
// padding: EdgeInsets.symmetric(horizontal: 40, vertical: 20),
// width: double.infinity,
// child:
// )
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
InkWell(
onTap: () async {
Get.toNamed(AppRoutes.USER_EULA);
// final Uri _url = Uri.parse(
// 'https://docs.qq.com/doc/DY3pybXJ5Y1JLQm13');
// await launchUrl(_url);
},
child: RichText(
text: const TextSpan(children: [
TextSpan(
text: 'Tap To view the ',
style: TextStyle(
fontWeight: FontWeight.bold,
color: Color.fromARGB(
255, 164, 164, 183))),
TextSpan(
text: 'EULA',
style: TextStyle(
color: color,
fontWeight: FontWeight.bold)),
]),
),
// child: Text(
// "Tap To view the EULA",
// style: TextStyle(color: Colors.white),
// ),
),
]),
]))
],
)),
// loadingList
Obx(() => AnimatedOpacity(
opacity: controller.state.loadingList ? 0 : 1,
duration: const Duration(milliseconds: 500),
child: Container(
padding: const EdgeInsets.only(
top: 10,
bottom: 50,
),
decoration: BoxDecoration(
color: const Color(0xFF3d3f54).withOpacity(.8),
),
)
width: Get.width,
child: Obx(
() => GradientButton(
increaseHeightBy: 10.00,
increaseWidthBy: Get.width * .7,
callback: () {
controller.requestPurchase();
},
isEnabled: !controller.state.loading,
// callback: controller.genInner,
shapeRadius: const BorderRadius.all(Radius.circular(5)),
elevation: 0,
gradient: const LinearGradient(
colors: [
Color(0xFFbe6afb),
Color(0xFF9c67f6),
Color(0xFF7965f8)
],
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
),
child: const Text('立即解锁',
style: TextStyle(
fontSize: 14, fontWeight: FontWeight.w500)),
),
))))
],
);
// Center(
// child:
// Obx(() => Text(
// "${controller.state.items.length}",
// style: TextStyle(color: Colors.amber, fontSize: 40),
// )),
// );
}
}
Widget _buildText(String txt) {
return Container(
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10),
margin: EdgeInsets.only(right: 20),
decoration: const BoxDecoration(
color: Color.fromARGB(255, 42, 43, 61),
borderRadius: BorderRadius.all(Radius.circular(40))),
child: Text(
txt,
style: const TextStyle(
fontSize: 12,
color: Color.fromARGB(255, 160, 165, 184),
),
maxLines: 1,
overflow: TextOverflow.fade,
));
}
......@@ -388,13 +388,25 @@ class HomeController extends GetxController with SingleGetTickerProviderMixin {
} catch (e) {}
}
virtualPay() {
bool get isLogin => UserStore.to.isLogin;
virtualPay() async {
if (!isLogin) {
//只有Android才会存在登录情况
if (GetPlatform.isAndroid) {
var rev = await Get.toNamed(AppRoutes.SIGN_IN);
if (isLogin) {
virtualPay();
}
}
} else {
if (GetPlatform.isAndroid) {
Get.toNamed(AppRoutes.AN_PAY_LIST);
} else {
Get.toNamed(AppRoutes.PAY_LIST);
}
}
}
share() async {
Get.toNamed(AppRoutes.MY_PAGE);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment