mirror of
https://github.com/Iconica-Development/flutter_date_time_picker.git
synced 2025-05-18 18:33:49 +02:00
Added customization options for box encapsulating the datetimepicker (Customize shadow, add image or gradient)
This commit is contained in:
parent
5cf0cc6b38
commit
f44da5b80f
7 changed files with 41 additions and 22 deletions
|
@ -1,3 +1,6 @@
|
||||||
|
## 2.3.2
|
||||||
|
|
||||||
|
- Added customization options for box encapsulating the datetimepicker (Customize shadow, add image or gradient)
|
||||||
## 2.3.1
|
## 2.3.1
|
||||||
|
|
||||||
- Added extra customization options for datetimepicker (Customizable buttons, text formatting for weekday and month)
|
- Added extra customization options for datetimepicker (Customizable buttons, text formatting for weekday and month)
|
||||||
|
|
|
@ -50,6 +50,9 @@ class DatePickerDemo extends StatelessWidget {
|
||||||
dateFormatMonth: (value) => value.toUpperCase(),
|
dateFormatMonth: (value) => value.toUpperCase(),
|
||||||
prevIcon: (context) => const Icon(Icons.chevron_left_sharp),
|
prevIcon: (context) => const Icon(Icons.chevron_left_sharp),
|
||||||
nextIcon: (context) => const Icon(Icons.chevron_right_sharp),
|
nextIcon: (context) => const Icon(Icons.chevron_right_sharp),
|
||||||
|
shapeDecoration: const ShapeDecoration(
|
||||||
|
shape: ArrowedBorder(),
|
||||||
|
),
|
||||||
dateBoxShape: DateBoxShape.circle,
|
dateBoxShape: DateBoxShape.circle,
|
||||||
backgroundColor: Colors.white,
|
backgroundColor: Colors.white,
|
||||||
markedIndicatorColor: Colors.red,
|
markedIndicatorColor: Colors.red,
|
||||||
|
@ -74,7 +77,6 @@ class DatePickerDemo extends StatelessWidget {
|
||||||
barOpacity: 1,
|
barOpacity: 1,
|
||||||
textStyle: TextStyle(fontSize: 16, fontWeight: FontWeight.bold)),
|
textStyle: TextStyle(fontSize: 16, fontWeight: FontWeight.bold)),
|
||||||
paginationSize: 25,
|
paginationSize: 25,
|
||||||
shapeBorder: const ArrowedBorder(),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
|
|
|
@ -68,7 +68,7 @@ packages:
|
||||||
path: ".."
|
path: ".."
|
||||||
relative: true
|
relative: true
|
||||||
source: path
|
source: path
|
||||||
version: "2.3.1"
|
version: "2.3.2"
|
||||||
flutter_lints:
|
flutter_lints:
|
||||||
dependency: "direct dev"
|
dependency: "direct dev"
|
||||||
description:
|
description:
|
||||||
|
|
|
@ -22,7 +22,7 @@ class DateTimePickerTheme {
|
||||||
this.weekViewSize = 0.2,
|
this.weekViewSize = 0.2,
|
||||||
this.monthViewSize = 0.6,
|
this.monthViewSize = 0.6,
|
||||||
this.weekMonthTriggerSize = 0.3,
|
this.weekMonthTriggerSize = 0.3,
|
||||||
this.shapeBorder,
|
this.shapeDecoration,
|
||||||
this.baseTheme = const DateBoxBaseTheme(
|
this.baseTheme = const DateBoxBaseTheme(
|
||||||
Colors.white,
|
Colors.white,
|
||||||
TextStyle(color: Colors.black),
|
TextStyle(color: Colors.black),
|
||||||
|
@ -86,8 +86,10 @@ class DateTimePickerTheme {
|
||||||
/// The size of the buttons for navigation the different pages
|
/// The size of the buttons for navigation the different pages
|
||||||
final double paginationSize;
|
final double paginationSize;
|
||||||
|
|
||||||
/// The shape of the border using a [ShapeBorder]
|
/// The decoration of the box that encapsulates the date picker
|
||||||
final ShapeBorder? shapeBorder;
|
/// Requires [ShapeBorder], default shadow and backgroundcolor implemented
|
||||||
|
/// Image and gradient optional
|
||||||
|
final ShapeDecoration? shapeDecoration;
|
||||||
|
|
||||||
/// If true the first letters of the weekdays will be displayed above the days of the month
|
/// If true the first letters of the weekdays will be displayed above the days of the month
|
||||||
final bool monthWeekDayHeaders;
|
final bool monthWeekDayHeaders;
|
||||||
|
|
|
@ -189,7 +189,7 @@ class _OverlayDateTimePickerState extends State<OverlayDateTimePicker> {
|
||||||
|
|
||||||
Widget _buildOverlay(BuildContext context) {
|
Widget _buildOverlay(BuildContext context) {
|
||||||
return Container(
|
return Container(
|
||||||
decoration: (widget.theme.shapeBorder == null)
|
decoration: (widget.theme.shapeDecoration == null)
|
||||||
? BoxDecoration(
|
? BoxDecoration(
|
||||||
color: widget.theme.backgroundColor,
|
color: widget.theme.backgroundColor,
|
||||||
borderRadius: const BorderRadius.all(Radius.circular(16)),
|
borderRadius: const BorderRadius.all(Radius.circular(16)),
|
||||||
|
@ -201,14 +201,20 @@ class _OverlayDateTimePickerState extends State<OverlayDateTimePicker> {
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
: ShapeDecoration(
|
: ShapeDecoration(
|
||||||
shape: widget.theme.shapeBorder!,
|
shape: widget.theme.shapeDecoration!.shape,
|
||||||
color: widget.theme.backgroundColor,
|
color: widget.theme.backgroundColor,
|
||||||
shadows: [
|
image: (widget.theme.shapeDecoration!.image) ??
|
||||||
|
widget.theme.shapeDecoration!.image,
|
||||||
|
gradient: (widget.theme.shapeDecoration!.gradient) ??
|
||||||
|
widget.theme.shapeDecoration!.gradient,
|
||||||
|
shadows: (widget.theme.shapeDecoration!.shadows == null)
|
||||||
|
? [
|
||||||
BoxShadow(
|
BoxShadow(
|
||||||
blurRadius: 5,
|
blurRadius: 5,
|
||||||
color: Colors.black.withOpacity(0.25),
|
color: Colors.black.withOpacity(0.25),
|
||||||
),
|
),
|
||||||
],
|
]
|
||||||
|
: widget.theme.shapeDecoration!.shadows,
|
||||||
),
|
),
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
width: widget.size.width,
|
width: widget.size.width,
|
||||||
|
|
|
@ -107,7 +107,7 @@ class _DateTimePickerState extends State<DateTimePicker> {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return Container(
|
||||||
decoration: (widget.theme.shapeBorder == null)
|
decoration: (widget.theme.shapeDecoration == null)
|
||||||
? BoxDecoration(
|
? BoxDecoration(
|
||||||
color: widget.theme.backgroundColor,
|
color: widget.theme.backgroundColor,
|
||||||
borderRadius: const BorderRadius.all(Radius.circular(16)),
|
borderRadius: const BorderRadius.all(Radius.circular(16)),
|
||||||
|
@ -119,14 +119,20 @@ class _DateTimePickerState extends State<DateTimePicker> {
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
: ShapeDecoration(
|
: ShapeDecoration(
|
||||||
shape: widget.theme.shapeBorder!,
|
shape: widget.theme.shapeDecoration!.shape,
|
||||||
color: widget.theme.backgroundColor,
|
color: widget.theme.backgroundColor,
|
||||||
shadows: [
|
image: (widget.theme.shapeDecoration!.image) ??
|
||||||
|
widget.theme.shapeDecoration!.image,
|
||||||
|
gradient: (widget.theme.shapeDecoration!.gradient) ??
|
||||||
|
widget.theme.shapeDecoration!.gradient,
|
||||||
|
shadows: (widget.theme.shapeDecoration!.shadows == null)
|
||||||
|
? [
|
||||||
BoxShadow(
|
BoxShadow(
|
||||||
blurRadius: 5,
|
blurRadius: 5,
|
||||||
color: Colors.black.withOpacity(0.25),
|
color: Colors.black.withOpacity(0.25),
|
||||||
),
|
),
|
||||||
],
|
]
|
||||||
|
: widget.theme.shapeDecoration!.shadows,
|
||||||
),
|
),
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
width: widget.size.width,
|
width: widget.size.width,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
name: flutter_date_time_picker
|
name: flutter_date_time_picker
|
||||||
description: A Flutter package for date and time picker.
|
description: A Flutter package for date and time picker.
|
||||||
version: 2.3.1
|
version: 2.3.2
|
||||||
homepage: https://iconica.nl/
|
homepage: https://iconica.nl/
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
|
|
Loading…
Reference in a new issue