Browse Source

1.修复页面无背景对像时报错问题

tags/0.0.4+1
“yanghuaxuan” 3 years ago
parent
commit
91bf717070
4 changed files with 36 additions and 31 deletions
  1. +27
    -27
      example/android/app/build.gradle
  2. +1
    -2
      lib/pages/custom_page/custom_page.dart
  3. +1
    -1
      lib/pages/main_page/main_page.dart
  4. +7
    -1
      lib/pages/main_page/main_page_bloc.dart

+ 27
- 27
example/android/app/build.gradle View File

@@ -108,33 +108,33 @@ android {




// 应用信息配置 // 应用信息配置
// productFlavors {
// // 智夜生活
// zhiying {
// applicationId "cn.zhios.zhiying"
// versionCode 28
// dimension "app"
// versionName '1.2.28'
// // 签名信息
// 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")
// }
//
// variant.outputs.all { output ->
// def outputFile = output.outputFile
// if (outputFile != null && outputFile.name.endsWith('.apk')) {
// //这里修改apk文件名
// def fileName = "${variant.productFlavors[0].name}_${releaseTime()}01_&V${variant.productFlavors[0].versionCode}.apk"
// outputFileName = fileName
// }
// }
// }
productFlavors {
// 智夜生活
zhiying {
applicationId "cn.zhios.zhiying"
versionCode 28
dimension "app"
versionName '1.2.28'
// 签名信息
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")
}
variant.outputs.all { output ->
def outputFile = output.outputFile
if (outputFile != null && outputFile.name.endsWith('.apk')) {
//这里修改apk文件名
def fileName = "${variant.productFlavors[0].name}_${releaseTime()}01_&V${variant.productFlavors[0].versionCode}.apk"
outputFileName = fileName
}
}
}


configurations.all { configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details -> resolutionStrategy.eachDependency { DependencyResolveDetails details ->


+ 1
- 2
lib/pages/custom_page/custom_page.dart View File

@@ -411,8 +411,7 @@ class __CommonPageContainerState extends State<_CommonPageContainer> with Single


///监听页面滚动 ///监听页面滚动
_listenScroller(double offset) { _listenScroller(double offset) {
print(offset.toString());
if (offset > 0) {
if (offset >= 0) {
backgroundTopMargin = -offset; backgroundTopMargin = -offset;
if (backgroundTopMargin > -500) { if (backgroundTopMargin > -500) {
backgroundBloc.streamController.add(""); backgroundBloc.streamController.add("");


+ 1
- 1
lib/pages/main_page/main_page.dart View File

@@ -218,7 +218,7 @@ class _MainPageContainerState extends State<_MainPageContainer> {
if (_bloc.backgroundModel != null) { if (_bloc.backgroundModel != null) {
var headerBg = _bloc.backgroundModel.headerBg; var headerBg = _bloc.backgroundModel.headerBg;
return Container( return Container(
height: double.tryParse(_bloc?.backgroundModel?.headerBg?.height)?? 0,
height: double.tryParse(_bloc?.backgroundModel?.headerBg?.height)?? 0,
decoration: BoxDecoration( decoration: BoxDecoration(
gradient: LinearGradient( gradient: LinearGradient(
begin: Alignment.topCenter, begin: Alignment.topCenter,


+ 7
- 1
lib/pages/main_page/main_page_bloc.dart View File

@@ -38,7 +38,13 @@ class MainPageBloc extends BlocBase {
_pageData = list.map((item) { _pageData = list.map((item) {
return Map<String, dynamic>.from(item); return Map<String, dynamic>.from(item);
}).toList(); }).toList();
backgroundModel=BackgroundModel.fromJson(Con.json.decode(json['out_data']));
try{
backgroundModel=BackgroundModel.fromJson(Con.json.decode(json['out_data']));
}catch(e,s){
print(e);
print(s);
}

_mainController.add(_pageData); _mainController.add(_pageData);
} }
} }

Loading…
Cancel
Save