Showing
27 changed files
with
394 additions
and
92 deletions
analysis_options.yaml
0 → 100644
example/analysis_options.yaml
0 → 100644
example/ios/Podfile
0 → 100644
1 | +# Uncomment this line to define a global platform for your project | ||
2 | +# platform :ios, '9.0' | ||
3 | + | ||
4 | +# CocoaPods analytics sends network stats synchronously affecting flutter build latency. | ||
5 | +ENV['COCOAPODS_DISABLE_STATS'] = 'true' | ||
6 | + | ||
7 | +project 'Runner', { | ||
8 | + 'Debug' => :debug, | ||
9 | + 'Profile' => :release, | ||
10 | + 'Release' => :release, | ||
11 | +} | ||
12 | + | ||
13 | +def parse_KV_file(file, separator='=') | ||
14 | + file_abs_path = File.expand_path(file) | ||
15 | + if !File.exists? file_abs_path | ||
16 | + return []; | ||
17 | + end | ||
18 | + generated_key_values = {} | ||
19 | + skip_line_start_symbols = ["#", "/"] | ||
20 | + File.foreach(file_abs_path) do |line| | ||
21 | + next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ } | ||
22 | + plugin = line.split(pattern=separator) | ||
23 | + if plugin.length == 2 | ||
24 | + podname = plugin[0].strip() | ||
25 | + path = plugin[1].strip() | ||
26 | + podpath = File.expand_path("#{path}", file_abs_path) | ||
27 | + generated_key_values[podname] = podpath | ||
28 | + else | ||
29 | + puts "Invalid plugin specification: #{line}" | ||
30 | + end | ||
31 | + end | ||
32 | + generated_key_values | ||
33 | +end | ||
34 | + | ||
35 | +target 'Runner' do | ||
36 | + use_frameworks! | ||
37 | + use_modular_headers! | ||
38 | + | ||
39 | + # Flutter Pod | ||
40 | + | ||
41 | + copied_flutter_dir = File.join(__dir__, 'Flutter') | ||
42 | + copied_framework_path = File.join(copied_flutter_dir, 'Flutter.framework') | ||
43 | + copied_podspec_path = File.join(copied_flutter_dir, 'Flutter.podspec') | ||
44 | + unless File.exist?(copied_framework_path) && File.exist?(copied_podspec_path) | ||
45 | + # Copy Flutter.framework and Flutter.podspec to Flutter/ to have something to link against if the xcode backend script has not run yet. | ||
46 | + # That script will copy the correct debug/profile/release version of the framework based on the currently selected Xcode configuration. | ||
47 | + # CocoaPods will not embed the framework on pod install (before any build phases can generate) if the dylib does not exist. | ||
48 | + | ||
49 | + generated_xcode_build_settings_path = File.join(copied_flutter_dir, 'Generated.xcconfig') | ||
50 | + unless File.exist?(generated_xcode_build_settings_path) | ||
51 | + raise "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first" | ||
52 | + end | ||
53 | + generated_xcode_build_settings = parse_KV_file(generated_xcode_build_settings_path) | ||
54 | + cached_framework_dir = generated_xcode_build_settings['FLUTTER_FRAMEWORK_DIR']; | ||
55 | + | ||
56 | + unless File.exist?(copied_framework_path) | ||
57 | + FileUtils.cp_r(File.join(cached_framework_dir, 'Flutter.framework'), copied_flutter_dir) | ||
58 | + end | ||
59 | + unless File.exist?(copied_podspec_path) | ||
60 | + FileUtils.cp(File.join(cached_framework_dir, 'Flutter.podspec'), copied_flutter_dir) | ||
61 | + end | ||
62 | + end | ||
63 | + | ||
64 | + # Keep pod path relative so it can be checked into Podfile.lock. | ||
65 | + pod 'Flutter', :path => 'Flutter' | ||
66 | + | ||
67 | + # Plugin Pods | ||
68 | + | ||
69 | + # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock | ||
70 | + # referring to absolute paths on developers' machines. | ||
71 | + system('rm -rf .symlinks') | ||
72 | + system('mkdir -p .symlinks/plugins') | ||
73 | + plugin_pods = parse_KV_file('../.flutter-plugins') | ||
74 | + plugin_pods.each do |name, path| | ||
75 | + symlink = File.join('.symlinks', 'plugins', name) | ||
76 | + File.symlink(path, symlink) | ||
77 | + pod name, :path => File.join(symlink, 'ios') | ||
78 | + end | ||
79 | +end | ||
80 | + | ||
81 | +post_install do |installer| | ||
82 | + installer.pods_project.targets.each do |target| | ||
83 | + target.build_configurations.each do |config| | ||
84 | + config.build_settings['ENABLE_BITCODE'] = 'NO' | ||
85 | + end | ||
86 | + end | ||
87 | +end |
example/ios/Podfile.lock
0 → 100644
1 | +PODS: | ||
2 | + - Flutter (1.0.0) | ||
3 | + - url_launcher (0.0.1): | ||
4 | + - Flutter | ||
5 | + - url_launcher_macos (0.0.1): | ||
6 | + - Flutter | ||
7 | + - url_launcher_web (0.0.1): | ||
8 | + - Flutter | ||
9 | + | ||
10 | +DEPENDENCIES: | ||
11 | + - Flutter (from `Flutter`) | ||
12 | + - url_launcher (from `.symlinks/plugins/url_launcher/ios`) | ||
13 | + - url_launcher_macos (from `.symlinks/plugins/url_launcher_macos/ios`) | ||
14 | + - url_launcher_web (from `.symlinks/plugins/url_launcher_web/ios`) | ||
15 | + | ||
16 | +EXTERNAL SOURCES: | ||
17 | + Flutter: | ||
18 | + :path: Flutter | ||
19 | + url_launcher: | ||
20 | + :path: ".symlinks/plugins/url_launcher/ios" | ||
21 | + url_launcher_macos: | ||
22 | + :path: ".symlinks/plugins/url_launcher_macos/ios" | ||
23 | + url_launcher_web: | ||
24 | + :path: ".symlinks/plugins/url_launcher_web/ios" | ||
25 | + | ||
26 | +SPEC CHECKSUMS: | ||
27 | + Flutter: 0e3d915762c693b495b44d77113d4970485de6ec | ||
28 | + url_launcher: a1c0cc845906122c4784c542523d8cacbded5626 | ||
29 | + url_launcher_macos: fd7894421cd39320dce5f292fc99ea9270b2a313 | ||
30 | + url_launcher_web: e5527357f037c87560776e36436bf2b0288b965c | ||
31 | + | ||
32 | +PODFILE CHECKSUM: c34e2287a9ccaa606aeceab922830efb9a6ff69a | ||
33 | + | ||
34 | +COCOAPODS: 1.8.4 |
@@ -8,6 +8,7 @@ | @@ -8,6 +8,7 @@ | ||
8 | 8 | ||
9 | /* Begin PBXBuildFile section */ | 9 | /* Begin PBXBuildFile section */ |
10 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; | 10 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; |
11 | + 31E8A031F29A5C9DCEE5A35E /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0A551F173703771838A21386 /* Pods_Runner.framework */; }; | ||
11 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; | 12 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; |
12 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; | 13 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; |
13 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; | 14 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; |
@@ -29,9 +30,12 @@ | @@ -29,9 +30,12 @@ | ||
29 | /* End PBXCopyFilesBuildPhase section */ | 30 | /* End PBXCopyFilesBuildPhase section */ |
30 | 31 | ||
31 | /* Begin PBXFileReference section */ | 32 | /* Begin PBXFileReference section */ |
33 | + 0A551F173703771838A21386 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; | ||
32 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; }; | 34 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; }; |
33 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; }; | 35 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; }; |
34 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; }; | 36 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; }; |
37 | + 453483ADEDE58E2FFD3A0F32 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; }; | ||
38 | + 5BE1C954520B0C4D1A5C47DF /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; }; | ||
35 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; }; | 39 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; }; |
36 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; }; | 40 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; }; |
37 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; }; | 41 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; }; |
@@ -42,6 +46,7 @@ | @@ -42,6 +46,7 @@ | ||
42 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; }; | 46 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; }; |
43 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; }; | 47 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; }; |
44 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; | 48 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; |
49 | + ECE24C51B4309A57743A5800 /* 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 = "<group>"; }; | ||
45 | /* End PBXFileReference section */ | 50 | /* End PBXFileReference section */ |
46 | 51 | ||
47 | /* Begin PBXFrameworksBuildPhase section */ | 52 | /* Begin PBXFrameworksBuildPhase section */ |
@@ -49,12 +54,24 @@ | @@ -49,12 +54,24 @@ | ||
49 | isa = PBXFrameworksBuildPhase; | 54 | isa = PBXFrameworksBuildPhase; |
50 | buildActionMask = 2147483647; | 55 | buildActionMask = 2147483647; |
51 | files = ( | 56 | files = ( |
57 | + 31E8A031F29A5C9DCEE5A35E /* Pods_Runner.framework in Frameworks */, | ||
52 | ); | 58 | ); |
53 | runOnlyForDeploymentPostprocessing = 0; | 59 | runOnlyForDeploymentPostprocessing = 0; |
54 | }; | 60 | }; |
55 | /* End PBXFrameworksBuildPhase section */ | 61 | /* End PBXFrameworksBuildPhase section */ |
56 | 62 | ||
57 | /* Begin PBXGroup section */ | 63 | /* Begin PBXGroup section */ |
64 | + 03BE858701E6013D75C55192 /* Pods */ = { | ||
65 | + isa = PBXGroup; | ||
66 | + children = ( | ||
67 | + ECE24C51B4309A57743A5800 /* Pods-Runner.debug.xcconfig */, | ||
68 | + 453483ADEDE58E2FFD3A0F32 /* Pods-Runner.release.xcconfig */, | ||
69 | + 5BE1C954520B0C4D1A5C47DF /* Pods-Runner.profile.xcconfig */, | ||
70 | + ); | ||
71 | + name = Pods; | ||
72 | + path = Pods; | ||
73 | + sourceTree = "<group>"; | ||
74 | + }; | ||
58 | 9740EEB11CF90186004384FC /* Flutter */ = { | 75 | 9740EEB11CF90186004384FC /* Flutter */ = { |
59 | isa = PBXGroup; | 76 | isa = PBXGroup; |
60 | children = ( | 77 | children = ( |
@@ -72,6 +89,8 @@ | @@ -72,6 +89,8 @@ | ||
72 | 9740EEB11CF90186004384FC /* Flutter */, | 89 | 9740EEB11CF90186004384FC /* Flutter */, |
73 | 97C146F01CF9000F007C117D /* Runner */, | 90 | 97C146F01CF9000F007C117D /* Runner */, |
74 | 97C146EF1CF9000F007C117D /* Products */, | 91 | 97C146EF1CF9000F007C117D /* Products */, |
92 | + 03BE858701E6013D75C55192 /* Pods */, | ||
93 | + BB84F3538ADB8070C8092550 /* Frameworks */, | ||
75 | ); | 94 | ); |
76 | sourceTree = "<group>"; | 95 | sourceTree = "<group>"; |
77 | }; | 96 | }; |
@@ -106,6 +125,14 @@ | @@ -106,6 +125,14 @@ | ||
106 | name = "Supporting Files"; | 125 | name = "Supporting Files"; |
107 | sourceTree = "<group>"; | 126 | sourceTree = "<group>"; |
108 | }; | 127 | }; |
128 | + BB84F3538ADB8070C8092550 /* Frameworks */ = { | ||
129 | + isa = PBXGroup; | ||
130 | + children = ( | ||
131 | + 0A551F173703771838A21386 /* Pods_Runner.framework */, | ||
132 | + ); | ||
133 | + name = Frameworks; | ||
134 | + sourceTree = "<group>"; | ||
135 | + }; | ||
109 | /* End PBXGroup section */ | 136 | /* End PBXGroup section */ |
110 | 137 | ||
111 | /* Begin PBXNativeTarget section */ | 138 | /* Begin PBXNativeTarget section */ |
@@ -113,12 +140,14 @@ | @@ -113,12 +140,14 @@ | ||
113 | isa = PBXNativeTarget; | 140 | isa = PBXNativeTarget; |
114 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; | 141 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; |
115 | buildPhases = ( | 142 | buildPhases = ( |
143 | + D0B7AC2EB31CC6A828ADA674 /* [CP] Check Pods Manifest.lock */, | ||
116 | 9740EEB61CF901F6004384FC /* Run Script */, | 144 | 9740EEB61CF901F6004384FC /* Run Script */, |
117 | 97C146EA1CF9000F007C117D /* Sources */, | 145 | 97C146EA1CF9000F007C117D /* Sources */, |
118 | 97C146EB1CF9000F007C117D /* Frameworks */, | 146 | 97C146EB1CF9000F007C117D /* Frameworks */, |
119 | 97C146EC1CF9000F007C117D /* Resources */, | 147 | 97C146EC1CF9000F007C117D /* Resources */, |
120 | 9705A1C41CF9048500538489 /* Embed Frameworks */, | 148 | 9705A1C41CF9048500538489 /* Embed Frameworks */, |
121 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, | 149 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, |
150 | + F282B7FE454FE6B56BD6580F /* [CP] Embed Pods Frameworks */, | ||
122 | ); | 151 | ); |
123 | buildRules = ( | 152 | buildRules = ( |
124 | ); | 153 | ); |
@@ -205,6 +234,48 @@ | @@ -205,6 +234,48 @@ | ||
205 | shellPath = /bin/sh; | 234 | shellPath = /bin/sh; |
206 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; | 235 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; |
207 | }; | 236 | }; |
237 | + D0B7AC2EB31CC6A828ADA674 /* [CP] Check Pods Manifest.lock */ = { | ||
238 | + isa = PBXShellScriptBuildPhase; | ||
239 | + buildActionMask = 2147483647; | ||
240 | + files = ( | ||
241 | + ); | ||
242 | + inputFileListPaths = ( | ||
243 | + ); | ||
244 | + inputPaths = ( | ||
245 | + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", | ||
246 | + "${PODS_ROOT}/Manifest.lock", | ||
247 | + ); | ||
248 | + name = "[CP] Check Pods Manifest.lock"; | ||
249 | + outputFileListPaths = ( | ||
250 | + ); | ||
251 | + outputPaths = ( | ||
252 | + "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", | ||
253 | + ); | ||
254 | + runOnlyForDeploymentPostprocessing = 0; | ||
255 | + shellPath = /bin/sh; | ||
256 | + 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"; | ||
257 | + showEnvVarsInLog = 0; | ||
258 | + }; | ||
259 | + F282B7FE454FE6B56BD6580F /* [CP] Embed Pods Frameworks */ = { | ||
260 | + isa = PBXShellScriptBuildPhase; | ||
261 | + buildActionMask = 2147483647; | ||
262 | + files = ( | ||
263 | + ); | ||
264 | + inputPaths = ( | ||
265 | + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh", | ||
266 | + "${PODS_ROOT}/../Flutter/Flutter.framework", | ||
267 | + "${BUILT_PRODUCTS_DIR}/url_launcher/url_launcher.framework", | ||
268 | + ); | ||
269 | + name = "[CP] Embed Pods Frameworks"; | ||
270 | + outputPaths = ( | ||
271 | + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Flutter.framework", | ||
272 | + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/url_launcher.framework", | ||
273 | + ); | ||
274 | + runOnlyForDeploymentPostprocessing = 0; | ||
275 | + shellPath = /bin/sh; | ||
276 | + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; | ||
277 | + showEnvVarsInLog = 0; | ||
278 | + }; | ||
208 | /* End PBXShellScriptBuildPhase section */ | 279 | /* End PBXShellScriptBuildPhase section */ |
209 | 280 | ||
210 | /* Begin PBXSourcesBuildPhase section */ | 281 | /* Begin PBXSourcesBuildPhase section */ |
1 | import 'dart:ui'; | 1 | import 'dart:ui'; |
2 | 2 | ||
3 | import 'package:example/examples/sliver_container.dart'; | 3 | import 'package:example/examples/sliver_container.dart'; |
4 | -import 'package:example/modals/modal_fit.dart'; | ||
5 | import 'package:flutter/cupertino.dart'; | 4 | import 'package:flutter/cupertino.dart'; |
6 | -import 'package:flutter/gestures.dart'; | ||
7 | import 'package:flutter/material.dart'; | 5 | import 'package:flutter/material.dart'; |
8 | import 'package:modal_bottom_sheet/modal_bottom_sheet.dart'; | 6 | import 'package:modal_bottom_sheet/modal_bottom_sheet.dart'; |
9 | 7 | ||
@@ -163,8 +161,7 @@ class PhotoShareBottomSheet extends StatelessWidget { | @@ -163,8 +161,7 @@ class PhotoShareBottomSheet extends StatelessWidget { | ||
163 | width: 60, | 161 | width: 60, |
164 | decoration: BoxDecoration( | 162 | decoration: BoxDecoration( |
165 | image: DecorationImage( | 163 | image: DecorationImage( |
166 | - image: | ||
167 | - AssetImage(app.imageUrl), | 164 | + image: AssetImage(app.imageUrl), |
168 | fit: BoxFit.cover), | 165 | fit: BoxFit.cover), |
169 | color: Colors.white, | 166 | color: Colors.white, |
170 | borderRadius: | 167 | borderRadius: |
@@ -69,6 +69,7 @@ class _SliverGroupElement extends RenderObjectElement { | @@ -69,6 +69,7 @@ class _SliverGroupElement extends RenderObjectElement { | ||
69 | if (child == _backgroundDecoration) _backgroundDecoration = null; | 69 | if (child == _backgroundDecoration) _backgroundDecoration = null; |
70 | if (child == _foregroundDecoration) _foregroundDecoration = null; | 70 | if (child == _foregroundDecoration) _foregroundDecoration = null; |
71 | if (child == _sliver) _sliver = null; | 71 | if (child == _sliver) _sliver = null; |
72 | + super.forgetChild(child); | ||
72 | } | 73 | } |
73 | 74 | ||
74 | @override | 75 | @override |
@@ -9,8 +9,6 @@ import 'modals/floating_modal.dart'; | @@ -9,8 +9,6 @@ import 'modals/floating_modal.dart'; | ||
9 | import 'modals/modal_complex_all.dart'; | 9 | import 'modals/modal_complex_all.dart'; |
10 | import 'modals/modal_fit.dart'; | 10 | import 'modals/modal_fit.dart'; |
11 | import 'modals/modal_inside_modal.dart'; | 11 | import 'modals/modal_inside_modal.dart'; |
12 | -import 'modals/modal_inside_modal.dart'; | ||
13 | -import 'modals/modal_simple.dart'; | ||
14 | import 'modals/modal_will_scope.dart'; | 12 | import 'modals/modal_will_scope.dart'; |
15 | import 'modals/modal_with_navigator.dart'; | 13 | import 'modals/modal_with_navigator.dart'; |
16 | import 'modals/modal_with_scroll.dart'; | 14 | import 'modals/modal_with_scroll.dart'; |
@@ -25,7 +23,9 @@ class MyApp extends StatelessWidget { | @@ -25,7 +23,9 @@ class MyApp extends StatelessWidget { | ||
25 | return MaterialApp( | 23 | return MaterialApp( |
26 | theme: ThemeData(platform: TargetPlatform.iOS), | 24 | theme: ThemeData(platform: TargetPlatform.iOS), |
27 | title: 'BottomSheet Modals', | 25 | title: 'BottomSheet Modals', |
28 | - builder: (context, child) => WebFrame(child: child,), | 26 | + builder: (context, child) => WebFrame( |
27 | + child: child, | ||
28 | + ), | ||
29 | onGenerateRoute: (RouteSettings settings) { | 29 | onGenerateRoute: (RouteSettings settings) { |
30 | switch (settings.name) { | 30 | switch (settings.name) { |
31 | case '/': | 31 | case '/': |
@@ -184,6 +184,16 @@ class _MyHomePageState extends State<MyHomePage> { | @@ -184,6 +184,16 @@ class _MyHomePageState extends State<MyHomePage> { | ||
184 | scrollController: scrollController), | 184 | scrollController: scrollController), |
185 | )), | 185 | )), |
186 | ListTile( | 186 | ListTile( |
187 | + title: Text('Cupertino Modal with inside navigation'), | ||
188 | + onTap: () => showCupertinoModalBottomSheet( | ||
189 | + expand: true, | ||
190 | + context: context, | ||
191 | + backgroundColor: Colors.transparent, | ||
192 | + builder: (context, scrollController) => | ||
193 | + ModalWithNavigator( | ||
194 | + scrollController: scrollController), | ||
195 | + )), | ||
196 | + ListTile( | ||
187 | title: Text('Cupertino Navigator + Scroll + WillScope'), | 197 | title: Text('Cupertino Navigator + Scroll + WillScope'), |
188 | onTap: () => showCupertinoModalBottomSheet( | 198 | onTap: () => showCupertinoModalBottomSheet( |
189 | expand: true, | 199 | expand: true, |
1 | -import 'dart:math'; | ||
2 | - | ||
3 | import 'package:flutter/material.dart'; | 1 | import 'package:flutter/material.dart'; |
4 | -import 'package:flutter/services.dart'; | ||
5 | import 'package:flutter/widgets.dart'; | 2 | import 'package:flutter/widgets.dart'; |
6 | import 'package:modal_bottom_sheet/modal_bottom_sheet.dart'; | 3 | import 'package:modal_bottom_sheet/modal_bottom_sheet.dart'; |
7 | 4 |
@@ -2,8 +2,6 @@ import 'package:flutter/cupertino.dart'; | @@ -2,8 +2,6 @@ import 'package:flutter/cupertino.dart'; | ||
2 | import 'package:flutter/material.dart'; | 2 | import 'package:flutter/material.dart'; |
3 | import 'package:modal_bottom_sheet/modal_bottom_sheet.dart'; | 3 | import 'package:modal_bottom_sheet/modal_bottom_sheet.dart'; |
4 | 4 | ||
5 | -import 'modal_with_scroll.dart'; | ||
6 | - | ||
7 | class ModalInsideModal extends StatelessWidget { | 5 | class ModalInsideModal extends StatelessWidget { |
8 | final ScrollController scrollController; | 6 | final ScrollController scrollController; |
9 | 7 |
@@ -2,7 +2,6 @@ import 'package:flutter/cupertino.dart'; | @@ -2,7 +2,6 @@ import 'package:flutter/cupertino.dart'; | ||
2 | import 'package:flutter/foundation.dart'; | 2 | import 'package:flutter/foundation.dart'; |
3 | import 'package:flutter/material.dart'; | 3 | import 'package:flutter/material.dart'; |
4 | import 'package:flutter/rendering.dart'; | 4 | import 'package:flutter/rendering.dart'; |
5 | -import 'package:flutter/services.dart'; | ||
6 | import 'package:url_launcher/url_launcher.dart'; | 5 | import 'package:url_launcher/url_launcher.dart'; |
7 | 6 | ||
8 | class WebFrame extends StatelessWidget { | 7 | class WebFrame extends StatelessWidget { |
@@ -55,7 +54,8 @@ class WebFrame extends StatelessWidget { | @@ -55,7 +54,8 @@ class WebFrame extends StatelessWidget { | ||
55 | MainAxisAlignment.spaceBetween, | 54 | MainAxisAlignment.spaceBetween, |
56 | children: <Widget>[ | 55 | children: <Widget>[ |
57 | Padding( | 56 | Padding( |
58 | - padding: EdgeInsets.only(left: 30, top: 4), | 57 | + padding: |
58 | + EdgeInsets.only(left: 30, top: 4), | ||
59 | child: Text( | 59 | child: Text( |
60 | '${date.hour}:${date.minute}', | 60 | '${date.hour}:${date.minute}', |
61 | style: TextStyle( | 61 | style: TextStyle( |
@@ -113,37 +113,43 @@ class WebFrame extends StatelessWidget { | @@ -113,37 +113,43 @@ class WebFrame extends StatelessWidget { | ||
113 | child: FittedBox( | 113 | child: FittedBox( |
114 | fit: BoxFit.scaleDown, | 114 | fit: BoxFit.scaleDown, |
115 | child: Container( | 115 | child: Container( |
116 | - padding: EdgeInsets.only(bottom: 40), | ||
117 | - width: mediaQuery.size.width, | ||
118 | - height: mediaQuery.size.height, | ||
119 | - alignment: Alignment.center, | ||
120 | - child: Column( | ||
121 | - crossAxisAlignment: CrossAxisAlignment.stretch, | ||
122 | - children: <Widget>[ | ||
123 | - Expanded( | ||
124 | - child: Text( | ||
125 | - 'Modal\nBottom\nSheet', | ||
126 | - style: TextStyle( | ||
127 | - fontWeight: FontWeight.w600, | ||
128 | - fontSize: 80, | ||
129 | - ), | ||
130 | - maxLines: 3, | ||
131 | - overflow: TextOverflow.clip, | ||
132 | - )), | ||
133 | - Spacer(), | ||
134 | - Row(children: <Widget>[ | ||
135 | - InkWell( | ||
136 | - onTap: () => launch('https://pub.dev/packages/modal_bottom_sheet'), | ||
137 | - child: Image.asset('assets/flutter.png', height: 60), | ||
138 | - ), | ||
139 | - Spacer(), | ||
140 | - InkWell( | ||
141 | - onTap: () => launch('https://github.com/jamesblasco/modal_bottom_sheet'), | ||
142 | - child: Image.asset('assets/github.png', height: 60), | ||
143 | - ), | ||
144 | - ],) | ||
145 | - ], | ||
146 | - )))) | 116 | + padding: EdgeInsets.only(bottom: 40), |
117 | + width: mediaQuery.size.width, | ||
118 | + height: mediaQuery.size.height, | ||
119 | + alignment: Alignment.center, | ||
120 | + child: Column( | ||
121 | + crossAxisAlignment: CrossAxisAlignment.stretch, | ||
122 | + children: <Widget>[ | ||
123 | + Expanded( | ||
124 | + child: Text( | ||
125 | + 'Modal\nBottom\nSheet', | ||
126 | + style: TextStyle( | ||
127 | + fontWeight: FontWeight.w600, | ||
128 | + fontSize: 80, | ||
129 | + ), | ||
130 | + maxLines: 3, | ||
131 | + overflow: TextOverflow.clip, | ||
132 | + )), | ||
133 | + Spacer(), | ||
134 | + Row( | ||
135 | + children: <Widget>[ | ||
136 | + InkWell( | ||
137 | + onTap: () => launch( | ||
138 | + 'https://pub.dev/packages/modal_bottom_sheet'), | ||
139 | + child: Image.asset('assets/flutter.png', | ||
140 | + height: 60), | ||
141 | + ), | ||
142 | + Spacer(), | ||
143 | + InkWell( | ||
144 | + onTap: () => launch( | ||
145 | + 'https://github.com/jamesblasco/modal_bottom_sheet'), | ||
146 | + child: Image.asset('assets/github.png', | ||
147 | + height: 60), | ||
148 | + ), | ||
149 | + ], | ||
150 | + ) | ||
151 | + ], | ||
152 | + )))) | ||
147 | ], | 153 | ], |
148 | ), | 154 | ), |
149 | ), | 155 | ), |
@@ -5,6 +5,8 @@ | @@ -5,6 +5,8 @@ | ||
5 | import FlutterMacOS | 5 | import FlutterMacOS |
6 | import Foundation | 6 | import Foundation |
7 | 7 | ||
8 | +import url_launcher_macos | ||
8 | 9 | ||
9 | func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { | 10 | func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { |
11 | + UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin")) | ||
10 | } | 12 | } |
example/macos/Podfile
0 → 100644
1 | +platform :osx, '10.11' | ||
2 | + | ||
3 | +# CocoaPods analytics sends network stats synchronously affecting flutter build latency. | ||
4 | +ENV['COCOAPODS_DISABLE_STATS'] = 'true' | ||
5 | + | ||
6 | +project 'Runner', { | ||
7 | + 'Debug' => :debug, | ||
8 | + 'Profile' => :release, | ||
9 | + 'Release' => :release, | ||
10 | +} | ||
11 | + | ||
12 | +def parse_KV_file(file, separator='=') | ||
13 | + file_abs_path = File.expand_path(file) | ||
14 | + if !File.exists? file_abs_path | ||
15 | + return []; | ||
16 | + end | ||
17 | + pods_ary = [] | ||
18 | + skip_line_start_symbols = ["#", "/"] | ||
19 | + File.foreach(file_abs_path) { |line| | ||
20 | + next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ } | ||
21 | + plugin = line.split(pattern=separator) | ||
22 | + if plugin.length == 2 | ||
23 | + podname = plugin[0].strip() | ||
24 | + path = plugin[1].strip() | ||
25 | + podpath = File.expand_path("#{path}", file_abs_path) | ||
26 | + pods_ary.push({:name => podname, :path => podpath}); | ||
27 | + else | ||
28 | + puts "Invalid plugin specification: #{line}" | ||
29 | + end | ||
30 | + } | ||
31 | + return pods_ary | ||
32 | +end | ||
33 | + | ||
34 | +def pubspec_supports_macos(file) | ||
35 | + file_abs_path = File.expand_path(file) | ||
36 | + if !File.exists? file_abs_path | ||
37 | + return false; | ||
38 | + end | ||
39 | + File.foreach(file_abs_path) { |line| | ||
40 | + return true if line =~ /^\s*macos:/ | ||
41 | + } | ||
42 | + return false | ||
43 | +end | ||
44 | + | ||
45 | +target 'Runner' do | ||
46 | + use_frameworks! | ||
47 | + use_modular_headers! | ||
48 | + | ||
49 | + # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock | ||
50 | + # referring to absolute paths on developers' machines. | ||
51 | + ephemeral_dir = File.join('Flutter', 'ephemeral') | ||
52 | + symlink_dir = File.join(ephemeral_dir, '.symlinks') | ||
53 | + symlink_plugins_dir = File.join(symlink_dir, 'plugins') | ||
54 | + system("rm -rf #{symlink_dir}") | ||
55 | + system("mkdir -p #{symlink_plugins_dir}") | ||
56 | + | ||
57 | + # Flutter Pods | ||
58 | + generated_xcconfig = parse_KV_file(File.join(ephemeral_dir, 'Flutter-Generated.xcconfig')) | ||
59 | + if generated_xcconfig.empty? | ||
60 | + puts "Flutter-Generated.xcconfig must exist. If you're running pod install manually, make sure flutter packages get is executed first." | ||
61 | + end | ||
62 | + generated_xcconfig.map { |p| | ||
63 | + if p[:name] == 'FLUTTER_FRAMEWORK_DIR' | ||
64 | + symlink = File.join(symlink_dir, 'flutter') | ||
65 | + File.symlink(File.dirname(p[:path]), symlink) | ||
66 | + pod 'FlutterMacOS', :path => File.join(symlink, File.basename(p[:path])) | ||
67 | + end | ||
68 | + } | ||
69 | + | ||
70 | + # Plugin Pods | ||
71 | + plugin_pods = parse_KV_file('../.flutter-plugins') | ||
72 | + plugin_pods.map { |p| | ||
73 | + symlink = File.join(symlink_plugins_dir, p[:name]) | ||
74 | + File.symlink(p[:path], symlink) | ||
75 | + if pubspec_supports_macos(File.join(symlink, 'pubspec.yaml')) | ||
76 | + pod p[:name], :path => File.join(symlink, 'macos') | ||
77 | + end | ||
78 | + } | ||
79 | +end | ||
80 | + | ||
81 | +# Prevent Cocoapods from embedding a second Flutter framework and causing an error with the new Xcode build system. | ||
82 | +install! 'cocoapods', :disable_input_output_paths => true |
@@ -14,7 +14,7 @@ description: A new Flutter project. | @@ -14,7 +14,7 @@ description: A new Flutter project. | ||
14 | version: 1.0.0+1 | 14 | version: 1.0.0+1 |
15 | 15 | ||
16 | environment: | 16 | environment: |
17 | - sdk: ">=2.1.0 <3.0.0" | 17 | + sdk: ">=2.7.0 <3.0.0" |
18 | 18 | ||
19 | dependencies: | 19 | dependencies: |
20 | flutter: | 20 | flutter: |
@@ -124,8 +124,7 @@ class _ModalBottomSheetState extends State<ModalBottomSheet> | @@ -124,8 +124,7 @@ class _ModalBottomSheetState extends State<ModalBottomSheet> | ||
124 | AnimationController _bounceDragController; | 124 | AnimationController _bounceDragController; |
125 | 125 | ||
126 | double get _childHeight { | 126 | double get _childHeight { |
127 | - final RenderBox renderBox = | ||
128 | - _childKey.currentContext.findRenderObject() as RenderBox; | 127 | + final renderBox = _childKey.currentContext.findRenderObject() as RenderBox; |
129 | return renderBox.size.height; | 128 | return renderBox.size.height; |
130 | } | 129 | } |
131 | 130 | ||
@@ -152,8 +151,9 @@ class _ModalBottomSheetState extends State<ModalBottomSheet> | @@ -152,8 +151,9 @@ class _ModalBottomSheetState extends State<ModalBottomSheet> | ||
152 | widget.animationController.forward().then((value) { | 151 | widget.animationController.forward().then((value) { |
153 | // When using WillPop, animation doesn't end at 1. | 152 | // When using WillPop, animation doesn't end at 1. |
154 | // Check more in detail the problem | 153 | // Check more in detail the problem |
155 | - if (!widget.animationController.isCompleted) | 154 | + if (!widget.animationController.isCompleted) { |
156 | widget.animationController.value = 1; | 155 | widget.animationController.value = 1; |
156 | + } | ||
157 | }); | 157 | }); |
158 | _bounceDragController.reverse(); | 158 | _bounceDragController.reverse(); |
159 | } | 159 | } |
@@ -208,7 +208,7 @@ class _ModalBottomSheetState extends State<ModalBottomSheet> | @@ -208,7 +208,7 @@ class _ModalBottomSheetState extends State<ModalBottomSheet> | ||
208 | isDragging = false; | 208 | isDragging = false; |
209 | _bounceDragController.reverse(); | 209 | _bounceDragController.reverse(); |
210 | 210 | ||
211 | - bool canClose = true; | 211 | + var canClose = true; |
212 | if (widget.shouldClose != null && hasReachedWillPopThreshold) { | 212 | if (widget.shouldClose != null && hasReachedWillPopThreshold) { |
213 | _cancelClose(); | 213 | _cancelClose(); |
214 | canClose = await shouldClose(); | 214 | canClose = await shouldClose(); |
@@ -219,8 +219,9 @@ class _ModalBottomSheetState extends State<ModalBottomSheet> | @@ -219,8 +219,9 @@ class _ModalBottomSheetState extends State<ModalBottomSheet> | ||
219 | _close(); | 219 | _close(); |
220 | print('close2'); | 220 | print('close2'); |
221 | } else if (hasReachedCloseThreshold) { | 221 | } else if (hasReachedCloseThreshold) { |
222 | - if (widget.animationController.value > 0.0) | 222 | + if (widget.animationController.value > 0.0) { |
223 | widget.animationController.fling(velocity: -1.0); | 223 | widget.animationController.fling(velocity: -1.0); |
224 | + } | ||
224 | _close(); | 225 | _close(); |
225 | print('close3'); | 226 | print('close3'); |
226 | } else { | 227 | } else { |
@@ -231,11 +232,11 @@ class _ModalBottomSheetState extends State<ModalBottomSheet> | @@ -231,11 +232,11 @@ class _ModalBottomSheetState extends State<ModalBottomSheet> | ||
231 | } | 232 | } |
232 | } | 233 | } |
233 | 234 | ||
234 | - _handleScrollUpdate(ScrollNotification notification) { | 235 | + void _handleScrollUpdate(ScrollNotification notification) { |
235 | if (notification.metrics.pixels <= notification.metrics.minScrollExtent) { | 236 | if (notification.metrics.pixels <= notification.metrics.minScrollExtent) { |
236 | //Check if listener is same from scrollController | 237 | //Check if listener is same from scrollController |
237 | if (_scrollController.position.pixels != notification.metrics.pixels) { | 238 | if (_scrollController.position.pixels != notification.metrics.pixels) { |
238 | - return false; | 239 | + return; |
239 | } | 240 | } |
240 | DragUpdateDetails dragDetails; | 241 | DragUpdateDetails dragDetails; |
241 | if (notification is ScrollUpdateNotification) { | 242 | if (notification is ScrollUpdateNotification) { |
@@ -270,14 +271,15 @@ class _ModalBottomSheetState extends State<ModalBottomSheet> | @@ -270,14 +271,15 @@ class _ModalBottomSheetState extends State<ModalBottomSheet> | ||
270 | curve: Curves.easeOutSine, | 271 | curve: Curves.easeOutSine, |
271 | ); | 272 | ); |
272 | 273 | ||
273 | - Widget child = widget.builder(context, _scrollController); | 274 | + var child = widget.builder(context, _scrollController); |
274 | 275 | ||
275 | - if (widget.containerBuilder != null) | 276 | + if (widget.containerBuilder != null) { |
276 | child = widget.containerBuilder( | 277 | child = widget.containerBuilder( |
277 | context, | 278 | context, |
278 | widget.animationController, | 279 | widget.animationController, |
279 | child, | 280 | child, |
280 | ); | 281 | ); |
282 | + } | ||
281 | 283 | ||
282 | // Todo: Add curved Animation when push and pop without gesture | 284 | // Todo: Add curved Animation when push and pop without gesture |
283 | /* final Animation<double> containerAnimation = CurvedAnimation( | 285 | /* final Animation<double> containerAnimation = CurvedAnimation( |
@@ -366,15 +368,14 @@ class _CustomBottomSheetLayout extends SingleChildLayoutDelegate { | @@ -366,15 +368,14 @@ class _CustomBottomSheetLayout extends SingleChildLayoutDelegate { | ||
366 | 368 | ||
367 | @override | 369 | @override |
368 | Offset getPositionForChild(Size size, Size childSize) { | 370 | Offset getPositionForChild(Size size, Size childSize) { |
369 | - if (this.childHeight == null) this.childHeight = childSize.height; | ||
370 | - | 371 | + childHeight ??= childSize.height; |
371 | return Offset(0.0, size.height - childSize.height); | 372 | return Offset(0.0, size.height - childSize.height); |
372 | } | 373 | } |
373 | 374 | ||
374 | @override | 375 | @override |
375 | bool shouldRelayout(_CustomBottomSheetLayout oldDelegate) { | 376 | bool shouldRelayout(_CustomBottomSheetLayout oldDelegate) { |
376 | if (progress != oldDelegate.progress) { | 377 | if (progress != oldDelegate.progress) { |
377 | - this.childHeight = oldDelegate.childHeight; | 378 | + childHeight = oldDelegate.childHeight; |
378 | return true; | 379 | return true; |
379 | } | 380 | } |
380 | return false; | 381 | return false; |
@@ -57,7 +57,7 @@ class _ModalBottomSheetState<T> extends State<_ModalBottomSheet<T>> { | @@ -57,7 +57,7 @@ class _ModalBottomSheetState<T> extends State<_ModalBottomSheet<T>> { | ||
57 | super.dispose(); | 57 | super.dispose(); |
58 | } | 58 | } |
59 | 59 | ||
60 | - updateController() { | 60 | + void updateController() { |
61 | widget.secondAnimationController?.value = widget.route.animation.value; | 61 | widget.secondAnimationController?.value = widget.route.animation.value; |
62 | } | 62 | } |
63 | 63 | ||
@@ -65,9 +65,8 @@ class _ModalBottomSheetState<T> extends State<_ModalBottomSheet<T>> { | @@ -65,9 +65,8 @@ class _ModalBottomSheetState<T> extends State<_ModalBottomSheet<T>> { | ||
65 | Widget build(BuildContext context) { | 65 | Widget build(BuildContext context) { |
66 | assert(debugCheckHasMediaQuery(context)); | 66 | assert(debugCheckHasMediaQuery(context)); |
67 | assert(debugCheckHasMaterialLocalizations(context)); | 67 | assert(debugCheckHasMaterialLocalizations(context)); |
68 | - final MaterialLocalizations localizations = | ||
69 | - MaterialLocalizations.of(context); | ||
70 | - final String routeLabel = _getRouteLabel(localizations); | 68 | + final localizations = MaterialLocalizations.of(context); |
69 | + final routeLabel = _getRouteLabel(localizations); | ||
71 | 70 | ||
72 | return AnimatedBuilder( | 71 | return AnimatedBuilder( |
73 | animation: widget.route._animationController, | 72 | animation: widget.route._animationController, |
@@ -176,7 +176,7 @@ class _CupertinoModalTransition extends StatelessWidget { | @@ -176,7 +176,7 @@ class _CupertinoModalTransition extends StatelessWidget { | ||
176 | 176 | ||
177 | @override | 177 | @override |
178 | Widget build(BuildContext context) { | 178 | Widget build(BuildContext context) { |
179 | - double startRoundCorner = 0; | 179 | + var startRoundCorner = 0.0; |
180 | final paddingTop = MediaQuery.of(context).padding.top; | 180 | final paddingTop = MediaQuery.of(context).padding.top; |
181 | if (Theme.of(context).platform == TargetPlatform.iOS && paddingTop > 20) { | 181 | if (Theme.of(context).platform == TargetPlatform.iOS && paddingTop > 20) { |
182 | startRoundCorner = 38.5; | 182 | startRoundCorner = 38.5; |
@@ -194,8 +194,6 @@ class _CupertinoModalTransition extends StatelessWidget { | @@ -194,8 +194,6 @@ class _CupertinoModalTransition extends StatelessWidget { | ||
194 | animation: curvedAnimation, | 194 | animation: curvedAnimation, |
195 | child: body, | 195 | child: body, |
196 | builder: (context, child) { | 196 | builder: (context, child) { |
197 | - Widget result = child; | ||
198 | - | ||
199 | final progress = curvedAnimation.value; | 197 | final progress = curvedAnimation.value; |
200 | final yOffset = progress * paddingTop; | 198 | final yOffset = progress * paddingTop; |
201 | final scale = 1 - progress / 10; | 199 | final scale = 1 - progress / 10; |
@@ -212,7 +210,7 @@ class _CupertinoModalTransition extends StatelessWidget { | @@ -212,7 +210,7 @@ class _CupertinoModalTransition extends StatelessWidget { | ||
212 | alignment: Alignment.topCenter, | 210 | alignment: Alignment.topCenter, |
213 | child: ClipRRect( | 211 | child: ClipRRect( |
214 | borderRadius: BorderRadius.circular(radius), | 212 | borderRadius: BorderRadius.circular(radius), |
215 | - child: result), | 213 | + child: child), |
216 | ), | 214 | ), |
217 | ) | 215 | ) |
218 | ], | 216 | ], |
@@ -225,6 +223,7 @@ class _CupertinoModalTransition extends StatelessWidget { | @@ -225,6 +223,7 @@ class _CupertinoModalTransition extends StatelessWidget { | ||
225 | class _CupertinoScaffold extends InheritedWidget { | 223 | class _CupertinoScaffold extends InheritedWidget { |
226 | final AnimationController animation; | 224 | final AnimationController animation; |
227 | 225 | ||
226 | + @override | ||
228 | final Widget child; | 227 | final Widget child; |
229 | 228 | ||
230 | const _CupertinoScaffold({Key key, this.animation, this.child}) | 229 | const _CupertinoScaffold({Key key, this.animation, this.child}) |
@@ -55,14 +55,13 @@ WidgetWithChildBuilder _materialContainerBuilder(BuildContext context, | @@ -55,14 +55,13 @@ WidgetWithChildBuilder _materialContainerBuilder(BuildContext context, | ||
55 | ThemeData theme, | 55 | ThemeData theme, |
56 | Clip clipBehavior, | 56 | Clip clipBehavior, |
57 | ShapeBorder shape}) { | 57 | ShapeBorder shape}) { |
58 | - final BottomSheetThemeData bottomSheetTheme = | ||
59 | - Theme.of(context).bottomSheetTheme; | ||
60 | - final Color color = backgroundColor ?? | 58 | + final bottomSheetTheme = Theme.of(context).bottomSheetTheme; |
59 | + final color = backgroundColor ?? | ||
61 | bottomSheetTheme?.modalBackgroundColor ?? | 60 | bottomSheetTheme?.modalBackgroundColor ?? |
62 | bottomSheetTheme?.backgroundColor; | 61 | bottomSheetTheme?.backgroundColor; |
63 | - final double _elevation = elevation ?? bottomSheetTheme.elevation ?? 0; | ||
64 | - final ShapeBorder _shape = shape ?? bottomSheetTheme.shape; | ||
65 | - final Clip _clipBehavior = | 62 | + final _elevation = elevation ?? bottomSheetTheme.elevation ?? 0.0; |
63 | + final _shape = shape ?? bottomSheetTheme.shape; | ||
64 | + final _clipBehavior = | ||
66 | clipBehavior ?? bottomSheetTheme.clipBehavior ?? Clip.none; | 65 | clipBehavior ?? bottomSheetTheme.clipBehavior ?? Clip.none; |
67 | 66 | ||
68 | final result = (context, animation, child) => Material( | 67 | final result = (context, animation, child) => Material( |
@@ -40,7 +40,7 @@ class MaterialWithModalsPageRoute<T> extends MaterialPageRoute<T> { | @@ -40,7 +40,7 @@ class MaterialWithModalsPageRoute<T> extends MaterialPageRoute<T> { | ||
40 | @override | 40 | @override |
41 | void didChangeNext(Route nextRoute) { | 41 | void didChangeNext(Route nextRoute) { |
42 | if (nextRoute is ModalBottomSheetRoute) { | 42 | if (nextRoute is ModalBottomSheetRoute) { |
43 | - this._nextModalRoute = nextRoute; | 43 | + _nextModalRoute = nextRoute; |
44 | } | 44 | } |
45 | 45 | ||
46 | super.didChangeNext(nextRoute); | 46 | super.didChangeNext(nextRoute); |
@@ -60,7 +60,7 @@ class MaterialWithModalsPageRoute<T> extends MaterialPageRoute<T> { | @@ -60,7 +60,7 @@ class MaterialWithModalsPageRoute<T> extends MaterialPageRoute<T> { | ||
60 | @override | 60 | @override |
61 | Widget buildTransitions(BuildContext context, Animation<double> animation, | 61 | Widget buildTransitions(BuildContext context, Animation<double> animation, |
62 | Animation<double> secondaryAnimation, Widget child) { | 62 | Animation<double> secondaryAnimation, Widget child) { |
63 | - final PageTransitionsTheme theme = Theme.of(context).pageTransitionsTheme; | 63 | + final theme = Theme.of(context).pageTransitionsTheme; |
64 | if (_nextModalRoute != null) { | 64 | if (_nextModalRoute != null) { |
65 | if (!secondaryAnimation.isDismissed) { | 65 | if (!secondaryAnimation.isDismissed) { |
66 | // Avoid default transition theme to animate when a new modal view is pushed | 66 | // Avoid default transition theme to animate when a new modal view is pushed |
@@ -7,42 +7,42 @@ packages: | @@ -7,42 +7,42 @@ packages: | ||
7 | name: archive | 7 | name: archive |
8 | url: "https://pub.dartlang.org" | 8 | url: "https://pub.dartlang.org" |
9 | source: hosted | 9 | source: hosted |
10 | - version: "2.0.11" | 10 | + version: "2.0.13" |
11 | args: | 11 | args: |
12 | dependency: transitive | 12 | dependency: transitive |
13 | description: | 13 | description: |
14 | name: args | 14 | name: args |
15 | url: "https://pub.dartlang.org" | 15 | url: "https://pub.dartlang.org" |
16 | source: hosted | 16 | source: hosted |
17 | - version: "1.5.2" | 17 | + version: "1.6.0" |
18 | async: | 18 | async: |
19 | dependency: transitive | 19 | dependency: transitive |
20 | description: | 20 | description: |
21 | name: async | 21 | name: async |
22 | url: "https://pub.dartlang.org" | 22 | url: "https://pub.dartlang.org" |
23 | source: hosted | 23 | source: hosted |
24 | - version: "2.4.0" | 24 | + version: "2.4.1" |
25 | boolean_selector: | 25 | boolean_selector: |
26 | dependency: transitive | 26 | dependency: transitive |
27 | description: | 27 | description: |
28 | name: boolean_selector | 28 | name: boolean_selector |
29 | url: "https://pub.dartlang.org" | 29 | url: "https://pub.dartlang.org" |
30 | source: hosted | 30 | source: hosted |
31 | - version: "1.0.5" | 31 | + version: "2.0.0" |
32 | charcode: | 32 | charcode: |
33 | dependency: transitive | 33 | dependency: transitive |
34 | description: | 34 | description: |
35 | name: charcode | 35 | name: charcode |
36 | url: "https://pub.dartlang.org" | 36 | url: "https://pub.dartlang.org" |
37 | source: hosted | 37 | source: hosted |
38 | - version: "1.1.2" | 38 | + version: "1.1.3" |
39 | collection: | 39 | collection: |
40 | dependency: transitive | 40 | dependency: transitive |
41 | description: | 41 | description: |
42 | name: collection | 42 | name: collection |
43 | url: "https://pub.dartlang.org" | 43 | url: "https://pub.dartlang.org" |
44 | source: hosted | 44 | source: hosted |
45 | - version: "1.14.11" | 45 | + version: "1.14.12" |
46 | convert: | 46 | convert: |
47 | dependency: transitive | 47 | dependency: transitive |
48 | description: | 48 | description: |
@@ -56,7 +56,7 @@ packages: | @@ -56,7 +56,7 @@ packages: | ||
56 | name: crypto | 56 | name: crypto |
57 | url: "https://pub.dartlang.org" | 57 | url: "https://pub.dartlang.org" |
58 | source: hosted | 58 | source: hosted |
59 | - version: "2.1.3" | 59 | + version: "2.1.4" |
60 | flutter: | 60 | flutter: |
61 | dependency: "direct main" | 61 | dependency: "direct main" |
62 | description: flutter | 62 | description: flutter |
@@ -73,7 +73,7 @@ packages: | @@ -73,7 +73,7 @@ packages: | ||
73 | name: image | 73 | name: image |
74 | url: "https://pub.dartlang.org" | 74 | url: "https://pub.dartlang.org" |
75 | source: hosted | 75 | source: hosted |
76 | - version: "2.1.4" | 76 | + version: "2.1.12" |
77 | matcher: | 77 | matcher: |
78 | dependency: transitive | 78 | dependency: transitive |
79 | description: | 79 | description: |
@@ -96,26 +96,26 @@ packages: | @@ -96,26 +96,26 @@ packages: | ||
96 | source: hosted | 96 | source: hosted |
97 | version: "1.6.4" | 97 | version: "1.6.4" |
98 | pedantic: | 98 | pedantic: |
99 | - dependency: transitive | 99 | + dependency: "direct dev" |
100 | description: | 100 | description: |
101 | name: pedantic | 101 | name: pedantic |
102 | url: "https://pub.dartlang.org" | 102 | url: "https://pub.dartlang.org" |
103 | source: hosted | 103 | source: hosted |
104 | - version: "1.8.0+1" | 104 | + version: "1.9.0" |
105 | petitparser: | 105 | petitparser: |
106 | dependency: transitive | 106 | dependency: transitive |
107 | description: | 107 | description: |
108 | name: petitparser | 108 | name: petitparser |
109 | url: "https://pub.dartlang.org" | 109 | url: "https://pub.dartlang.org" |
110 | source: hosted | 110 | source: hosted |
111 | - version: "2.4.0" | 111 | + version: "3.0.2" |
112 | quiver: | 112 | quiver: |
113 | dependency: transitive | 113 | dependency: transitive |
114 | description: | 114 | description: |
115 | name: quiver | 115 | name: quiver |
116 | url: "https://pub.dartlang.org" | 116 | url: "https://pub.dartlang.org" |
117 | source: hosted | 117 | source: hosted |
118 | - version: "2.0.5" | 118 | + version: "2.1.3" |
119 | sky_engine: | 119 | sky_engine: |
120 | dependency: transitive | 120 | dependency: transitive |
121 | description: flutter | 121 | description: flutter |
@@ -127,7 +127,7 @@ packages: | @@ -127,7 +127,7 @@ packages: | ||
127 | name: source_span | 127 | name: source_span |
128 | url: "https://pub.dartlang.org" | 128 | url: "https://pub.dartlang.org" |
129 | source: hosted | 129 | source: hosted |
130 | - version: "1.5.5" | 130 | + version: "1.7.0" |
131 | stack_trace: | 131 | stack_trace: |
132 | dependency: transitive | 132 | dependency: transitive |
133 | description: | 133 | description: |
@@ -162,7 +162,7 @@ packages: | @@ -162,7 +162,7 @@ packages: | ||
162 | name: test_api | 162 | name: test_api |
163 | url: "https://pub.dartlang.org" | 163 | url: "https://pub.dartlang.org" |
164 | source: hosted | 164 | source: hosted |
165 | - version: "0.2.11" | 165 | + version: "0.2.15" |
166 | typed_data: | 166 | typed_data: |
167 | dependency: transitive | 167 | dependency: transitive |
168 | description: | 168 | description: |
@@ -183,6 +183,7 @@ packages: | @@ -183,6 +183,7 @@ packages: | ||
183 | name: xml | 183 | name: xml |
184 | url: "https://pub.dartlang.org" | 184 | url: "https://pub.dartlang.org" |
185 | source: hosted | 185 | source: hosted |
186 | - version: "3.5.0" | 186 | + version: "3.7.0" |
187 | sdks: | 187 | sdks: |
188 | - dart: ">=2.4.0 <3.0.0" | 188 | + dart: ">=2.7.0 <3.0.0" |
189 | + flutter: ">=1.12.0 <2.0.0" |
1 | name: modal_bottom_sheet | 1 | name: modal_bottom_sheet |
2 | -description: 'Create flutter advanced modal bottom sheets. Material, Cupertino or your own style' | ||
3 | -version: 0.1.3 | 2 | +description: 'Create awesome and powerful modal bottom sheets. Material, Cupertino or create your own' |
3 | +version: 0.1.4 | ||
4 | homepage: 'https://github.com/jamesblasco/modal_bottom_sheet' | 4 | homepage: 'https://github.com/jamesblasco/modal_bottom_sheet' |
5 | 5 | ||
6 | environment: | 6 | environment: |
@@ -14,6 +14,7 @@ dependencies: | @@ -14,6 +14,7 @@ dependencies: | ||
14 | dev_dependencies: | 14 | dev_dependencies: |
15 | flutter_test: | 15 | flutter_test: |
16 | sdk: flutter | 16 | sdk: flutter |
17 | + pedantic: ^1.9.0 | ||
17 | 18 | ||
18 | # For information on the generic Dart part of this file, see the | 19 | # For information on the generic Dart part of this file, see the |
19 | # following page: https://dart.dev/tools/pub/pubspec | 20 | # following page: https://dart.dev/tools/pub/pubspec |
-
Please register or login to post a comment