mirror of
https://github.com/Iconica-Development/flutter_date_time_picker.git
synced 2025-05-18 18:33:49 +02:00
added customizable sizes for the views
This commit is contained in:
parent
a407f8dcbd
commit
df770c5c23
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
|
## 1.1.0
|
||||||
|
|
||||||
* Added option to change background color of date picker.
|
* Added option to change background color of date picker.
|
||||||
|
|
|
@ -220,9 +220,9 @@ class _DateTimePickerState extends State<DateTimePicker> {
|
||||||
child: DraggableScrollableSheet(
|
child: DraggableScrollableSheet(
|
||||||
controller: _dragController,
|
controller: _dragController,
|
||||||
snap: true,
|
snap: true,
|
||||||
minChildSize: 0.25,
|
minChildSize: _dateTimePickerController.theme.weekViewSize,
|
||||||
initialChildSize: 0.25,
|
initialChildSize: _dateTimePickerController.theme.weekViewSize,
|
||||||
maxChildSize: 0.7,
|
maxChildSize: _dateTimePickerController.theme.monthViewSize,
|
||||||
builder: (context, scrollController) {
|
builder: (context, scrollController) {
|
||||||
double dragSize =
|
double dragSize =
|
||||||
_dragController.isAttached ? _dragController.size : 0;
|
_dragController.isAttached ? _dragController.size : 0;
|
||||||
|
@ -251,7 +251,7 @@ class _DateTimePickerState extends State<DateTimePicker> {
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
child: dragSize < 0.3
|
child: dragSize < _dateTimePickerController.theme.weekMonthTriggerSize
|
||||||
? WeekDateTimePickerSheet(
|
? WeekDateTimePickerSheet(
|
||||||
dateTimePickerController:
|
dateTimePickerController:
|
||||||
_dateTimePickerController,
|
_dateTimePickerController,
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_date_time_picker/flutter_date_time_picker.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 {
|
class DateTimePickerTheme {
|
||||||
/// The [DateTimePickerTheme] to style [DateTimePicker] in. Define a custom shape for the dates and specifically style
|
/// 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.markedIndicatorColor,
|
||||||
this.dateBoxShape = DateBoxShape.roundedRectangle,
|
this.dateBoxShape = DateBoxShape.roundedRectangle,
|
||||||
this.backgroundColor = Colors.white,
|
this.backgroundColor = Colors.white,
|
||||||
|
this.weekViewSize = 0.2,
|
||||||
|
this.monthViewSize = 0.6,
|
||||||
|
this.weekMonthTriggerSize = 0.3,
|
||||||
this.baseTheme = const DateBoxBaseTheme(
|
this.baseTheme = const DateBoxBaseTheme(
|
||||||
Colors.white,
|
Colors.white,
|
||||||
TextStyle(color: Colors.black),
|
TextStyle(color: Colors.black),
|
||||||
|
@ -64,4 +66,13 @@ class DateTimePickerTheme {
|
||||||
|
|
||||||
/// The color used for a background of the date picker.
|
/// The color used for a background of the date picker.
|
||||||
final Color backgroundColor;
|
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