mirror of
https://github.com/Iconica-Development/flutter_date_time_picker.git
synced 2025-05-18 18:33:49 +02:00
fixed skipping month bug
This commit is contained in:
parent
fb92171ff3
commit
f5eaef39ac
6 changed files with 15 additions and 26 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
## 2.2.3
|
||||||
|
|
||||||
|
- Fixed skipping month bug
|
||||||
|
|
||||||
## 2.2.2
|
## 2.2.2
|
||||||
|
|
||||||
- Made the popup dismissible
|
- Made the popup dismissible
|
||||||
|
|
|
@ -3,8 +3,4 @@
|
||||||
// SPDX-License-Identifier: BSD-3-Clause
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
/// Defines the shape of a specific date.
|
/// Defines the shape of a specific date.
|
||||||
enum DateBoxShape {
|
enum DateBoxShape { circle, rectangle, roundedRectangle }
|
||||||
circle,
|
|
||||||
rectangle,
|
|
||||||
roundedRectangle
|
|
||||||
}
|
|
||||||
|
|
|
@ -31,7 +31,6 @@ extension DateTimeExtension on DateTime {
|
||||||
bool get isLeapYear =>
|
bool get isLeapYear =>
|
||||||
(year % 4 == 0) && (year % 100 != 0) || (year % 400 == 0);
|
(year % 4 == 0) && (year % 100 != 0) || (year % 400 == 0);
|
||||||
|
|
||||||
|
|
||||||
/// Returns the amount of days in the current month of the [DateTime] object
|
/// Returns the amount of days in the current month of the [DateTime] object
|
||||||
int daysInMonth() {
|
int daysInMonth() {
|
||||||
return DateTime(year, month + 1, 0).day;
|
return DateTime(year, month + 1, 0).day;
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
// SPDX-License-Identifier: BSD-3-Clause
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_date_time_picker/src/extensions/date_time.dart';
|
|
||||||
import 'package:flutter_date_time_picker/src/models/date_time_picker_theme.dart';
|
import 'package:flutter_date_time_picker/src/models/date_time_picker_theme.dart';
|
||||||
import 'package:flutter_date_time_picker/src/utils/date_time_picker_controller.dart';
|
import 'package:flutter_date_time_picker/src/utils/date_time_picker_controller.dart';
|
||||||
import 'package:flutter_date_time_picker/src/models/date_constraint.dart';
|
import 'package:flutter_date_time_picker/src/models/date_constraint.dart';
|
||||||
|
@ -232,14 +231,10 @@ class _OverlayDateTimePickerState extends State<OverlayDateTimePicker> {
|
||||||
void nextDate() {
|
void nextDate() {
|
||||||
if (!mounted) return;
|
if (!mounted) return;
|
||||||
setState(() {
|
setState(() {
|
||||||
_dateTimePickerController.browsingDate =
|
_dateTimePickerController.browsingDate = DateTime(
|
||||||
_dateTimePickerController.browsingDate.add(
|
_dateTimePickerController.browsingDate.year,
|
||||||
Duration(
|
_dateTimePickerController.browsingDate.month + 1,
|
||||||
days: DateTime(
|
_dateTimePickerController.browsingDate.day,
|
||||||
_dateTimePickerController.browsingDate.year,
|
|
||||||
_dateTimePickerController.browsingDate.month,
|
|
||||||
).daysInMonth(),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -247,14 +242,10 @@ class _OverlayDateTimePickerState extends State<OverlayDateTimePicker> {
|
||||||
void previousDate() {
|
void previousDate() {
|
||||||
if (!mounted) return;
|
if (!mounted) return;
|
||||||
setState(() {
|
setState(() {
|
||||||
_dateTimePickerController.browsingDate =
|
_dateTimePickerController.browsingDate = DateTime(
|
||||||
_dateTimePickerController.browsingDate.subtract(
|
_dateTimePickerController.browsingDate.year,
|
||||||
Duration(
|
_dateTimePickerController.browsingDate.month - 1,
|
||||||
days: DateTime(
|
_dateTimePickerController.browsingDate.day,
|
||||||
_dateTimePickerController.browsingDate.year,
|
|
||||||
_dateTimePickerController.browsingDate.month,
|
|
||||||
).daysInMonth(),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,8 +21,7 @@ class WeekDateTimePickerSheet extends StatelessWidget {
|
||||||
final double weekDateBoxSize;
|
final double weekDateBoxSize;
|
||||||
|
|
||||||
String _getDateHeader(BuildContext context) {
|
String _getDateHeader(BuildContext context) {
|
||||||
var weekDays =
|
var weekDays = dateTimePickerController.browsingDate.daysOfWeek();
|
||||||
dateTimePickerController.browsingDate.daysOfWeek();
|
|
||||||
|
|
||||||
var firstDay = weekDays.first.day.toString();
|
var firstDay = weekDays.first.day.toString();
|
||||||
|
|
||||||
|
|
|
@ -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.2.2
|
version: 2.2.3
|
||||||
homepage: https://iconica.nl/
|
homepage: https://iconica.nl/
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
|
|
Loading…
Reference in a new issue