|
|
@@ -36,9 +36,13 @@ class DatePicker {
|
|
|
onConfirm: onConfirm,
|
|
|
locale: locale,
|
|
|
theme: theme,
|
|
|
- barrierLabel: MaterialLocalizations.of(context).modalBarrierDismissLabel,
|
|
|
+ barrierLabel:
|
|
|
+ MaterialLocalizations.of(context).modalBarrierDismissLabel,
|
|
|
pickerModel: DatePickerModel(
|
|
|
- currentTime: currentTime, maxTime: maxTime, minTime: minTime, locale: locale)));
|
|
|
+ currentTime: currentTime,
|
|
|
+ maxTime: maxTime,
|
|
|
+ minTime: minTime,
|
|
|
+ locale: locale)));
|
|
|
}
|
|
|
|
|
|
///
|
|
|
@@ -61,8 +65,10 @@ class DatePicker {
|
|
|
onConfirm: onConfirm,
|
|
|
locale: locale,
|
|
|
theme: theme,
|
|
|
- barrierLabel: MaterialLocalizations.of(context).modalBarrierDismissLabel,
|
|
|
- pickerModel: TimePickerModel(currentTime: currentTime, locale: locale)));
|
|
|
+ barrierLabel:
|
|
|
+ MaterialLocalizations.of(context).modalBarrierDismissLabel,
|
|
|
+ pickerModel:
|
|
|
+ TimePickerModel(currentTime: currentTime, locale: locale)));
|
|
|
}
|
|
|
|
|
|
///
|
|
|
@@ -85,8 +91,10 @@ class DatePicker {
|
|
|
onConfirm: onConfirm,
|
|
|
locale: locale,
|
|
|
theme: theme,
|
|
|
- barrierLabel: MaterialLocalizations.of(context).modalBarrierDismissLabel,
|
|
|
- pickerModel: DateTimePickerModel(currentTime: currentTime, locale: locale)));
|
|
|
+ barrierLabel:
|
|
|
+ MaterialLocalizations.of(context).modalBarrierDismissLabel,
|
|
|
+ pickerModel:
|
|
|
+ DateTimePickerModel(currentTime: currentTime, locale: locale)));
|
|
|
}
|
|
|
|
|
|
///
|
|
|
@@ -109,7 +117,8 @@ class DatePicker {
|
|
|
onConfirm: onConfirm,
|
|
|
locale: locale,
|
|
|
theme: theme,
|
|
|
- barrierLabel: MaterialLocalizations.of(context).modalBarrierDismissLabel,
|
|
|
+ barrierLabel:
|
|
|
+ MaterialLocalizations.of(context).modalBarrierDismissLabel,
|
|
|
pickerModel: pickerModel));
|
|
|
}
|
|
|
}
|
|
|
@@ -152,13 +161,14 @@ class _DatePickerRoute<T> extends PopupRoute<T> {
|
|
|
@override
|
|
|
AnimationController createAnimationController() {
|
|
|
assert(_animationController == null);
|
|
|
- _animationController = BottomSheet.createAnimationController(navigator.overlay);
|
|
|
+ _animationController =
|
|
|
+ BottomSheet.createAnimationController(navigator.overlay);
|
|
|
return _animationController;
|
|
|
}
|
|
|
|
|
|
@override
|
|
|
- Widget buildPage(
|
|
|
- BuildContext context, Animation<double> animation, Animation<double> secondaryAnimation) {
|
|
|
+ Widget buildPage(BuildContext context, Animation<double> animation,
|
|
|
+ Animation<double> secondaryAnimation) {
|
|
|
Widget bottomSheet = new MediaQuery.removePadding(
|
|
|
context: context,
|
|
|
removeTop: true,
|
|
|
@@ -179,7 +189,11 @@ class _DatePickerRoute<T> extends PopupRoute<T> {
|
|
|
|
|
|
class _DatePickerComponent extends StatefulWidget {
|
|
|
_DatePickerComponent(
|
|
|
- {Key key, @required this.route, this.onChanged, this.locale, this.pickerModel});
|
|
|
+ {Key key,
|
|
|
+ @required this.route,
|
|
|
+ this.onChanged,
|
|
|
+ this.locale,
|
|
|
+ this.pickerModel});
|
|
|
|
|
|
final DateChangedCallback onChanged;
|
|
|
|
|
|
@@ -205,12 +219,12 @@ class _DatePickerState extends State<_DatePickerComponent> {
|
|
|
}
|
|
|
|
|
|
void refreshScrollOffset() {
|
|
|
- leftScrollCtrl =
|
|
|
- new FixedExtentScrollController(initialItem: widget.pickerModel.currentLeftIndex());
|
|
|
- middleScrollCtrl =
|
|
|
- new FixedExtentScrollController(initialItem: widget.pickerModel.currentMiddleIndex());
|
|
|
- rightScrollCtrl =
|
|
|
- new FixedExtentScrollController(initialItem: widget.pickerModel.currentRightIndex());
|
|
|
+ leftScrollCtrl = new FixedExtentScrollController(
|
|
|
+ initialItem: widget.pickerModel.currentLeftIndex());
|
|
|
+ middleScrollCtrl = new FixedExtentScrollController(
|
|
|
+ initialItem: widget.pickerModel.currentMiddleIndex());
|
|
|
+ rightScrollCtrl = new FixedExtentScrollController(
|
|
|
+ initialItem: widget.pickerModel.currentRightIndex());
|
|
|
}
|
|
|
|
|
|
@override
|
|
|
@@ -222,7 +236,8 @@ class _DatePickerState extends State<_DatePickerComponent> {
|
|
|
builder: (BuildContext context, Widget child) {
|
|
|
return new ClipRect(
|
|
|
child: new CustomSingleChildLayout(
|
|
|
- delegate: new _BottomPickerLayout(widget.route.animation.value, theme,
|
|
|
+ delegate: new _BottomPickerLayout(
|
|
|
+ widget.route.animation.value, theme,
|
|
|
showTitleActions: widget.route.showTitleActions),
|
|
|
child: new GestureDetector(
|
|
|
child: Material(
|
|
|
@@ -269,7 +284,8 @@ class _DatePickerState extends State<_DatePickerComponent> {
|
|
|
child: Container(
|
|
|
padding: EdgeInsets.all(8.0),
|
|
|
height: theme.containerHeight,
|
|
|
- decoration: BoxDecoration(color: theme.backgroundColor ?? Colors.white),
|
|
|
+ decoration:
|
|
|
+ BoxDecoration(color: theme.backgroundColor ?? Colors.white),
|
|
|
child: NotificationListener(
|
|
|
onNotification: (ScrollNotification notification) {
|
|
|
if (notification.depth == 0 &&
|
|
|
@@ -350,8 +366,8 @@ class _DatePickerState extends State<_DatePickerComponent> {
|
|
|
style: theme.itemStyle,
|
|
|
),
|
|
|
_renderColumnView(
|
|
|
- ValueKey(
|
|
|
- widget.pickerModel.currentMiddleIndex() + widget.pickerModel.currentLeftIndex()),
|
|
|
+ ValueKey(widget.pickerModel.currentMiddleIndex() +
|
|
|
+ widget.pickerModel.currentLeftIndex()),
|
|
|
theme,
|
|
|
widget.pickerModel.rightStringAtIndex,
|
|
|
rightScrollCtrl,
|
|
|
@@ -415,7 +431,8 @@ class _DatePickerState extends State<_DatePickerComponent> {
|
|
|
}
|
|
|
|
|
|
class _BottomPickerLayout extends SingleChildLayoutDelegate {
|
|
|
- _BottomPickerLayout(this.progress, this.theme, {this.itemCount, this.showTitleActions});
|
|
|
+ _BottomPickerLayout(this.progress, this.theme,
|
|
|
+ {this.itemCount, this.showTitleActions});
|
|
|
|
|
|
final double progress;
|
|
|
final int itemCount;
|