添加 r_upgrade

修改弹窗
master
张萌 2 years ago
parent b97acacbeb
commit 9676d13777

@ -4,10 +4,4 @@ package_info_plus_linux=/Users/zhangmeng/.pub-cache/hosted/pub.dartlang.org/pack
package_info_plus_macos=/Users/zhangmeng/.pub-cache/hosted/pub.dartlang.org/package_info_plus_macos-1.3.0/
package_info_plus_web=/Users/zhangmeng/.pub-cache/hosted/pub.dartlang.org/package_info_plus_web-1.0.5/
package_info_plus_windows=/Users/zhangmeng/.pub-cache/hosted/pub.dartlang.org/package_info_plus_windows-1.0.5/
url_launcher=/Users/zhangmeng/.pub-cache/hosted/pub.dartlang.org/url_launcher-6.1.2/
url_launcher_android=/Users/zhangmeng/.pub-cache/hosted/pub.dartlang.org/url_launcher_android-6.0.17/
url_launcher_ios=/Users/zhangmeng/.pub-cache/hosted/pub.dartlang.org/url_launcher_ios-6.0.17/
url_launcher_linux=/Users/zhangmeng/.pub-cache/hosted/pub.dartlang.org/url_launcher_linux-3.0.1/
url_launcher_macos=/Users/zhangmeng/.pub-cache/hosted/pub.dartlang.org/url_launcher_macos-3.0.1/
url_launcher_web=/Users/zhangmeng/.pub-cache/hosted/pub.dartlang.org/url_launcher_web-2.0.11/
url_launcher_windows=/Users/zhangmeng/.pub-cache/hosted/pub.dartlang.org/url_launcher_windows-3.0.1/
r_upgrade=/Users/zhangmeng/.pub-cache/hosted/pub.dartlang.org/r_upgrade-0.3.8+2/

@ -1 +1 @@
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"package_info_plus","path":"/Users/zhangmeng/.pub-cache/hosted/pub.dartlang.org/package_info_plus-1.4.2/","native_build":true,"dependencies":[]},{"name":"url_launcher_ios","path":"/Users/zhangmeng/.pub-cache/hosted/pub.dartlang.org/url_launcher_ios-6.0.17/","native_build":true,"dependencies":[]}],"android":[{"name":"package_info_plus","path":"/Users/zhangmeng/.pub-cache/hosted/pub.dartlang.org/package_info_plus-1.4.2/","native_build":true,"dependencies":[]},{"name":"url_launcher_android","path":"/Users/zhangmeng/.pub-cache/hosted/pub.dartlang.org/url_launcher_android-6.0.17/","native_build":true,"dependencies":[]}],"macos":[{"name":"package_info_plus_macos","path":"/Users/zhangmeng/.pub-cache/hosted/pub.dartlang.org/package_info_plus_macos-1.3.0/","native_build":true,"dependencies":[]},{"name":"url_launcher_macos","path":"/Users/zhangmeng/.pub-cache/hosted/pub.dartlang.org/url_launcher_macos-3.0.1/","native_build":true,"dependencies":[]}],"linux":[{"name":"package_info_plus_linux","path":"/Users/zhangmeng/.pub-cache/hosted/pub.dartlang.org/package_info_plus_linux-1.0.5/","native_build":false,"dependencies":[]},{"name":"url_launcher_linux","path":"/Users/zhangmeng/.pub-cache/hosted/pub.dartlang.org/url_launcher_linux-3.0.1/","native_build":true,"dependencies":[]}],"windows":[{"name":"package_info_plus_windows","path":"/Users/zhangmeng/.pub-cache/hosted/pub.dartlang.org/package_info_plus_windows-1.0.5/","native_build":false,"dependencies":[]},{"name":"url_launcher_windows","path":"/Users/zhangmeng/.pub-cache/hosted/pub.dartlang.org/url_launcher_windows-3.0.1/","native_build":true,"dependencies":[]}],"web":[{"name":"package_info_plus_web","path":"/Users/zhangmeng/.pub-cache/hosted/pub.dartlang.org/package_info_plus_web-1.0.5/","dependencies":[]},{"name":"url_launcher_web","path":"/Users/zhangmeng/.pub-cache/hosted/pub.dartlang.org/url_launcher_web-2.0.11/","dependencies":[]}]},"dependencyGraph":[{"name":"package_info_plus","dependencies":["package_info_plus_linux","package_info_plus_macos","package_info_plus_windows","package_info_plus_web"]},{"name":"package_info_plus_linux","dependencies":[]},{"name":"package_info_plus_macos","dependencies":[]},{"name":"package_info_plus_web","dependencies":[]},{"name":"package_info_plus_windows","dependencies":[]},{"name":"url_launcher","dependencies":["url_launcher_android","url_launcher_ios","url_launcher_linux","url_launcher_macos","url_launcher_web","url_launcher_windows"]},{"name":"url_launcher_android","dependencies":[]},{"name":"url_launcher_ios","dependencies":[]},{"name":"url_launcher_linux","dependencies":[]},{"name":"url_launcher_macos","dependencies":[]},{"name":"url_launcher_web","dependencies":[]},{"name":"url_launcher_windows","dependencies":[]}],"date_created":"2022-06-02 10:29:21.647080","version":"3.0.0"}
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"package_info_plus","path":"/Users/zhangmeng/.pub-cache/hosted/pub.dartlang.org/package_info_plus-1.4.2/","native_build":true,"dependencies":[]},{"name":"r_upgrade","path":"/Users/zhangmeng/.pub-cache/hosted/pub.dartlang.org/r_upgrade-0.3.8+2/","native_build":true,"dependencies":[]}],"android":[{"name":"package_info_plus","path":"/Users/zhangmeng/.pub-cache/hosted/pub.dartlang.org/package_info_plus-1.4.2/","native_build":true,"dependencies":[]},{"name":"r_upgrade","path":"/Users/zhangmeng/.pub-cache/hosted/pub.dartlang.org/r_upgrade-0.3.8+2/","native_build":true,"dependencies":[]}],"macos":[{"name":"package_info_plus_macos","path":"/Users/zhangmeng/.pub-cache/hosted/pub.dartlang.org/package_info_plus_macos-1.3.0/","native_build":true,"dependencies":[]}],"linux":[{"name":"package_info_plus_linux","path":"/Users/zhangmeng/.pub-cache/hosted/pub.dartlang.org/package_info_plus_linux-1.0.5/","native_build":false,"dependencies":[]}],"windows":[{"name":"package_info_plus_windows","path":"/Users/zhangmeng/.pub-cache/hosted/pub.dartlang.org/package_info_plus_windows-1.0.5/","native_build":false,"dependencies":[]}],"web":[{"name":"package_info_plus_web","path":"/Users/zhangmeng/.pub-cache/hosted/pub.dartlang.org/package_info_plus_web-1.0.5/","dependencies":[]}]},"dependencyGraph":[{"name":"package_info_plus","dependencies":["package_info_plus_linux","package_info_plus_macos","package_info_plus_windows","package_info_plus_web"]},{"name":"package_info_plus_linux","dependencies":[]},{"name":"package_info_plus_macos","dependencies":[]},{"name":"package_info_plus_web","dependencies":[]},{"name":"package_info_plus_windows","dependencies":[]},{"name":"r_upgrade","dependencies":[]}],"date_created":"2022-06-07 14:38:49.619690","version":"3.0.0"}

@ -0,0 +1 @@
/Users/zhangmeng/fvm/versions/3.0.0

@ -0,0 +1,4 @@
{
"flutterSdkVersion": "3.0.0",
"flavors": {}
}

@ -6,8 +6,7 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:package_info_plus/package_info_plus.dart';
import 'package:dio/dio.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:url_launcher/url_launcher_string.dart';
import 'package:r_upgrade/r_upgrade.dart';
enum ForceUpgrade {
force(1),
@ -77,17 +76,11 @@ class AppUpgrade {
upgradeDialog(BuildContext context, PackageInfo packageInfo,
Function()? onLaunchFail, AkuAppVersion akuAppVersion) {
return Center(
child: Material(
borderRadius: BorderRadius.circular(16),
child: Container(
width: 300,
height: 200,
clipBehavior: Clip.antiAliasWithSaveLayer,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(16),
// gradient: LinearGradient(colors: [
// Colors.yellow.withOpacity(0.05),
// Colors.white,
// ], begin: Alignment.topCenter, end: Alignment.bottomCenter),
color: Colors.white,
boxShadow: const [
BoxShadow(
@ -95,7 +88,20 @@ class AppUpgrade {
blurRadius: 5,
spreadRadius: 0,
)
]),
],
borderRadius: BorderRadius.circular(24),
),
child: Material(
child: Container(
decoration: const BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
stops: [0,0.7],
colors: [
Color(0x33FBE541),
Colors.white,
])),
child: Column(
children: [
const Padding(
@ -105,7 +111,7 @@ class AppUpgrade {
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.black,
fontSize: 24,
fontSize: 22,
fontWeight: FontWeight.bold),
),
),
@ -123,7 +129,7 @@ class AppUpgrade {
children: [
if (akuAppVersion.forceEM != ForceUpgrade.force)
Expanded(
child: TextButton(
child: MaterialButton(
onPressed: () {
Navigator.pop(context);
},
@ -145,17 +151,20 @@ class AppUpgrade {
),
),
Expanded(
child: TextButton(
child: MaterialButton(
onPressed: () async {
Navigator.pop(context);
if (Platform.isAndroid) {
var re = await launchUrlString(
'mimarket://detail?id=${packageInfo.packageName}');
if (!re && onLaunchFail != null) {
onLaunchFail.call();
var stores = await RUpgrade.androidStores;
if (stores == null || stores.isEmpty) {
onLaunchFail?.call();
return;
}
await RUpgrade.upgradeFromAndroidStore(
stores.first);
} else if (Platform.isIOS) {
launchUrlString(
'itms-apps://itunes.apple.com/app/${packageInfo.packageName}');
await RUpgrade.upgradeFromAppStore(
packageInfo.packageName);
} else {}
},
child: const Text(
@ -174,6 +183,7 @@ class AppUpgrade {
),
),
),
),
);
}
}

@ -11,8 +11,8 @@ dependencies:
flutter:
sdk: flutter
package_info_plus: ^1.4.2
url_launcher: ^6.1.2
dio: ^4.0.6
r_upgrade: ^0.3.8+2
dev_dependencies:
flutter_test:

Loading…
Cancel
Save