mirror of
https://github.com/Iconica-Development/flutter_date_time_picker.git
synced 2025-05-18 18:33:49 +02:00
Merge pull request #6 from Iconica-Development/feature/customizable-sizes
added customizable sizes for the views
This commit is contained in:
commit
1bb8dd5da3
3 changed files with 19 additions and 5 deletions
|
@ -1,3 +1,6 @@
|
|||
## 1.2.0
|
||||
* Made date time picker height customizable
|
||||
|
||||
## 1.1.0
|
||||
|
||||
* Added option to change background color of date picker.
|
||||
|
|
|
@ -220,9 +220,9 @@ class _DateTimePickerState extends State<DateTimePicker> {
|
|||
child: DraggableScrollableSheet(
|
||||
controller: _dragController,
|
||||
snap: true,
|
||||
minChildSize: 0.25,
|
||||
initialChildSize: 0.25,
|
||||
maxChildSize: 0.7,
|
||||
minChildSize: _dateTimePickerController.theme.weekViewSize,
|
||||
initialChildSize: _dateTimePickerController.theme.weekViewSize,
|
||||
maxChildSize: _dateTimePickerController.theme.monthViewSize,
|
||||
builder: (context, scrollController) {
|
||||
double dragSize =
|
||||
_dragController.isAttached ? _dragController.size : 0;
|
||||
|
@ -251,7 +251,7 @@ class _DateTimePickerState extends State<DateTimePicker> {
|
|||
),
|
||||
],
|
||||
),
|
||||
child: dragSize < 0.3
|
||||
child: dragSize < _dateTimePickerController.theme.weekMonthTriggerSize
|
||||
? WeekDateTimePickerSheet(
|
||||
dateTimePickerController:
|
||||
_dateTimePickerController,
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_date_time_picker/flutter_date_time_picker.dart';
|
||||
import 'package:flutter_date_time_picker/src/models/date_time_picker_bar_theme.dart';
|
||||
|
||||
class DateTimePickerTheme {
|
||||
/// The [DateTimePickerTheme] to style [DateTimePicker] in. Define a custom shape for the dates and specifically style
|
||||
|
@ -15,6 +14,9 @@ class DateTimePickerTheme {
|
|||
this.markedIndicatorColor,
|
||||
this.dateBoxShape = DateBoxShape.roundedRectangle,
|
||||
this.backgroundColor = Colors.white,
|
||||
this.weekViewSize = 0.2,
|
||||
this.monthViewSize = 0.6,
|
||||
this.weekMonthTriggerSize = 0.3,
|
||||
this.baseTheme = const DateBoxBaseTheme(
|
||||
Colors.white,
|
||||
TextStyle(color: Colors.black),
|
||||
|
@ -64,4 +66,13 @@ class DateTimePickerTheme {
|
|||
|
||||
/// The color used for a background of the date picker.
|
||||
final Color backgroundColor;
|
||||
|
||||
/// The size of the week view of the date picker. Enter a value between 0 and 1.
|
||||
final double weekViewSize;
|
||||
|
||||
/// The size of the month view of the date picker. Enter a value between 0 and 1 that's bigger than the weekViewSize.
|
||||
final double monthViewSize;
|
||||
|
||||
/// The position where the week view changes to month view and the other way around. Enter a value between 0 and 1 that's between the weekViewSize and the monthViewSize.
|
||||
final double weekMonthTriggerSize;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue