Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
ChatGPT
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
关振斌
ChatGPT
Commits
e44879c0
Commit
e44879c0
authored
Apr 13, 2023
by
skeyboy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
同步Android、iOS支付页
parent
5487a56b
Changes
6
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
760 additions
and
453 deletions
+760
-453
lib/common/store/user.dart
lib/common/store/user.dart
+96
-93
lib/pages/frame/android_pay_list/controller.dart
lib/pages/frame/android_pay_list/controller.dart
+17
-5
lib/pages/frame/android_pay_list/state.dart
lib/pages/frame/android_pay_list/state.dart
+16
-0
lib/pages/frame/android_pay_list/view.dart
lib/pages/frame/android_pay_list/view.dart
+41
-40
lib/pages/frame/android_pay_list/widgets/helloword.dart
lib/pages/frame/android_pay_list/widgets/helloword.dart
+574
-311
lib/pages/home/controller.dart
lib/pages/home/controller.dart
+16
-4
No files found.
lib/common/store/user.dart
View file @
e44879c0
...
...
@@ -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
;
...
...
lib/pages/frame/android_pay_list/controller.dart
View file @
e44879c0
...
...
@@ -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}
"
,
...
...
lib/pages/frame/android_pay_list/state.dart
View file @
e44879c0
...
...
@@ -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
;
}
lib/pages/frame/android_pay_list/view.dart
View file @
e44879c0
...
...
@@ -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:
// ),
),
);
}
}
lib/pages/frame/android_pay_list/widgets/helloword.dart
View file @
e44879c0
This diff is collapsed.
Click to expand it.
lib/pages/home/controller.dart
View file @
e44879c0
...
...
@@ -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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment