Commit e44879c0 authored by skeyboy's avatar skeyboy

同步Android、iOS支付页

parent 5487a56b
...@@ -110,6 +110,9 @@ class UserStore extends GetxController { ...@@ -110,6 +110,9 @@ class UserStore extends GetxController {
} }
void logout() { void logout() {
StorageService.to.remove(STORAGE_USER_TOKEN_KEY);
StorageService.to.remove(STORAGE_USER_PROFILE_KEY);
_profile.value = IntegralEntity( _profile.value = IntegralEntity(
id: '', token: '', username: '', integral: 0, expireTime: null); id: '', token: '', username: '', integral: 0, expireTime: null);
_isLogin.value = false; _isLogin.value = false;
......
...@@ -48,9 +48,19 @@ class AndroidPayListController extends GetxController { ...@@ -48,9 +48,19 @@ class AndroidPayListController extends GetxController {
@override @override
void onInit() async { void onInit() async {
super.onInit(); super.onInit();
await initializedPlugins();
try {
await initializedPlugins();
EasyLoading.show(status: "正在获取套餐中...");
await _getProduct(); await _getProduct();
state.loadingList = false;
EasyLoading.dismiss();
} catch(e){
state.loadingList = false;
}
// EasyLoading.dismiss(); // EasyLoading.dismiss();
// await initializedPlugins(); // await initializedPlugins();
// new 对象 // new 对象
...@@ -110,6 +120,9 @@ class AndroidPayListController extends GetxController { ...@@ -110,6 +120,9 @@ class AndroidPayListController extends GetxController {
// print(goodsList); // print(goodsList);
state.items.addAll(goodsList); state.items.addAll(goodsList);
EasyLoading.dismiss(); EasyLoading.dismiss();
if(goodsList.isNotEmpty) {
state.setSelectedItem = goodsList.first;
}
} catch (e) { } catch (e) {
print(e); print(e);
EasyLoading.dismiss(); EasyLoading.dismiss();
...@@ -130,13 +143,12 @@ class AndroidPayListController extends GetxController { ...@@ -130,13 +143,12 @@ class AndroidPayListController extends GetxController {
} }
void requestPurchase() async { void requestPurchase() async {
Vibrate.feedback(FeedbackType.selection); Vibrate.feedback(FeedbackType.impact);
// print("${item.productId}"); // print("${item.productId}");
EasyLoading.show(status: '支付中...'); EasyLoading.show(status: '支付中...');
// List<String> newList = list.where((element) => element.compareTo('b') > 0).toList(); // ['c', 'd'] // List<String> newList = list.where((element) => element.compareTo('b') > 0).toList(); // ['c', 'd']
final actSelected = state.items final actSelected = state.selectedItem;
.firstWhere((element) => element.appleProductId == state.selected);
String orderInfo = await NewsAPI.doPay({ String orderInfo = await NewsAPI.doPay({
"goodsId": "${actSelected.id}", "goodsId": "${actSelected.id}",
......
...@@ -2,7 +2,19 @@ import 'package:chart/common/entities/good.dart'; ...@@ -2,7 +2,19 @@ import 'package:chart/common/entities/good.dart';
import 'package:flutter_inapp_purchase/flutter_inapp_purchase.dart'; import 'package:flutter_inapp_purchase/flutter_inapp_purchase.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import '../../../common/entities/good.dart';
class AndroidPayListState { 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 // title
final _title = "".obs; final _title = "".obs;
set title(value) => this._title.value = value; set title(value) => this._title.value = value;
...@@ -12,5 +24,9 @@ class AndroidPayListState { ...@@ -12,5 +24,9 @@ class AndroidPayListState {
set selected(value) => _selected.value = value; set selected(value) => _selected.value = value;
get selected => _selected.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; RxList<GoodEntity> items = <GoodEntity>[].obs;
} }
...@@ -20,47 +20,48 @@ class AndroidPayListPage extends GetView<AndroidPayListController> { ...@@ -20,47 +20,48 @@ class AndroidPayListPage extends GetView<AndroidPayListController> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final c = Get.put(AndroidPayListController()); final c = Get.put(AndroidPayListController());
return Scaffold( return Container(
// appBar: transparentAppBar( // color: Colors.amber,
// 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,
height: double.infinity, height: double.infinity,
// padding: EdgeInsets.symmetric(horizontal: 20), // width: Get.width,
decoration: BoxDecoration( decoration: BoxDecoration(
image: DecorationImage( image: DecorationImage(
image: Image.asset("assets/images/bg1.png").image, image: Image.asset("assets/images/background.png").image,
fit: BoxFit.cover), 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/material.dart';
import 'package:flutter_barrage/flutter_barrage.dart';
import 'package:flutter_vibrate/flutter_vibrate.dart'; import 'package:flutter_vibrate/flutter_vibrate.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:glassy/glassy_button.dart'; import 'package:glassy/glassy_button.dart';
...@@ -6,6 +7,9 @@ import 'package:glassy/glassy_card.dart'; ...@@ -6,6 +7,9 @@ import 'package:glassy/glassy_card.dart';
import 'package:glassy/glassy_config.dart'; import 'package:glassy/glassy_config.dart';
import 'package:gradient_widgets/gradient_widgets.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'; import '../index.dart';
const color = Color(0xff8AFBFF); const color = Color(0xff8AFBFF);
...@@ -14,337 +18,596 @@ const color = Color(0xff8AFBFF); ...@@ -14,337 +18,596 @@ const color = Color(0xff8AFBFF);
class PayItemWidget extends GetView<AndroidPayListController> { class PayItemWidget extends GetView<AndroidPayListController> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( // Random random = new Random();
padding: EdgeInsets.only(top: 40, bottom: 40), // List<Bullet> bullets = [];
child: Column(
// 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: [ children: [
Container( Expanded(
// padding: EdgeInsets.all(0), child: ListView(
// color: Colors.red,
height: Get.mediaQuery.size.height * 0.35,
child: Stack(
// ignore: prefer_const_literals_to_create_immutables
children: [ children: [
Align( Obx(() => c.profile.expireTime == null
alignment: Alignment.topRight, ? const Center(
child: InkWell( child: Text(
onTap: () => Get.back(), "您还不是 VIP 会员",
style: TextStyle(
color: Color.fromARGB(255, 160, 165, 184),
fontSize: 14,
),
),
)
// 那俄语呢 那他的反义词呢
: Align(
alignment: Alignment.center,
child: Container( child: Container(
// color: Colors.amber, // color: Colors.amber,
padding: EdgeInsets.symmetric( padding:
horizontal: 20, vertical: 20), EdgeInsets.symmetric(horizontal: 20, vertical: 0),
child: Icon( child: RichText(
Icons.close_outlined, textAlign: TextAlign.center,
color: Colors.white, 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,
), ),
TextSpan(
// child: Container( text:
// width: getRelativeHeight(0.13), " ${c.profile.expireTime.year}-${c.profile.expireTime.month}-${c.profile.expireTime.day} "),
// height: getRelativeHeight(0.13), const TextSpan(
// decoration: BoxDecoration( text: '过期,如果您是自动续费会员将会在过期日前一天自动续费。',
// border: style: TextStyle(
// Border.all(width: 15, color: circleColor.withOpacity(0.6)), color: Color.fromARGB(255, 160, 165, 184),
// shape: BoxShape.circle, 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( // Text(
alignment: Alignment.centerRight, // "您的VIP会员资格将于" +
child: Image( // "${c.profile.expireTime.year}-${c.profile.expireTime.month}-${c.profile.expireTime.day}" +
image: AssetImage("assets/images/you.png"), // "过期,如果您是自动续费会员将会在过期日前一天自动续费。",
width: Get.mediaQuery.size.height * 0.17, // textAlign: TextAlign.center,
), // style: TextStyle(
// child: Container( // color: color,
// width: getRelativeHeight(0.11), // fontSize: 14,
// height: getRelativeHeight(0.11),
// decoration: BoxDecoration(
// border:
// Border.all(width: 15, color: circleColor.withOpacity(0.17)),
// shape: BoxShape.circle,
// ),
// ), // ),
// )
])),
), ),
],
)), )),
Expanded( MarqueeView(
child: Container( child: Row(children: [
padding: EdgeInsets.all(10), _buildText('手机用户159****0542购买了按周订阅套餐'),
child: Column( _buildText('手机用户136****1949购买了按年订阅套餐'),
children: [ _buildText('手机用户159****1252购买了按月订阅套餐'),
Row( _buildText('手机用户176****1429购买了按周订阅套餐'),
mainAxisAlignment: MainAxisAlignment.start, _buildText('手机用户158****8953购买了按月订阅套餐'),
children: [ _buildText('手机用户139****2752购买了按年订阅套餐'),
Icon(Icons.send, color: color), _buildText('手机用户130****5959购买了按季订阅套餐'),
Text(" 选择自己需要的套餐", _buildText('手机用户158****6048购买了按月订阅套餐'),
style: TextStyle(color: color, fontSize: 20)) _buildText('手机用户136****8962购买了按年订阅套餐'),
], ]),
), ),
Container( Padding(
margin: EdgeInsets.only(top: 20), padding: EdgeInsets.symmetric(horizontal: 20),
padding: EdgeInsets.only(left: 10),
height: Get.mediaQuery.size.height * 0.14,
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Obx( Image(
() => Column( image: Image.asset('assets/images/vip-2.png').image,
crossAxisAlignment: CrossAxisAlignment.start, width: Get.width * 0.4,
mainAxisAlignment: MainAxisAlignment.spaceAround, ),
children: controller.state.items.length == 0 Image(
? [] image: Image.asset('assets/images/vip-1.png').image,
: controller.state.items width: Get.width * 0.2,
.firstWhere((element) => )
element.appleProductId == ],
controller.state.selected) ),
.goodsDesc! ),
.split('、') Container(
.map( margin: const EdgeInsets.all(10),
(item) => Row( decoration: const BoxDecoration(
// crossAxisAlignment // 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: [ children: [
Icon(Icons.check, color: color), Row(children: const [
Text(item, Image(
style: TextStyle( image: AssetImage("assets/images/message.png"),
color: color, fontSize: 16)) 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,
), ),
Column(
// Obx(() => controller.state.selected == children: [
// 'com.wudi.app.60stars' Row(children: const [
// ? 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))
// ],
// )
// ],
// )),
Image( Image(
image: AssetImage("assets/images/center-1.png"), image: AssetImage("assets/images/office.png"),
width: Get.mediaQuery.size.height * 0.17, 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( Obx(
margin: EdgeInsets.only(top: 20), () => Container(
child: Row( width: Get.width,
// final String? productId; height: 150,
// final String? price; margin: const EdgeInsets.all(10),
// final String? currency; child: ListView(
// final String? localizedPrice; shrinkWrap: true,
// final String? title; scrollDirection: Axis.horizontal,
// final String? description;
// final String? introductoryPrice;
children: controller.state.items children: controller.state.items
.asMap() .map((element) => Container(
.keys margin: const EdgeInsets.only(right: 20),
.map(
(item) => Expanded(
child: InkWell( child: InkWell(
borderRadius: BorderRadius.circular(10),
onTap: () { onTap: () {
Vibrate.feedback( /// 增加选中事件
FeedbackType.selection); controller.state.setSelectedItem = element;
controller.state.selected = controller Vibrate.feedback(FeedbackType.impact);
.state
.items[item]
.appleProductId!;
//
// c.requestPurchase(item);
}, },
child: GlassyCard( child: Ink(
config: GlassyConfig( padding: const EdgeInsets.symmetric(
backgroundColor: controller horizontal: 15, vertical: 20),
.state decoration: BoxDecoration(
.items[item] borderRadius: BorderRadius.circular(10),
.appleProductId! == // border: ,Color.argb(255, 62, 67, 95)
controller.state.selected border: Border.all(
? color width: 1,
: Colors.grey), color: (controller.state.selectedItem
child: Container( .id ??
height: 100, 0) ==
padding: EdgeInsets.only( (element.id ?? 0)
top: 16, ? const Color.fromARGB(0, 0, 0, 0)
left: 16, : const Color.fromARGB(
right: 16, 255, 90, 82, 91)),
bottom: 16), gradient: LinearGradient(
// color: Colors.pink, 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( 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:
MainAxisAlignment MainAxisAlignment.spaceBetween,
.spaceAround, ),
),
),
))
.toList(),
),
),
),
Container(
margin: const EdgeInsets.only(top: 10, bottom: 10),
padding: const EdgeInsets.symmetric(horizontal: 10),
child: Column(
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [ 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( Text(
'${controller.state.items[item].amount!}', '年度会员',
style: TextStyle( 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( Text(
"${controller.state.items[item].goodsName!}", '作为公司小编,每天写文章很头疼,偶然发现这个软件,提高了我的工作效率。太赞了!',
maxLines: 2,
overflow: TextOverflow.clip,
style: TextStyle( 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")) Container(
Expanded( padding: EdgeInsets.all(10),
child: Container( child: Column(
margin: EdgeInsets.only(top: 20), mainAxisAlignment: MainAxisAlignment.start,
child: GradientButton( children: [
child: Text('购买'), Row(children: [
increaseHeightBy: 15.00, ClipRRect(
increaseWidthBy: 200.00, borderRadius: BorderRadius.circular(40),
callback: controller.requestPurchase, child: Image.asset('assets/images/feature-3.png',
gradient: Gradients.cosmicFusion, width: 40, height: 40),
shadowColor:
Gradients.backToFuture.colors.last.withOpacity(0.25),
), ),
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( Row(
// padding: EdgeInsets.symmetric(horizontal: 40, vertical: 20), mainAxisAlignment: MainAxisAlignment.center,
// width: double.infinity, children: [
// child: 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 { ...@@ -388,13 +388,25 @@ class HomeController extends GetxController with SingleGetTickerProviderMixin {
} catch (e) {} } 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) { if (GetPlatform.isAndroid) {
Get.toNamed(AppRoutes.AN_PAY_LIST); Get.toNamed(AppRoutes.AN_PAY_LIST);
} else { } else {
Get.toNamed(AppRoutes.PAY_LIST); Get.toNamed(AppRoutes.PAY_LIST);
} }
} }
}
share() async { share() async {
Get.toNamed(AppRoutes.MY_PAGE); 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