From a1678451ac19b5bb706b0c1410bc595396bb27bc Mon Sep 17 00:00:00 2001 From: wyl2022 <2373073266@qq.com> Date: Fri, 24 Jun 2022 15:43:55 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .flutter-plugins | 12 +++--- .flutter-plugins-dependencies | 2 +- lib/aku_app_upgrade.dart | 70 +++++++++++++++++++++-------------- 3 files changed, 50 insertions(+), 34 deletions(-) diff --git a/.flutter-plugins b/.flutter-plugins index 52f8b69..0ad472b 100644 --- a/.flutter-plugins +++ b/.flutter-plugins @@ -1,7 +1,7 @@ # This is a generated file; do not edit or check into version control. -package_info_plus=/Users/zhangmeng/.pub-cache/hosted/pub.dartlang.org/package_info_plus-1.4.2/ -package_info_plus_linux=/Users/zhangmeng/.pub-cache/hosted/pub.dartlang.org/package_info_plus_linux-1.0.5/ -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/ -r_upgrade=/Users/zhangmeng/.pub-cache/hosted/pub.dartlang.org/r_upgrade-0.3.8+2/ +package_info_plus=/Users/datang/.pub-cache/hosted/pub.dartlang.org/package_info_plus-1.4.2/ +package_info_plus_linux=/Users/datang/.pub-cache/hosted/pub.dartlang.org/package_info_plus_linux-1.0.5/ +package_info_plus_macos=/Users/datang/.pub-cache/hosted/pub.dartlang.org/package_info_plus_macos-1.3.0/ +package_info_plus_web=/Users/datang/.pub-cache/hosted/pub.dartlang.org/package_info_plus_web-1.0.5/ +package_info_plus_windows=/Users/datang/.pub-cache/hosted/pub.dartlang.org/package_info_plus_windows-1.0.5/ +r_upgrade=/Users/datang/.pub-cache/hosted/pub.dartlang.org/r_upgrade-0.3.8+2/ diff --git a/.flutter-plugins-dependencies b/.flutter-plugins-dependencies index de10931..58c0d54 100644 --- a/.flutter-plugins-dependencies +++ b/.flutter-plugins-dependencies @@ -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":"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"} \ No newline at end of file +{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"package_info_plus","path":"/Users/datang/.pub-cache/hosted/pub.dartlang.org/package_info_plus-1.4.2/","native_build":true,"dependencies":[]},{"name":"r_upgrade","path":"/Users/datang/.pub-cache/hosted/pub.dartlang.org/r_upgrade-0.3.8+2/","native_build":true,"dependencies":[]}],"android":[{"name":"package_info_plus","path":"/Users/datang/.pub-cache/hosted/pub.dartlang.org/package_info_plus-1.4.2/","native_build":true,"dependencies":[]},{"name":"r_upgrade","path":"/Users/datang/.pub-cache/hosted/pub.dartlang.org/r_upgrade-0.3.8+2/","native_build":true,"dependencies":[]}],"macos":[{"name":"package_info_plus_macos","path":"/Users/datang/.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/datang/.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/datang/.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/datang/.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-24 11:54:55.391030","version":"3.0.2"} \ No newline at end of file diff --git a/lib/aku_app_upgrade.dart b/lib/aku_app_upgrade.dart index 1d29163..6fb2cb3 100644 --- a/lib/aku_app_upgrade.dart +++ b/lib/aku_app_upgrade.dart @@ -36,9 +36,14 @@ enum AndroidStoreName { final String name; final String packageName; - static AndroidStoreName getValue(String packageName) => - AndroidStoreName.values - .firstWhere((element) => element.packageName == packageName); + static AndroidStoreName getValue(String packageName) { + var re =AndroidStoreName.values + .firstWhere((element) => element.packageName == packageName,orElse: ()=>-1); + if(re=1) + + return ; + + } AndroidStore get getAndroidStore => AndroidStore.internal(packageName); @@ -159,6 +164,7 @@ class AppUpgrade { Expanded( child: MaterialButton( onPressed: () { + Navigator.pop(context); }, child: const Text( @@ -183,39 +189,49 @@ class AppUpgrade { onPressed: () async { Navigator.pop(context); if (Platform.isAndroid) { - var stores = await RUpgrade.androidStores; + var stores = await RUpgrade.androidStores;/// + if (stores == null || stores.isEmpty) { onLaunchFail?.call(); return; } + print(stores); AndroidStoreName? selectStore; await showModalBottomSheet( isDismissible: false, context: context, builder: (context) { - return FittedBox( - child: ListView.separated( - itemBuilder: (context, index) { - var value = - AndroidStoreName.getValue( - stores[index].packageName); - return GestureDetector( - onTap: () { - Navigator.pop(context); - selectStore = value; - }, - child: Center( - child: Text(value.name), - ), - ); - }, - separatorBuilder: (context, index) { - return const SizedBox( - height: 10, - ); - }, - itemCount: stores.length), - ); + + return SizedBox( + height:450, + child: ListView.separated( + itemBuilder: (context, index) { + var value = + AndroidStoreName.getValue( + stores[index].packageName); + print("这是${value}"); + print("这是${ stores[index].packageName}"); + return Container(); + // return GestureDetector( + // onTap: () { + // Navigator.pop(context); + // selectStore = value; + // }, + // child: Center( + // child: Text(value.name), + // ), + // ); + }, + separatorBuilder: (context, index) { + return const SizedBox( + height: 10, + ); + }, + itemCount: stores.length), + ) + ; + + }); if (selectStore == null) return;