Ver código fonte

1.添加引导页图片下载失败捕获处理

tags/0.0.8+1
“yanghuaxuan” 3 anos atrás
pai
commit
6856bf0e49
6 arquivos alterados com 67 adições e 48 exclusões
  1. +25
    -25
      example/android/app/build.gradle
  2. +7
    -2
      example/android/app/src/main/java/cn/zhios/zhiying_base_widget_example/MainActivity.java
  3. +1
    -0
      lib/pages/custom_page/custom_item_page.dart
  4. +13
    -7
      lib/pages/guide_page/guide_page.dart
  5. +20
    -13
      lib/pages/launch_page/launch_page.dart
  6. +1
    -1
      pubspec.yaml

+ 25
- 25
example/android/app/build.gradle Ver arquivo

@@ -109,19 +109,19 @@ android {


// 应用信息配置
productFlavors {
// 智夜生活
zhiying {
applicationId "cn.zhios.zhiying"
versionCode 53
dimension "app"
versionName '1.3.13'
// 签名信息
signingConfig signingConfigs.zhiying
}
}
// 打包脚本
// productFlavors {
// // 智夜生活
// zhiying {
// applicationId "cn.zhios.zhiying"
// versionCode 53
// dimension "app"
// versionName '1.3.13'
// // 签名信息
// signingConfig signingConfigs.zhiying
// }
// }
//
// // 打包脚本
// android.applicationVariants.all { variant ->
// if (variant.buildType.name != "debug") {
// variant.getPackageApplicationProvider().get().outputDirectory = new File(project.rootDir.absolutePath + "/app/build/outputs/apk")
@@ -136,18 +136,18 @@ android {
// }
// }
// }
//
// configurations.all {
// resolutionStrategy.eachDependency { DependencyResolveDetails details ->
// def requested = details.requested
// if (requested.group == 'com.android.support') {
// if (!requested.name.startsWith("multidex")) {
// details.useVersion '28.0.3'
// }
// }
// resolutionStrategy.force 'com.android.support:support-v4:28.0.0'
// }
// }
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (!requested.name.startsWith("multidex")) {
details.useVersion '28.0.3'
}
}
resolutionStrategy.force 'com.android.support:support-v4:28.0.0'
}
}


}


+ 7
- 2
example/android/app/src/main/java/cn/zhios/zhiying_base_widget_example/MainActivity.java Ver arquivo

@@ -162,8 +162,13 @@ public class MainActivity extends FlutterActivity implements ZhiyingFlutterCommN
// map.put("secret_key", "123456");

///正式
map.put("domain", "http://api.zhios.cn/");//45678910,api.zhios.cn84198689
map.put("master_id", "99813608");
// map.put("domain", "http://api.zhios.cn/");//45678910,api.zhios.cn84198689
// map.put("master_id", "99813608");
// map.put("secret_key", "123456");

//客户测试
map.put("domain", "http://api.zhiyingos.com/");//45678910,api.zhios.cn84198689
map.put("master_id", "80685217");
map.put("secret_key", "123456");

// map.put("token", "123465");


+ 1
- 0
lib/pages/custom_page/custom_item_page.dart Ver arquivo

@@ -166,6 +166,7 @@ class __CustomItemPageContainerState extends State<_CustomItemPageContainer> wit
header: RefreshGifHeader(),
// footer: RefreshFooter(),
child: CustomScrollView(
physics: BouncingScrollPhysics(),
controller: _controller,
slivers: _buildContentWidgets(model),
),


+ 13
- 7
lib/pages/guide_page/guide_page.dart Ver arquivo

@@ -59,15 +59,21 @@ class _GuidePageState extends State<GuidePage> {
height: double.infinity,
decoration: BoxDecoration(
image: DecorationImage(
image: Image.memory(
bgImage,
).image,
image: bgImage != null
? Image.memory(
bgImage,
).image
: CachedNetworkImageProvider(""),
fit: BoxFit.fill)),
child: Center(
child: Image.memory(
widget.imageDatas[index],
fit: BoxFit.fitWidth,
))),
child: widget.imageDatas[index] != null
? Image.memory(
widget.imageDatas[index],
fit: BoxFit.fitWidth,
)
: Container(
color: Colors.white,
))),
index == widget?.bgImageDatas?.length - 1
? Positioned(
left: 0,


+ 20
- 13
lib/pages/launch_page/launch_page.dart Ver arquivo

@@ -59,7 +59,6 @@ class _LaunchPageState extends State<LaunchPage> with TickerProviderStateMixin {
Logger.debug('ConnectivityResult.wifi');
print('ConnectivityResult.wifi');
Application.init().then((_) async {

///引导页
PackageInfo packageInfo = await PackageInfo.fromPlatform();
String versionNumber = await SharedPreferencesUtil.getStringValue(Constants.versionNumber);
@@ -76,7 +75,7 @@ class _LaunchPageState extends State<LaunchPage> with TickerProviderStateMixin {
// CupertinoPageRoute(builder: (context) => HomePage()));
Navigator.of(context).pushReplacementNamed('/homePage');
}
}).catchError((err,s) async {
}).catchError((err, s) async {
print(s);
// if (err.toString().contains("BaseSettingModel")) {
// await showDialog(
@@ -122,22 +121,30 @@ class _LaunchPageState extends State<LaunchPage> with TickerProviderStateMixin {
Dio dio = Dio();
print("加载图片");
List<Uint8List> guideImages = List();
List<Uint8List>bgImages = List();
List<Uint8List> bgImages = List();
for (int i = 0; i < guide.guideData.guideCss.length; i++) {
Response response = await dio.get(guide.guideData.guideCss[i].contentImage, options: Options(responseType: ResponseType.bytes));
if (response.statusCode == 200) {
Uint8List data = Uint8List.fromList(response.data);
guideImages.add(data);
try {
Response response = await dio.get(guide.guideData.guideCss[i].contentImage, options: Options(responseType: ResponseType.bytes));
if (response.statusCode == 200) {
Uint8List data = Uint8List.fromList(response.data);
guideImages.add(data);
}
} catch (e, s) {
guideImages.add(null);
}
response = await dio.get(guide.guideData.guideCss[i].bgImage, options: Options(responseType: ResponseType.bytes));
if (response.statusCode == 200) {
Uint8List data = Uint8List.fromList(response.data);
bgImages.add(data);

try {
Response response = await dio.get(guide.guideData.guideCss[i].bgImage, options: Options(responseType: ResponseType.bytes));
if (response.statusCode == 200) {
Uint8List data = Uint8List.fromList(response.data);
bgImages.add(data);
}
} catch (e, s) {
bgImages.add(null);
}
}

NativeUtil.notifyInitSuccess();
await Navigator.of(context).push(CupertinoPageRoute(builder: (context) => GuidePage(guide.guideData, guideImages,bgImages)));
await Navigator.of(context).push(CupertinoPageRoute(builder: (context) => GuidePage(guide.guideData, guideImages, bgImages)));
}
} catch (e) {
throw "引导图加载失败";


+ 1
- 1
pubspec.yaml Ver arquivo

@@ -59,6 +59,7 @@ dependencies:
flutter_user_agent: ^1.2.2



dev_dependencies:
flutter_test:
sdk: flutter
@@ -66,7 +67,6 @@ dev_dependencies:
zhiying_comm:
path: ../zhiying_comm


# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec



Carregando…
Cancelar
Salvar