Merge branch 'master' of github.com:jamesblasco/modal_bottom_sheet
Showing
52 changed files
with
805 additions
and
160 deletions
.github/workflows/flutter_web.yml
0 → 100644
1 | +name: Flutter Web | ||
2 | +on: | ||
3 | + push: | ||
4 | + branches: | ||
5 | + - master | ||
6 | +jobs: | ||
7 | + build: | ||
8 | + name: Build Web | ||
9 | + env: | ||
10 | + my_secret: ${{secrets.commit_secret}} | ||
11 | + runs-on: ubuntu-latest | ||
12 | + steps: | ||
13 | + - uses: actions/checkout@v1 | ||
14 | + - uses: subosito/flutter-action@v1 | ||
15 | + with: | ||
16 | + channel: 'dev' | ||
17 | + - run: | | ||
18 | + cd example | ||
19 | + flutter config --enable-web | ||
20 | + flutter pub get | ||
21 | + - run: | | ||
22 | + cd example | ||
23 | + flutter build web --release --dart-define=FLUTTER_WEB_USE_SKIA=true | ||
24 | + - run: | | ||
25 | + cd example/build/web | ||
26 | + git init | ||
27 | + git config --global user.email git@jaimeblasco.com | ||
28 | + git config --global user.name jamesblasco | ||
29 | + git status | ||
30 | + git remote add origin https://${{secrets.commit_secret}}@github.com/jamesblasco/modal_bottom_sheet.git | ||
31 | + git checkout -b gh-pages | ||
32 | + git add --all | ||
33 | + git commit -m "Update web" | ||
34 | + git push origin gh-pages -f |
@@ -2,4 +2,9 @@ | @@ -2,4 +2,9 @@ | ||
2 | 2 | ||
3 | ## [0.1.0] - Package Release. | 3 | ## [0.1.0] - Package Release. |
4 | 4 | ||
5 | +## [0.1.4] - Clean code and fix small bugs | ||
5 | 6 | ||
7 | +## [0.1.5] - Scroll improvements and bug fixes | ||
8 | +- Support for closing a modal with a scroll view by dragging down fast. | ||
9 | +- Fix assertion in CupertinoBottomSheet and BottomSheetRoute when using the CupetinoApp or WidgetsApp as root | ||
10 | +- Fix assertion when scrollController isn't used by the builder |
1 | -TODO: Add your license here. | 1 | +MIT License |
2 | + | ||
3 | +Copyright (c) 2020 Jaime Blasco | ||
4 | + | ||
5 | +Permission is hereby granted, free of charge, to any person obtaining a copy | ||
6 | +of this software and associated documentation files (the "Software"), to deal | ||
7 | +in the Software without restriction, including without limitation the rights | ||
8 | +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
9 | +copies of the Software, and to permit persons to whom the Software is | ||
10 | +furnished to do so, subject to the following conditions: | ||
11 | + | ||
12 | +The above copyright notice and this permission notice shall be included in all | ||
13 | +copies or substantial portions of the Software. | ||
14 | + | ||
15 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
16 | +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
17 | +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
18 | +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
19 | +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
20 | +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
21 | +SOFTWARE. |
1 | -<img src="https://github.com/jamesblasco/modal_bottom_sheet/blob/master/screenshots/preview.png?raw=true"> | 1 | +<a href="https://jamesblasco.github.io/modal_bottom_sheet/#/"><img src="https://github.com/jamesblasco/modal_bottom_sheet/blob/master/screenshots/preview.png?raw=true"></a> |
2 | 2 | ||
3 | # Flutter Modal Bottom Sheet | 3 | # Flutter Modal Bottom Sheet |
4 | 4 | ||
5 | -Create awesome and powerful modal bottom sheets | 5 | +Create awesome and powerful modal bottom sheets. |
6 | + | ||
7 | + | ||
6 | 8 | ||
7 | | Cupertino Modal | Multiple Modals | Material Modal | Bar Modal | Create your own | | 9 | | Cupertino Modal | Multiple Modals | Material Modal | Bar Modal | Create your own | |
8 | |---|---|---|---|---| | 10 | |---|---|---|---|---| |
9 | |<img height="300" src="https://github.com/jamesblasco/modal_bottom_sheet/blob/master/screenshots/cupertino_shared_view.gif?raw=true">| <img height="300" src="https://github.com/jamesblasco/modal_bottom_sheet/blob/master/screenshots/modal_inside_modal.gif?raw=true">| <img height="300" src="https://github.com/jamesblasco/modal_bottom_sheet/blob/master/screenshots/material_fit.png?raw=true">|<img height="300" src="https://github.com/jamesblasco/modal_bottom_sheet/blob/master/screenshots/bar_modal.png?raw=true">| <img height="300" src="https://github.com/jamesblasco/modal_bottom_sheet/blob/master/screenshots/avatar_modal.png?raw=true">| | 11 | |<img height="300" src="https://github.com/jamesblasco/modal_bottom_sheet/blob/master/screenshots/cupertino_shared_view.gif?raw=true">| <img height="300" src="https://github.com/jamesblasco/modal_bottom_sheet/blob/master/screenshots/modal_inside_modal.gif?raw=true">| <img height="300" src="https://github.com/jamesblasco/modal_bottom_sheet/blob/master/screenshots/material_fit.png?raw=true">|<img height="300" src="https://github.com/jamesblasco/modal_bottom_sheet/blob/master/screenshots/bar_modal.png?raw=true">| <img height="300" src="https://github.com/jamesblasco/modal_bottom_sheet/blob/master/screenshots/avatar_modal.png?raw=true">| |
10 | 12 | ||
13 | +## Try it | ||
14 | + | ||
15 | +Explore the [Web Demo](https://jamesblasco.github.io/modal_bottom_sheet/#/) or clone the repository. | ||
16 | + | ||
17 | +Known problems on web demo: | ||
18 | +- Web demo can run very slow on mobile devides. | ||
19 | + | ||
20 | +- Fake status bar doesn't change color as the iOS, Android app | ||
21 | + | ||
11 | ## First Steps | 22 | ## First Steps |
12 | 23 | ||
13 | How to install it? [Follow Instructions]( | 24 | How to install it? [Follow Instructions]( |
@@ -19,11 +30,13 @@ https://pub.dev/packages/modal_bottom_sheet#-installing-tab-) | @@ -19,11 +30,13 @@ https://pub.dev/packages/modal_bottom_sheet#-installing-tab-) | ||
19 | showMaterialModalBottomSheet( | 30 | showMaterialModalBottomSheet( |
20 | context: context, | 31 | context: context, |
21 | builder: (context, scrollController) => Container(), | 32 | builder: (context, scrollController) => Container(), |
22 | -}) | 33 | +) |
23 | ``` | 34 | ``` |
24 | What to use this over flutter `showModalBottomSheet`? | 35 | What to use this over flutter `showModalBottomSheet`? |
36 | + | ||
25 | `showMaterialModalBottomSheet` supports closing bottoms sheets by dragging down even if there is a scrollview inside. | 37 | `showMaterialModalBottomSheet` supports closing bottoms sheets by dragging down even if there is a scrollview inside. |
26 | -`showModalBottomSheet` won't work correctly with scrollviews | 38 | +`showModalBottomSheet` won't work correctly with scrollviews. |
39 | +Also it supports `WillPopScope` to prevent closing the dialog | ||
27 | 40 | ||
28 | #### Generic params for all modal bottom sheets | 41 | #### Generic params for all modal bottom sheets |
29 | 42 | ||
@@ -35,7 +48,7 @@ What to use this over flutter `showModalBottomSheet`? | @@ -35,7 +48,7 @@ What to use this over flutter `showModalBottomSheet`? | ||
35 | |Color barrierColor | The `barrierColor` parameter controls the color of the scrim for this route | | 48 | |Color barrierColor | The `barrierColor` parameter controls the color of the scrim for this route | |
36 | |bool enableDrag = true| The `enableDrag` parameter specifies whether the bottom sheet can be dragged up and down and dismissed by swiping downwards. | | 49 | |bool enableDrag = true| The `enableDrag` parameter specifies whether the bottom sheet can be dragged up and down and dismissed by swiping downwards. | |
37 | |AnimationController secondAnimation| The `secondAnimation` parameter allows you to provide an animation controller that will be used to animate push/pop of the modal route. Using this param is advised against and will be probably removed in future versions | | 50 | |AnimationController secondAnimation| The `secondAnimation` parameter allows you to provide an animation controller that will be used to animate push/pop of the modal route. Using this param is advised against and will be probably removed in future versions | |
38 | -|bool bounce = false| The `enableDrag` parameter specifies if the bottom sheet can go beyond the top boundary while dragging | | 51 | +|bool bounce = false| The `bounce` parameter specifies if the bottom sheet can go beyond the top boundary while dragging | |
39 | 52 | ||
40 | 53 | ||
41 | #### Material params | 54 | #### Material params |
@@ -51,7 +64,7 @@ iOS 13 came with an amazing new modal navigation and now it is available to use | @@ -51,7 +64,7 @@ iOS 13 came with an amazing new modal navigation and now it is available to use | ||
51 | showCupertinoModalBottomSheet( | 64 | showCupertinoModalBottomSheet( |
52 | context: context, | 65 | context: context, |
53 | builder: (context, scrollController) => Container(), | 66 | builder: (context, scrollController) => Container(), |
54 | -}) | 67 | +) |
55 | ``` | 68 | ``` |
56 | See generic paramameter in the Material section above | 69 | See generic paramameter in the Material section above |
57 | 70 | ||
@@ -73,7 +86,10 @@ Notice this route type behaves the same as `MaterialPageRoute` and supports cust | @@ -73,7 +86,10 @@ Notice this route type behaves the same as `MaterialPageRoute` and supports cust | ||
73 | 86 | ||
74 | How can I change my route class? See cases: | 87 | How can I change my route class? See cases: |
75 | 88 | ||
76 | -<details><summary> 1. Using Navigator.of(context).push </summary> | 89 | +<details><summary> 1. |
90 | + | ||
91 | + Using `Navigator.of(context).push` | ||
92 | + </summary> | ||
77 | 93 | ||
78 | ```dart | 94 | ```dart |
79 | Navigator.of(context).push(MaterialPageRoute(builder: (context) => Container()));` | 95 | Navigator.of(context).push(MaterialPageRoute(builder: (context) => Container()));` |
@@ -85,8 +101,8 @@ Navigator.of(context).push(MaterialPageRoute(builder: (context) => Container())) | @@ -85,8 +101,8 @@ Navigator.of(context).push(MaterialPageRoute(builder: (context) => Container())) | ||
85 | 101 | ||
86 | </details> | 102 | </details> |
87 | 103 | ||
88 | -<details><summary> | ||
89 | - 2. | 104 | +<details><summary>2. |
105 | + | ||
90 | Using `onGenerateRoute` parameter of `MaterialApp`, `CupertinoApp` or `Navigator` | 106 | Using `onGenerateRoute` parameter of `MaterialApp`, `CupertinoApp` or `Navigator` |
91 | </summary> | 107 | </summary> |
92 | 108 | ||
@@ -106,8 +122,8 @@ Navigator.of(context).push(MaterialPageRoute(builder: (context) => Container())) | @@ -106,8 +122,8 @@ Navigator.of(context).push(MaterialPageRoute(builder: (context) => Container())) | ||
106 | 122 | ||
107 | </details> | 123 | </details> |
108 | 124 | ||
109 | - <details><summary> | ||
110 | - 3. | 125 | + <details><summary> 3. |
126 | + | ||
111 | Using `pageRouteBuilder` parameter of `WidgetApp` | 127 | Using `pageRouteBuilder` parameter of `WidgetApp` |
112 | </summary> | 128 | </summary> |
113 | 129 | ||
@@ -118,13 +134,13 @@ pageRouteBuilder: <T>(RouteSettings settings, WidgetBuilder builder) => Material | @@ -118,13 +134,13 @@ pageRouteBuilder: <T>(RouteSettings settings, WidgetBuilder builder) => Material | ||
118 | </details> | 134 | </details> |
119 | 135 | ||
120 | <details> | 136 | <details> |
121 | - <summary> | ||
122 | - 4. | 137 | + <summary>4. |
138 | + | ||
123 | Using `routes` parameter from `MaterialApp` or `CupertinoApp` | 139 | Using `routes` parameter from `MaterialApp` or `CupertinoApp` |
124 | </summary> | 140 | </summary> |
125 | 141 | ||
126 | -Unfortunately this routes are `MaterialPageRoute` and `CupertinoPageRoute` respectively and cannot be changes. | ||
127 | -You can change the way you call the previous route with one of the previous methods or try option 2 | 142 | +Unfortunately this parameter uses `MaterialPageRoute` and `CupertinoPageRoute` respectively and cannot be changed. |
143 | +You can modify the way you call the previous route with one of the previous methods or try option 2 | ||
128 | 144 | ||
129 | </details> | 145 | </details> |
130 | 146 | ||
@@ -173,7 +189,7 @@ Check in the example project `showAvatarModalBottomSheet` for how to create your | @@ -173,7 +189,7 @@ Check in the example project `showAvatarModalBottomSheet` for how to create your | ||
173 | 189 | ||
174 | ## Roadmap | 190 | ## Roadmap |
175 | 191 | ||
176 | -- [ ] Support closing by dragging fast on a modal with a scroll view. | 192 | +- [X] Support closing by dragging fast on a modal with a scroll view. |
177 | 193 | ||
178 | - [ ] Improve animation curves when user is not dragging. | 194 | - [ ] Improve animation curves when user is not dragging. |
179 | 195 |
analysis_options.yaml
0 → 100644
example/analysis_options.yaml
0 → 100644
example/assets/MacBook.jpg
0 → 100644

126 KB
example/assets/demo_image.jpeg
0 → 100644

2.08 MB
example/assets/flutter.png
0 → 100644

20.7 KB
example/assets/github.png
0 → 100644

10.2 KB
example/assets/github_app.png
0 → 100644

6.94 KB
example/assets/jaimeblasco.jpeg
0 → 100644

8.03 KB
example/assets/mail.png
0 → 100644

46.1 KB
example/assets/message.png
0 → 100644

39.5 KB
example/assets/person1.jpeg
0 → 100644

323 KB
example/assets/person2.jpeg
0 → 100644

293 KB
example/assets/person3.jpeg
0 → 100644

612 KB
example/assets/person4.jpeg
0 → 100644

1.5 MB
example/assets/slack.png
0 → 100644

14.1 KB
example/assets/twitter.png
0 → 100644

1.62 KB
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 | +# 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 | ||
83 | + | ||
84 | +post_install do |installer| | ||
85 | + installer.pods_project.targets.each do |target| | ||
86 | + target.build_configurations.each do |config| | ||
87 | + config.build_settings['ENABLE_BITCODE'] = 'NO' | ||
88 | + end | ||
89 | + end | ||
90 | +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: 1b66dae606f75376c5f2135a8290850eeb09ae83 | ||
33 | + | ||
34 | +COCOAPODS: 1.8.4 |
@@ -8,8 +8,13 @@ | @@ -8,8 +8,13 @@ | ||
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 | + 212D1E304840672EFB9BFFA7 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8D52A2E75CF34C7E6DC549F4 /* 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 */; }; |
13 | + 3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; }; | ||
14 | + 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; | ||
12 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; | 15 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; |
16 | + 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; }; | ||
17 | + 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; | ||
13 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; | 18 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; |
14 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; | 19 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; |
15 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; | 20 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; |
@@ -22,6 +27,8 @@ | @@ -22,6 +27,8 @@ | ||
22 | dstPath = ""; | 27 | dstPath = ""; |
23 | dstSubfolderSpec = 10; | 28 | dstSubfolderSpec = 10; |
24 | files = ( | 29 | files = ( |
30 | + 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */, | ||
31 | + 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */, | ||
25 | ); | 32 | ); |
26 | name = "Embed Frameworks"; | 33 | name = "Embed Frameworks"; |
27 | runOnlyForDeploymentPostprocessing = 0; | 34 | runOnlyForDeploymentPostprocessing = 0; |
@@ -31,17 +38,23 @@ | @@ -31,17 +38,23 @@ | ||
31 | /* Begin PBXFileReference section */ | 38 | /* Begin PBXFileReference section */ |
32 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; }; | 39 | 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>"; }; | 40 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; }; |
41 | + 248080BB287D735D5E630360 /* 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>"; }; | ||
34 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; }; | 42 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; }; |
43 | + 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = "<group>"; }; | ||
35 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; }; | 44 | 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>"; }; | 45 | 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>"; }; | 46 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; }; |
47 | + 8D52A2E75CF34C7E6DC549F4 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; | ||
38 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; }; | 48 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; }; |
39 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; }; | 49 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; }; |
50 | + 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = "<group>"; }; | ||
40 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; | 51 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; |
41 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; }; | 52 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; }; |
42 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; }; | 53 | 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>"; }; | 54 | 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>"; }; | 55 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; |
56 | + B3E04C271E591BD1327CA5FF /* 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>"; }; | ||
57 | + BAB1D322E537D55B4325D2C3 /* 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 */ | 58 | /* End PBXFileReference section */ |
46 | 59 | ||
47 | /* Begin PBXFrameworksBuildPhase section */ | 60 | /* Begin PBXFrameworksBuildPhase section */ |
@@ -49,16 +62,32 @@ | @@ -49,16 +62,32 @@ | ||
49 | isa = PBXFrameworksBuildPhase; | 62 | isa = PBXFrameworksBuildPhase; |
50 | buildActionMask = 2147483647; | 63 | buildActionMask = 2147483647; |
51 | files = ( | 64 | files = ( |
65 | + 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */, | ||
66 | + 3B80C3941E831B6300D905FE /* App.framework in Frameworks */, | ||
67 | + 212D1E304840672EFB9BFFA7 /* Pods_Runner.framework in Frameworks */, | ||
52 | ); | 68 | ); |
53 | runOnlyForDeploymentPostprocessing = 0; | 69 | runOnlyForDeploymentPostprocessing = 0; |
54 | }; | 70 | }; |
55 | /* End PBXFrameworksBuildPhase section */ | 71 | /* End PBXFrameworksBuildPhase section */ |
56 | 72 | ||
57 | /* Begin PBXGroup section */ | 73 | /* Begin PBXGroup section */ |
74 | + 7FA2A098790C5377E18FABC1 /* Pods */ = { | ||
75 | + isa = PBXGroup; | ||
76 | + children = ( | ||
77 | + BAB1D322E537D55B4325D2C3 /* Pods-Runner.debug.xcconfig */, | ||
78 | + B3E04C271E591BD1327CA5FF /* Pods-Runner.release.xcconfig */, | ||
79 | + 248080BB287D735D5E630360 /* Pods-Runner.profile.xcconfig */, | ||
80 | + ); | ||
81 | + name = Pods; | ||
82 | + path = Pods; | ||
83 | + sourceTree = "<group>"; | ||
84 | + }; | ||
58 | 9740EEB11CF90186004384FC /* Flutter */ = { | 85 | 9740EEB11CF90186004384FC /* Flutter */ = { |
59 | isa = PBXGroup; | 86 | isa = PBXGroup; |
60 | children = ( | 87 | children = ( |
88 | + 3B80C3931E831B6300D905FE /* App.framework */, | ||
61 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, | 89 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, |
90 | + 9740EEBA1CF902C7004384FC /* Flutter.framework */, | ||
62 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, | 91 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, |
63 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, | 92 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, |
64 | 9740EEB31CF90195004384FC /* Generated.xcconfig */, | 93 | 9740EEB31CF90195004384FC /* Generated.xcconfig */, |
@@ -72,6 +101,8 @@ | @@ -72,6 +101,8 @@ | ||
72 | 9740EEB11CF90186004384FC /* Flutter */, | 101 | 9740EEB11CF90186004384FC /* Flutter */, |
73 | 97C146F01CF9000F007C117D /* Runner */, | 102 | 97C146F01CF9000F007C117D /* Runner */, |
74 | 97C146EF1CF9000F007C117D /* Products */, | 103 | 97C146EF1CF9000F007C117D /* Products */, |
104 | + 7FA2A098790C5377E18FABC1 /* Pods */, | ||
105 | + 9D90B19A7E12B9186516773E /* Frameworks */, | ||
75 | ); | 106 | ); |
76 | sourceTree = "<group>"; | 107 | sourceTree = "<group>"; |
77 | }; | 108 | }; |
@@ -106,6 +137,14 @@ | @@ -106,6 +137,14 @@ | ||
106 | name = "Supporting Files"; | 137 | name = "Supporting Files"; |
107 | sourceTree = "<group>"; | 138 | sourceTree = "<group>"; |
108 | }; | 139 | }; |
140 | + 9D90B19A7E12B9186516773E /* Frameworks */ = { | ||
141 | + isa = PBXGroup; | ||
142 | + children = ( | ||
143 | + 8D52A2E75CF34C7E6DC549F4 /* Pods_Runner.framework */, | ||
144 | + ); | ||
145 | + name = Frameworks; | ||
146 | + sourceTree = "<group>"; | ||
147 | + }; | ||
109 | /* End PBXGroup section */ | 148 | /* End PBXGroup section */ |
110 | 149 | ||
111 | /* Begin PBXNativeTarget section */ | 150 | /* Begin PBXNativeTarget section */ |
@@ -113,12 +152,14 @@ | @@ -113,12 +152,14 @@ | ||
113 | isa = PBXNativeTarget; | 152 | isa = PBXNativeTarget; |
114 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; | 153 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; |
115 | buildPhases = ( | 154 | buildPhases = ( |
155 | + 00BBBB875F21B7EBEF944E13 /* [CP] Check Pods Manifest.lock */, | ||
116 | 9740EEB61CF901F6004384FC /* Run Script */, | 156 | 9740EEB61CF901F6004384FC /* Run Script */, |
117 | 97C146EA1CF9000F007C117D /* Sources */, | 157 | 97C146EA1CF9000F007C117D /* Sources */, |
118 | 97C146EB1CF9000F007C117D /* Frameworks */, | 158 | 97C146EB1CF9000F007C117D /* Frameworks */, |
119 | 97C146EC1CF9000F007C117D /* Resources */, | 159 | 97C146EC1CF9000F007C117D /* Resources */, |
120 | 9705A1C41CF9048500538489 /* Embed Frameworks */, | 160 | 9705A1C41CF9048500538489 /* Embed Frameworks */, |
121 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, | 161 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, |
162 | + 87338F8232AE1406F5B9308C /* [CP] Embed Pods Frameworks */, | ||
122 | ); | 163 | ); |
123 | buildRules = ( | 164 | buildRules = ( |
124 | ); | 165 | ); |
@@ -136,7 +177,7 @@ | @@ -136,7 +177,7 @@ | ||
136 | isa = PBXProject; | 177 | isa = PBXProject; |
137 | attributes = { | 178 | attributes = { |
138 | LastUpgradeCheck = 1020; | 179 | LastUpgradeCheck = 1020; |
139 | - ORGANIZATIONNAME = ""; | 180 | + ORGANIZATIONNAME = "The Chromium Authors"; |
140 | TargetAttributes = { | 181 | TargetAttributes = { |
141 | 97C146ED1CF9000F007C117D = { | 182 | 97C146ED1CF9000F007C117D = { |
142 | CreatedOnToolsVersion = 7.3.1; | 183 | CreatedOnToolsVersion = 7.3.1; |
@@ -145,7 +186,7 @@ | @@ -145,7 +186,7 @@ | ||
145 | }; | 186 | }; |
146 | }; | 187 | }; |
147 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; | 188 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; |
148 | - compatibilityVersion = "Xcode 9.3"; | 189 | + compatibilityVersion = "Xcode 3.2"; |
149 | developmentRegion = en; | 190 | developmentRegion = en; |
150 | hasScannedForEncodings = 0; | 191 | hasScannedForEncodings = 0; |
151 | knownRegions = ( | 192 | knownRegions = ( |
@@ -177,6 +218,28 @@ | @@ -177,6 +218,28 @@ | ||
177 | /* End PBXResourcesBuildPhase section */ | 218 | /* End PBXResourcesBuildPhase section */ |
178 | 219 | ||
179 | /* Begin PBXShellScriptBuildPhase section */ | 220 | /* Begin PBXShellScriptBuildPhase section */ |
221 | + 00BBBB875F21B7EBEF944E13 /* [CP] Check Pods Manifest.lock */ = { | ||
222 | + isa = PBXShellScriptBuildPhase; | ||
223 | + buildActionMask = 2147483647; | ||
224 | + files = ( | ||
225 | + ); | ||
226 | + inputFileListPaths = ( | ||
227 | + ); | ||
228 | + inputPaths = ( | ||
229 | + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", | ||
230 | + "${PODS_ROOT}/Manifest.lock", | ||
231 | + ); | ||
232 | + name = "[CP] Check Pods Manifest.lock"; | ||
233 | + outputFileListPaths = ( | ||
234 | + ); | ||
235 | + outputPaths = ( | ||
236 | + "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", | ||
237 | + ); | ||
238 | + runOnlyForDeploymentPostprocessing = 0; | ||
239 | + shellPath = /bin/sh; | ||
240 | + 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"; | ||
241 | + showEnvVarsInLog = 0; | ||
242 | + }; | ||
180 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { | 243 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { |
181 | isa = PBXShellScriptBuildPhase; | 244 | isa = PBXShellScriptBuildPhase; |
182 | buildActionMask = 2147483647; | 245 | buildActionMask = 2147483647; |
@@ -189,7 +252,22 @@ | @@ -189,7 +252,22 @@ | ||
189 | ); | 252 | ); |
190 | runOnlyForDeploymentPostprocessing = 0; | 253 | runOnlyForDeploymentPostprocessing = 0; |
191 | shellPath = /bin/sh; | 254 | shellPath = /bin/sh; |
192 | - shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; | 255 | + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin"; |
256 | + }; | ||
257 | + 87338F8232AE1406F5B9308C /* [CP] Embed Pods Frameworks */ = { | ||
258 | + isa = PBXShellScriptBuildPhase; | ||
259 | + buildActionMask = 2147483647; | ||
260 | + files = ( | ||
261 | + ); | ||
262 | + inputPaths = ( | ||
263 | + ); | ||
264 | + name = "[CP] Embed Pods Frameworks"; | ||
265 | + outputPaths = ( | ||
266 | + ); | ||
267 | + runOnlyForDeploymentPostprocessing = 0; | ||
268 | + shellPath = /bin/sh; | ||
269 | + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; | ||
270 | + showEnvVarsInLog = 0; | ||
193 | }; | 271 | }; |
194 | 9740EEB61CF901F6004384FC /* Run Script */ = { | 272 | 9740EEB61CF901F6004384FC /* Run Script */ = { |
195 | isa = PBXShellScriptBuildPhase; | 273 | isa = PBXShellScriptBuildPhase; |
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 | ||
@@ -16,9 +14,8 @@ class CupertinoSharePage extends StatelessWidget { | @@ -16,9 +14,8 @@ class CupertinoSharePage extends StatelessWidget { | ||
16 | child: Center( | 14 | child: Center( |
17 | child: Hero( | 15 | child: Hero( |
18 | tag: 'image', | 16 | tag: 'image', |
19 | - child: Image.network( | ||
20 | - 'https://images.unsplash.com/photo-1586042062881-03688ce69774')), | ||
21 | - ), | 17 | + child: Image.asset('assets/demo_image.jpeg'), |
18 | + )), | ||
22 | ), | 19 | ), |
23 | bottomNavigationBar: bottomAppBar(context)); | 20 | bottomNavigationBar: bottomAppBar(context)); |
24 | } | 21 | } |
@@ -116,22 +113,20 @@ class PhotoShareBottomSheet extends StatelessWidget { | @@ -116,22 +113,20 @@ class PhotoShareBottomSheet extends StatelessWidget { | ||
116 | borderRadius: BorderRadius.circular(12), | 113 | borderRadius: BorderRadius.circular(12), |
117 | child: Hero( | 114 | child: Hero( |
118 | tag: 'image', | 115 | tag: 'image', |
119 | - child: Image.network( | ||
120 | - 'https://images.unsplash.com/photo-1586042062881-03688ce69774'), | 116 | + child: |
117 | + Image.asset('assets/demo_image.jpeg'), | ||
121 | ))), | 118 | ))), |
122 | Padding( | 119 | Padding( |
123 | padding: EdgeInsets.symmetric(horizontal: 6), | 120 | padding: EdgeInsets.symmetric(horizontal: 6), |
124 | child: ClipRRect( | 121 | child: ClipRRect( |
125 | borderRadius: BorderRadius.circular(12), | 122 | borderRadius: BorderRadius.circular(12), |
126 | - child: Image.network( | ||
127 | - 'https://images.unsplash.com/photo-1586042062881-03688ce69774'), | 123 | + child: Image.asset('assets/demo_image.jpeg'), |
128 | )), | 124 | )), |
129 | Padding( | 125 | Padding( |
130 | padding: EdgeInsets.symmetric(horizontal: 6), | 126 | padding: EdgeInsets.symmetric(horizontal: 6), |
131 | child: ClipRRect( | 127 | child: ClipRRect( |
132 | borderRadius: BorderRadius.circular(12), | 128 | borderRadius: BorderRadius.circular(12), |
133 | - child: Image.network( | ||
134 | - 'https://images.unsplash.com/photo-1586042062881-03688ce69774'), | 129 | + child: Image.asset('assets/demo_image.jpeg'), |
135 | )), | 130 | )), |
136 | ], | 131 | ], |
137 | ), | 132 | ), |
@@ -166,8 +161,7 @@ class PhotoShareBottomSheet extends StatelessWidget { | @@ -166,8 +161,7 @@ class PhotoShareBottomSheet extends StatelessWidget { | ||
166 | width: 60, | 161 | width: 60, |
167 | decoration: BoxDecoration( | 162 | decoration: BoxDecoration( |
168 | image: DecorationImage( | 163 | image: DecorationImage( |
169 | - image: | ||
170 | - NetworkImage(app.imageUrl), | 164 | + image: AssetImage(app.imageUrl), |
171 | fit: BoxFit.cover), | 165 | fit: BoxFit.cover), |
172 | color: Colors.white, | 166 | color: Colors.white, |
173 | borderRadius: | 167 | borderRadius: |
@@ -292,7 +286,7 @@ class PhotoShareBottomSheet extends StatelessWidget { | @@ -292,7 +286,7 @@ class PhotoShareBottomSheet extends StatelessWidget { | ||
292 | children: <Widget>[ | 286 | children: <Widget>[ |
293 | Material( | 287 | Material( |
294 | child: CircleAvatar( | 288 | child: CircleAvatar( |
295 | - backgroundImage: NetworkImage( | 289 | + backgroundImage: AssetImage( |
296 | person.imageUrl, | 290 | person.imageUrl, |
297 | ), | 291 | ), |
298 | radius: 30, | 292 | radius: 30, |
@@ -338,8 +332,8 @@ class PhotoShareBottomSheet extends StatelessWidget { | @@ -338,8 +332,8 @@ class PhotoShareBottomSheet extends StatelessWidget { | ||
338 | SizedBox(width: 18), | 332 | SizedBox(width: 18), |
339 | ClipRRect( | 333 | ClipRRect( |
340 | borderRadius: BorderRadius.circular(4), | 334 | borderRadius: BorderRadius.circular(4), |
341 | - child: Image.network( | ||
342 | - 'https://images.unsplash.com/photo-1586042062881-03688ce69774', | 335 | + child: Image.asset( |
336 | + 'assets/demo_image.jpeg', | ||
343 | fit: BoxFit.cover, | 337 | fit: BoxFit.cover, |
344 | height: 40, | 338 | height: 40, |
345 | width: 40, | 339 | width: 40, |
@@ -422,31 +416,24 @@ class Item { | @@ -422,31 +416,24 @@ class Item { | ||
422 | } | 416 | } |
423 | 417 | ||
424 | final people = [ | 418 | final people = [ |
425 | - Item('MacBook Pro', | ||
426 | - 'https://www.uoduckstore.com/TDS%20Product%20Images/Apple%20MacBook%20Pro%2016%20w%20T%20Bar%20Late%202019_1.jpg'), | ||
427 | - Item('Jaime Blasco', | ||
428 | - 'https://media-exp1.licdn.com/dms/image/C5603AQGfIMBxWBRMSg/profile-displayphoto-shrink_200_200/0?e=1591833600&v=beta&t=r6xnd4oBDfb3A3IcsgliyrT_avYaeBEwRr9XtlizWq8'), | ||
429 | - Item('Mya Johnston', | ||
430 | - 'https://images.unsplash.com/photo-1520813792240-56fc4a3765a7'), | 419 | + Item('MacBook Pro', 'assets/MacBook.jpg'), |
420 | + Item('Jaime Blasco', 'assets/jaimeblasco.jpeg'), | ||
421 | + Item('Mya Johnston', 'assets/person1.jpeg'), | ||
422 | + // https://images.unsplash.com/photo-1520813792240-56fc4a3765a7' | ||
431 | Item('Maxime Nicholls', | 423 | Item('Maxime Nicholls', |
432 | - 'https://images.unsplash.com/photo-1520719627573-5e2c1a6610f0'), | 424 | + 'assets/person4.jpeg'), //https://images.unsplash.com/photo-1568707043650-eb03f2536825' |
433 | Item('Susanna Thorne', | 425 | Item('Susanna Thorne', |
434 | - 'https://images.unsplash.com/photo-1568707043650-eb03f2536825'), | ||
435 | - Item('Jarod Aguilar', | ||
436 | - 'https://images.unsplash.com/photo-1547106634-56dcd53ae883') | 426 | + 'assets/person2.jpeg'), //https://images.unsplash.com/photo-1520719627573-5e2c1a6610f0 |
427 | + Item('Jarod Aguilar', 'assets/person3.jpeg') | ||
428 | + //https://images.unsplash.com/photo-1547106634-56dcd53ae883 | ||
437 | ]; | 429 | ]; |
438 | 430 | ||
439 | final apps = [ | 431 | final apps = [ |
440 | - Item('Messages', | ||
441 | - 'https://upload.wikimedia.org/wikipedia/commons/thumb/5/51/IMessage_logo.svg/1200px-IMessage_logo.svg.png'), | ||
442 | - Item('Github', | ||
443 | - 'https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png'), | ||
444 | - Item('Slack', | ||
445 | - 'https://is3-ssl.mzstatic.com/image/thumb/Purple113/v4/6e/80/06/6e80063f-e5c8-3f20-d8d5-22dd0740f5ba/AppIcon-0-0-1x_U007emarketing-0-0-0-7-0-0-sRGB-0-0-0-GLES2_U002c0-512MB-85-220-0-0.png/246x0w.png'), | ||
446 | - Item('Twitter', | ||
447 | - 'https://cfcdnpull-creativefreedoml.netdna-ssl.com/wp-content/uploads/2015/06/Twitter-bird-white-blue2.png'), | ||
448 | - Item('Mail', | ||
449 | - 'https://upload.wikimedia.org/wikipedia/commons/thumb/4/4e/Mail_%28iOS%29.svg/1200px-Mail_%28iOS%29.svg.png'), | 432 | + Item('Messages', 'assets/message.png'), |
433 | + Item('Github', 'assets/github_app.png'), | ||
434 | + Item('Slack', 'assets/slack.png'), | ||
435 | + Item('Twitter', 'assets/twitter.png'), | ||
436 | + Item('Mail', 'assets/mail.png'), | ||
450 | ]; | 437 | ]; |
451 | 438 | ||
452 | final actions = [ | 439 | final actions = [ |
@@ -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 |
1 | import 'package:example/modals/circular_modal.dart'; | 1 | import 'package:example/modals/circular_modal.dart'; |
2 | +import 'package:example/web_frame.dart'; | ||
2 | import 'package:flutter/cupertino.dart'; | 3 | import 'package:flutter/cupertino.dart'; |
3 | import 'package:flutter/material.dart'; | 4 | import 'package:flutter/material.dart'; |
4 | 5 | ||
5 | import 'package:modal_bottom_sheet/modal_bottom_sheet.dart'; | 6 | import 'package:modal_bottom_sheet/modal_bottom_sheet.dart'; |
6 | 7 | ||
8 | +import 'modals/floating_modal.dart'; | ||
7 | import 'modals/modal_complex_all.dart'; | 9 | import 'modals/modal_complex_all.dart'; |
8 | import 'modals/modal_fit.dart'; | 10 | import 'modals/modal_fit.dart'; |
9 | import 'modals/modal_inside_modal.dart'; | 11 | import 'modals/modal_inside_modal.dart'; |
10 | -import 'modals/modal_inside_modal.dart'; | ||
11 | -import 'modals/modal_simple.dart'; | ||
12 | import 'modals/modal_will_scope.dart'; | 12 | import 'modals/modal_will_scope.dart'; |
13 | import 'modals/modal_with_navigator.dart'; | 13 | import 'modals/modal_with_navigator.dart'; |
14 | import 'modals/modal_with_scroll.dart'; | 14 | import 'modals/modal_with_scroll.dart'; |
@@ -21,6 +21,11 @@ class MyApp extends StatelessWidget { | @@ -21,6 +21,11 @@ class MyApp extends StatelessWidget { | ||
21 | @override | 21 | @override |
22 | Widget build(BuildContext context) { | 22 | Widget build(BuildContext context) { |
23 | return MaterialApp( | 23 | return MaterialApp( |
24 | + theme: ThemeData(platform: TargetPlatform.iOS), | ||
25 | + title: 'BottomSheet Modals', | ||
26 | + builder: (context, child) => WebFrame( | ||
27 | + child: child, | ||
28 | + ), | ||
24 | onGenerateRoute: (RouteSettings settings) { | 29 | onGenerateRoute: (RouteSettings settings) { |
25 | switch (settings.name) { | 30 | switch (settings.name) { |
26 | case '/': | 31 | case '/': |
@@ -35,6 +40,7 @@ class MyApp extends StatelessWidget { | @@ -35,6 +40,7 @@ class MyApp extends StatelessWidget { | ||
35 | builder: (context) => CupertinoPageScaffold( | 40 | builder: (context) => CupertinoPageScaffold( |
36 | backgroundColor: Colors.white, | 41 | backgroundColor: Colors.white, |
37 | navigationBar: CupertinoNavigationBar( | 42 | navigationBar: CupertinoNavigationBar( |
43 | + transitionBetweenRoutes: false, | ||
38 | middle: Text('Normal Navigation Presentation'), | 44 | middle: Text('Normal Navigation Presentation'), |
39 | trailing: GestureDetector( | 45 | trailing: GestureDetector( |
40 | child: Icon(Icons.arrow_upward), | 46 | child: Icon(Icons.arrow_upward), |
@@ -94,6 +100,7 @@ class _MyHomePageState extends State<MyHomePage> { | @@ -94,6 +100,7 @@ class _MyHomePageState extends State<MyHomePage> { | ||
94 | child: CupertinoPageScaffold( | 100 | child: CupertinoPageScaffold( |
95 | backgroundColor: Colors.white, | 101 | backgroundColor: Colors.white, |
96 | navigationBar: CupertinoNavigationBar( | 102 | navigationBar: CupertinoNavigationBar( |
103 | + transitionBetweenRoutes: false, | ||
97 | middle: Text('iOS13 Modal Presentation'), | 104 | middle: Text('iOS13 Modal Presentation'), |
98 | trailing: GestureDetector( | 105 | trailing: GestureDetector( |
99 | child: Icon(Icons.arrow_forward), | 106 | child: Icon(Icons.arrow_forward), |
@@ -142,6 +149,13 @@ class _MyHomePageState extends State<MyHomePage> { | @@ -142,6 +149,13 @@ class _MyHomePageState extends State<MyHomePage> { | ||
142 | scrollController: scrollController), | 149 | scrollController: scrollController), |
143 | )), | 150 | )), |
144 | ListTile( | 151 | ListTile( |
152 | + title: Text('Float Modal'), | ||
153 | + onTap: () => showFloatingModalBottomSheet( | ||
154 | + context: context, | ||
155 | + builder: (context, scrollController) => | ||
156 | + ModalFit(scrollController: scrollController), | ||
157 | + )), | ||
158 | + ListTile( | ||
145 | title: Text('Cupertino Modal fit'), | 159 | title: Text('Cupertino Modal fit'), |
146 | onTap: () => showCupertinoModalBottomSheet( | 160 | onTap: () => showCupertinoModalBottomSheet( |
147 | expand: false, | 161 | expand: false, |
@@ -151,7 +165,7 @@ class _MyHomePageState extends State<MyHomePage> { | @@ -151,7 +165,7 @@ class _MyHomePageState extends State<MyHomePage> { | ||
151 | ModalFit(scrollController: scrollController), | 165 | ModalFit(scrollController: scrollController), |
152 | )), | 166 | )), |
153 | ListTile( | 167 | ListTile( |
154 | - title: Text('Cupertino Small Modal forzed to expand'), | 168 | + title: Text('Cupertino Small Modal forced to expand'), |
155 | onTap: () => showCupertinoModalBottomSheet( | 169 | onTap: () => showCupertinoModalBottomSheet( |
156 | expand: true, | 170 | expand: true, |
157 | context: context, | 171 | context: context, |
@@ -170,7 +184,18 @@ class _MyHomePageState extends State<MyHomePage> { | @@ -170,7 +184,18 @@ class _MyHomePageState extends State<MyHomePage> { | ||
170 | scrollController: scrollController), | 184 | scrollController: scrollController), |
171 | )), | 185 | )), |
172 | ListTile( | 186 | ListTile( |
173 | - title: Text('Cupertino Navigator + Scroll + WillScope'), | 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( | ||
197 | + title: | ||
198 | + Text('Cupertino Navigator + Scroll + WillPopScope'), | ||
174 | onTap: () => showCupertinoModalBottomSheet( | 199 | onTap: () => showCupertinoModalBottomSheet( |
175 | expand: true, | 200 | expand: true, |
176 | context: context, | 201 | context: context, |
@@ -180,7 +205,7 @@ class _MyHomePageState extends State<MyHomePage> { | @@ -180,7 +205,7 @@ class _MyHomePageState extends State<MyHomePage> { | ||
180 | scrollController: scrollController), | 205 | scrollController: scrollController), |
181 | )), | 206 | )), |
182 | ListTile( | 207 | ListTile( |
183 | - title: Text('Cupertino Modal with WillScope'), | 208 | + title: Text('Cupertino Modal with WillPopScope'), |
184 | onTap: () => showCupertinoModalBottomSheet( | 209 | onTap: () => showCupertinoModalBottomSheet( |
185 | expand: true, | 210 | expand: true, |
186 | context: context, | 211 | context: context, |
example/lib/modals/floating_modal.dart
0 → 100644
1 | +import 'package:flutter/material.dart'; | ||
2 | +import 'package:flutter/widgets.dart'; | ||
3 | +import 'package:modal_bottom_sheet/modal_bottom_sheet.dart'; | ||
4 | + | ||
5 | +class FloatingModal extends StatelessWidget { | ||
6 | + final Widget child; | ||
7 | + final Color backgroundColor; | ||
8 | + | ||
9 | + const FloatingModal({Key key, this.child, this.backgroundColor}) | ||
10 | + : super(key: key); | ||
11 | + | ||
12 | + @override | ||
13 | + Widget build(BuildContext context) { | ||
14 | + return SafeArea( | ||
15 | + child: Padding( | ||
16 | + padding: EdgeInsets.symmetric(horizontal: 20), | ||
17 | + child: Material( | ||
18 | + color: backgroundColor, | ||
19 | + clipBehavior: Clip.antiAlias, | ||
20 | + borderRadius: BorderRadius.circular(12), | ||
21 | + child: child, | ||
22 | + ), | ||
23 | + ), | ||
24 | + ); | ||
25 | + } | ||
26 | +} | ||
27 | + | ||
28 | +Future<T> showFloatingModalBottomSheet<T>({ | ||
29 | + @required BuildContext context, | ||
30 | + @required ScrollWidgetBuilder builder, | ||
31 | + Color backgroundColor, | ||
32 | +}) async { | ||
33 | + final result = await showCustomModalBottomSheet( | ||
34 | + context: context, | ||
35 | + builder: builder, | ||
36 | + containerWidget: (_, animation, child) => FloatingModal( | ||
37 | + child: child, | ||
38 | + ), | ||
39 | + expand: false); | ||
40 | + | ||
41 | + return result; | ||
42 | +} |
@@ -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 |
example/lib/web_frame.dart
0 → 100644
1 | +import 'package:flutter/cupertino.dart'; | ||
2 | +import 'package:flutter/foundation.dart'; | ||
3 | +import 'package:flutter/material.dart'; | ||
4 | +import 'package:flutter/rendering.dart'; | ||
5 | +import 'package:url_launcher/url_launcher.dart'; | ||
6 | + | ||
7 | +class WebFrame extends StatelessWidget { | ||
8 | + final Widget child; | ||
9 | + | ||
10 | + const WebFrame({Key key, this.child}) : super(key: key); | ||
11 | + | ||
12 | + @override | ||
13 | + Widget build(BuildContext context) { | ||
14 | + if (kIsWeb && MediaQuery.of(context).size.width > 600) { | ||
15 | + final date = DateTime.now(); | ||
16 | + final MediaQueryData mediaQuery = MediaQueryData( | ||
17 | + size: Size(414, 896), | ||
18 | + padding: EdgeInsets.only( | ||
19 | + top: 44, | ||
20 | + bottom: 34, | ||
21 | + ), | ||
22 | + devicePixelRatio: 2, | ||
23 | + ); | ||
24 | + return Material( | ||
25 | + child: Padding( | ||
26 | + padding: EdgeInsets.all(60), | ||
27 | + child: Row( | ||
28 | + mainAxisAlignment: MainAxisAlignment.center, | ||
29 | + crossAxisAlignment: CrossAxisAlignment.stretch, | ||
30 | + children: <Widget>[ | ||
31 | + Flexible( | ||
32 | + flex: 2, | ||
33 | + key: Key('Preview'), | ||
34 | + child: FittedBox( | ||
35 | + fit: BoxFit.contain, | ||
36 | + child: Builder(builder: (context) { | ||
37 | + final device = MediaQuery( | ||
38 | + data: mediaQuery, | ||
39 | + child: Container( | ||
40 | + width: mediaQuery.size.width, | ||
41 | + height: mediaQuery.size.height, | ||
42 | + alignment: Alignment.center, | ||
43 | + child: Stack( | ||
44 | + fit: StackFit.expand, | ||
45 | + children: <Widget>[ | ||
46 | + child, | ||
47 | + Positioned( | ||
48 | + top: 0, | ||
49 | + left: 0, | ||
50 | + right: 0, | ||
51 | + height: 44, | ||
52 | + child: Row( | ||
53 | + mainAxisAlignment: | ||
54 | + MainAxisAlignment.spaceBetween, | ||
55 | + children: <Widget>[ | ||
56 | + Padding( | ||
57 | + padding: | ||
58 | + EdgeInsets.only(left: 30, top: 4), | ||
59 | + child: Text( | ||
60 | + '${date.hour}:${date.minute}', | ||
61 | + style: TextStyle( | ||
62 | + fontWeight: FontWeight.bold), | ||
63 | + )), | ||
64 | + Padding( | ||
65 | + padding: EdgeInsets.only(right: 18), | ||
66 | + child: Row( | ||
67 | + children: <Widget>[ | ||
68 | + Icon( | ||
69 | + Icons.signal_cellular_4_bar, | ||
70 | + size: 14, | ||
71 | + ), | ||
72 | + SizedBox(width: 4), | ||
73 | + Icon(Icons.wifi, size: 16), | ||
74 | + SizedBox(width: 4), | ||
75 | + Icon( | ||
76 | + CupertinoIcons.battery_charging, | ||
77 | + size: 20) | ||
78 | + ], | ||
79 | + )) | ||
80 | + ], | ||
81 | + ), | ||
82 | + ), | ||
83 | + Align( | ||
84 | + alignment: Alignment.bottomCenter, | ||
85 | + child: Container( | ||
86 | + margin: EdgeInsets.only(bottom: 8), | ||
87 | + height: 4, | ||
88 | + width: 140, | ||
89 | + decoration: BoxDecoration( | ||
90 | + color: Colors.black, | ||
91 | + borderRadius: BorderRadius.circular(4)), | ||
92 | + ), | ||
93 | + ) | ||
94 | + ], | ||
95 | + )), | ||
96 | + ); | ||
97 | + | ||
98 | + return Container( | ||
99 | + child: ClipRRect( | ||
100 | + clipBehavior: Clip.antiAlias, | ||
101 | + borderRadius: BorderRadius.circular(38.5), | ||
102 | + child: device), | ||
103 | + decoration: BoxDecoration( | ||
104 | + borderRadius: BorderRadius.circular(50), | ||
105 | + border: Border.all(color: Colors.black, width: 12)), | ||
106 | + ); | ||
107 | + }), | ||
108 | + ), | ||
109 | + ), | ||
110 | + SizedBox(width: 80), | ||
111 | + Flexible( | ||
112 | + flex: 1, | ||
113 | + child: FittedBox( | ||
114 | + fit: BoxFit.scaleDown, | ||
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( | ||
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 | + )))) | ||
153 | + ], | ||
154 | + ), | ||
155 | + ), | ||
156 | + ); | ||
157 | + } else { | ||
158 | + return child; | ||
159 | + } | ||
160 | + } | ||
161 | +} |
@@ -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 |
@@ -74,6 +74,11 @@ packages: | @@ -74,6 +74,11 @@ packages: | ||
74 | description: flutter | 74 | description: flutter |
75 | source: sdk | 75 | source: sdk |
76 | version: "0.0.0" | 76 | version: "0.0.0" |
77 | + flutter_web_plugins: | ||
78 | + dependency: transitive | ||
79 | + description: flutter | ||
80 | + source: sdk | ||
81 | + version: "0.0.0" | ||
77 | image: | 82 | image: |
78 | dependency: transitive | 83 | dependency: transitive |
79 | description: | 84 | description: |
@@ -96,12 +101,12 @@ packages: | @@ -96,12 +101,12 @@ packages: | ||
96 | source: hosted | 101 | source: hosted |
97 | version: "1.1.8" | 102 | version: "1.1.8" |
98 | modal_bottom_sheet: | 103 | modal_bottom_sheet: |
99 | - dependency: "direct dev" | 104 | + dependency: "direct main" |
100 | description: | 105 | description: |
101 | path: ".." | 106 | path: ".." |
102 | relative: true | 107 | relative: true |
103 | source: path | 108 | source: path |
104 | - version: "0.1.0" | 109 | + version: "0.1.4" |
105 | path: | 110 | path: |
106 | dependency: transitive | 111 | dependency: transitive |
107 | description: | 112 | description: |
@@ -123,6 +128,13 @@ packages: | @@ -123,6 +128,13 @@ packages: | ||
123 | url: "https://pub.dartlang.org" | 128 | url: "https://pub.dartlang.org" |
124 | source: hosted | 129 | source: hosted |
125 | version: "2.4.0" | 130 | version: "2.4.0" |
131 | + plugin_platform_interface: | ||
132 | + dependency: transitive | ||
133 | + description: | ||
134 | + name: plugin_platform_interface | ||
135 | + url: "https://pub.dartlang.org" | ||
136 | + source: hosted | ||
137 | + version: "1.0.2" | ||
126 | quiver: | 138 | quiver: |
127 | dependency: transitive | 139 | dependency: transitive |
128 | description: | 140 | description: |
@@ -184,6 +196,34 @@ packages: | @@ -184,6 +196,34 @@ packages: | ||
184 | url: "https://pub.dartlang.org" | 196 | url: "https://pub.dartlang.org" |
185 | source: hosted | 197 | source: hosted |
186 | version: "1.1.6" | 198 | version: "1.1.6" |
199 | + url_launcher: | ||
200 | + dependency: "direct main" | ||
201 | + description: | ||
202 | + name: url_launcher | ||
203 | + url: "https://pub.dartlang.org" | ||
204 | + source: hosted | ||
205 | + version: "5.4.2" | ||
206 | + url_launcher_macos: | ||
207 | + dependency: transitive | ||
208 | + description: | ||
209 | + name: url_launcher_macos | ||
210 | + url: "https://pub.dartlang.org" | ||
211 | + source: hosted | ||
212 | + version: "0.0.1+4" | ||
213 | + url_launcher_platform_interface: | ||
214 | + dependency: transitive | ||
215 | + description: | ||
216 | + name: url_launcher_platform_interface | ||
217 | + url: "https://pub.dartlang.org" | ||
218 | + source: hosted | ||
219 | + version: "1.0.6" | ||
220 | + url_launcher_web: | ||
221 | + dependency: transitive | ||
222 | + description: | ||
223 | + name: url_launcher_web | ||
224 | + url: "https://pub.dartlang.org" | ||
225 | + source: hosted | ||
226 | + version: "0.1.1+1" | ||
187 | vector_math: | 227 | vector_math: |
188 | dependency: transitive | 228 | dependency: transitive |
189 | description: | 229 | description: |
@@ -199,4 +239,5 @@ packages: | @@ -199,4 +239,5 @@ packages: | ||
199 | source: hosted | 239 | source: hosted |
200 | version: "3.5.0" | 240 | version: "3.5.0" |
201 | sdks: | 241 | sdks: |
202 | - dart: ">=2.4.0 <3.0.0" | 242 | + dart: ">=2.7.0 <3.0.0" |
243 | + flutter: ">=1.12.8 <2.0.0" |
@@ -14,11 +14,14 @@ description: A new Flutter project. | @@ -14,11 +14,14 @@ 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: |
21 | sdk: flutter | 21 | sdk: flutter |
22 | + url_launcher: ^5.4.2 | ||
23 | + modal_bottom_sheet: | ||
24 | + path: '../' | ||
22 | 25 | ||
23 | 26 | ||
24 | # The following adds the Cupertino Icons font to your application. | 27 | # The following adds the Cupertino Icons font to your application. |
@@ -28,8 +31,6 @@ dependencies: | @@ -28,8 +31,6 @@ dependencies: | ||
28 | dev_dependencies: | 31 | dev_dependencies: |
29 | flutter_test: | 32 | flutter_test: |
30 | sdk: flutter | 33 | sdk: flutter |
31 | - modal_bottom_sheet: | ||
32 | - path: '../' | ||
33 | 34 | ||
34 | # For information on the generic Dart part of this file, see the | 35 | # For information on the generic Dart part of this file, see the |
35 | # following page: https://dart.dev/tools/pub/pubspec | 36 | # following page: https://dart.dev/tools/pub/pubspec |
@@ -42,6 +43,8 @@ flutter: | @@ -42,6 +43,8 @@ flutter: | ||
42 | # the material Icons class. | 43 | # the material Icons class. |
43 | uses-material-design: true | 44 | uses-material-design: true |
44 | 45 | ||
46 | + assets: | ||
47 | + - assets/ | ||
45 | # To add assets to your application, add an assets section, like this: | 48 | # To add assets to your application, add an assets section, like this: |
46 | # assets: | 49 | # assets: |
47 | # - images/a_dot_burr.jpeg | 50 | # - images/a_dot_burr.jpeg |
example/web/icons/image.png
0 → 100644

609 KB
@@ -3,7 +3,24 @@ | @@ -3,7 +3,24 @@ | ||
3 | <head> | 3 | <head> |
4 | <meta charset="UTF-8"> | 4 | <meta charset="UTF-8"> |
5 | <meta content="IE=Edge" http-equiv="X-UA-Compatible"> | 5 | <meta content="IE=Edge" http-equiv="X-UA-Compatible"> |
6 | - <meta name="description" content="A new Flutter project."> | 6 | + <!-- Primary Meta Tags --> |
7 | + <title>Flutter Modal Bottom Sheets</title> | ||
8 | + <meta name="title" content="Flutter Modal Bottom Sheets"> | ||
9 | + <meta name="description" content="Build advanced modals. Cupertino, material or create your own"> | ||
10 | + | ||
11 | + <!-- Open Graph / Facebook --> | ||
12 | + <meta property="og:type" content="website"> | ||
13 | + <meta property="og:url" content="https://jamesblasco.github.io/modal_bottom_sheet/"> | ||
14 | + <meta property="og:title" content="Flutter Modal Bottom Sheets"> | ||
15 | + <meta property="og:description" content="Build advanced modals. Cupertino, material or create your own"> | ||
16 | + <meta property="og:image" content="https://jamesblasco.github.io/modal_bottom_sheet/icons/image.png"> | ||
17 | + | ||
18 | + <!-- Twitter --> | ||
19 | + <meta property="twitter:card" content="summary_large_image"> | ||
20 | + <meta property="twitter:url" content="https://jamesblasco.github.io/modal_bottom_sheet/"> | ||
21 | + <meta property="twitter:title" content="Flutter Modal Bottom Sheets"> | ||
22 | + <meta property="twitter:description" content="Build advanced modals. Cupertino, material or create your own"> | ||
23 | + <meta property="og:image" content="https://jamesblasco.github.io/modal_bottom_sheet/icons/image.png"> | ||
7 | 24 | ||
8 | <!-- iOS meta tags & icons --> | 25 | <!-- iOS meta tags & icons --> |
9 | <meta name="apple-mobile-web-app-capable" content="yes"> | 26 | <meta name="apple-mobile-web-app-capable" content="yes"> |
@@ -14,7 +31,6 @@ | @@ -14,7 +31,6 @@ | ||
14 | <!-- Favicon --> | 31 | <!-- Favicon --> |
15 | <link rel="shortcut icon" type="image/png" href="/favicon.png"/> | 32 | <link rel="shortcut icon" type="image/png" href="/favicon.png"/> |
16 | 33 | ||
17 | - <title>example</title> | ||
18 | <link rel="manifest" href="/manifest.json"> | 34 | <link rel="manifest" href="/manifest.json"> |
19 | </head> | 35 | </head> |
20 | <body> | 36 | <body> |
@@ -24,7 +40,9 @@ | @@ -24,7 +40,9 @@ | ||
24 | <script> | 40 | <script> |
25 | if ('serviceWorker' in navigator) { | 41 | if ('serviceWorker' in navigator) { |
26 | window.addEventListener('load', function () { | 42 | window.addEventListener('load', function () { |
27 | - navigator.serviceWorker.register('/flutter_service_worker.js'); | 43 | + navigator.serviceWorker.register('flutter_service_worker.js', { |
44 | + scope: './' | ||
45 | + }); | ||
28 | }); | 46 | }); |
29 | } | 47 | } |
30 | </script> | 48 | </script> |
@@ -30,13 +30,11 @@ typedef WidgetWithChildBuilder = Widget Function( | @@ -30,13 +30,11 @@ typedef WidgetWithChildBuilder = Widget Function( | ||
30 | /// See also: | 30 | /// See also: |
31 | /// | 31 | /// |
32 | /// * [showMaterialModalBottomSheet] which can be used to display a modal bottom | 32 | /// * [showMaterialModalBottomSheet] which can be used to display a modal bottom |
33 | +/// sheet with Material appareance. | ||
34 | +/// * [showCupertinoModalBottomSheet] which can be used to display a modal bottom | ||
33 | /// sheet with Cupertino appareance. | 35 | /// sheet with Cupertino appareance. |
34 | class ModalBottomSheet extends StatefulWidget { | 36 | class ModalBottomSheet extends StatefulWidget { |
35 | /// Creates a bottom sheet. | 37 | /// Creates a bottom sheet. |
36 | - /// | ||
37 | - /// Typically, bottom sheets are created implicitly by | ||
38 | - /// [ScaffoldState.showBottomSheet], for persistent bottom sheets, or by | ||
39 | - /// [showModalBottomSheet], for modal bottom sheets. | ||
40 | const ModalBottomSheet({ | 38 | const ModalBottomSheet({ |
41 | Key key, | 39 | Key key, |
42 | this.animationController, | 40 | this.animationController, |
@@ -85,8 +83,6 @@ class ModalBottomSheet extends StatefulWidget { | @@ -85,8 +83,6 @@ class ModalBottomSheet extends StatefulWidget { | ||
85 | 83 | ||
86 | /// A builder for the contents of the sheet. | 84 | /// A builder for the contents of the sheet. |
87 | /// | 85 | /// |
88 | - /// The bottom sheet will wrap the widget produced by this builder in a | ||
89 | - /// [Material] widget. | ||
90 | final ScrollWidgetBuilder builder; | 86 | final ScrollWidgetBuilder builder; |
91 | 87 | ||
92 | /// If true, the bottom sheet can be dragged up and down and dismissed by | 88 | /// If true, the bottom sheet can be dragged up and down and dismissed by |
@@ -124,8 +120,7 @@ class _ModalBottomSheetState extends State<ModalBottomSheet> | @@ -124,8 +120,7 @@ class _ModalBottomSheetState extends State<ModalBottomSheet> | ||
124 | AnimationController _bounceDragController; | 120 | AnimationController _bounceDragController; |
125 | 121 | ||
126 | double get _childHeight { | 122 | double get _childHeight { |
127 | - final RenderBox renderBox = | ||
128 | - _childKey.currentContext.findRenderObject() as RenderBox; | 123 | + final renderBox = _childKey.currentContext.findRenderObject() as RenderBox; |
129 | return renderBox.size.height; | 124 | return renderBox.size.height; |
130 | } | 125 | } |
131 | 126 | ||
@@ -152,8 +147,9 @@ class _ModalBottomSheetState extends State<ModalBottomSheet> | @@ -152,8 +147,9 @@ class _ModalBottomSheetState extends State<ModalBottomSheet> | ||
152 | widget.animationController.forward().then((value) { | 147 | widget.animationController.forward().then((value) { |
153 | // When using WillPop, animation doesn't end at 1. | 148 | // When using WillPop, animation doesn't end at 1. |
154 | // Check more in detail the problem | 149 | // Check more in detail the problem |
155 | - if (!widget.animationController.isCompleted) | 150 | + if (!widget.animationController.isCompleted) { |
156 | widget.animationController.value = 1; | 151 | widget.animationController.value = 1; |
152 | + } | ||
157 | }); | 153 | }); |
158 | _bounceDragController.reverse(); | 154 | _bounceDragController.reverse(); |
159 | } | 155 | } |
@@ -182,7 +178,6 @@ class _ModalBottomSheetState extends State<ModalBottomSheet> | @@ -182,7 +178,6 @@ class _ModalBottomSheetState extends State<ModalBottomSheet> | ||
182 | final canClose = await shouldClose(); | 178 | final canClose = await shouldClose(); |
183 | if (canClose) { | 179 | if (canClose) { |
184 | _close(); | 180 | _close(); |
185 | - print('close'); | ||
186 | return; | 181 | return; |
187 | } else { | 182 | } else { |
188 | _cancelClose(); | 183 | _cancelClose(); |
@@ -208,7 +203,7 @@ class _ModalBottomSheetState extends State<ModalBottomSheet> | @@ -208,7 +203,7 @@ class _ModalBottomSheetState extends State<ModalBottomSheet> | ||
208 | isDragging = false; | 203 | isDragging = false; |
209 | _bounceDragController.reverse(); | 204 | _bounceDragController.reverse(); |
210 | 205 | ||
211 | - bool canClose = true; | 206 | + var canClose = true; |
212 | if (widget.shouldClose != null && hasReachedWillPopThreshold) { | 207 | if (widget.shouldClose != null && hasReachedWillPopThreshold) { |
213 | _cancelClose(); | 208 | _cancelClose(); |
214 | canClose = await shouldClose(); | 209 | canClose = await shouldClose(); |
@@ -217,12 +212,11 @@ class _ModalBottomSheetState extends State<ModalBottomSheet> | @@ -217,12 +212,11 @@ class _ModalBottomSheetState extends State<ModalBottomSheet> | ||
217 | // If speed is bigger than _minFlingVelocity try to close it | 212 | // If speed is bigger than _minFlingVelocity try to close it |
218 | if (velocity > _minFlingVelocity) { | 213 | if (velocity > _minFlingVelocity) { |
219 | _close(); | 214 | _close(); |
220 | - print('close2'); | ||
221 | } else if (hasReachedCloseThreshold) { | 215 | } else if (hasReachedCloseThreshold) { |
222 | - if (widget.animationController.value > 0.0) | 216 | + if (widget.animationController.value > 0.0) { |
223 | widget.animationController.fling(velocity: -1.0); | 217 | widget.animationController.fling(velocity: -1.0); |
218 | + } | ||
224 | _close(); | 219 | _close(); |
225 | - print('close3'); | ||
226 | } else { | 220 | } else { |
227 | _cancelClose(); | 221 | _cancelClose(); |
228 | } | 222 | } |
@@ -231,13 +225,26 @@ class _ModalBottomSheetState extends State<ModalBottomSheet> | @@ -231,13 +225,26 @@ class _ModalBottomSheetState extends State<ModalBottomSheet> | ||
231 | } | 225 | } |
232 | } | 226 | } |
233 | 227 | ||
234 | - _handleScrollUpdate(ScrollNotification notification) { | 228 | + // As we cannot access the dragGesture detector of the scroll view |
229 | + // we can not know the DragDownDetails and therefore the end velocity. | ||
230 | + // VelocityTracker it is used to calculate the end velocity of the scroll | ||
231 | + // when user is trying to close the modal by dragging | ||
232 | + VelocityTracker _velocityTracker; | ||
233 | + DateTime _startTime; | ||
234 | + | ||
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 |
238 | + if (!_scrollController.hasClients) return; | ||
239 | + | ||
237 | if (_scrollController.position.pixels != notification.metrics.pixels) { | 240 | if (_scrollController.position.pixels != notification.metrics.pixels) { |
238 | - return false; | 241 | + return; |
239 | } | 242 | } |
240 | DragUpdateDetails dragDetails; | 243 | DragUpdateDetails dragDetails; |
244 | + if (notification is ScrollStartNotification) { | ||
245 | + _velocityTracker = VelocityTracker(); | ||
246 | + _startTime = DateTime.now(); | ||
247 | + } | ||
241 | if (notification is ScrollUpdateNotification) { | 248 | if (notification is ScrollUpdateNotification) { |
242 | dragDetails = notification.dragDetails; | 249 | dragDetails = notification.dragDetails; |
243 | } | 250 | } |
@@ -245,12 +252,14 @@ class _ModalBottomSheetState extends State<ModalBottomSheet> | @@ -245,12 +252,14 @@ class _ModalBottomSheetState extends State<ModalBottomSheet> | ||
245 | dragDetails = notification.dragDetails; | 252 | dragDetails = notification.dragDetails; |
246 | } | 253 | } |
247 | if (dragDetails != null) { | 254 | if (dragDetails != null) { |
248 | - print('scroll'); | 255 | + final duration = _startTime.difference(DateTime.now()); |
256 | + final offset = Offset(0, _scrollController.offset); | ||
257 | + _velocityTracker.addPosition(duration, offset); | ||
249 | _handleDragUpdate(dragDetails.primaryDelta); | 258 | _handleDragUpdate(dragDetails.primaryDelta); |
259 | + } else if (isDragging) { | ||
260 | + final velocity = _velocityTracker.getVelocity().pixelsPerSecond.dy; | ||
261 | + _handleDragEnd(velocity); | ||
250 | } | 262 | } |
251 | - // Todo: detect dragEnd during scroll so it can bottom sheet can close | ||
252 | - // if velocity > _minFlingVelocity | ||
253 | - else if (isDragging) _handleDragEnd(0); | ||
254 | } | 263 | } |
255 | } | 264 | } |
256 | 265 | ||
@@ -270,14 +279,15 @@ class _ModalBottomSheetState extends State<ModalBottomSheet> | @@ -270,14 +279,15 @@ class _ModalBottomSheetState extends State<ModalBottomSheet> | ||
270 | curve: Curves.easeOutSine, | 279 | curve: Curves.easeOutSine, |
271 | ); | 280 | ); |
272 | 281 | ||
273 | - Widget child = widget.builder(context, _scrollController); | 282 | + var child = widget.builder(context, _scrollController); |
274 | 283 | ||
275 | - if (widget.containerBuilder != null) | 284 | + if (widget.containerBuilder != null) { |
276 | child = widget.containerBuilder( | 285 | child = widget.containerBuilder( |
277 | context, | 286 | context, |
278 | widget.animationController, | 287 | widget.animationController, |
279 | child, | 288 | child, |
280 | ); | 289 | ); |
290 | + } | ||
281 | 291 | ||
282 | // Todo: Add curved Animation when push and pop without gesture | 292 | // Todo: Add curved Animation when push and pop without gesture |
283 | /* final Animation<double> containerAnimation = CurvedAnimation( | 293 | /* final Animation<double> containerAnimation = CurvedAnimation( |
@@ -366,15 +376,14 @@ class _CustomBottomSheetLayout extends SingleChildLayoutDelegate { | @@ -366,15 +376,14 @@ class _CustomBottomSheetLayout extends SingleChildLayoutDelegate { | ||
366 | 376 | ||
367 | @override | 377 | @override |
368 | Offset getPositionForChild(Size size, Size childSize) { | 378 | Offset getPositionForChild(Size size, Size childSize) { |
369 | - if (this.childHeight == null) this.childHeight = childSize.height; | ||
370 | - | 379 | + childHeight ??= childSize.height; |
371 | return Offset(0.0, size.height - childSize.height); | 380 | return Offset(0.0, size.height - childSize.height); |
372 | } | 381 | } |
373 | 382 | ||
374 | @override | 383 | @override |
375 | bool shouldRelayout(_CustomBottomSheetLayout oldDelegate) { | 384 | bool shouldRelayout(_CustomBottomSheetLayout oldDelegate) { |
376 | if (progress != oldDelegate.progress) { | 385 | if (progress != oldDelegate.progress) { |
377 | - this.childHeight = oldDelegate.childHeight; | 386 | + childHeight = oldDelegate.childHeight; |
378 | return true; | 387 | return true; |
379 | } | 388 | } |
380 | return false; | 389 | return false; |
1 | import 'dart:async'; | 1 | import 'dart:async'; |
2 | 2 | ||
3 | import 'package:flutter/cupertino.dart'; | 3 | import 'package:flutter/cupertino.dart'; |
4 | +import 'package:flutter/foundation.dart'; | ||
4 | import 'package:flutter/material.dart'; | 5 | import 'package:flutter/material.dart'; |
5 | 6 | ||
6 | import '../modal_bottom_sheet.dart'; | 7 | import '../modal_bottom_sheet.dart'; |
@@ -32,15 +33,18 @@ class _ModalBottomSheet<T> extends StatefulWidget { | @@ -32,15 +33,18 @@ class _ModalBottomSheet<T> extends StatefulWidget { | ||
32 | } | 33 | } |
33 | 34 | ||
34 | class _ModalBottomSheetState<T> extends State<_ModalBottomSheet<T>> { | 35 | class _ModalBottomSheetState<T> extends State<_ModalBottomSheet<T>> { |
35 | - String _getRouteLabel(MaterialLocalizations localizations) { | ||
36 | - final platform = Theme.of(context).platform; | 36 | + String _getRouteLabel() { |
37 | + final platform = Theme.of(context)?.platform ?? defaultTargetPlatform; | ||
37 | switch (platform) { | 38 | switch (platform) { |
38 | case TargetPlatform.iOS: | 39 | case TargetPlatform.iOS: |
39 | return ''; | 40 | return ''; |
40 | case TargetPlatform.android: | 41 | case TargetPlatform.android: |
41 | case TargetPlatform.fuchsia: | 42 | case TargetPlatform.fuchsia: |
42 | - return localizations.dialogLabel; | ||
43 | - break; | 43 | + if (Localizations.of(context, MaterialLocalizations) != null) { |
44 | + return MaterialLocalizations.of(context).dialogLabel; | ||
45 | + } else { | ||
46 | + return DefaultMaterialLocalizations().dialogLabel; | ||
47 | + } | ||
44 | } | 48 | } |
45 | return null; | 49 | return null; |
46 | } | 50 | } |
@@ -57,17 +61,13 @@ class _ModalBottomSheetState<T> extends State<_ModalBottomSheet<T>> { | @@ -57,17 +61,13 @@ class _ModalBottomSheetState<T> extends State<_ModalBottomSheet<T>> { | ||
57 | super.dispose(); | 61 | super.dispose(); |
58 | } | 62 | } |
59 | 63 | ||
60 | - updateController() { | 64 | + void updateController() { |
61 | widget.secondAnimationController?.value = widget.route.animation.value; | 65 | widget.secondAnimationController?.value = widget.route.animation.value; |
62 | } | 66 | } |
63 | 67 | ||
64 | @override | 68 | @override |
65 | Widget build(BuildContext context) { | 69 | Widget build(BuildContext context) { |
66 | assert(debugCheckHasMediaQuery(context)); | 70 | assert(debugCheckHasMediaQuery(context)); |
67 | - assert(debugCheckHasMaterialLocalizations(context)); | ||
68 | - final MaterialLocalizations localizations = | ||
69 | - MaterialLocalizations.of(context); | ||
70 | - final String routeLabel = _getRouteLabel(localizations); | ||
71 | 71 | ||
72 | return AnimatedBuilder( | 72 | return AnimatedBuilder( |
73 | animation: widget.route._animationController, | 73 | animation: widget.route._animationController, |
@@ -77,7 +77,7 @@ class _ModalBottomSheetState<T> extends State<_ModalBottomSheet<T>> { | @@ -77,7 +77,7 @@ class _ModalBottomSheetState<T> extends State<_ModalBottomSheet<T>> { | ||
77 | return Semantics( | 77 | return Semantics( |
78 | scopesRoute: true, | 78 | scopesRoute: true, |
79 | namesRoute: true, | 79 | namesRoute: true, |
80 | - label: routeLabel, | 80 | + label: _getRouteLabel(), |
81 | explicitChildNodes: true, | 81 | explicitChildNodes: true, |
82 | child: ModalBottomSheet( | 82 | child: ModalBottomSheet( |
83 | expanded: widget.route.expanded, | 83 | expanded: widget.route.expanded, |
@@ -4,10 +4,15 @@ | @@ -4,10 +4,15 @@ | ||
4 | 4 | ||
5 | import 'dart:async'; | 5 | import 'dart:async'; |
6 | 6 | ||
7 | -import 'package:flutter/cupertino.dart'; | 7 | +import 'package:flutter/cupertino.dart' show CupertinoTheme; |
8 | import 'package:flutter/foundation.dart'; | 8 | import 'package:flutter/foundation.dart'; |
9 | import 'package:flutter/gestures.dart'; | 9 | import 'package:flutter/gestures.dart'; |
10 | -import 'package:flutter/material.dart'; | 10 | +import 'package:flutter/material.dart' |
11 | + show | ||
12 | + Colors, | ||
13 | + Theme, | ||
14 | + MaterialLocalizations, | ||
15 | + debugCheckHasMaterialLocalizations; | ||
11 | import 'package:flutter/services.dart'; | 16 | import 'package:flutter/services.dart'; |
12 | import 'package:flutter/widgets.dart'; | 17 | import 'package:flutter/widgets.dart'; |
13 | 18 | ||
@@ -85,7 +90,13 @@ Future<T> showCupertinoModalBottomSheet<T>({ | @@ -85,7 +90,13 @@ Future<T> showCupertinoModalBottomSheet<T>({ | ||
85 | assert(useRootNavigator != null); | 90 | assert(useRootNavigator != null); |
86 | assert(enableDrag != null); | 91 | assert(enableDrag != null); |
87 | assert(debugCheckHasMediaQuery(context)); | 92 | assert(debugCheckHasMediaQuery(context)); |
88 | - assert(debugCheckHasMaterialLocalizations(context)); | 93 | + final hasMaterialLocalizations = |
94 | + Localizations.of<MaterialLocalizations>(context, MaterialLocalizations) != | ||
95 | + null; | ||
96 | + final barrierLabel = hasMaterialLocalizations | ||
97 | + ? MaterialLocalizations.of(context).modalBarrierDismissLabel | ||
98 | + : ''; | ||
99 | + | ||
89 | final result = await Navigator.of(context, rootNavigator: useRootNavigator) | 100 | final result = await Navigator.of(context, rootNavigator: useRootNavigator) |
90 | .push(CupertinoModalBottomSheetRoute<T>( | 101 | .push(CupertinoModalBottomSheetRoute<T>( |
91 | builder: builder, | 102 | builder: builder, |
@@ -96,7 +107,7 @@ Future<T> showCupertinoModalBottomSheet<T>({ | @@ -96,7 +107,7 @@ Future<T> showCupertinoModalBottomSheet<T>({ | ||
96 | ), | 107 | ), |
97 | secondAnimationController: secondAnimation, | 108 | secondAnimationController: secondAnimation, |
98 | expanded: expand, | 109 | expanded: expand, |
99 | - barrierLabel: MaterialLocalizations.of(context).modalBarrierDismissLabel, | 110 | + barrierLabel: barrierLabel, |
100 | elevation: elevation, | 111 | elevation: elevation, |
101 | bounce: bounce, | 112 | bounce: bounce, |
102 | shape: shape, | 113 | shape: shape, |
@@ -184,9 +195,9 @@ class _CupertinoModalTransition extends StatelessWidget { | @@ -184,9 +195,9 @@ class _CupertinoModalTransition extends StatelessWidget { | ||
184 | 195 | ||
185 | @override | 196 | @override |
186 | Widget build(BuildContext context) { | 197 | Widget build(BuildContext context) { |
187 | - double startRoundCorner = 0; | 198 | + var startRoundCorner = 0.0; |
188 | final paddingTop = MediaQuery.of(context).padding.top; | 199 | final paddingTop = MediaQuery.of(context).padding.top; |
189 | - if (defaultTargetPlatform == TargetPlatform.iOS && paddingTop > 20) { | 200 | + if (Theme.of(context).platform == TargetPlatform.iOS && paddingTop > 20) { |
190 | startRoundCorner = 38.5; | 201 | startRoundCorner = 38.5; |
191 | //https://kylebashour.com/posts/finding-the-real-iphone-x-corner-radius | 202 | //https://kylebashour.com/posts/finding-the-real-iphone-x-corner-radius |
192 | } | 203 | } |
@@ -202,8 +213,6 @@ class _CupertinoModalTransition extends StatelessWidget { | @@ -202,8 +213,6 @@ class _CupertinoModalTransition extends StatelessWidget { | ||
202 | animation: curvedAnimation, | 213 | animation: curvedAnimation, |
203 | child: body, | 214 | child: body, |
204 | builder: (context, child) { | 215 | builder: (context, child) { |
205 | - Widget result = child; | ||
206 | - | ||
207 | final progress = curvedAnimation.value; | 216 | final progress = curvedAnimation.value; |
208 | final yOffset = progress * paddingTop; | 217 | final yOffset = progress * paddingTop; |
209 | final scale = 1 - progress / 10; | 218 | final scale = 1 - progress / 10; |
@@ -220,7 +229,7 @@ class _CupertinoModalTransition extends StatelessWidget { | @@ -220,7 +229,7 @@ class _CupertinoModalTransition extends StatelessWidget { | ||
220 | alignment: Alignment.topCenter, | 229 | alignment: Alignment.topCenter, |
221 | child: ClipRRect( | 230 | child: ClipRRect( |
222 | borderRadius: BorderRadius.circular(radius), | 231 | borderRadius: BorderRadius.circular(radius), |
223 | - child: result), | 232 | + child: child), |
224 | ), | 233 | ), |
225 | ) | 234 | ) |
226 | ], | 235 | ], |
@@ -233,6 +242,7 @@ class _CupertinoModalTransition extends StatelessWidget { | @@ -233,6 +242,7 @@ class _CupertinoModalTransition extends StatelessWidget { | ||
233 | class _CupertinoScaffold extends InheritedWidget { | 242 | class _CupertinoScaffold extends InheritedWidget { |
234 | final AnimationController animation; | 243 | final AnimationController animation; |
235 | 244 | ||
245 | + @override | ||
236 | final Widget child; | 246 | final Widget child; |
237 | 247 | ||
238 | const _CupertinoScaffold({Key key, this.animation, this.child}) | 248 | const _CupertinoScaffold({Key key, this.animation, this.child}) |
@@ -273,7 +283,12 @@ class CupertinoScaffold extends StatefulWidget { | @@ -273,7 +283,12 @@ class CupertinoScaffold extends StatefulWidget { | ||
273 | assert(useRootNavigator != null); | 283 | assert(useRootNavigator != null); |
274 | assert(enableDrag != null); | 284 | assert(enableDrag != null); |
275 | assert(debugCheckHasMediaQuery(context)); | 285 | assert(debugCheckHasMediaQuery(context)); |
286 | + final isCupertinoApp = Theme.of(context, shadowThemeOnly: true) == null; | ||
287 | + String barrierLabel = ''; | ||
288 | + if (!isCupertinoApp) { | ||
276 | assert(debugCheckHasMaterialLocalizations(context)); | 289 | assert(debugCheckHasMaterialLocalizations(context)); |
290 | + barrierLabel = MaterialLocalizations.of(context).modalBarrierDismissLabel; | ||
291 | + } | ||
277 | final result = await Navigator.of(context, rootNavigator: useRootNavigator) | 292 | final result = await Navigator.of(context, rootNavigator: useRootNavigator) |
278 | .push(CupertinoModalBottomSheetRoute<T>( | 293 | .push(CupertinoModalBottomSheetRoute<T>( |
279 | builder: builder, | 294 | builder: builder, |
@@ -283,7 +298,7 @@ class CupertinoScaffold extends StatefulWidget { | @@ -283,7 +298,7 @@ class CupertinoScaffold extends StatefulWidget { | ||
283 | backgroundColor: backgroundColor, | 298 | backgroundColor: backgroundColor, |
284 | ), | 299 | ), |
285 | expanded: expand, | 300 | expanded: expand, |
286 | - barrierLabel: MaterialLocalizations.of(context).modalBarrierDismissLabel, | 301 | + barrierLabel: barrierLabel, |
287 | bounce: bounce, | 302 | bounce: bounce, |
288 | isDismissible: isDismissible ?? expand == false ? true : false, | 303 | isDismissible: isDismissible ?? expand == false ? true : false, |
289 | modalBarrierColor: barrierColor ?? Colors.black12, | 304 | modalBarrierColor: barrierColor ?? Colors.black12, |
@@ -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 |
@@ -96,7 +96,7 @@ packages: | @@ -96,7 +96,7 @@ 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" |
@@ -186,3 +186,4 @@ packages: | @@ -186,3 +186,4 @@ packages: | ||
186 | version: "3.5.0" | 186 | version: "3.5.0" |
187 | sdks: | 187 | sdks: |
188 | dart: ">=2.4.0 <3.0.0" | 188 | dart: ">=2.4.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 iOS 13 or create your own style' |
3 | +version: 0.1.5 | ||
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.8.0+1 | ||
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