From 1acc7150c0f624b811dbb18e8712305b33ef4f53 Mon Sep 17 00:00:00 2001 From: jiankian Date: Fri, 11 Feb 2022 09:32:50 +0800 Subject: [PATCH] upgrade to Flutter V2 --- .flutter-plugins-dependencies | 1 + android/app/build.gradle | 12 ++-- android/app/src/main/AndroidManifest.xml | 16 ++++- .../com/example/doubanapp/MainActivity.java | 10 +-- android/app/src/main/res/values/styles.xml | 12 +++- android/build.gradle | 6 +- android/gradle.properties | 2 + .../gradle/wrapper/gradle-wrapper.properties | 2 +- android/settings.gradle | 18 ++--- ios/Flutter/AppFrameworkInfo.plist | 2 +- ios/Flutter/Flutter.podspec | 18 +++++ ios/Flutter/flutter_export_environment.sh | 14 ++++ ios/Podfile | 61 +++++------------ ios/Runner.xcodeproj/project.pbxproj | 65 +++++-------------- .../contents.xcworkspacedata | 2 +- .../xcshareddata/xcschemes/Runner.xcscheme | 2 +- .../xcshareddata/WorkspaceSettings.xcsettings | 8 --- lib/demo/my_scroll_view.dart | 2 +- lib/demo/my_scrollable.dart | 7 +- lib/main.dart | 4 +- lib/pages/container_page.dart | 32 ++++----- lib/pages/detail/detail_page.dart | 8 +-- lib/pages/detail/long_comment_widget.dart | 2 +- lib/pages/douya_top_250_list_widget.dart | 4 +- lib/pages/group/group_page.dart | 6 +- lib/pages/home/home_app_bar.dart | 21 +++--- lib/pages/home/home_page.dart | 8 +-- lib/pages/home/my_home_tab_bar.dart | 4 +- lib/pages/movie/book_audio_video_page.dart | 4 +- lib/pages/movie/movie_app_bar.dart | 21 +++--- lib/pages/movie/movie_page.dart | 8 +-- lib/pages/movie/movie_page_new.dart | 6 +- lib/pages/movie/title_widget.dart | 10 +-- lib/pages/person_detail_page.dart | 4 +- lib/pages/photo_hero_page.dart | 2 +- lib/pages/search/search_page.dart | 6 +- lib/util/palette_generator.dart | 7 +- pubspec.yaml | 18 +++-- 38 files changed, 209 insertions(+), 226 deletions(-) create mode 100644 .flutter-plugins-dependencies create mode 100644 ios/Flutter/Flutter.podspec create mode 100755 ios/Flutter/flutter_export_environment.sh delete mode 100644 ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings diff --git a/.flutter-plugins-dependencies b/.flutter-plugins-dependencies new file mode 100644 index 0000000..34cdd59 --- /dev/null +++ b/.flutter-plugins-dependencies @@ -0,0 +1 @@ +{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"flutter_webview_plugin","path":"/Users/jiankian/.pub-cache/git/flutter_webview_plugin-2c1fd19f713750575dce6733f3c7c4651bece9dd/","dependencies":[]},{"name":"fluttertoast","path":"/Users/jiankian/.pub-cache/hosted/pub.dartlang.org/fluttertoast-8.0.8/","dependencies":[]},{"name":"path_provider_ios","path":"/Users/jiankian/.pub-cache/hosted/pub.dartlang.org/path_provider_ios-2.0.7/","dependencies":[]},{"name":"shared_preferences_ios","path":"/Users/jiankian/.pub-cache/hosted/pub.dartlang.org/shared_preferences_ios-2.0.10/","dependencies":[]},{"name":"sqflite","path":"/Users/jiankian/.pub-cache/hosted/pub.dartlang.org/sqflite-2.0.2/","dependencies":[]},{"name":"video_player_avfoundation","path":"/Users/jiankian/.pub-cache/hosted/pub.dartlang.org/video_player_avfoundation-2.2.18/","dependencies":[]},{"name":"webview_flutter_wkwebview","path":"/Users/jiankian/.pub-cache/hosted/pub.dartlang.org/webview_flutter_wkwebview-2.7.1/","dependencies":[]}],"android":[{"name":"flutter_webview_plugin","path":"/Users/jiankian/.pub-cache/git/flutter_webview_plugin-2c1fd19f713750575dce6733f3c7c4651bece9dd/","dependencies":[]},{"name":"fluttertoast","path":"/Users/jiankian/.pub-cache/hosted/pub.dartlang.org/fluttertoast-8.0.8/","dependencies":[]},{"name":"path_provider_android","path":"/Users/jiankian/.pub-cache/hosted/pub.dartlang.org/path_provider_android-2.0.11/","dependencies":[]},{"name":"shared_preferences_android","path":"/Users/jiankian/.pub-cache/hosted/pub.dartlang.org/shared_preferences_android-2.0.11/","dependencies":[]},{"name":"sqflite","path":"/Users/jiankian/.pub-cache/hosted/pub.dartlang.org/sqflite-2.0.2/","dependencies":[]},{"name":"video_player_android","path":"/Users/jiankian/.pub-cache/hosted/pub.dartlang.org/video_player_android-2.2.17/","dependencies":[]},{"name":"webview_flutter_android","path":"/Users/jiankian/.pub-cache/hosted/pub.dartlang.org/webview_flutter_android-2.8.2/","dependencies":[]}],"macos":[{"name":"path_provider_macos","path":"/Users/jiankian/.pub-cache/hosted/pub.dartlang.org/path_provider_macos-2.0.5/","dependencies":[]},{"name":"shared_preferences_macos","path":"/Users/jiankian/.pub-cache/hosted/pub.dartlang.org/shared_preferences_macos-2.0.3/","dependencies":[]},{"name":"sqflite","path":"/Users/jiankian/.pub-cache/hosted/pub.dartlang.org/sqflite-2.0.2/","dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"/Users/jiankian/.pub-cache/hosted/pub.dartlang.org/path_provider_linux-2.1.5/","dependencies":[]},{"name":"shared_preferences_linux","path":"/Users/jiankian/.pub-cache/hosted/pub.dartlang.org/shared_preferences_linux-2.1.0/","dependencies":["path_provider_linux"]}],"windows":[{"name":"path_provider_windows","path":"/Users/jiankian/.pub-cache/hosted/pub.dartlang.org/path_provider_windows-2.0.5/","dependencies":[]},{"name":"shared_preferences_windows","path":"/Users/jiankian/.pub-cache/hosted/pub.dartlang.org/shared_preferences_windows-2.1.0/","dependencies":["path_provider_windows"]}],"web":[{"name":"fluttertoast","path":"/Users/jiankian/.pub-cache/hosted/pub.dartlang.org/fluttertoast-8.0.8/","dependencies":[]},{"name":"shared_preferences_web","path":"/Users/jiankian/.pub-cache/hosted/pub.dartlang.org/shared_preferences_web-2.0.3/","dependencies":[]},{"name":"video_player_web","path":"/Users/jiankian/.pub-cache/hosted/pub.dartlang.org/video_player_web-2.0.6/","dependencies":[]}]},"dependencyGraph":[{"name":"flutter_webview_plugin","dependencies":[]},{"name":"fluttertoast","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_android","path_provider_ios","path_provider_linux","path_provider_macos","path_provider_windows"]},{"name":"path_provider_android","dependencies":[]},{"name":"path_provider_ios","dependencies":[]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_macos","dependencies":[]},{"name":"path_provider_windows","dependencies":[]},{"name":"shared_preferences","dependencies":["shared_preferences_android","shared_preferences_ios","shared_preferences_linux","shared_preferences_macos","shared_preferences_web","shared_preferences_windows"]},{"name":"shared_preferences_android","dependencies":[]},{"name":"shared_preferences_ios","dependencies":[]},{"name":"shared_preferences_linux","dependencies":["path_provider_linux"]},{"name":"shared_preferences_macos","dependencies":[]},{"name":"shared_preferences_web","dependencies":[]},{"name":"shared_preferences_windows","dependencies":["path_provider_windows"]},{"name":"sqflite","dependencies":[]},{"name":"video_player","dependencies":["video_player_android","video_player_avfoundation","video_player_web"]},{"name":"video_player_android","dependencies":[]},{"name":"video_player_avfoundation","dependencies":[]},{"name":"video_player_web","dependencies":[]},{"name":"webview_flutter","dependencies":["webview_flutter_android","webview_flutter_wkwebview"]},{"name":"webview_flutter_android","dependencies":[]},{"name":"webview_flutter_wkwebview","dependencies":[]}],"date_created":"2022-02-11 08:09:45.481676","version":"2.10.1"} \ No newline at end of file diff --git a/android/app/build.gradle b/android/app/build.gradle index e7c4d4c..eb6d149 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -25,17 +25,14 @@ apply plugin: 'com.android.application' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { - compileSdkVersion 28 + compileSdkVersion 31 - lintOptions { - disable 'InvalidPackage' - } defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "com.example.doubanapp" - minSdkVersion 16 - targetSdkVersion 28 + minSdkVersion 19 + targetSdkVersion 31 versionCode flutterVersionCode.toInteger() versionName flutterVersionName testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" @@ -48,6 +45,9 @@ android { signingConfig signingConfigs.debug } } + lint { + disable 'InvalidPackage' + } } flutter { diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 1525414..ae83f8d 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -12,12 +12,13 @@ + android:name="io.flutter.embedding.android.SplashScreenDrawable" + android:resource="@drawable/launch_background" /> + + + + diff --git a/android/app/src/main/java/com/example/doubanapp/MainActivity.java b/android/app/src/main/java/com/example/doubanapp/MainActivity.java index 574f09d..724b3bc 100644 --- a/android/app/src/main/java/com/example/doubanapp/MainActivity.java +++ b/android/app/src/main/java/com/example/doubanapp/MainActivity.java @@ -1,13 +1,7 @@ package com.example.doubanapp; -import android.os.Bundle; -import io.flutter.app.FlutterActivity; -import io.flutter.plugins.GeneratedPluginRegistrant; +import io.flutter.embedding.android.FlutterActivity; public class MainActivity extends FlutterActivity { - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - GeneratedPluginRegistrant.registerWith(this); - } + } diff --git a/android/app/src/main/res/values/styles.xml b/android/app/src/main/res/values/styles.xml index 00fa441..d460d1e 100644 --- a/android/app/src/main/res/values/styles.xml +++ b/android/app/src/main/res/values/styles.xml @@ -1,8 +1,18 @@ - + + diff --git a/android/build.gradle b/android/build.gradle index bb8a303..f2a747d 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,11 +1,15 @@ buildscript { + + ext.kotlin_version = '1.6.10' + repositories { google() jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:3.2.1' + classpath 'com.android.tools.build:gradle:7.1.1' + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } diff --git a/android/gradle.properties b/android/gradle.properties index 8bd86f6..4d3226a 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -1 +1,3 @@ org.gradle.jvmargs=-Xmx1536M +android.useAndroidX=true +android.enableJetifier=true \ No newline at end of file diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index 2819f02..595fb86 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip diff --git a/android/settings.gradle b/android/settings.gradle index 5a2f14f..44e62bc 100644 --- a/android/settings.gradle +++ b/android/settings.gradle @@ -1,15 +1,11 @@ include ':app' -def flutterProjectRoot = rootProject.projectDir.parentFile.toPath() +def localPropertiesFile = new File(rootProject.projectDir, "local.properties") +def properties = new Properties() -def plugins = new Properties() -def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins') -if (pluginsFile.exists()) { - pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) } -} +assert localPropertiesFile.exists() +localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } -plugins.each { name, path -> - def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile() - include ":$name" - project(":$name").projectDir = pluginDirectory -} +def flutterSdkPath = properties.getProperty("flutter.sdk") +assert flutterSdkPath != null, "flutter.sdk not set in local.properties" +apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" diff --git a/ios/Flutter/AppFrameworkInfo.plist b/ios/Flutter/AppFrameworkInfo.plist index 9367d48..8d4492f 100644 --- a/ios/Flutter/AppFrameworkInfo.plist +++ b/ios/Flutter/AppFrameworkInfo.plist @@ -21,6 +21,6 @@ CFBundleVersion 1.0 MinimumOSVersion - 8.0 + 9.0 diff --git a/ios/Flutter/Flutter.podspec b/ios/Flutter/Flutter.podspec new file mode 100644 index 0000000..663d5b2 --- /dev/null +++ b/ios/Flutter/Flutter.podspec @@ -0,0 +1,18 @@ +# +# NOTE: This podspec is NOT to be published. It is only used as a local source! +# This is a generated file; do not edit or check into version control. +# + +Pod::Spec.new do |s| + s.name = 'Flutter' + s.version = '1.0.0' + s.summary = 'High-performance, high-fidelity mobile apps.' + s.homepage = 'https://flutter.io' + s.license = { :type => 'MIT' } + s.author = { 'Flutter Dev Team' => 'flutter-dev@googlegroups.com' } + s.source = { :git => 'https://github.com/flutter/engine', :tag => s.version.to_s } + s.ios.deployment_target = '9.0' + # Framework linking is handled by Flutter tooling, not CocoaPods. + # Add a placeholder to satisfy `s.dependency 'Flutter'` plugin podspecs. + s.vendored_frameworks = 'path/to/nothing' +end diff --git a/ios/Flutter/flutter_export_environment.sh b/ios/Flutter/flutter_export_environment.sh new file mode 100755 index 0000000..c534707 --- /dev/null +++ b/ios/Flutter/flutter_export_environment.sh @@ -0,0 +1,14 @@ +#!/bin/sh +# This is a generated file; do not edit or check into version control. +export "FLUTTER_ROOT=/Users/jiankian/Developer/flutter" +export "FLUTTER_APPLICATION_PATH=/Users/jiankian/FlutterProjects/FlutterDouBan" +export "COCOAPODS_PARALLEL_CODE_SIGN=true" +export "FLUTTER_TARGET=/Users/jiankian/FlutterProjects/FlutterDouBan/lib/main.dart" +export "FLUTTER_BUILD_DIR=build" +export "FLUTTER_BUILD_NAME=1.0.0" +export "FLUTTER_BUILD_NUMBER=1" +export "DART_DEFINES=Zmx1dHRlci5pbnNwZWN0b3Iuc3RydWN0dXJlZEVycm9ycz10cnVl,RkxVVFRFUl9XRUJfQVVUT19ERVRFQ1Q9dHJ1ZQ==" +export "DART_OBFUSCATION=false" +export "TRACK_WIDGET_CREATION=true" +export "TREE_SHAKE_ICONS=false" +export "PACKAGE_CONFIG=/Users/jiankian/FlutterProjects/FlutterDouBan/.dart_tool/package_config.json" diff --git a/ios/Podfile b/ios/Podfile index d077b08..f7d6a5e 100644 --- a/ios/Podfile +++ b/ios/Podfile @@ -10,60 +10,29 @@ project 'Runner', { 'Release' => :release, } -def parse_KV_file(file, separator='=') - file_abs_path = File.expand_path(file) - if !File.exists? file_abs_path - return []; +def flutter_root + generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) + unless File.exist?(generated_xcode_build_settings_path) + raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" end - pods_ary = [] - skip_line_start_symbols = ["#", "/"] - File.foreach(file_abs_path) { |line| - next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ } - plugin = line.split(pattern=separator) - if plugin.length == 2 - podname = plugin[0].strip() - path = plugin[1].strip() - podpath = File.expand_path("#{path}", file_abs_path) - pods_ary.push({:name => podname, :path => podpath}); - else - puts "Invalid plugin specification: #{line}" - end - } - return pods_ary + + File.foreach(generated_xcode_build_settings_path) do |line| + matches = line.match(/FLUTTER_ROOT\=(.*)/) + return matches[1].strip if matches + end + raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" end -target 'Runner' do - # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock - # referring to absolute paths on developers' machines. - system('rm -rf .symlinks') - system('mkdir -p .symlinks/plugins') +require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) - # Flutter Pods - generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig') - if generated_xcode_build_settings.empty? - puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter packages get is executed first." - end - generated_xcode_build_settings.map { |p| - if p[:name] == 'FLUTTER_FRAMEWORK_DIR' - symlink = File.join('.symlinks', 'flutter') - File.symlink(File.dirname(p[:path]), symlink) - pod 'Flutter', :path => File.join(symlink, File.basename(p[:path])) - end - } +flutter_ios_podfile_setup - # Plugin Pods - plugin_pods = parse_KV_file('../.flutter-plugins') - plugin_pods.map { |p| - symlink = File.join('.symlinks', 'plugins', p[:name]) - File.symlink(p[:path], symlink) - pod p[:name], :path => File.join(symlink, 'ios') - } +target 'Runner' do + flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) end post_install do |installer| installer.pods_project.targets.each do |target| - target.build_configurations.each do |config| - config.build_settings['ENABLE_BITCODE'] = 'NO' - end + flutter_additional_ios_build_settings(target) end end diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index ecf69cc..0fb01cc 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -3,16 +3,12 @@ archiveVersion = 1; classes = { }; - objectVersion = 46; + objectVersion = 50; objects = { /* Begin PBXBuildFile section */ 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; - 3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; }; - 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; }; - 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; }; 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; }; 97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; }; @@ -29,8 +25,6 @@ dstPath = ""; dstSubfolderSpec = 10; files = ( - 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */, - 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */, ); name = "Embed Frameworks"; runOnlyForDeploymentPostprocessing = 0; @@ -41,14 +35,12 @@ 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; - 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; }; 5D6E35B6F4F5583377BF139E /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; - 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = ""; }; 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 97C146F21CF9000F007C117D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; @@ -65,8 +57,6 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */, - 3B80C3941E831B6300D905FE /* App.framework in Frameworks */, CFFBC44147880970969C2082 /* libPods-Runner.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -95,9 +85,7 @@ 9740EEB11CF90186004384FC /* Flutter */ = { isa = PBXGroup; children = ( - 3B80C3931E831B6300D905FE /* App.framework */, 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, - 9740EEBA1CF902C7004384FC /* Flutter.framework */, 9740EEB21CF90195004384FC /* Debug.xcconfig */, 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 9740EEB31CF90195004384FC /* Generated.xcconfig */, @@ -162,7 +150,6 @@ 97C146EC1CF9000F007C117D /* Resources */, 9705A1C41CF9048500538489 /* Embed Frameworks */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */, - DEFC3506D917473443EE6764 /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -179,7 +166,7 @@ 97C146E61CF9000F007C117D /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0910; + LastUpgradeCheck = 1300; ORGANIZATIONNAME = "The Chromium Authors"; TargetAttributes = { 97C146ED1CF9000F007C117D = { @@ -234,7 +221,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin"; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; }; 9740EEB61CF901F6004384FC /* Run Script */ = { isa = PBXShellScriptBuildPhase; @@ -272,28 +259,6 @@ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; - DEFC3506D917473443EE6764 /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh", - "${PODS_ROOT}/../.symlinks/flutter/ios/Flutter.framework", - ); - name = "[CP] Embed Pods Frameworks"; - outputFileListPaths = ( - ); - outputPaths = ( - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Flutter.framework", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ @@ -331,7 +296,6 @@ /* Begin XCBuildConfiguration section */ 249021D3217E4FDB00AE95B9 /* Profile */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; @@ -369,7 +333,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; @@ -390,7 +354,10 @@ "$(PROJECT_DIR)/Flutter", ); INFOPLIST_FILE = Runner/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); LIBRARY_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/Flutter", @@ -403,7 +370,6 @@ }; 97C147031CF9000F007C117D /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; @@ -447,7 +413,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -457,7 +423,6 @@ }; 97C147041CF9000F007C117D /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; @@ -495,7 +460,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; @@ -516,7 +481,10 @@ "$(PROJECT_DIR)/Flutter", ); INFOPLIST_FILE = Runner/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); LIBRARY_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/Flutter", @@ -540,7 +508,10 @@ "$(PROJECT_DIR)/Flutter", ); INFOPLIST_FILE = Runner/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); LIBRARY_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/Flutter", diff --git a/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata index 1d526a1..919434a 100644 --- a/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ b/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -2,6 +2,6 @@ + location = "self:"> diff --git a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index 786d6aa..f156018 100644 --- a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -1,6 +1,6 @@ - - - - BuildSystemType - Original - - diff --git a/lib/demo/my_scroll_view.dart b/lib/demo/my_scroll_view.dart index 7c49888..c167482 100644 --- a/lib/demo/my_scroll_view.dart +++ b/lib/demo/my_scroll_view.dart @@ -471,7 +471,7 @@ abstract class BoxScrollView extends ScrollView { Widget sliver = buildChildLayout(context); EdgeInsetsGeometry effectivePadding = padding; if (padding == null) { - final MediaQueryData mediaQuery = MediaQuery.of(context, nullOk: true); + final MediaQueryData mediaQuery = MediaQuery.maybeOf(context); if (mediaQuery != null) { // Automatically pad sliver with padding from MediaQuery. final EdgeInsets mediaQueryHorizontalPadding = diff --git a/lib/demo/my_scrollable.dart b/lib/demo/my_scrollable.dart index 19c7df0..2357829 100644 --- a/lib/demo/my_scrollable.dart +++ b/lib/demo/my_scrollable.dart @@ -196,7 +196,7 @@ class Scrollable extends StatefulWidget { /// ``` static ScrollableState of(BuildContext context) { final _ScrollableScope widget = - context.inheritFromWidgetOfExactType(_ScrollableScope); + context.dependOnInheritedWidgetOfExactType<_ScrollableScope>(); return widget?.scrollable; } @@ -567,6 +567,11 @@ class ScrollableState extends State super.debugFillProperties(properties); properties.add(DiagnosticsProperty('position', position)); } + + @override + void saveOffset(double offset) { + // TODO: implement saveOffset + } } /// With [_ScrollSemantics] certain child [SemanticsNode]s can be diff --git a/lib/main.dart b/lib/main.dart index fe91308..78b5b8c 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -23,7 +23,7 @@ class MyApp extends StatelessWidget { child: MaterialApp( theme: ThemeData(backgroundColor: Colors.white), home: Scaffold( - resizeToAvoidBottomPadding: false, + resizeToAvoidBottomInset: false, body: SplashWidget(), ), ), @@ -42,7 +42,7 @@ class RestartWidget extends StatefulWidget { static restartApp(BuildContext context) { final _RestartWidgetState state = - context.ancestorStateOfType(const TypeMatcher<_RestartWidgetState>()); + context.findAncestorStateOfType<_RestartWidgetState>(); state.restartApp(); } diff --git a/lib/pages/container_page.dart b/lib/pages/container_page.dart index 57ca57e..a86593c 100644 --- a/lib/pages/container_page.dart +++ b/lib/pages/container_page.dart @@ -5,7 +5,6 @@ import 'package:doubanapp/pages/home/home_page.dart'; import 'package:doubanapp/pages/person/person_center_page.dart'; import 'package:doubanapp/pages/shop_page.dart'; - ///这个页面是作为整个APP的最外层的容器,以Tab为基础控制每个item的显示与隐藏 class ContainerPage extends StatefulWidget { ContainerPage({Key key}) : super(key: key); @@ -23,7 +22,7 @@ class _Item { } class _ContainerPageState extends State { - final ShopPageWidget shopPageWidget = ShopPageWidget(); + final ShopPageWidget shopPageWidget = ShopPageWidget(); List pages; final defaultItemColor = Color.fromARGB(255, 125, 125, 125); @@ -47,7 +46,7 @@ class _ContainerPageState extends State { void initState() { super.initState(); print('initState _ContainerPageState'); - if(pages == null){ + if (pages == null) { pages = [ HomePage(), BookAudioVideoPage(), @@ -56,26 +55,21 @@ class _ContainerPageState extends State { PersonCenterPage() ]; } - if(itemList == null){ + if (itemList == null) { itemList = itemNames .map((item) => BottomNavigationBarItem( - icon: Image.asset( - item.normalIcon, - width: 30.0, - height: 30.0, - ), - title: Text( - item.name, - style: TextStyle(fontSize: 10.0), - ), - activeIcon: - Image.asset(item.activeIcon, width: 30.0, height: 30.0))) + icon: Image.asset( + item.normalIcon, + width: 30.0, + height: 30.0, + ), + label: item.name, + activeIcon: + Image.asset(item.activeIcon, width: 30.0, height: 30.0))) .toList(); } - } - int _selectIndex = 0; //Stack(层叠布局)+Offstage组合,解决状态被重置的问题 @@ -89,7 +83,6 @@ class _ContainerPageState extends State { ); } - @override void didUpdateWidget(ContainerPage oldWidget) { super.didUpdateWidget(oldWidget); @@ -138,7 +131,8 @@ class _ContainerPageState extends State { setState(() { _selectIndex = index; //这个是用来控制比较特别的shopPage中WebView不能动态隐藏的问题 - shopPageWidget.setShowState(pages.indexOf(shopPageWidget) == _selectIndex); + shopPageWidget + .setShowState(pages.indexOf(shopPageWidget) == _selectIndex); }); }, //图标大小 diff --git a/lib/pages/detail/detail_page.dart b/lib/pages/detail/detail_page.dart index d394606..3005a7a 100644 --- a/lib/pages/detail/detail_page.dart +++ b/lib/pages/detail/detail_page.dart @@ -11,7 +11,7 @@ import 'package:doubanapp/pages/detail/score_start.dart'; import 'package:doubanapp/pages/detail/look_confirm_button.dart'; import 'dart:math' as math; //import 'package:doubanapp/widgets/image/cached_network_image.dart'; -import 'package:doubanapp/router.dart'; +import 'package:doubanapp/router.dart' as _R; import 'package:doubanapp/widgets/item_count_title.dart'; import 'package:doubanapp/bean/comments_entity.dart'; import 'package:doubanapp/widgets/rating_bar.dart'; @@ -247,7 +247,7 @@ class _DetailPageState extends State { ], ), onTap: () { - Router.push(context, Router.personDetailPage, + _R.Router.push(context, _R.Router.personDetailPage, {'personImgUrl': imgUrl, 'id': id}); }, ), @@ -327,7 +327,7 @@ class _DetailPageState extends State { ), ), onTap: () { - Router.push(context, Router.playListPage, + _R.Router.push(context, _R.Router.playListPage, _movieDetailBean.trailers); }, ); @@ -493,7 +493,7 @@ class _DetailPageState extends State { padding: EdgeInsets.all(12.0), ), onTap: () { - Router.push(context, bean.author.alt, {'title': '个人主页'}); + _R.Router.push(context, bean.author.alt, {'title': '个人主页'}); }, ); } diff --git a/lib/pages/detail/long_comment_widget.dart b/lib/pages/detail/long_comment_widget.dart index a9babc3..e2f1ae6 100644 --- a/lib/pages/detail/long_comment_widget.dart +++ b/lib/pages/detail/long_comment_widget.dart @@ -2,7 +2,7 @@ import 'package:flutter/material.dart'; import '../../bean/movie_long_comments_entity.dart'; import '../../widgets/rating_bar.dart'; import '../../constant/constant.dart'; -import 'package:doubanapp/router.dart'; +import 'package:doubanapp/router.dart' as _R; import 'package:flutter_webview_plugin/flutter_webview_plugin.dart'; ///电影长评论 diff --git a/lib/pages/douya_top_250_list_widget.dart b/lib/pages/douya_top_250_list_widget.dart index e166e69..4935c50 100644 --- a/lib/pages/douya_top_250_list_widget.dart +++ b/lib/pages/douya_top_250_list_widget.dart @@ -1,7 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; import 'package:doubanapp/http/API.dart'; -import 'package:doubanapp/router.dart'; +import 'package:doubanapp/router.dart' as _Router; import 'package:doubanapp/bean/subject_entity.dart'; class DouBanListView extends StatefulWidget { @@ -68,7 +68,7 @@ class DouBanState extends State ), onTap: () { //监听点击事件 - Router.push(context, Router.detailPage, bean.id); + _Router.Router.push(context, _Router.Router.detailPage, bean.id); }, ); }); diff --git a/lib/pages/group/group_page.dart b/lib/pages/group/group_page.dart index 1cac3cc..3995a62 100644 --- a/lib/pages/group/group_page.dart +++ b/lib/pages/group/group_page.dart @@ -1,6 +1,6 @@ import 'package:flutter/material.dart'; import 'package:doubanapp/widgets/search_text_field_widget.dart'; -import 'package:doubanapp/router.dart'; +import 'package:doubanapp/router.dart' as _R; import 'package:doubanapp/constant/constant.dart'; import 'package:doubanapp/http/API.dart'; import 'package:doubanapp/http/http_request.dart'; @@ -21,7 +21,7 @@ class GroupPage extends StatelessWidget { margin: EdgeInsets.all(Constant.MARGIN_RIGHT), hintText: hintText, onTab: () { - Router.push(context, Router.searchPage, hintText); + _R.Router.push(context, _R.Router.searchPage, hintText); }, ), Expanded( @@ -133,7 +133,7 @@ class _GroupWidgetState extends State<_GroupWidget> { ], ), onTap: () { - Router.push(context, Router.detailPage, bean.id); + _R.Router.push(context, _R.Router.detailPage, bean.id); }, ); } diff --git a/lib/pages/home/home_app_bar.dart b/lib/pages/home/home_app_bar.dart index 26d263a..3b1c737 100644 --- a/lib/pages/home/home_app_bar.dart +++ b/lib/pages/home/home_app_bar.dart @@ -379,7 +379,7 @@ class _AppBarState extends State { assert(debugCheckHasMaterialLocalizations(context)); final ThemeData themeData = Theme.of(context); final AppBarTheme appBarTheme = AppBarTheme.of(context); - final ScaffoldState scaffold = Scaffold.of(context, nullOk: true); + final ScaffoldState scaffold = Scaffold.maybeOf(context); final ModalRoute parentRoute = ModalRoute.of(context); final bool hasDrawer = scaffold?.hasDrawer ?? false; @@ -390,12 +390,12 @@ class _AppBarState extends State { IconThemeData appBarIconTheme = widget.iconTheme ?? appBarTheme.iconTheme ?? themeData.primaryIconTheme; - TextStyle centerStyle = widget.textTheme?.title ?? - appBarTheme.textTheme?.title ?? - themeData.primaryTextTheme.title; - TextStyle sideStyle = widget.textTheme?.body1 ?? - appBarTheme.textTheme?.body1 ?? - themeData.primaryTextTheme.body1; + TextStyle centerStyle = widget.textTheme?.titleLarge ?? + appBarTheme.textTheme?.titleLarge ?? + themeData.primaryTextTheme.titleLarge; + TextStyle sideStyle = widget.textTheme?.bodyText1 ?? + appBarTheme.textTheme?.bodyText1 ?? + themeData.primaryTextTheme.bodyText1; if (widget.toolbarOpacity != 1.0) { final double opacity = @@ -560,8 +560,8 @@ class _FloatingAppBarState extends State<_FloatingAppBar> { } RenderSliverFloatingPersistentHeader _headerRenderer() { - return context.ancestorRenderObjectOfType( - const TypeMatcher()); + return context.findAncestorRenderObjectOfType( + ); } void _isScrollingListener() { @@ -1106,7 +1106,6 @@ class _SliverAppBarState extends State void _updateSnapConfiguration() { if (widget.snap && widget.floating) { _snapConfiguration = FloatingHeaderSnapConfiguration( - vsync: this, curve: Curves.easeOut, duration: const Duration(milliseconds: 200), ); @@ -1192,7 +1191,7 @@ getWidget() { // This is not necessary if the "headerSliverBuilder" only builds // widgets that do not overlap the next sliver. handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context), - child: SliverAppBar( + sliver: SliverAppBar( pinned: true, expandedHeight: 100.0, primary: false, diff --git a/lib/pages/home/home_page.dart b/lib/pages/home/home_page.dart index 117e79f..e4e4372 100644 --- a/lib/pages/home/home_page.dart +++ b/lib/pages/home/home_page.dart @@ -8,7 +8,7 @@ import 'package:doubanapp/bean/subject_entity.dart'; import 'package:doubanapp/widgets/image/radius_img.dart'; import 'package:doubanapp/constant/constant.dart'; import 'package:doubanapp/widgets/video_widget.dart'; -import 'package:doubanapp/router.dart'; +import 'package:doubanapp/router.dart' as _R; ///首页,TAB页面,显示动态和推荐TAB class HomePage extends StatelessWidget { @@ -38,7 +38,7 @@ DefaultTabController getWidget() { // This is not necessary if the "headerSliverBuilder" only builds // widgets that do not overlap the next sliver. handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context), - child: myapp.SliverAppBar( + sliver: myapp.SliverAppBar( pinned: true, expandedHeight: 120.0, primary: true, @@ -52,7 +52,7 @@ DefaultTabController getWidget() { hintText: '影视作品中你难忘的离别', margin: const EdgeInsets.only(left: 15.0, right: 15.0), onTab: () { - Router.push(context, Router.searchPage, '影视作品中你难忘的离别'); + _R.Router.push(context, _R.Router.searchPage, '影视作品中你难忘的离别'); }, ), alignment: Alignment(0.0, 0.0), @@ -328,7 +328,7 @@ _loginContainer(BuildContext context) { borderRadius: const BorderRadius.all(Radius.circular(6.0))), ), onTap: () { - Router.push(context, Router.searchPage, '搜索笨啦灯'); + _R.Router.push(context, _R.Router.searchPage, '搜索笨啦灯'); }, ) ], diff --git a/lib/pages/home/my_home_tab_bar.dart b/lib/pages/home/my_home_tab_bar.dart index 41f5c97..7dae13a 100644 --- a/lib/pages/home/my_home_tab_bar.dart +++ b/lib/pages/home/my_home_tab_bar.dart @@ -1,7 +1,7 @@ import 'package:flutter/material.dart'; import 'package:doubanapp/widgets/search_text_field_widget.dart'; import 'package:doubanapp/util/screen_utils.dart'; -import 'package:doubanapp/router.dart'; +import 'package:doubanapp/router.dart' as _R; const double _kTabHeight = 46.0; const double _kTextAndIconTabHeight = 42.0; @@ -68,7 +68,7 @@ class _HomeTabBarState extends State { ), ), onTap: () { - Router.push(context, Router.searchPage, '搜索流浪地球试一试'); + _R.Router.push(context, _R.Router.searchPage, '搜索流浪地球试一试'); }, ), ) diff --git a/lib/pages/movie/book_audio_video_page.dart b/lib/pages/movie/book_audio_video_page.dart index 013c3d8..b8aca41 100644 --- a/lib/pages/movie/book_audio_video_page.dart +++ b/lib/pages/movie/book_audio_video_page.dart @@ -3,7 +3,7 @@ import 'package:flutter/rendering.dart'; import 'dart:math' as math; import 'package:doubanapp/widgets/my_tab_bar_widget.dart'; import 'package:doubanapp/widgets/search_text_field_widget.dart'; -import 'package:doubanapp/router.dart'; +import 'package:doubanapp/router.dart' as _R; var titleList = ['电影', '电视', '综艺', '读书', '音乐', '同城']; @@ -66,7 +66,7 @@ Widget _getNestedScrollView(Widget tabBar) { child: SearchTextFieldWidget( hintText: hintText, onTab: () { - Router.push(context, Router.searchPage, hintText); + _R.Router.push(context, _R.Router.searchPage, hintText); }, ), ), diff --git a/lib/pages/movie/movie_app_bar.dart b/lib/pages/movie/movie_app_bar.dart index 68146cf..7da23cd 100644 --- a/lib/pages/movie/movie_app_bar.dart +++ b/lib/pages/movie/movie_app_bar.dart @@ -378,7 +378,7 @@ class _AppBarState extends State { assert(debugCheckHasMaterialLocalizations(context)); final ThemeData themeData = Theme.of(context); final AppBarTheme appBarTheme = AppBarTheme.of(context); - final ScaffoldState scaffold = Scaffold.of(context, nullOk: true); + final ScaffoldState scaffold = Scaffold.maybeOf(context); final ModalRoute parentRoute = ModalRoute.of(context); final bool hasDrawer = scaffold?.hasDrawer ?? false; @@ -389,12 +389,12 @@ class _AppBarState extends State { IconThemeData appBarIconTheme = widget.iconTheme ?? appBarTheme.iconTheme ?? themeData.primaryIconTheme; - TextStyle centerStyle = widget.textTheme?.title ?? - appBarTheme.textTheme?.title ?? - themeData.primaryTextTheme.title; - TextStyle sideStyle = widget.textTheme?.body1 ?? - appBarTheme.textTheme?.body1 ?? - themeData.primaryTextTheme.body1; + TextStyle centerStyle = widget.textTheme?.titleLarge ?? + appBarTheme.textTheme?.titleLarge ?? + themeData.primaryTextTheme.titleLarge; + TextStyle sideStyle = widget.textTheme?.bodyText1 ?? + appBarTheme.textTheme?.bodyText1 ?? + themeData.primaryTextTheme.bodyText1; if (widget.toolbarOpacity != 1.0) { final double opacity = @@ -559,8 +559,8 @@ class _FloatingAppBarState extends State<_FloatingAppBar> { } RenderSliverFloatingPersistentHeader _headerRenderer() { - return context.ancestorRenderObjectOfType( - const TypeMatcher()); + return context.findAncestorRenderObjectOfType( + ); } void _isScrollingListener() { @@ -1106,7 +1106,6 @@ class _SliverAppBarState extends State void _updateSnapConfiguration() { if (widget.snap && widget.floating) { _snapConfiguration = FloatingHeaderSnapConfiguration( - vsync: this, curve: Curves.easeOut, duration: const Duration(milliseconds: 200), ); @@ -1192,7 +1191,7 @@ getWidget() { // This is not necessary if the "headerSliverBuilder" only builds // widgets that do not overlap the next sliver. handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context), - child: SliverAppBar( + sliver: SliverAppBar( pinned: true, expandedHeight: 100.0, primary: false, diff --git a/lib/pages/movie/movie_page.dart b/lib/pages/movie/movie_page.dart index 2fea994..ab1f94d 100644 --- a/lib/pages/movie/movie_page.dart +++ b/lib/pages/movie/movie_page.dart @@ -13,7 +13,7 @@ import 'dart:math' as math; import 'package:doubanapp/widgets/image/cache_img_radius.dart'; import 'package:doubanapp/constant/constant.dart'; import 'package:doubanapp/pages/movie/top_item_widget.dart'; -import 'package:doubanapp/router.dart'; +import 'package:doubanapp/router.dart' as _R; import 'package:doubanapp/http/http_request.dart'; //import 'package:palette_generator/palette_generator.dart'; import 'package:flutter/rendering.dart'; @@ -160,7 +160,7 @@ class _MoviePageState extends State with AutomaticKeepAliveClientMix ), ), onTap: () { - Router.push(context, Router.detailPage, comingSoonBean.id); + _R.Router.push(context, _R.Router.detailPage, comingSoonBean.id); }, ); } @@ -205,7 +205,7 @@ class _MoviePageState extends State with AutomaticKeepAliveClientMix ), ), onTap: () { - Router.push(context, Router.detailPage, hotMovieBean.id); + _R.Router.push(context, _R.Router.detailPage, hotMovieBean.id); }, ); } @@ -338,7 +338,7 @@ class _MoviePageState extends State with AutomaticKeepAliveClientMix mainAxisSpacing: 0.0, childAspectRatio: _getRadio())), getCommonImg(Constant.IMG_TMP1, (){ - Router.pushNoParams(context, "http://www.flutterall.com"); + _R.Router.pushNoParams(context, "http://www.flutterall.com"); }), SliverToBoxAdapter( child: Padding( diff --git a/lib/pages/movie/movie_page_new.dart b/lib/pages/movie/movie_page_new.dart index fab6ddf..865e1fb 100644 --- a/lib/pages/movie/movie_page_new.dart +++ b/lib/pages/movie/movie_page_new.dart @@ -13,7 +13,7 @@ import 'dart:math' as math; import 'package:doubanapp/widgets/image/cache_img_radius.dart'; import 'package:doubanapp/constant/constant.dart'; import 'package:doubanapp/pages/movie/top_item_widget.dart'; -import 'package:doubanapp/router.dart'; +import 'package:doubanapp/router.dart' as _R; import 'package:doubanapp/http/http_request.dart'; //import 'package:palette_generator/palette_generator.dart'; import 'package:flutter/rendering.dart'; @@ -314,7 +314,7 @@ class _HotComingSoonWidgetState extends State<_HotComingSoonWidget> { ), ), onTap: () { - Router.push(context, Router.detailPage, comingSoonBean.id); + _R.Router.push(context, _R.Router.detailPage, comingSoonBean.id); }, ); } @@ -359,7 +359,7 @@ class _HotComingSoonWidgetState extends State<_HotComingSoonWidget> { ), ), onTap: () { - Router.push(context, Router.detailPage, hotMovieBean.id); + _R.Router.push(context, _R.Router.detailPage, hotMovieBean.id); }, ); } diff --git a/lib/pages/movie/title_widget.dart b/lib/pages/movie/title_widget.dart index 2bd3b46..e91af1c 100644 --- a/lib/pages/movie/title_widget.dart +++ b/lib/pages/movie/title_widget.dart @@ -1,5 +1,5 @@ import 'package:flutter/material.dart'; -import 'package:doubanapp/router.dart'; +import 'package:doubanapp/router.dart' as _R; typedef TapCallback = void Function(); ///《书影业》顶部四个TAB @@ -14,7 +14,7 @@ class TitleWidget extends StatelessWidget { 'assets/images/find_movie.png', tabCallBack: () { print('点击找电影'); - Router.push(context, Router.searchPage, '找电影'); + _R.Router.push(context, _R.Router.searchPage, '找电影'); }, ), _TextImgWidget( @@ -22,21 +22,21 @@ class TitleWidget extends StatelessWidget { 'assets/images/douban_top.png', tabCallBack: () { print('点击豆瓣榜单'); - Router.push(context, Router.searchPage, '豆瓣榜单'); + _R.Router.push(context, _R.Router.searchPage, '豆瓣榜单'); }, ), _TextImgWidget( '豆瓣猜', 'assets/images/douban_guess.png', tabCallBack: () { - Router.push(context, Router.searchPage, '豆瓣猜'); + _R.Router.push(context, _R.Router.searchPage, '豆瓣猜'); }, ), _TextImgWidget( '豆瓣片单', 'assets/images/douban_film_list.png', tabCallBack: () { - Router.push(context, Router.searchPage, '豆瓣片单'); + _R.Router.push(context, _R.Router.searchPage, '豆瓣片单'); }, ) ], diff --git a/lib/pages/person_detail_page.dart b/lib/pages/person_detail_page.dart index 0523d5e..4b66913 100644 --- a/lib/pages/person_detail_page.dart +++ b/lib/pages/person_detail_page.dart @@ -1,7 +1,7 @@ import 'package:doubanapp/bean/celebrity_work_entity.dart'; import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; -import 'package:doubanapp/router.dart'; +import 'package:doubanapp/router.dart' as _R; import 'package:doubanapp/http/API.dart'; import 'package:doubanapp/bean/celebrity_entity.dart'; import 'package:doubanapp/widgets/title_bar.dart'; @@ -227,7 +227,7 @@ class _PersonDetailPageState extends State { ), ), onTap: () { - Router.push(context, Router.detailPage, bean.id); + _R.Router.push(context, _R.Router.detailPage, bean.id); }, ); } diff --git a/lib/pages/photo_hero_page.dart b/lib/pages/photo_hero_page.dart index fd3b2a4..2d870dd 100644 --- a/lib/pages/photo_hero_page.dart +++ b/lib/pages/photo_hero_page.dart @@ -1,6 +1,6 @@ import 'package:flutter/material.dart'; import 'package:doubanapp/widgets/title_bar.dart'; -import 'package:doubanapp/router.dart'; +import 'package:doubanapp/router.dart' as _R; class PhotoHeroPage extends StatelessWidget { final String photoUrl; diff --git a/lib/pages/search/search_page.dart b/lib/pages/search/search_page.dart index 95dfcb6..aa378d6 100644 --- a/lib/pages/search/search_page.dart +++ b/lib/pages/search/search_page.dart @@ -3,7 +3,7 @@ import 'package:doubanapp/widgets/search_text_field_widget.dart'; import 'package:doubanapp/http/API.dart'; import 'package:doubanapp/bean/search_result_entity.dart'; //import 'package:doubanapp/widgets/image/cached_network_image.dart'; -import 'package:doubanapp/router.dart'; +import 'package:doubanapp/router.dart' as _R; import 'package:flutter/cupertino.dart'; ///搜索 @@ -57,8 +57,8 @@ class _SearchPageState extends State { behavior: HitTestBehavior.translucent, child: _getItem(bean, index), onTap: () { - Router.push( - context, Router.detailPage, bean.id); + _R.Router.push( + context, _R.Router.detailPage, bean.id); }, ), ); diff --git a/lib/util/palette_generator.dart b/lib/util/palette_generator.dart index b17e2bd..66790ad 100644 --- a/lib/util/palette_generator.dart +++ b/lib/util/palette_generator.dart @@ -11,6 +11,7 @@ import 'dart:ui' show Color; import 'package:collection/collection.dart' show PriorityQueue, HeapPriorityQueue; import 'package:flutter/foundation.dart'; +import 'package:flutter/foundation.dart'; import 'package:flutter/painting.dart'; /// A class to extract prominent colors from an image for use as user interface @@ -58,7 +59,7 @@ import 'package:flutter/painting.dart'; /// * [PaletteTarget], to be able to create your own target color types. /// * [PaletteFilter], a function signature for filtering the allowed colors /// in the palette. -class PaletteGenerator extends Diagnosticable { +class PaletteGenerator extends Object with Diagnosticable { /// Create a [PaletteGenerator] from a set of paletteColors and targets. /// /// The usual way to create a [PaletteGenerator] is to use the asynchronous @@ -372,7 +373,7 @@ class PaletteGenerator extends Diagnosticable { /// See also: /// /// * [PaletteGenerator], a class for selecting color palettes from images. -class PaletteTarget extends Diagnosticable { +class PaletteTarget extends Object with Diagnosticable { /// Creates a [PaletteTarget] for custom palette selection. /// /// None of the arguments can be null. @@ -600,7 +601,7 @@ typedef _ContrastCalculator = double Function(Color a, Color b, int alpha); /// See also: /// /// * [PaletteGenerator], a class for selecting color palettes from images. -class PaletteColor extends Diagnosticable { +class PaletteColor extends Object with Diagnosticable { /// Generate a [PaletteColor]. /// /// The `color` and `population` parameters must not be null. diff --git a/pubspec.yaml b/pubspec.yaml index 59d8789..7d3343d 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -24,23 +24,27 @@ dependencies: # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: 0.1.2 - flutter_cache_manager: 1.1.0 + flutter_cache_manager: ^3.3.0 # palette_generator: 0.1.1 - flutter_webview_plugin: 0.3.0+2 +# flutter_webview_plugin: ^0.4.0 out latest Flutter V2 + flutter_webview_plugin: + git: + url: https://github.com/jiankian/flutter_webview_plugin - webview_flutter: 0.3.3+1 + webview_flutter: ^3.0.0 - video_player: 0.10.0+2 + video_player: ^2.2.18 # 用来模拟网络返回的数据,这些数据是真实的,这里模拟 dio: 1.0.13 - fluttertoast: 3.0.4 + fluttertoast: ^8.0.8 - cached_network_image: 1.1.0 + cached_network_image: ^3.2.0 + + shared_preferences: ^2.0.13 - shared_preferences: 0.5.3+2 dev_dependencies: flutter_test: