From 4e7c05880f40fa72aaabb9e10c77389187f33365 Mon Sep 17 00:00:00 2001 From: dylan wu Date: Fri, 23 Aug 2019 14:29:44 +0800 Subject: [PATCH] issue fixed: #40 and #43 --- lib/src/date_picker.dart | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/lib/src/date_picker.dart b/lib/src/date_picker.dart index 2441097..9cf67cb 100644 --- a/lib/src/date_picker.dart +++ b/lib/src/date_picker.dart @@ -82,10 +82,9 @@ class DatePicker { onChange: onChange, onConfirm: onConfirm, theme: Theme.of(context, shadowThemeOnly: true), - barrierLabel: - MaterialLocalizations.of(context).modalBarrierDismissLabel, + barrierLabel: MaterialLocalizations.of(context).modalBarrierDismissLabel, ), - ).whenComplete(onClose); + ).whenComplete(onClose ?? () => {}); } } @@ -134,14 +133,12 @@ class _DatePickerRoute extends PopupRoute { @override AnimationController createAnimationController() { assert(_animationController == null); - _animationController = - BottomSheet.createAnimationController(navigator.overlay); + _animationController = BottomSheet.createAnimationController(navigator.overlay); return _animationController; } @override - Widget buildPage(BuildContext context, Animation animation, - Animation secondaryAnimation) { + Widget buildPage(BuildContext context, Animation animation, Animation secondaryAnimation) { double height = pickerTheme.pickerHeight; if (pickerTheme.title != null || pickerTheme.showTitle) { height += pickerTheme.titleHeight; @@ -164,8 +161,7 @@ class _DatePickerComponent extends StatelessWidget { final _DatePickerRoute route; final double _pickerHeight; - _DatePickerComponent({Key key, @required this.route, @required pickerHeight}) - : this._pickerHeight = pickerHeight; + _DatePickerComponent({Key key, @required this.route, @required pickerHeight}) : this._pickerHeight = pickerHeight; @override Widget build(BuildContext context) { @@ -217,8 +213,7 @@ class _DatePickerComponent extends StatelessWidget { builder: (BuildContext context, Widget child) { return new ClipRect( child: new CustomSingleChildLayout( - delegate: new _BottomPickerLayout(route.animation.value, - contentHeight: _pickerHeight), + delegate: new _BottomPickerLayout(route.animation.value, contentHeight: _pickerHeight), child: pickerWidget, ), );