|
|
@ -8,6 +8,8 @@ import 'package:package_info_plus/package_info_plus.dart';
|
|
|
|
import 'package:dio/dio.dart';
|
|
|
|
import 'package:dio/dio.dart';
|
|
|
|
import 'package:r_upgrade/r_upgrade.dart';
|
|
|
|
import 'package:r_upgrade/r_upgrade.dart';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const apkLink = 'https://saas.kaidalai.cn/resource/appPackage/app.apk';
|
|
|
|
|
|
|
|
|
|
|
|
enum ForceUpgrade {
|
|
|
|
enum ForceUpgrade {
|
|
|
|
force(1),
|
|
|
|
force(1),
|
|
|
|
unForce(2);
|
|
|
|
unForce(2);
|
|
|
@ -185,6 +187,40 @@ class AppUpgrade {
|
|
|
|
child: MaterialButton(
|
|
|
|
child: MaterialButton(
|
|
|
|
onPressed: () async {
|
|
|
|
onPressed: () async {
|
|
|
|
if (Platform.isAndroid) {
|
|
|
|
if (Platform.isAndroid) {
|
|
|
|
|
|
|
|
showModalBottomSheet(
|
|
|
|
|
|
|
|
isDismissible: false,
|
|
|
|
|
|
|
|
context: context,
|
|
|
|
|
|
|
|
builder: (context) {
|
|
|
|
|
|
|
|
return Container(
|
|
|
|
|
|
|
|
child:
|
|
|
|
|
|
|
|
Column(
|
|
|
|
|
|
|
|
children: [
|
|
|
|
|
|
|
|
const SizedBox(height: 20),
|
|
|
|
|
|
|
|
const Text('选择下载途径',style: TextStyle(fontSize: 24),),
|
|
|
|
|
|
|
|
const Divider(),
|
|
|
|
|
|
|
|
GestureDetector(
|
|
|
|
|
|
|
|
onTap: () async{
|
|
|
|
|
|
|
|
await RUpgrade.upgrade(apkLink);
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
child: Padding(
|
|
|
|
|
|
|
|
padding:
|
|
|
|
|
|
|
|
const EdgeInsets.only(top: 0),
|
|
|
|
|
|
|
|
child:
|
|
|
|
|
|
|
|
Column(children: [
|
|
|
|
|
|
|
|
const Divider(),
|
|
|
|
|
|
|
|
SizedBox(
|
|
|
|
|
|
|
|
height: 20,
|
|
|
|
|
|
|
|
child:Text(
|
|
|
|
|
|
|
|
'直接下载',style:const TextStyle(fontSize: 14,),),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
],)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
const Divider(),
|
|
|
|
|
|
|
|
GestureDetector(
|
|
|
|
|
|
|
|
onTap: () async{
|
|
|
|
var stores = await RUpgrade.androidStores;
|
|
|
|
var stores = await RUpgrade.androidStores;
|
|
|
|
if (stores == null || stores.isEmpty) {
|
|
|
|
if (stores == null || stores.isEmpty) {
|
|
|
|
onLaunchFail?.call();
|
|
|
|
onLaunchFail?.call();
|
|
|
@ -203,11 +239,27 @@ class AppUpgrade {
|
|
|
|
isDismissible: false,
|
|
|
|
isDismissible: false,
|
|
|
|
context: context,
|
|
|
|
context: context,
|
|
|
|
builder: (context) {
|
|
|
|
builder: (context) {
|
|
|
|
return Center(
|
|
|
|
return Container(
|
|
|
|
child: Column(
|
|
|
|
// decoration: const BoxDecoration(gradient: LinearGradient(
|
|
|
|
|
|
|
|
// begin: Alignment.topCenter,
|
|
|
|
|
|
|
|
// end: Alignment.bottomCenter,
|
|
|
|
|
|
|
|
// stops: [
|
|
|
|
|
|
|
|
// 0,
|
|
|
|
|
|
|
|
// 0.7
|
|
|
|
|
|
|
|
// ],
|
|
|
|
|
|
|
|
// colors: [
|
|
|
|
|
|
|
|
// Color(0x33FBE541),
|
|
|
|
|
|
|
|
// Colors.white,
|
|
|
|
|
|
|
|
// ]),
|
|
|
|
|
|
|
|
// // borderRadius: BorderRadius.only(
|
|
|
|
|
|
|
|
// // topLeft: Radius.circular(25.0),
|
|
|
|
|
|
|
|
// // topRight: Radius.circular(25.0))
|
|
|
|
|
|
|
|
// ),
|
|
|
|
|
|
|
|
child:
|
|
|
|
|
|
|
|
Column(
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
const SizedBox(height: 20),
|
|
|
|
const SizedBox(height: 20),
|
|
|
|
const Text('选择应用商店'),
|
|
|
|
const Text('选择应用商店',style: TextStyle(fontSize: 24),),
|
|
|
|
Expanded(
|
|
|
|
Expanded(
|
|
|
|
child: ListView.separated(
|
|
|
|
child: ListView.separated(
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
itemBuilder: (context, index) {
|
|
|
@ -218,13 +270,19 @@ class AppUpgrade {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
child: Padding(
|
|
|
|
child: Padding(
|
|
|
|
padding:
|
|
|
|
padding:
|
|
|
|
const EdgeInsets.all(
|
|
|
|
const EdgeInsets.only(top: 0),
|
|
|
|
32.0),
|
|
|
|
child:
|
|
|
|
child: Center(
|
|
|
|
Column(children: [
|
|
|
|
|
|
|
|
const Divider(),
|
|
|
|
|
|
|
|
SizedBox(
|
|
|
|
|
|
|
|
height: 20,
|
|
|
|
child:Text(
|
|
|
|
child:Text(
|
|
|
|
storeEMs[index]
|
|
|
|
storeEMs[index]
|
|
|
|
.name),
|
|
|
|
.name,style:const TextStyle(fontSize: 14,),),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
],)
|
|
|
|
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -236,6 +294,9 @@ class AppUpgrade {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
itemCount: storeEMs.length),
|
|
|
|
itemCount: storeEMs.length),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
GestureDetector(onTap: (){
|
|
|
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
|
|
|
},child: const Text('取消',style: TextStyle(fontSize: 20),),)
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
);
|
|
|
@ -245,6 +306,33 @@ class AppUpgrade {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
await RUpgrade.upgradeFromAndroidStore(
|
|
|
|
await RUpgrade.upgradeFromAndroidStore(
|
|
|
|
selectStore!.getAndroidStore);
|
|
|
|
selectStore!.getAndroidStore);
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
child: Padding(
|
|
|
|
|
|
|
|
padding:
|
|
|
|
|
|
|
|
const EdgeInsets.only(top: 0),
|
|
|
|
|
|
|
|
child:
|
|
|
|
|
|
|
|
Column(children: [
|
|
|
|
|
|
|
|
const Divider(),
|
|
|
|
|
|
|
|
SizedBox(
|
|
|
|
|
|
|
|
height: 20,
|
|
|
|
|
|
|
|
child:Text(
|
|
|
|
|
|
|
|
'应用市场',style:const TextStyle(fontSize: 14,),),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
],)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else if (Platform.isIOS) {
|
|
|
|
} else if (Platform.isIOS) {
|
|
|
|
await RUpgrade.upgradeFromAppStore(
|
|
|
|
await RUpgrade.upgradeFromAppStore(
|
|
|
|
packageInfo.packageName);
|
|
|
|
packageInfo.packageName);
|
|
|
|