From 19dd25749022a4d3d55a177b208f3909e4457e4c Mon Sep 17 00:00:00 2001 From: Kevin Blondel Date: Wed, 10 Aug 2022 10:05:35 +0200 Subject: [PATCH 1/3] Add spacerHeight and spacerThickness options --- lib/date_picker.dart | 4 ++++ lib/widget/date_picker_widget.dart | 8 ++++++-- pubspec.yaml | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/date_picker.dart b/lib/date_picker.dart index 18770b3..6f7f01e 100644 --- a/lib/date_picker.dart +++ b/lib/date_picker.dart @@ -125,6 +125,8 @@ class DatePicker { String? cancelText, bool looping: false, bool reverse: false, + double? spacerHeight, + double? spackerThickness, }) { DateTime? _selectedDate = initialDate; final List listButtonActions = [ @@ -189,6 +191,8 @@ class DatePicker { _selectedDate = date; }), looping: looping, + spacerHeight: spacerHeight, + spacerThickness: spackerThickness, ), ), actions: diff --git a/lib/widget/date_picker_widget.dart b/lib/widget/date_picker_widget.dart index 3e1cf36..ac1a60e 100644 --- a/lib/widget/date_picker_widget.dart +++ b/lib/widget/date_picker_widget.dart @@ -26,6 +26,8 @@ class DatePickerWidget extends StatefulWidget { this.onChange, this.onConfirm, this.looping: false, + this.spacerHeight, + this.spacerThickness, }) : super(key: key) { DateTime minTime = firstDate ?? DateTime.parse(DATE_PICKER_MIN_DATETIME); DateTime maxTime = lastDate ?? DateTime.parse(DATE_PICKER_MAX_DATETIME); @@ -36,6 +38,8 @@ class DatePickerWidget extends StatefulWidget { final String? dateFormat; final DateTimePickerLocale? locale; final DateTimePickerTheme? pickerTheme; + final double? spacerHeight; + final double? spacerThickness; final DateVoidCallback? onCancel; final DateValueCallback? onChange, onConfirm; @@ -227,8 +231,8 @@ class _DatePickerWidgetState extends State { child: Divider( color: widget.pickerTheme!.dividerColor ?? widget.pickerTheme!.itemTextStyle.color, - height: 1, - thickness: 2, + height: widget.spacerHeight, + thickness: widget.spacerThickness, ), ), SizedBox(width: MediaQuery.of(context).size.width * 0.02) diff --git a/pubspec.yaml b/pubspec.yaml index c242702..389335f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_holo_date_picker description: A Flutter package of Datepicker that looks like Holo Theme in Android. -version: 1.0.6 +version: 1.0.7 homepage: https://github.com/kfiross/flutter_holo_date_picker environment: From b0e6ed72bd84302d2d6e3af6ad422c8941fbf24a Mon Sep 17 00:00:00 2001 From: Kevin Blondel Date: Wed, 10 Aug 2022 10:10:49 +0200 Subject: [PATCH 2/3] rename spacer to divider and set default values --- lib/date_picker.dart | 8 ++++---- lib/widget/date_picker_widget.dart | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/date_picker.dart b/lib/date_picker.dart index 6f7f01e..bdb42ad 100644 --- a/lib/date_picker.dart +++ b/lib/date_picker.dart @@ -125,8 +125,8 @@ class DatePicker { String? cancelText, bool looping: false, bool reverse: false, - double? spacerHeight, - double? spackerThickness, + double? dividerHeight, + double? dividerThickness, }) { DateTime? _selectedDate = initialDate; final List listButtonActions = [ @@ -191,8 +191,8 @@ class DatePicker { _selectedDate = date; }), looping: looping, - spacerHeight: spacerHeight, - spacerThickness: spackerThickness, + dividerHeight: dividerHeight, + dividerThickness: dividerThickness, ), ), actions: diff --git a/lib/widget/date_picker_widget.dart b/lib/widget/date_picker_widget.dart index ac1a60e..d4a787d 100644 --- a/lib/widget/date_picker_widget.dart +++ b/lib/widget/date_picker_widget.dart @@ -26,8 +26,8 @@ class DatePickerWidget extends StatefulWidget { this.onChange, this.onConfirm, this.looping: false, - this.spacerHeight, - this.spacerThickness, + this.dividerHeight = 1, + this.dividerThickness = 2, }) : super(key: key) { DateTime minTime = firstDate ?? DateTime.parse(DATE_PICKER_MIN_DATETIME); DateTime maxTime = lastDate ?? DateTime.parse(DATE_PICKER_MAX_DATETIME); @@ -38,8 +38,8 @@ class DatePickerWidget extends StatefulWidget { final String? dateFormat; final DateTimePickerLocale? locale; final DateTimePickerTheme? pickerTheme; - final double? spacerHeight; - final double? spacerThickness; + final double? dividerHeight; + final double? dividerThickness; final DateVoidCallback? onCancel; final DateValueCallback? onChange, onConfirm; @@ -231,8 +231,8 @@ class _DatePickerWidgetState extends State { child: Divider( color: widget.pickerTheme!.dividerColor ?? widget.pickerTheme!.itemTextStyle.color, - height: widget.spacerHeight, - thickness: widget.spacerThickness, + height: widget.dividerHeight, + thickness: widget.dividerThickness, ), ), SizedBox(width: MediaQuery.of(context).size.width * 0.02) From 6a64798358553793d50cb5222c38dafbca3c4da8 Mon Sep 17 00:00:00 2001 From: Kevin Blondel Date: Wed, 10 Aug 2022 10:18:03 +0200 Subject: [PATCH 3/3] apply dividerHeight and dividerThickness to 2nd divider --- lib/widget/date_picker_widget.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/widget/date_picker_widget.dart b/lib/widget/date_picker_widget.dart index d4a787d..07ba224 100644 --- a/lib/widget/date_picker_widget.dart +++ b/lib/widget/date_picker_widget.dart @@ -250,8 +250,8 @@ class _DatePickerWidgetState extends State { child: Divider( color: widget.pickerTheme!.dividerColor ?? widget.pickerTheme!.itemTextStyle.color, - height: 1, - thickness: 2, + height: widget.dividerHeight, + thickness: widget.dividerThickness, ), ), SizedBox(width: MediaQuery.of(context).size.width * 0.02),