Jaime Blasco

Fix analysis warnings

... ... @@ -2,4 +2,6 @@
## [0.1.0] - Package Release.
## [0.1.4] - Clean code and fix small bugs
... ...
include: package:pedantic/analysis_options.yaml
enable-experiment:
- extension-methods
\ No newline at end of file
... ...
enable-experiment:
- extension-methods
\ No newline at end of file
... ...
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
#include "Generated.xcconfig"
... ...
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "Generated.xcconfig"
... ...
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}
def parse_KV_file(file, separator='=')
file_abs_path = File.expand_path(file)
if !File.exists? file_abs_path
return [];
end
generated_key_values = {}
skip_line_start_symbols = ["#", "/"]
File.foreach(file_abs_path) do |line|
next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ }
plugin = line.split(pattern=separator)
if plugin.length == 2
podname = plugin[0].strip()
path = plugin[1].strip()
podpath = File.expand_path("#{path}", file_abs_path)
generated_key_values[podname] = podpath
else
puts "Invalid plugin specification: #{line}"
end
end
generated_key_values
end
target 'Runner' do
use_frameworks!
use_modular_headers!
# Flutter Pod
copied_flutter_dir = File.join(__dir__, 'Flutter')
copied_framework_path = File.join(copied_flutter_dir, 'Flutter.framework')
copied_podspec_path = File.join(copied_flutter_dir, 'Flutter.podspec')
unless File.exist?(copied_framework_path) && File.exist?(copied_podspec_path)
# Copy Flutter.framework and Flutter.podspec to Flutter/ to have something to link against if the xcode backend script has not run yet.
# That script will copy the correct debug/profile/release version of the framework based on the currently selected Xcode configuration.
# CocoaPods will not embed the framework on pod install (before any build phases can generate) if the dylib does not exist.
generated_xcode_build_settings_path = File.join(copied_flutter_dir, 'Generated.xcconfig')
unless File.exist?(generated_xcode_build_settings_path)
raise "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end
generated_xcode_build_settings = parse_KV_file(generated_xcode_build_settings_path)
cached_framework_dir = generated_xcode_build_settings['FLUTTER_FRAMEWORK_DIR'];
unless File.exist?(copied_framework_path)
FileUtils.cp_r(File.join(cached_framework_dir, 'Flutter.framework'), copied_flutter_dir)
end
unless File.exist?(copied_podspec_path)
FileUtils.cp(File.join(cached_framework_dir, 'Flutter.podspec'), copied_flutter_dir)
end
end
# Keep pod path relative so it can be checked into Podfile.lock.
pod 'Flutter', :path => 'Flutter'
# Plugin Pods
# Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
# referring to absolute paths on developers' machines.
system('rm -rf .symlinks')
system('mkdir -p .symlinks/plugins')
plugin_pods = parse_KV_file('../.flutter-plugins')
plugin_pods.each do |name, path|
symlink = File.join('.symlinks', 'plugins', name)
File.symlink(path, symlink)
pod name, :path => File.join(symlink, 'ios')
end
end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['ENABLE_BITCODE'] = 'NO'
end
end
end
... ...
PODS:
- Flutter (1.0.0)
- url_launcher (0.0.1):
- Flutter
- url_launcher_macos (0.0.1):
- Flutter
- url_launcher_web (0.0.1):
- Flutter
DEPENDENCIES:
- Flutter (from `Flutter`)
- url_launcher (from `.symlinks/plugins/url_launcher/ios`)
- url_launcher_macos (from `.symlinks/plugins/url_launcher_macos/ios`)
- url_launcher_web (from `.symlinks/plugins/url_launcher_web/ios`)
EXTERNAL SOURCES:
Flutter:
:path: Flutter
url_launcher:
:path: ".symlinks/plugins/url_launcher/ios"
url_launcher_macos:
:path: ".symlinks/plugins/url_launcher_macos/ios"
url_launcher_web:
:path: ".symlinks/plugins/url_launcher_web/ios"
SPEC CHECKSUMS:
Flutter: 0e3d915762c693b495b44d77113d4970485de6ec
url_launcher: a1c0cc845906122c4784c542523d8cacbded5626
url_launcher_macos: fd7894421cd39320dce5f292fc99ea9270b2a313
url_launcher_web: e5527357f037c87560776e36436bf2b0288b965c
PODFILE CHECKSUM: c34e2287a9ccaa606aeceab922830efb9a6ff69a
COCOAPODS: 1.8.4
... ...
... ... @@ -8,6 +8,7 @@
/* Begin PBXBuildFile section */
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
31E8A031F29A5C9DCEE5A35E /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0A551F173703771838A21386 /* Pods_Runner.framework */; };
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
... ... @@ -29,9 +30,12 @@
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
0A551F173703771838A21386 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
453483ADEDE58E2FFD3A0F32 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
5BE1C954520B0C4D1A5C47DF /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
... ... @@ -42,6 +46,7 @@
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
ECE24C51B4309A57743A5800 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
... ... @@ -49,12 +54,24 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
31E8A031F29A5C9DCEE5A35E /* Pods_Runner.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
03BE858701E6013D75C55192 /* Pods */ = {
isa = PBXGroup;
children = (
ECE24C51B4309A57743A5800 /* Pods-Runner.debug.xcconfig */,
453483ADEDE58E2FFD3A0F32 /* Pods-Runner.release.xcconfig */,
5BE1C954520B0C4D1A5C47DF /* Pods-Runner.profile.xcconfig */,
);
name = Pods;
path = Pods;
sourceTree = "<group>";
};
9740EEB11CF90186004384FC /* Flutter */ = {
isa = PBXGroup;
children = (
... ... @@ -72,6 +89,8 @@
9740EEB11CF90186004384FC /* Flutter */,
97C146F01CF9000F007C117D /* Runner */,
97C146EF1CF9000F007C117D /* Products */,
03BE858701E6013D75C55192 /* Pods */,
BB84F3538ADB8070C8092550 /* Frameworks */,
);
sourceTree = "<group>";
};
... ... @@ -106,6 +125,14 @@
name = "Supporting Files";
sourceTree = "<group>";
};
BB84F3538ADB8070C8092550 /* Frameworks */ = {
isa = PBXGroup;
children = (
0A551F173703771838A21386 /* Pods_Runner.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
... ... @@ -113,12 +140,14 @@
isa = PBXNativeTarget;
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
buildPhases = (
D0B7AC2EB31CC6A828ADA674 /* [CP] Check Pods Manifest.lock */,
9740EEB61CF901F6004384FC /* Run Script */,
97C146EA1CF9000F007C117D /* Sources */,
97C146EB1CF9000F007C117D /* Frameworks */,
97C146EC1CF9000F007C117D /* Resources */,
9705A1C41CF9048500538489 /* Embed Frameworks */,
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
F282B7FE454FE6B56BD6580F /* [CP] Embed Pods Frameworks */,
);
buildRules = (
);
... ... @@ -205,6 +234,48 @@
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
};
D0B7AC2EB31CC6A828ADA674 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
"${PODS_ROOT}/Manifest.lock",
);
name = "[CP] Check Pods Manifest.lock";
outputFileListPaths = (
);
outputPaths = (
"$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
F282B7FE454FE6B56BD6580F /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh",
"${PODS_ROOT}/../Flutter/Flutter.framework",
"${BUILT_PRODUCTS_DIR}/url_launcher/url_launcher.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Flutter.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/url_launcher.framework",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
... ...
... ... @@ -4,4 +4,7 @@
<FileRef
location = "group:Runner.xcodeproj">
</FileRef>
<FileRef
location = "group:Pods/Pods.xcodeproj">
</FileRef>
</Workspace>
... ...
import 'dart:ui';
import 'package:example/examples/sliver_container.dart';
import 'package:example/modals/modal_fit.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:modal_bottom_sheet/modal_bottom_sheet.dart';
... ... @@ -163,8 +161,7 @@ class PhotoShareBottomSheet extends StatelessWidget {
width: 60,
decoration: BoxDecoration(
image: DecorationImage(
image:
AssetImage(app.imageUrl),
image: AssetImage(app.imageUrl),
fit: BoxFit.cover),
color: Colors.white,
borderRadius:
... ...
... ... @@ -69,6 +69,7 @@ class _SliverGroupElement extends RenderObjectElement {
if (child == _backgroundDecoration) _backgroundDecoration = null;
if (child == _foregroundDecoration) _foregroundDecoration = null;
if (child == _sliver) _sliver = null;
super.forgetChild(child);
}
@override
... ...
... ... @@ -9,8 +9,6 @@ import 'modals/floating_modal.dart';
import 'modals/modal_complex_all.dart';
import 'modals/modal_fit.dart';
import 'modals/modal_inside_modal.dart';
import 'modals/modal_inside_modal.dart';
import 'modals/modal_simple.dart';
import 'modals/modal_will_scope.dart';
import 'modals/modal_with_navigator.dart';
import 'modals/modal_with_scroll.dart';
... ... @@ -25,7 +23,9 @@ class MyApp extends StatelessWidget {
return MaterialApp(
theme: ThemeData(platform: TargetPlatform.iOS),
title: 'BottomSheet Modals',
builder: (context, child) => WebFrame(child: child,),
builder: (context, child) => WebFrame(
child: child,
),
onGenerateRoute: (RouteSettings settings) {
switch (settings.name) {
case '/':
... ... @@ -184,6 +184,16 @@ class _MyHomePageState extends State<MyHomePage> {
scrollController: scrollController),
)),
ListTile(
title: Text('Cupertino Modal with inside navigation'),
onTap: () => showCupertinoModalBottomSheet(
expand: true,
context: context,
backgroundColor: Colors.transparent,
builder: (context, scrollController) =>
ModalWithNavigator(
scrollController: scrollController),
)),
ListTile(
title: Text('Cupertino Navigator + Scroll + WillScope'),
onTap: () => showCupertinoModalBottomSheet(
expand: true,
... ...
import 'dart:math';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart';
import 'package:modal_bottom_sheet/modal_bottom_sheet.dart';
... ...
... ... @@ -2,8 +2,6 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:modal_bottom_sheet/modal_bottom_sheet.dart';
import 'modal_with_scroll.dart';
class ModalInsideModal extends StatelessWidget {
final ScrollController scrollController;
... ...
... ... @@ -2,7 +2,6 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/services.dart';
import 'package:url_launcher/url_launcher.dart';
class WebFrame extends StatelessWidget {
... ... @@ -55,7 +54,8 @@ class WebFrame extends StatelessWidget {
MainAxisAlignment.spaceBetween,
children: <Widget>[
Padding(
padding: EdgeInsets.only(left: 30, top: 4),
padding:
EdgeInsets.only(left: 30, top: 4),
child: Text(
'${date.hour}:${date.minute}',
style: TextStyle(
... ... @@ -131,17 +131,23 @@ class WebFrame extends StatelessWidget {
overflow: TextOverflow.clip,
)),
Spacer(),
Row(children: <Widget>[
Row(
children: <Widget>[
InkWell(
onTap: () => launch('https://pub.dev/packages/modal_bottom_sheet'),
child: Image.asset('assets/flutter.png', height: 60),
onTap: () => launch(
'https://pub.dev/packages/modal_bottom_sheet'),
child: Image.asset('assets/flutter.png',
height: 60),
),
Spacer(),
InkWell(
onTap: () => launch('https://github.com/jamesblasco/modal_bottom_sheet'),
child: Image.asset('assets/github.png', height: 60),
onTap: () => launch(
'https://github.com/jamesblasco/modal_bottom_sheet'),
child: Image.asset('assets/github.png',
height: 60),
),
],)
],
)
],
))))
],
... ...
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
#include "ephemeral/Flutter-Generated.xcconfig"
... ...
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "ephemeral/Flutter-Generated.xcconfig"
... ...
... ... @@ -5,6 +5,8 @@
import FlutterMacOS
import Foundation
import url_launcher_macos
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
}
... ...
platform :osx, '10.11'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}
def parse_KV_file(file, separator='=')
file_abs_path = File.expand_path(file)
if !File.exists? file_abs_path
return [];
end
pods_ary = []
skip_line_start_symbols = ["#", "/"]
File.foreach(file_abs_path) { |line|
next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ }
plugin = line.split(pattern=separator)
if plugin.length == 2
podname = plugin[0].strip()
path = plugin[1].strip()
podpath = File.expand_path("#{path}", file_abs_path)
pods_ary.push({:name => podname, :path => podpath});
else
puts "Invalid plugin specification: #{line}"
end
}
return pods_ary
end
def pubspec_supports_macos(file)
file_abs_path = File.expand_path(file)
if !File.exists? file_abs_path
return false;
end
File.foreach(file_abs_path) { |line|
return true if line =~ /^\s*macos:/
}
return false
end
target 'Runner' do
use_frameworks!
use_modular_headers!
# Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
# referring to absolute paths on developers' machines.
ephemeral_dir = File.join('Flutter', 'ephemeral')
symlink_dir = File.join(ephemeral_dir, '.symlinks')
symlink_plugins_dir = File.join(symlink_dir, 'plugins')
system("rm -rf #{symlink_dir}")
system("mkdir -p #{symlink_plugins_dir}")
# Flutter Pods
generated_xcconfig = parse_KV_file(File.join(ephemeral_dir, 'Flutter-Generated.xcconfig'))
if generated_xcconfig.empty?
puts "Flutter-Generated.xcconfig must exist. If you're running pod install manually, make sure flutter packages get is executed first."
end
generated_xcconfig.map { |p|
if p[:name] == 'FLUTTER_FRAMEWORK_DIR'
symlink = File.join(symlink_dir, 'flutter')
File.symlink(File.dirname(p[:path]), symlink)
pod 'FlutterMacOS', :path => File.join(symlink, File.basename(p[:path]))
end
}
# Plugin Pods
plugin_pods = parse_KV_file('../.flutter-plugins')
plugin_pods.map { |p|
symlink = File.join(symlink_plugins_dir, p[:name])
File.symlink(p[:path], symlink)
if pubspec_supports_macos(File.join(symlink, 'pubspec.yaml'))
pod p[:name], :path => File.join(symlink, 'macos')
end
}
end
# Prevent Cocoapods from embedding a second Flutter framework and causing an error with the new Xcode build system.
install! 'cocoapods', :disable_input_output_paths => true
... ...
... ... @@ -14,7 +14,7 @@ description: A new Flutter project.
version: 1.0.0+1
environment:
sdk: ">=2.1.0 <3.0.0"
sdk: ">=2.7.0 <3.0.0"
dependencies:
flutter:
... ...
... ... @@ -124,8 +124,7 @@ class _ModalBottomSheetState extends State<ModalBottomSheet>
AnimationController _bounceDragController;
double get _childHeight {
final RenderBox renderBox =
_childKey.currentContext.findRenderObject() as RenderBox;
final renderBox = _childKey.currentContext.findRenderObject() as RenderBox;
return renderBox.size.height;
}
... ... @@ -152,8 +151,9 @@ class _ModalBottomSheetState extends State<ModalBottomSheet>
widget.animationController.forward().then((value) {
// When using WillPop, animation doesn't end at 1.
// Check more in detail the problem
if (!widget.animationController.isCompleted)
if (!widget.animationController.isCompleted) {
widget.animationController.value = 1;
}
});
_bounceDragController.reverse();
}
... ... @@ -208,7 +208,7 @@ class _ModalBottomSheetState extends State<ModalBottomSheet>
isDragging = false;
_bounceDragController.reverse();
bool canClose = true;
var canClose = true;
if (widget.shouldClose != null && hasReachedWillPopThreshold) {
_cancelClose();
canClose = await shouldClose();
... ... @@ -219,8 +219,9 @@ class _ModalBottomSheetState extends State<ModalBottomSheet>
_close();
print('close2');
} else if (hasReachedCloseThreshold) {
if (widget.animationController.value > 0.0)
if (widget.animationController.value > 0.0) {
widget.animationController.fling(velocity: -1.0);
}
_close();
print('close3');
} else {
... ... @@ -231,11 +232,11 @@ class _ModalBottomSheetState extends State<ModalBottomSheet>
}
}
_handleScrollUpdate(ScrollNotification notification) {
void _handleScrollUpdate(ScrollNotification notification) {
if (notification.metrics.pixels <= notification.metrics.minScrollExtent) {
//Check if listener is same from scrollController
if (_scrollController.position.pixels != notification.metrics.pixels) {
return false;
return;
}
DragUpdateDetails dragDetails;
if (notification is ScrollUpdateNotification) {
... ... @@ -270,14 +271,15 @@ class _ModalBottomSheetState extends State<ModalBottomSheet>
curve: Curves.easeOutSine,
);
Widget child = widget.builder(context, _scrollController);
var child = widget.builder(context, _scrollController);
if (widget.containerBuilder != null)
if (widget.containerBuilder != null) {
child = widget.containerBuilder(
context,
widget.animationController,
child,
);
}
// Todo: Add curved Animation when push and pop without gesture
/* final Animation<double> containerAnimation = CurvedAnimation(
... ... @@ -366,15 +368,14 @@ class _CustomBottomSheetLayout extends SingleChildLayoutDelegate {
@override
Offset getPositionForChild(Size size, Size childSize) {
if (this.childHeight == null) this.childHeight = childSize.height;
childHeight ??= childSize.height;
return Offset(0.0, size.height - childSize.height);
}
@override
bool shouldRelayout(_CustomBottomSheetLayout oldDelegate) {
if (progress != oldDelegate.progress) {
this.childHeight = oldDelegate.childHeight;
childHeight = oldDelegate.childHeight;
return true;
}
return false;
... ...
... ... @@ -57,7 +57,7 @@ class _ModalBottomSheetState<T> extends State<_ModalBottomSheet<T>> {
super.dispose();
}
updateController() {
void updateController() {
widget.secondAnimationController?.value = widget.route.animation.value;
}
... ... @@ -65,9 +65,8 @@ class _ModalBottomSheetState<T> extends State<_ModalBottomSheet<T>> {
Widget build(BuildContext context) {
assert(debugCheckHasMediaQuery(context));
assert(debugCheckHasMaterialLocalizations(context));
final MaterialLocalizations localizations =
MaterialLocalizations.of(context);
final String routeLabel = _getRouteLabel(localizations);
final localizations = MaterialLocalizations.of(context);
final routeLabel = _getRouteLabel(localizations);
return AnimatedBuilder(
animation: widget.route._animationController,
... ...
... ... @@ -176,7 +176,7 @@ class _CupertinoModalTransition extends StatelessWidget {
@override
Widget build(BuildContext context) {
double startRoundCorner = 0;
var startRoundCorner = 0.0;
final paddingTop = MediaQuery.of(context).padding.top;
if (Theme.of(context).platform == TargetPlatform.iOS && paddingTop > 20) {
startRoundCorner = 38.5;
... ... @@ -194,8 +194,6 @@ class _CupertinoModalTransition extends StatelessWidget {
animation: curvedAnimation,
child: body,
builder: (context, child) {
Widget result = child;
final progress = curvedAnimation.value;
final yOffset = progress * paddingTop;
final scale = 1 - progress / 10;
... ... @@ -212,7 +210,7 @@ class _CupertinoModalTransition extends StatelessWidget {
alignment: Alignment.topCenter,
child: ClipRRect(
borderRadius: BorderRadius.circular(radius),
child: result),
child: child),
),
)
],
... ... @@ -225,6 +223,7 @@ class _CupertinoModalTransition extends StatelessWidget {
class _CupertinoScaffold extends InheritedWidget {
final AnimationController animation;
@override
final Widget child;
const _CupertinoScaffold({Key key, this.animation, this.child})
... ...
... ... @@ -55,14 +55,13 @@ WidgetWithChildBuilder _materialContainerBuilder(BuildContext context,
ThemeData theme,
Clip clipBehavior,
ShapeBorder shape}) {
final BottomSheetThemeData bottomSheetTheme =
Theme.of(context).bottomSheetTheme;
final Color color = backgroundColor ??
final bottomSheetTheme = Theme.of(context).bottomSheetTheme;
final color = backgroundColor ??
bottomSheetTheme?.modalBackgroundColor ??
bottomSheetTheme?.backgroundColor;
final double _elevation = elevation ?? bottomSheetTheme.elevation ?? 0;
final ShapeBorder _shape = shape ?? bottomSheetTheme.shape;
final Clip _clipBehavior =
final _elevation = elevation ?? bottomSheetTheme.elevation ?? 0.0;
final _shape = shape ?? bottomSheetTheme.shape;
final _clipBehavior =
clipBehavior ?? bottomSheetTheme.clipBehavior ?? Clip.none;
final result = (context, animation, child) => Material(
... ...
... ... @@ -40,7 +40,7 @@ class MaterialWithModalsPageRoute<T> extends MaterialPageRoute<T> {
@override
void didChangeNext(Route nextRoute) {
if (nextRoute is ModalBottomSheetRoute) {
this._nextModalRoute = nextRoute;
_nextModalRoute = nextRoute;
}
super.didChangeNext(nextRoute);
... ... @@ -60,7 +60,7 @@ class MaterialWithModalsPageRoute<T> extends MaterialPageRoute<T> {
@override
Widget buildTransitions(BuildContext context, Animation<double> animation,
Animation<double> secondaryAnimation, Widget child) {
final PageTransitionsTheme theme = Theme.of(context).pageTransitionsTheme;
final theme = Theme.of(context).pageTransitionsTheme;
if (_nextModalRoute != null) {
if (!secondaryAnimation.isDismissed) {
// Avoid default transition theme to animate when a new modal view is pushed
... ...
... ... @@ -7,42 +7,42 @@ packages:
name: archive
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.11"
version: "2.0.13"
args:
dependency: transitive
description:
name: args
url: "https://pub.dartlang.org"
source: hosted
version: "1.5.2"
version: "1.6.0"
async:
dependency: transitive
description:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.4.0"
version: "2.4.1"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.5"
version: "2.0.0"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.2"
version: "1.1.3"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.dartlang.org"
source: hosted
version: "1.14.11"
version: "1.14.12"
convert:
dependency: transitive
description:
... ... @@ -56,7 +56,7 @@ packages:
name: crypto
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.3"
version: "2.1.4"
flutter:
dependency: "direct main"
description: flutter
... ... @@ -73,7 +73,7 @@ packages:
name: image
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.4"
version: "2.1.12"
matcher:
dependency: transitive
description:
... ... @@ -96,26 +96,26 @@ packages:
source: hosted
version: "1.6.4"
pedantic:
dependency: transitive
dependency: "direct dev"
description:
name: pedantic
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0+1"
version: "1.9.0"
petitparser:
dependency: transitive
description:
name: petitparser
url: "https://pub.dartlang.org"
source: hosted
version: "2.4.0"
version: "3.0.2"
quiver:
dependency: transitive
description:
name: quiver
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.5"
version: "2.1.3"
sky_engine:
dependency: transitive
description: flutter
... ... @@ -127,7 +127,7 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.5.5"
version: "1.7.0"
stack_trace:
dependency: transitive
description:
... ... @@ -162,7 +162,7 @@ packages:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.11"
version: "0.2.15"
typed_data:
dependency: transitive
description:
... ... @@ -183,6 +183,7 @@ packages:
name: xml
url: "https://pub.dartlang.org"
source: hosted
version: "3.5.0"
version: "3.7.0"
sdks:
dart: ">=2.4.0 <3.0.0"
dart: ">=2.7.0 <3.0.0"
flutter: ">=1.12.0 <2.0.0"
... ...
name: modal_bottom_sheet
description: 'Create flutter advanced modal bottom sheets. Material, Cupertino or your own style'
version: 0.1.3
description: 'Create awesome and powerful modal bottom sheets. Material, Cupertino or create your own'
version: 0.1.4
homepage: 'https://github.com/jamesblasco/modal_bottom_sheet'
environment:
... ... @@ -14,6 +14,7 @@ dependencies:
dev_dependencies:
flutter_test:
sdk: flutter
pedantic: ^1.9.0
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
... ...