diff --git a/lib/date_picker.dart b/lib/date_picker.dart index 1efad9b..e225643 100644 --- a/lib/date_picker.dart +++ b/lib/date_picker.dart @@ -86,6 +86,7 @@ class DatePicker { /// backgroundColor: [Color] background color of the dialog /// itemTextStyle: [TextStyle] item TextStyle of the picker /// titleText: [String] text of the dialog's title + /// titleTextStyle: [TextStyle] item TextStyle of the dialog's title /// confirmText: [String] text of the dialog's confirm button /// cancelText: [String] text of the dialog's cancel button static Future showSimpleDatePicker( @@ -100,6 +101,7 @@ class DatePicker { Color? textColor, TextStyle? itemTextStyle, String? titleText, + TextStyle? titleTextStyle, String? confirmText, String? cancelText, bool looping: false, @@ -136,18 +138,16 @@ class DatePicker { initialDate = DateTime.now(); } - if (backgroundColor == null) - backgroundColor = DateTimePickerTheme.Default.backgroundColor; + if (backgroundColor == null) backgroundColor = DateTimePickerTheme.Default.backgroundColor; // if (itemTextStyle == null) // itemTextStyle = DateTimePickerTheme.Default.itemTextStyle; - if (textColor == null) - textColor = DateTimePickerTheme.Default.itemTextStyle.color; + if (textColor == null) textColor = DateTimePickerTheme.Default.itemTextStyle.color; var datePickerDialog = AlertDialog( title: Text( titleText ?? "Select Date", - style: TextStyle(color: textColor), + style: titleTextStyle ?? TextStyle(color: textColor), ), contentPadding: EdgeInsets.symmetric(vertical: 0, horizontal: 14), backgroundColor: backgroundColor, @@ -170,13 +170,9 @@ class DatePicker { looping: looping, ), ), - actions: - reverse ? listButtonActions.reversed.toList() : listButtonActions, + actions: reverse ? listButtonActions.reversed.toList() : listButtonActions, ); - return showDialog( - useRootNavigator: false, - context: context, - builder: (context) => datePickerDialog); + return showDialog(useRootNavigator: false, context: context, builder: (context) => datePickerDialog); } } @@ -225,14 +221,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; @@ -255,8 +249,7 @@ class _DatePickerComponent extends StatelessWidget { final _DatePickerRoute route; final double _pickerHeight; - _DatePickerComponent({required this.route, required pickerHeight}) - : this._pickerHeight = pickerHeight; + _DatePickerComponent({required this.route, required pickerHeight}) : this._pickerHeight = pickerHeight; @override Widget build(BuildContext context) { @@ -277,8 +270,7 @@ class _DatePickerComponent extends StatelessWidget { builder: (BuildContext context, Widget? child) { return ClipRect( child: CustomSingleChildLayout( - delegate: _BottomPickerLayout(route.animation!.value, - contentHeight: _pickerHeight), + delegate: _BottomPickerLayout(route.animation!.value, contentHeight: _pickerHeight), child: pickerWidget, ), ); diff --git a/pubspec.yaml b/pubspec.yaml index 93ab4db..cb81bcb 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -4,7 +4,7 @@ version: 1.0.3 homepage: https://github.com/kfiross/flutter_holo_date_picker environment: - sdk: '>=2.12.0 <3.0.0' + sdk: ">=2.12.0 <3.0.0" dependencies: flutter: