Commit e44879c0 authored by skeyboy's avatar skeyboy

同步Android、iOS支付页

parent 5487a56b
...@@ -110,120 +110,123 @@ class UserStore extends GetxController { ...@@ -110,120 +110,123 @@ class UserStore extends GetxController {
} }
void logout() { void logout() {
_profile.value = IntegralEntity(
id: '', token: '', username: '', integral: 0, expireTime: null);
_isLogin.value = false;
}
Future refreshInfo() async { StorageService.to.remove(STORAGE_USER_TOKEN_KEY);
if (GetPlatform.isIOS) { StorageService.to.remove(STORAGE_USER_PROFILE_KEY);
IosDeviceInfo iosInfo = await deviceInfo.iosInfo; _profile.value = IntegralEntity(
id: '', token: '', username: '', integral: 0, expireTime: null);
_isLogin.value = false;
}
final res = await UserAPI.appleLogin({ Future refreshInfo() async {
"phone": iosInfo.data['identifierForVendor'], if (GetPlatform.isIOS) {
}); IosDeviceInfo iosInfo = await deviceInfo.iosInfo;
final value = IntegralEntity( final res = await UserAPI.appleLogin({
expireTime: res.expireTime == null ? null : res.expireTime, "phone": iosInfo.data['identifierForVendor'],
id: res.id, });
token: res.token,
username: res.username, final value = IntegralEntity(
integral: res.integral, expireTime: res.expireTime == null ? null : res.expireTime,
); id: res.id,
token = res.token; token: res.token,
_profile.value = _profile(value); username: res.username,
integral: res.integral,
);
token = res.token;
_profile.value = _profile(value);
if (profile.id != '') { if (profile.id != '') {
_isLogin.value = true; _isLogin.value = true;
}
// await MainController.to.asyncLoadBannerData();
} }
}
// await MainController.to.asyncLoadBannerData(); handleLogin(IntegralEntity res) async {
await setToken(res.token);
// IntegralEntity userInfo = await UserAPI.getUserIntegral();
await getUserInfo(IntegralEntity(
id: res.id,
username: res.username,
token: res.token,
integral: res.integral,
expireTime: res.expireTime,
));
_isLogin.value = true;
Get.back();
// Get.put(ApplicationController());
// Get.offAndToNamed(AppRoutes.Application);
} }
}
handleLogin(IntegralEntity res) async { getUserInfo(IntegralEntity userInfo) async {
await setToken(res.token); await setToken(userInfo.token);
// IntegralEntity userInfo = await UserAPI.getUserIntegral();
await getUserInfo(IntegralEntity(
id: res.id,
username: res.username,
token: res.token,
integral: res.integral,
expireTime: res.expireTime,
));
_isLogin.value = true;
Get.back();
// Get.put(ApplicationController());
// Get.offAndToNamed(AppRoutes.Application);
}
getUserInfo(IntegralEntity userInfo) async { await saveProfile(userInfo);
await setToken(userInfo.token);
await saveProfile(userInfo); // token = StorageService.to.getString(STORAGE_USER_TOKEN_KEY);
// token = StorageService.to.getString(STORAGE_USER_TOKEN_KEY); // if (token.isNotEmpty) {
// return;
// }
// IntegralEntity userInfo = await UserAPI.getUserIntegral();
// if (token.isNotEmpty) { // print("$userInfo");
// return;
// }
// IntegralEntity userInfo = await UserAPI.getUserIntegral();
// print("$userInfo"); // var info = await UserAPI.getUserIntegral();
// if (token.isEmpty) {
// var info = await UserAPI.getUserIntegral(); // }
// if (token.isEmpty) { }
// } @override
} dispose() {
subscription?.cancel();
super.dispose();
}
@override // 保存 token
dispose() { Future<void> setToken(String value) async {
subscription?.cancel(); await StorageService.to.setString(STORAGE_USER_TOKEN_KEY, value);
super.dispose(); token = value;
} }
// 保存 token // 获取 profile
Future<void> setToken(String value) async { Future<void> getProfile() async {
await StorageService.to.setString(STORAGE_USER_TOKEN_KEY, value); // print("objectobjectobjectobjectobjectobject");
token = value; // if (token.isEmpty) return;
} // var result = await UserAPI.profile();
// _profile(result);
// _isLogin.value = true;
// StorageService.to.setString(STORAGE_USER_PROFILE_KEY, jsonEncode(result));
}
// 获取 profile // 保存 profile
Future<void> getProfile() async { Future<void> saveProfile(IntegralEntity profile) async {
// print("objectobjectobjectobjectobjectobject"); _profile.value = profile;
// if (token.isEmpty) return; var copiedMap = Map.from(profile.toMap());
// var result = await UserAPI.profile();
// _profile(result);
// _isLogin.value = true;
// StorageService.to.setString(STORAGE_USER_PROFILE_KEY, jsonEncode(result));
}
// 保存 profile copiedMap.update("expireTime", (value) => value?.toIso8601String());
Future<void> saveProfile(IntegralEntity profile) async {
_profile.value = profile;
var copiedMap = Map.from(profile.toMap());
copiedMap.update("expireTime", (value) => value?.toIso8601String()); StorageService.to
.setString(STORAGE_USER_PROFILE_KEY, jsonEncode(copiedMap));
}
StorageService.to // // 保存 profile
.setString(STORAGE_USER_PROFILE_KEY, jsonEncode(copiedMap)); // Future<void> saveProfile(UserLoginResponseEntity profile) async {
} // _isLogin.value = true;
// StorageService.to.setString(STORAGE_USER_PROFILE_KEY, jsonEncode(profile));
// }
// // 保存 profile // 注销
// Future<void> saveProfile(UserLoginResponseEntity profile) async { Future<void> onLogout() async {
// _isLogin.value = true; // if (_isLogin.value) await UserAPI.logout();
// StorageService.to.setString(STORAGE_USER_PROFILE_KEY, jsonEncode(profile)); await StorageService.to.remove(STORAGE_USER_TOKEN_KEY);
// } _isLogin.value = false;
token = '';
// 注销 saveProfile(IntegralEntity(
Future<void> onLogout() async { id: '', username: '', token: '', expireTime: null, integral: 0));
// if (_isLogin.value) await UserAPI.logout(); Get.toNamed(AppRoutes.Application);
await StorageService.to.remove(STORAGE_USER_TOKEN_KEY);
_isLogin.value = false;
token = '';
saveProfile(IntegralEntity(
id: '', username: '', token: '', expireTime: null, integral: 0));
Get.toNamed(AppRoutes.Application);
} }
} }
...@@ -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();
await _getProduct(); try {
await initializedPlugins();
EasyLoading.show(status: "正在获取套餐中...");
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( height: double.infinity,
// "套餐选择", // width: Get.width,
// style: TextStyle( decoration: BoxDecoration(
// color: AppColors.primaryElementText, image: DecorationImage(
// fontFamily: 'Montserrat', image: Image.asset("assets/images/background.png").image,
// fontSize: 18, fit: BoxFit.cover),
// fontWeight: FontWeight.w600, ),
// ), child: Scaffold(
// ), appBar: AppBar(
// leading: IconButton( elevation: 0,
// tooltip: '返回上一页', backgroundColor: const Color.fromARGB(0, 0, 0, 0),
// icon: const Icon( title: Text("订阅中心"),
// Icons.arrow_back, // actions: <Widget>[
// color: AppColors.primaryElementText, // GestureDetector(
// ), // onTap: () {
// onPressed: () async { // // controller.restorePurchases();
// // Get.back(); // },
// // Get.offAll(ApplicationPage()); // child: Container(
// // await Get.off(ApplicationPage()); // padding: EdgeInsets.only(right: 10),
// // Get.toNamed(AppRoutes.Application); // child: Center(
// child: Text("恢复购买"),
// Get.back(); // )),
// // await Get.toNamed(); // )
// // Navigator.of(context).pop(); // ],
// //_nextPage(-1);
// },
// ),
// ),
// _buildView
body: Container(
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: _buildView()), 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(
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
children: [
Align(
alignment: Alignment.topRight,
child: InkWell(
onTap: () => Get.back(),
child: Container(
// color: Colors.amber,
padding: EdgeInsets.symmetric(
horizontal: 20, vertical: 20),
child: Icon(
Icons.close_outlined,
color: Colors.white,
),
)),
),
// 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( // List<Bullet> bullets = List<Bullet>.generate(1000, (i) {
// width: getRelativeHeight(0.13), // final showTime = random.nextInt(60000); // in 60s
// height: getRelativeHeight(0.13), // return Bullet(child: Text('$i-$showTime'), showTime: showTime);
// decoration: BoxDecoration( // });
// border: final barrageWallController = BarrageWallController();
// Border.all(width: 15, color: circleColor.withOpacity(0.6)), final textEditingController = TextEditingController();
// shape: BoxShape.circle, // final textEditingController = TextEditingController();
// ), final c = Get.put(UserStore());
// ), return Column(
), children: [
Align( Expanded(
alignment: Alignment.center, child: ListView(
child: Image( children: [
image: AssetImage("assets/images/center.png"), Obx(() => c.profile.expireTime == null
width: Get.mediaQuery.size.height * 0.21, ? const Center(
child: Text(
"您还不是 VIP 会员",
style: TextStyle(
color: Color.fromARGB(255, 160, 165, 184),
fontSize: 14,
),
), ),
// child: Container( )
// width: getRelativeHeight(0.11), // 那俄语呢 那他的反义词呢
// height: getRelativeHeight(0.11), : Align(
// decoration: BoxDecoration( alignment: Alignment.center,
// border: child: Container(
// Border.all(width: 15, color: circleColor.withOpacity(0.25)), // color: Colors.amber,
// shape: BoxShape.circle, padding:
// ), EdgeInsets.symmetric(horizontal: 20, vertical: 0),
// ), child: RichText(
), textAlign: TextAlign.center,
Align( text: TextSpan(children: [
alignment: Alignment.centerRight, const TextSpan(
child: Image( text: '您的VIP会员资格将于',
image: AssetImage("assets/images/you.png"), style: TextStyle(
width: Get.mediaQuery.size.height * 0.17, color: Color.fromARGB(255, 160, 165, 184),
fontSize: 14,
),
),
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,
),
),
// Text(
// "您的VIP会员资格将于" +
// "${c.profile.expireTime.year}-${c.profile.expireTime.month}-${c.profile.expireTime.day}" +
// "过期,如果您是自动续费会员将会在过期日前一天自动续费。",
// textAlign: TextAlign.center,
// style: TextStyle(
// color: color,
// fontSize: 14,
// ),
// )
])),
), ),
// child: Container( )),
// width: getRelativeHeight(0.11), MarqueeView(
// height: getRelativeHeight(0.11), child: Row(children: [
// decoration: BoxDecoration( _buildText('手机用户159****0542购买了按周订阅套餐'),
// border: _buildText('手机用户136****1949购买了按年订阅套餐'),
// Border.all(width: 15, color: circleColor.withOpacity(0.17)), _buildText('手机用户159****1252购买了按月订阅套餐'),
// shape: BoxShape.circle, _buildText('手机用户176****1429购买了按周订阅套餐'),
// ), _buildText('手机用户158****8953购买了按月订阅套餐'),
// ), _buildText('手机用户139****2752购买了按年订阅套餐'),
_buildText('手机用户130****5959购买了按季订阅套餐'),
_buildText('手机用户158****6048购买了按月订阅套餐'),
_buildText('手机用户136****8962购买了按年订阅套餐'),
]),
),
Padding(
padding: EdgeInsets.symmetric(horizontal: 20),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
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,
)
], ],
)), ),
Expanded( ),
child: Container( Container(
padding: EdgeInsets.all(10), 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: [
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)),
)
],
),
const SizedBox(
height: 20,
),
Column(
children: [
Row(children: const [
Image(
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(
width: Get.width,
height: 150,
margin: const EdgeInsets.all(10),
child: ListView(
shrinkWrap: true,
scrollDirection: Axis.horizontal,
children: controller.state.items
.map((element) => Container(
margin: const EdgeInsets.only(right: 20),
child: InkWell(
borderRadius: BorderRadius.circular(10),
onTap: () {
/// 增加选中事件
controller.state.setSelectedItem = element;
Vibrate.feedback(FeedbackType.impact);
},
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.spaceBetween,
),
),
),
))
.toList(),
),
),
),
Container(
margin: const EdgeInsets.only(top: 10, bottom: 10),
padding: const EdgeInsets.symmetric(horizontal: 10),
child: Column( child: Column(
children: [ children: [
Row( Row(
mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Icon(Icons.send, color: color), Container(
Text(" 选择自己需要的套餐", width: 4,
style: TextStyle(color: color, fontSize: 20)) 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( Container(
margin: EdgeInsets.only(top: 20), padding: EdgeInsets.all(10),
padding: EdgeInsets.only(left: 10), child: Column(
height: Get.mediaQuery.size.height * 0.14, children: [
child: Row( Row(children: [
mainAxisAlignment: MainAxisAlignment.spaceBetween, Image(
children: [ width: 40,
Obx( image: Image.asset(
() => Column( 'assets/images/account_header.png')
crossAxisAlignment: CrossAxisAlignment.start, .image),
mainAxisAlignment: MainAxisAlignment.spaceAround, SizedBox(
children: controller.state.items.length == 0 width: 10,
? [] ),
: controller.state.items Text("182****1411"),
.firstWhere((element) => SizedBox(
element.appleProductId == width: 10,
controller.state.selected) ),
.goodsDesc! Container(
.split('、') padding: EdgeInsets.symmetric(
.map( vertical: 6, horizontal: 10),
(item) => Row( decoration: BoxDecoration(
// crossAxisAlignment color: Color.fromARGB(255, 53, 45, 55),
borderRadius:
children: [ BorderRadius.all(Radius.circular(40))),
Icon(Icons.check, color: color), // diamond
Text(item, child: Row(
style: TextStyle( children: [
color: color, fontSize: 16)) 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),
), ),
), Text(
'作为公司小编,每天写文章很头疼,偶然发现这个软件,提高了我的工作效率。太赞了!',
// Obx(() => controller.state.selected == style: TextStyle(
// 'com.wudi.app.60stars' color: Color.fromARGB(255, 161, 161, 176)),
// ? Column( )
// crossAxisAlignment: CrossAxisAlignment.start, ],
// mainAxisAlignment: )),
// MainAxisAlignment.spaceAround, Container(
// children: [ padding: const EdgeInsets.all(10),
// Row( child: Column(
// // crossAxisAlignment 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)),
)
],
))
]),
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)),
)
],
)),
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: [
// children: [ Row(
// Icon(Icons.check, color: color), mainAxisAlignment: MainAxisAlignment.center,
// Text("3022次提问机会", children: [
// style: TextStyle( InkWell(
// color: color, fontSize: 16)) onTap: () async {
// ], Get.toNamed(AppRoutes.USER_EULA);
// ), // final Uri _url = Uri.parse(
// Row( // 'https://docs.qq.com/doc/DY3pybXJ5Y1JLQm13');
// children: [ // await launchUrl(_url);
// Icon(Icons.check, color: color), },
// Text("解锁所有高级功能", child: RichText(
// style: TextStyle( text: const TextSpan(children: [
// color: color, fontSize: 16)) TextSpan(
// ], text: 'Tap To view the ',
// ) style: TextStyle(
// ], fontWeight: FontWeight.bold,
// ) color: Color.fromARGB(
// : controller.state.selected == 255, 164, 164, 183))),
// 'com.wudi.app.monthly_pass' TextSpan(
// ? Column( text: 'EULA',
// crossAxisAlignment: style: TextStyle(
// CrossAxisAlignment.start, color: color,
// mainAxisAlignment: fontWeight: FontWeight.bold)),
// MainAxisAlignment.spaceAround, ]),
// children: [ ),
// Row(
// // crossAxisAlignment
// children: [ // child: Text(
// Icon(Icons.check, color: color), // "Tap To view the EULA",
// Text("月卡会员", // style: TextStyle(color: Colors.white),
// 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: [ // loadingList
// Icon(Icons.check, color: color), Obx(() => AnimatedOpacity(
// Text("周卡会员", opacity: controller.state.loadingList ? 0 : 1,
// style: TextStyle( duration: const Duration(milliseconds: 500),
// color: color, fontSize: 16)) child: Container(
// ], padding: const EdgeInsets.only(
// ), top: 10,
// Row( bottom: 50,
// children: [ ),
// Icon(Icons.check, color: color), decoration: BoxDecoration(
// Text("无限聊天", color: const Color(0xFF3d3f54).withOpacity(.8),
// style: TextStyle( ),
// color: color, fontSize: 16)) width: Get.width,
// ], child: Obx(
// ), () => GradientButton(
// Row( increaseHeightBy: 10.00,
// children: [ increaseWidthBy: Get.width * .7,
// Icon(Icons.check, color: color), callback: () {
// Text("解锁所有高级功能", controller.requestPurchase();
// style: TextStyle( },
// color: color, fontSize: 16)) isEnabled: !controller.state.loading,
// ], // callback: controller.genInner,
// ) shapeRadius: const BorderRadius.all(Radius.circular(5)),
// ], elevation: 0,
// )), gradient: const LinearGradient(
Image( colors: [
image: AssetImage("assets/images/center-1.png"), Color(0xFFbe6afb),
width: Get.mediaQuery.size.height * 0.17, Color(0xFF9c67f6),
), Color(0xFF7965f8)
], ],
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
), ),
child: const Text('立即解锁',
style: TextStyle(
fontSize: 14, fontWeight: FontWeight.w500)),
), ),
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;
children: controller.state.items
.asMap()
.keys
.map(
(item) => Expanded(
child: InkWell(
onTap: () {
Vibrate.feedback(
FeedbackType.selection);
controller.state.selected = controller
.state
.items[item]
.appleProductId!;
//
// c.requestPurchase(item);
},
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: Column(
mainAxisAlignment:
MainAxisAlignment
.spaceAround,
children: [
Text(
'${controller.state.items[item].amount!}',
style: TextStyle(
color: Colors.white),
),
Text(
"${controller.state.items[item].goodsName!}",
maxLines: 2,
overflow: TextOverflow.clip,
style: TextStyle(
color: Colors.white),
)
],
)),
))),
)
.toList(),
),
)),
// 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.symmetric(horizontal: 40, vertical: 20),
// width: double.infinity,
// child:
// )
],
),
),
)
],
),
); );
// 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,11 +388,23 @@ class HomeController extends GetxController with SingleGetTickerProviderMixin { ...@@ -388,11 +388,23 @@ class HomeController extends GetxController with SingleGetTickerProviderMixin {
} catch (e) {} } catch (e) {}
} }
virtualPay() { bool get isLogin => UserStore.to.isLogin;
if (GetPlatform.isAndroid) {
Get.toNamed(AppRoutes.AN_PAY_LIST); virtualPay() async {
if (!isLogin) {
//只有Android才会存在登录情况
if (GetPlatform.isAndroid) {
var rev = await Get.toNamed(AppRoutes.SIGN_IN);
if (isLogin) {
virtualPay();
}
}
} else { } else {
Get.toNamed(AppRoutes.PAY_LIST); if (GetPlatform.isAndroid) {
Get.toNamed(AppRoutes.AN_PAY_LIST);
} else {
Get.toNamed(AppRoutes.PAY_LIST);
}
} }
} }
......
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