mirror of
https://github.com/Iconica-Development/flutter_date_time_picker.git
synced 2025-05-19 10:53:51 +02:00
Compare commits
No commits in common. "master" and "4.0.0" have entirely different histories.
27 changed files with 361 additions and 487 deletions
3
.fvmrc
3
.fvmrc
|
@ -1,3 +0,0 @@
|
|||
{
|
||||
"flutter": "3.22.2"
|
||||
}
|
14
.github/workflows/component-documentation.yml
vendored
14
.github/workflows/component-documentation.yml
vendored
|
@ -1,14 +0,0 @@
|
|||
name: Iconica Standard Component Documentation Workflow
|
||||
# Workflow Caller version: 1.0.0
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
call-iconica-component-documentation-workflow:
|
||||
uses: Iconica-Development/.github/.github/workflows/component-documentation.yml@master
|
||||
secrets: inherit
|
||||
permissions: write-all
|
5
.gitignore
vendored
5
.gitignore
vendored
|
@ -30,13 +30,10 @@ migrate_working_dir/
|
|||
build/
|
||||
.metadata
|
||||
|
||||
|
||||
example/web
|
||||
example/android
|
||||
example/ios
|
||||
example/macos
|
||||
example/windows
|
||||
example/linux
|
||||
|
||||
# FVM Version Cache
|
||||
.fvm/
|
||||
.fmvrc
|
||||
|
|
10
.metadata
Normal file
10
.metadata
Normal file
|
@ -0,0 +1,10 @@
|
|||
# This file tracks properties of this Flutter project.
|
||||
# Used by Flutter tool to assess capabilities and perform upgrades etc.
|
||||
#
|
||||
# This file should be version controlled and should not be manually edited.
|
||||
|
||||
version:
|
||||
revision: f1875d570e39de09040c8f79aa13cc56baab8db1
|
||||
channel: stable
|
||||
|
||||
project_type: package
|
|
@ -1,12 +1,3 @@
|
|||
## 4.1.0
|
||||
|
||||
- Fixed a bug where there would be an extra line for the week after the current month in the month_date_time_picker
|
||||
- Added more customization options for the container around the date_time_picker.dart
|
||||
|
||||
## 4.0.1
|
||||
|
||||
- Added an extra widget builder to add more customizability, for example to add 'today' and 'close' buttons.
|
||||
|
||||
## 4.0.0
|
||||
|
||||
- Controller has to be specified given to the [DragDownDateTimePicker] so the date can be changed outside of the widget itself.
|
||||
|
|
194
CONTRIBUTING.md
194
CONTRIBUTING.md
|
@ -1,194 +0,0 @@
|
|||
# Contributing
|
||||
First off, thanks for taking the time to contribute! ❤️
|
||||
|
||||
All types of contributions are encouraged and valued.
|
||||
See the [Table of Contents](#table-of-contents) for different ways to help and details about how we handle them.
|
||||
Please make sure to read the relevant section before making your contribution.
|
||||
It will make it a lot easier for us maintainers and smooth out the experience for all involved.
|
||||
Iconica looks forward to your contributions. 🎉
|
||||
|
||||
## Table of contents
|
||||
- [Code of conduct](#code-of-conduct)
|
||||
- [I Have a Question](#i-have-a-question)
|
||||
- [I Want To Contribute](#i-want-to-contribute)
|
||||
- [Reporting Bugs](#reporting-bugs)
|
||||
- [Contributing code](#contributing-code)
|
||||
|
||||
## Code of conduct
|
||||
|
||||
### Legal notice
|
||||
When contributing to this project, you must agree that you have authored 100% of the content, that you have the necessary rights to the content and that the content you contribute may be provided under the project license.
|
||||
All accepted pull requests and other additions to this project will be considered intellectual property of Iconica.
|
||||
|
||||
All repositories should be kept clean of jokes, easter eggs and other unnecessary additions.
|
||||
|
||||
## I have a question
|
||||
|
||||
If you want to ask a question, we assume that you have read the available documentation found within the code.
|
||||
Before you ask a question, it is best to search for existing issues that might help you.
|
||||
In case you have found a suitable issue but still need clarification, you can ask your question
|
||||
It is also advisable to search the internet for answers first.
|
||||
|
||||
If you then still feel the need to ask a question and need clarification, we recommend the following:
|
||||
|
||||
- Open an issue.
|
||||
- Provide as much context as you can about what you're running into.
|
||||
|
||||
We will then take care of the issue as soon as possible.
|
||||
|
||||
## I want to contribute
|
||||
|
||||
### Reporting bugs
|
||||
|
||||
<!-- omit in toc -->
|
||||
**Before submitting a bug report**
|
||||
|
||||
A good bug report shouldn't leave others needing to chase you up for more information.
|
||||
Therefore, we ask you to investigate carefully, collect information and describe the issue in detail in your report.
|
||||
Please complete the following steps in advance to help us fix any potential bug as fast as possible.
|
||||
|
||||
- Make sure that you are using the latest version.
|
||||
- Determine if your bug is really a bug and not an error on your side e.g. using incompatible environment components/versions (If you are looking for support, you might want to check [this section](#i-have-a-question)).
|
||||
- To see if other users have experienced (and potentially already solved) the same issue you are having, check if there is not already a bug report existing for your bug or error.
|
||||
- Also make sure to search the internet (including Stack Overflow) to see if users outside of Iconica have discussed the issue.
|
||||
- Collect information about the bug:
|
||||
- Stack trace (Traceback)
|
||||
- OS, Platform and Version (Windows, Linux, macOS, x86, ARM)
|
||||
- Version of the interpreter, compiler, SDK, runtime environment, package manager, depending on what seems relevant.
|
||||
- Time and date of occurance
|
||||
- Describe the expected result and actual result
|
||||
- Can you reliably reproduce the issue? And can you also reproduce it with older versions? Describe all steps that lead to the bug.
|
||||
|
||||
Once it's filed:
|
||||
|
||||
- The project team will label the issue accordingly.
|
||||
- A team member will try to reproduce the issue with your provided steps.
|
||||
If there are no reproduction steps or no obvious way to reproduce the issue, the team will ask you for additional information.
|
||||
- If the team is able to reproduce the issue, it will be moved into the backlog, as well as marked with a priority, and the issue will be left to be [implemented by someone](#contributing-code).
|
||||
|
||||
### Contributing code
|
||||
|
||||
When you start working on your contribution, make sure you are aware of the relevant documentation and the functionality of the component you are working on.
|
||||
|
||||
When writing code, follow the style guidelines set by Dart: [Effective Dart](https://Dart.dev/guides/language/effective-Dart). This contains most information you will need to write clean Dart code that is well documented.
|
||||
|
||||
**Documentation**
|
||||
|
||||
As Effective Dart indicates, documenting your public methods with Dart doc comments is recommended.
|
||||
Aside from Effective Dart, we require specific information in the documentation of a method:
|
||||
|
||||
At the very least, your documentation should first name what the code does, then followed below by requirements for calling the method, the result of the method.
|
||||
Any references to internal variables or other methods should be done through [var] to indicate a reference.
|
||||
|
||||
If the method or class is complex enough (determined by the reviewers) an example is required.
|
||||
If unsure, add an example in the docs using code blocks.
|
||||
|
||||
For classes and methods, document the individual parameters with their implications.
|
||||
|
||||
> Tip: Remember that the shortest documentation can be written by having good descriptive names in the first place.
|
||||
|
||||
An example:
|
||||
```Dart
|
||||
library iconica_utilities.bidirectional_sorter;
|
||||
|
||||
part 'sorter.Dart';
|
||||
part 'enum.Dart';
|
||||
|
||||
/// Generic sort method, allow sorting of list with primitives or complex types.
|
||||
/// Uses [SortDirection] to determine the direction, either Ascending or Descending,
|
||||
/// Gets called on [List] toSort of type [T] which cannot be shorter than 2.
|
||||
/// Optionally for complex types a [Comparable] [Function] can be given to compare complex types.
|
||||
/// ```
|
||||
/// List<TestObject> objects = [];
|
||||
/// for (int i = 0; i < 10; i++) {
|
||||
/// objects.add(TestObject(name: "name", id: i));
|
||||
/// }
|
||||
///
|
||||
/// sort<TestObject>(
|
||||
/// SortDirection.descending, objects, (object) => object.id);
|
||||
///
|
||||
/// ```
|
||||
/// In the above example a list of TestObjects is created, and then sorted in descending order.
|
||||
/// If the implementation of TestObject is as following:
|
||||
/// ```
|
||||
/// class TestObject {
|
||||
/// final String name;
|
||||
/// final int id;
|
||||
///
|
||||
/// TestObject({required this.name, required this.id});
|
||||
/// }
|
||||
/// ```
|
||||
/// And the list is logged to the console, the following will appear:
|
||||
/// ```
|
||||
/// [name9, name8, name7, name6, name5, name4, name3, name2, name1, name0]
|
||||
/// ```
|
||||
|
||||
void sort<T>(
|
||||
/// Determines the sorting direction, can be either Ascending or Descending
|
||||
SortDirection sortDirection,
|
||||
|
||||
/// Incoming list, which gets sorted
|
||||
List<T> toSort, [
|
||||
|
||||
/// Optional comparable, which is only necessary for complex types
|
||||
SortFieldGetter<T>? sortValueCallback,
|
||||
]) {
|
||||
if (toSort.length < 2) return;
|
||||
assert(
|
||||
toSort.whereType<Comparable>().isNotEmpty || sortValueCallback != null);
|
||||
BidirectionalSorter<T>(
|
||||
sortInstructions: <SortInstruction<T>>[
|
||||
SortInstruction(
|
||||
sortValueCallback ?? (t) => t as Comparable, sortDirection),
|
||||
],
|
||||
).sort(toSort);
|
||||
}
|
||||
|
||||
/// same functionality as [sort] but with the added functionality
|
||||
/// of sorting multiple values
|
||||
void sortMulti<T>(
|
||||
/// Incoming list, which gets sorted
|
||||
List<T> toSort,
|
||||
|
||||
/// list of comparables to sort multiple values at once,
|
||||
/// priority based on index
|
||||
List<SortInstruction<T>> sortValueCallbacks,
|
||||
) {
|
||||
if (toSort.length < 2) return;
|
||||
assert(sortValueCallbacks.isNotEmpty);
|
||||
BidirectionalSorter<T>(
|
||||
sortInstructions: sortValueCallbacks,
|
||||
).sort(toSort);
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
**Tests**
|
||||
|
||||
For each public method that was created, excluding widgets, which contains any form of logic (e.g. Calculations, predicates or major side-effects) tests are required.
|
||||
|
||||
A set of tests is written for each method, covering at least each path within the method. For example:
|
||||
|
||||
```Dart
|
||||
void foo() {
|
||||
try {
|
||||
var bar = doSomething();
|
||||
if (bar) {
|
||||
doSomethingElse();
|
||||
} else {
|
||||
doSomethingCool();
|
||||
}
|
||||
} catch (_) {
|
||||
displayError();
|
||||
}
|
||||
}
|
||||
```
|
||||
The method above should result in 3 tests:
|
||||
|
||||
1. A test for the path leading to displayError by the cause of an exception
|
||||
2. A test for if bar is true, resulting in doSomethingElse()
|
||||
3. A test for if bar is false, resulting in the doSomethingCool() method being called.
|
||||
|
||||
This means that we require 100% coverage of each method you test.
|
|
@ -4,9 +4,6 @@
|
|||
|
||||
Fluter DateTime Picker is a package you can use to implement an Calandar to pick dates and ust them in your Flutter app.
|
||||
|
||||
Figma Design that defines this component (only accessible for Iconica developers): https://www.figma.com/file/4WkjwynOz5wFeFBRqTHPeP/Iconica-Design-System?type=design&node-id=357%3A3345&mode=design&t=XulkAJNPQ32ARxWh-1
|
||||
Figma clickable prototype that demonstrates this component (only accessible for Iconica developers): https://www.figma.com/proto/4WkjwynOz5wFeFBRqTHPeP/Iconica-Design-System?type=design&node-id=340-611&viewport=-1987%2C15%2C0.3&t=XulkAJNPQ32ARxWh-0&scaling=min-zoom&starting-point-node-id=381%3A8571&show-proto-sidebar=1
|
||||
|
||||
## Features
|
||||
|
||||
### DragDownDateTimePicker
|
||||
|
@ -39,7 +36,7 @@ Please file any issues, bugs or feature request as an issue on our [GitHub](http
|
|||
|
||||
## Want to contribute
|
||||
|
||||
If you would like to contribute to the plugin (e.g. by improving the documentation, solving a bug or adding a cool new feature), please carefully review our [contribution guide](./CONTRIBUTING.md) and send us your [pull request](https://github.com/Iconica-Development/flutter_date_time_picker/pulls).
|
||||
If you would like to contribute to the plugin (e.g. by improving the documentation, solving a bug or adding a cool new feature), please carefully review our [contribution guide](../CONTRIBUTING.md) and send us your [pull request](https://github.com/Iconica-Development/flutter_date_time_picker/pulls).
|
||||
|
||||
## Author
|
||||
|
||||
|
|
3
example/.gitignore
vendored
3
example/.gitignore
vendored
|
@ -45,6 +45,3 @@ app.*.map.json
|
|||
/android/app/debug
|
||||
/android/app/profile
|
||||
/android/app/release
|
||||
|
||||
|
||||
pubspec.lock
|
45
example/.metadata
Normal file
45
example/.metadata
Normal file
|
@ -0,0 +1,45 @@
|
|||
# This file tracks properties of this Flutter project.
|
||||
# Used by Flutter tool to assess capabilities and perform upgrades etc.
|
||||
#
|
||||
# This file should be version controlled and should not be manually edited.
|
||||
|
||||
version:
|
||||
revision: "6c4930c4ac86fb286f30e31d0ec8bffbcbb9953e"
|
||||
channel: "stable"
|
||||
|
||||
project_type: app
|
||||
|
||||
# Tracks metadata for the flutter migrate command
|
||||
migration:
|
||||
platforms:
|
||||
- platform: root
|
||||
create_revision: 6c4930c4ac86fb286f30e31d0ec8bffbcbb9953e
|
||||
base_revision: 6c4930c4ac86fb286f30e31d0ec8bffbcbb9953e
|
||||
- platform: android
|
||||
create_revision: 6c4930c4ac86fb286f30e31d0ec8bffbcbb9953e
|
||||
base_revision: 6c4930c4ac86fb286f30e31d0ec8bffbcbb9953e
|
||||
- platform: ios
|
||||
create_revision: 6c4930c4ac86fb286f30e31d0ec8bffbcbb9953e
|
||||
base_revision: 6c4930c4ac86fb286f30e31d0ec8bffbcbb9953e
|
||||
- platform: linux
|
||||
create_revision: 6c4930c4ac86fb286f30e31d0ec8bffbcbb9953e
|
||||
base_revision: 6c4930c4ac86fb286f30e31d0ec8bffbcbb9953e
|
||||
- platform: macos
|
||||
create_revision: 6c4930c4ac86fb286f30e31d0ec8bffbcbb9953e
|
||||
base_revision: 6c4930c4ac86fb286f30e31d0ec8bffbcbb9953e
|
||||
- platform: web
|
||||
create_revision: 6c4930c4ac86fb286f30e31d0ec8bffbcbb9953e
|
||||
base_revision: 6c4930c4ac86fb286f30e31d0ec8bffbcbb9953e
|
||||
- platform: windows
|
||||
create_revision: 6c4930c4ac86fb286f30e31d0ec8bffbcbb9953e
|
||||
base_revision: 6c4930c4ac86fb286f30e31d0ec8bffbcbb9953e
|
||||
|
||||
# User provided section
|
||||
|
||||
# List of Local paths (relative to this file) that should be
|
||||
# ignored by the migrate tool.
|
||||
#
|
||||
# Files that are not part of the templates will be ignored by default.
|
||||
unmanaged_files:
|
||||
- 'lib/main.dart'
|
||||
- 'ios/Runner.xcodeproj/project.pbxproj'
|
209
example/pubspec.lock
Normal file
209
example/pubspec.lock
Normal file
|
@ -0,0 +1,209 @@
|
|||
# Generated by pub
|
||||
# See https://dart.dev/tools/pub/glossary#lockfile
|
||||
packages:
|
||||
async:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: async
|
||||
sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.11.0"
|
||||
boolean_selector:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: boolean_selector
|
||||
sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.1"
|
||||
characters:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: characters
|
||||
sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.3.0"
|
||||
clock:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: clock
|
||||
sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.1"
|
||||
collection:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: collection
|
||||
sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.17.2"
|
||||
cupertino_icons:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: cupertino_icons
|
||||
sha256: e35129dc44c9118cee2a5603506d823bab99c68393879edb440e0090d07586be
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.5"
|
||||
fake_async:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: fake_async
|
||||
sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.3.1"
|
||||
flutter:
|
||||
dependency: "direct main"
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
flutter_date_time_picker:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
path: ".."
|
||||
relative: true
|
||||
source: path
|
||||
version: "4.0.0"
|
||||
flutter_lints:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
name: flutter_lints
|
||||
sha256: "2118df84ef0c3ca93f96123a616ae8540879991b8b57af2f81b76a7ada49b2a4"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.0.2"
|
||||
flutter_localizations:
|
||||
dependency: "direct main"
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
flutter_test:
|
||||
dependency: "direct dev"
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
intl:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: intl
|
||||
sha256: "3bc132a9dbce73a7e4a21a17d06e1878839ffbf975568bc875c60537824b0c4d"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.18.1"
|
||||
lints:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: lints
|
||||
sha256: "0a217c6c989d21039f1498c3ed9f3ed71b354e69873f13a8dfc3c9fe76f1b452"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.1"
|
||||
matcher:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: matcher
|
||||
sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.12.16"
|
||||
material_color_utilities:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: material_color_utilities
|
||||
sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.5.0"
|
||||
meta:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: meta
|
||||
sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.9.1"
|
||||
path:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path
|
||||
sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.8.3"
|
||||
sky_engine:
|
||||
dependency: transitive
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.99"
|
||||
source_span:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: source_span
|
||||
sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.10.0"
|
||||
stack_trace:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: stack_trace
|
||||
sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.11.0"
|
||||
stream_channel:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: stream_channel
|
||||
sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.1"
|
||||
string_scanner:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: string_scanner
|
||||
sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.2.0"
|
||||
term_glyph:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: term_glyph
|
||||
sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.2.1"
|
||||
test_api:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: test_api
|
||||
sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.6.0"
|
||||
vector_math:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: vector_math
|
||||
sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.4"
|
||||
web:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: web
|
||||
sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.1.4-beta"
|
||||
sdks:
|
||||
dart: ">=3.1.0-185.0.dev <4.0.0"
|
||||
flutter: ">=2.0.0"
|
|
@ -16,7 +16,7 @@ dependencies:
|
|||
path: ../
|
||||
flutter_localizations:
|
||||
sdk: flutter
|
||||
intl: any
|
||||
intl: ^0.18.0 # Add this line
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
|
|
@ -2,21 +2,15 @@
|
|||
//
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
/// Class representing date constraints for DateTime values.
|
||||
class DateTimeConstraint {
|
||||
/// Minimum date constraint.
|
||||
final DateConstraint min;
|
||||
|
||||
/// Maximum date constraint.
|
||||
final DateConstraint max;
|
||||
|
||||
/// Constructs a DateTimeConstraint instance.
|
||||
const DateTimeConstraint({
|
||||
this.min = DateConstraint.infinity,
|
||||
this.max = DateConstraint.infinity,
|
||||
});
|
||||
|
||||
/// Checks if the given date is within the range specified by min and max constraints.
|
||||
bool inRange(DateTime date) {
|
||||
return _checkDate(
|
||||
min,
|
||||
|
@ -28,7 +22,6 @@ class DateTimeConstraint {
|
|||
);
|
||||
}
|
||||
|
||||
/// Checks if the given date is within the date range (ignoring time) specified by min and max constraints.
|
||||
bool inDateRange(DateTime date) {
|
||||
return _checkDate(
|
||||
min,
|
||||
|
@ -40,7 +33,6 @@ class DateTimeConstraint {
|
|||
);
|
||||
}
|
||||
|
||||
/// Checks if the given date is within the month range specified by min and max constraints.
|
||||
bool inMonthRange(DateTime date) {
|
||||
return _checkDate(
|
||||
min,
|
||||
|
@ -54,7 +46,6 @@ class DateTimeConstraint {
|
|||
);
|
||||
}
|
||||
|
||||
/// Checks if the given date is within the year range specified by min and max constraints.
|
||||
bool inYearRange(DateTime date) {
|
||||
return _checkDate(
|
||||
min,
|
||||
|
@ -66,7 +57,6 @@ class DateTimeConstraint {
|
|||
);
|
||||
}
|
||||
|
||||
/// Strips the given date to date only (no time information).
|
||||
DateTime _stripToDateOnly(DateTime date) {
|
||||
return DateTime(
|
||||
date.year,
|
||||
|
@ -75,7 +65,6 @@ class DateTimeConstraint {
|
|||
);
|
||||
}
|
||||
|
||||
/// Strips the given date to month only.
|
||||
DateTime _stripToMonthsOnly(DateTime date) {
|
||||
return DateTime(
|
||||
date.year,
|
||||
|
@ -84,7 +73,6 @@ class DateTimeConstraint {
|
|||
);
|
||||
}
|
||||
|
||||
/// Strips the given date to year only.
|
||||
DateTime _stripToYearsOnly(DateTime date) {
|
||||
return DateTime(
|
||||
date.year,
|
||||
|
@ -93,7 +81,6 @@ class DateTimeConstraint {
|
|||
);
|
||||
}
|
||||
|
||||
/// Checks if the date constraint is met.
|
||||
bool _checkDate(DateConstraint constraint, bool Function() checker) {
|
||||
if (!constraint.isInfinite) {
|
||||
return checker();
|
||||
|
@ -102,19 +89,12 @@ class DateTimeConstraint {
|
|||
}
|
||||
}
|
||||
|
||||
/// Class representing a date constraint.
|
||||
class DateConstraint {
|
||||
/// Date constraint representing infinity.
|
||||
static const DateConstraint infinity =
|
||||
DateConstraint(date: null, isInfinite: true);
|
||||
|
||||
/// The date associated with the constraint.
|
||||
final DateTime? date;
|
||||
|
||||
/// Indicates if the constraint is infinite.
|
||||
final bool isInfinite;
|
||||
|
||||
/// Constructs a DateConstraint instance.
|
||||
const DateConstraint({this.date, this.isInfinite = false})
|
||||
: assert(
|
||||
!(date != null && isInfinite),
|
||||
|
|
|
@ -28,9 +28,6 @@ class DateTimePickerTheme {
|
|||
this.monthViewSize = 0.6,
|
||||
this.weekMonthTriggerSize = 0.3,
|
||||
this.shapeDecoration,
|
||||
this.border,
|
||||
this.boxShadows,
|
||||
this.borderRadius,
|
||||
this.baseTheme = const DateBoxTheme(
|
||||
backgroundColor: Colors.white,
|
||||
textStyle: TextStyle(color: Colors.black)),
|
||||
|
@ -124,13 +121,4 @@ class DateTimePickerTheme {
|
|||
|
||||
/// The padding surrounding the calendar
|
||||
final EdgeInsetsGeometry calenderPadding;
|
||||
|
||||
/// Border for the container where the date picker is placed in
|
||||
final Border? border;
|
||||
|
||||
/// BorderRadius for the container where the date picker is placed in
|
||||
final BorderRadiusGeometry? borderRadius;
|
||||
|
||||
/// BoxShadow for the container where the date picker is placed in
|
||||
final List<BoxShadow>? boxShadows;
|
||||
}
|
||||
|
|
|
@ -10,10 +10,7 @@ import 'package:flutter_date_time_picker/src/models/date_constraint.dart';
|
|||
import 'package:flutter_date_time_picker/src/widgets/overlay_date_time_picker/overlay.dart';
|
||||
import 'package:intl/date_symbol_data_local.dart';
|
||||
|
||||
/// `OverlayDateTimePicker` is a StatefulWidget that represents a date time picker overlay.
|
||||
/// It provides a way to select a date and time from an overlay that can be positioned relative to other widgets.
|
||||
class OverlayDateTimePicker extends StatefulWidget {
|
||||
/// Creates a new instance of `OverlayDateTimePicker`.
|
||||
const OverlayDateTimePicker({
|
||||
this.theme = const DateTimePickerTheme(),
|
||||
this.textStyle = const TextStyle(),
|
||||
|
@ -35,7 +32,6 @@ class OverlayDateTimePicker extends StatefulWidget {
|
|||
this.dateTimeConstraint = const DateTimeConstraint(),
|
||||
this.onNextPageButtonBuilder,
|
||||
this.onPreviousPageButtonBuilder,
|
||||
this.extraWidgetBuilder,
|
||||
this.isShown = false,
|
||||
}) : assert(child != null || buttonBuilder != null);
|
||||
|
||||
|
@ -100,9 +96,6 @@ class OverlayDateTimePicker extends StatefulWidget {
|
|||
final Widget Function(void Function()? onPressed)?
|
||||
onPreviousPageButtonBuilder;
|
||||
|
||||
/// a [Widget] that can add custom widgets beneath the [OverlayDateTimeContent] for enhanced functionality
|
||||
final Widget? extraWidgetBuilder;
|
||||
|
||||
@override
|
||||
State<OverlayDateTimePicker> createState() => _OverlayDateTimePickerState();
|
||||
}
|
||||
|
@ -248,7 +241,6 @@ class _OverlayDateTimePickerState extends State<OverlayDateTimePicker> {
|
|||
dateTimeConstraint: widget.dateTimeConstraint,
|
||||
onNextPageButtonChild: widget.onNextPageButtonBuilder,
|
||||
onPreviousPageButtonChild: widget.onPreviousPageButtonBuilder,
|
||||
extraWidgetBuilder: widget.extraWidgetBuilder,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
|
@ -5,10 +5,7 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_date_time_picker/flutter_date_time_picker.dart';
|
||||
|
||||
/// `DateTimePickerConfiguration` is a class that holds the configuration for a DateTimePicker.
|
||||
/// It provides various options to customize the behavior and appearance of the DateTimePicker.
|
||||
class DateTimePickerConfiguration {
|
||||
/// Creates a new instance of `DateTimePickerConfiguration`.
|
||||
DateTimePickerConfiguration({
|
||||
required this.theme,
|
||||
this.pickTime = false,
|
||||
|
|
|
@ -4,56 +4,51 @@
|
|||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
/// Controller for managing date and time selection.
|
||||
class DateTimePickerController extends ChangeNotifier {
|
||||
/// Callback that provides the date tapped on as a [DateTime] object.
|
||||
final Function(DateTime)? onTapDayCallBack;
|
||||
|
||||
/// Callback triggered when the date scrolls to the border.
|
||||
final Function(DateTime)? onBorderScrollCallback;
|
||||
|
||||
/// Initial date.
|
||||
final DateTime initialDate;
|
||||
|
||||
/// Page controller for managing the date selection.
|
||||
final PageController _pageController = PageController(initialPage: 1);
|
||||
|
||||
/// The currently browsed date.
|
||||
late DateTime browsingDate = initialDate;
|
||||
|
||||
/// The selected date.
|
||||
late DateTime selectedDate = initialDate;
|
||||
|
||||
/// Constructs a DateTimePickerController.
|
||||
DateTimePickerController({
|
||||
required this.initialDate,
|
||||
this.onTapDayCallBack,
|
||||
this.onBorderScrollCallback,
|
||||
});
|
||||
|
||||
/// Callback that provides the date tapped on as a [DateTime] object.
|
||||
final Function(DateTime)? onTapDayCallBack;
|
||||
|
||||
/// Callback that provides the new date which is scroll to. If this is null the scroll feature is disabled.
|
||||
final Function(DateTime)? onBorderScrollCallback;
|
||||
|
||||
final DateTime initialDate;
|
||||
|
||||
final PageController _pageController = PageController(initialPage: 1);
|
||||
|
||||
late DateTime browsingDate = initialDate;
|
||||
late DateTime selectedDate = initialDate;
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_pageController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
/// Callback for page change.
|
||||
void onPageChanged(DateTime date) {
|
||||
Future.delayed(
|
||||
const Duration(milliseconds: 250),
|
||||
() {
|
||||
browsingDate = date;
|
||||
|
||||
notifyListeners();
|
||||
|
||||
_pageController.jumpToPage(1);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/// Callback for tapping a day.
|
||||
void onTapDay(DateTime date) {
|
||||
browsingDate = date;
|
||||
selectedDate = date;
|
||||
|
||||
notifyListeners();
|
||||
|
||||
if (onTapDayCallBack != null) {
|
||||
onTapDayCallBack!.call(
|
||||
date,
|
||||
|
@ -61,24 +56,24 @@ class DateTimePickerController extends ChangeNotifier {
|
|||
}
|
||||
}
|
||||
|
||||
/// Callback for scrolling to the border.
|
||||
void onBorderScroll(DateTime date) {
|
||||
browsingDate = date;
|
||||
selectedDate = date;
|
||||
|
||||
notifyListeners();
|
||||
onBorderScrollCallback?.call(date);
|
||||
|
||||
onBorderScrollCallback?.call(
|
||||
date,
|
||||
);
|
||||
}
|
||||
|
||||
/// Retrieves the page controller.
|
||||
PageController get pageController => _pageController;
|
||||
|
||||
/// Sets the browsing date.
|
||||
void setBrowsingDate(DateTime date) {
|
||||
browsingDate = date;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
/// Sets the selected date.
|
||||
void setSelectedDate(DateTime date) {
|
||||
selectedDate = date;
|
||||
notifyListeners();
|
||||
|
|
|
@ -4,15 +4,10 @@
|
|||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
/// Custom scroll physics for locking page scroll.
|
||||
class LockingPageScrollPhysics extends ScrollPhysics {
|
||||
/// Function to determine if scrolling to the next page is allowed.
|
||||
final bool Function() allowedNextPage;
|
||||
|
||||
/// Function to determine if scrolling to the previous page is allowed.
|
||||
final bool Function() allowedPreviousPage;
|
||||
|
||||
/// Constructs LockingPageScrollPhysics.
|
||||
const LockingPageScrollPhysics({
|
||||
required this.allowedNextPage,
|
||||
required this.allowedPreviousPage,
|
||||
|
|
|
@ -116,11 +116,8 @@ class _DateTimePickerState extends State<DateTimePicker> {
|
|||
decoration: (widget.theme.shapeDecoration == null)
|
||||
? BoxDecoration(
|
||||
color: widget.theme.backgroundColor,
|
||||
borderRadius: widget.theme.borderRadius ??
|
||||
const BorderRadius.all(Radius.circular(16)),
|
||||
border: widget.theme.border,
|
||||
boxShadow: widget.theme.boxShadows ??
|
||||
[
|
||||
borderRadius: const BorderRadius.all(Radius.circular(16)),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
blurRadius: 5,
|
||||
color: Colors.black.withOpacity(0.25),
|
||||
|
|
|
@ -1,15 +1,6 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
/// `MarkedIcon` is a StatelessWidget that represents a marked icon.
|
||||
/// It provides a colored circular icon that can be used to indicate a marked state.
|
||||
class MarkedIcon extends StatelessWidget {
|
||||
/// Creates a new instance of `MarkedIcon`.
|
||||
///
|
||||
/// The [width] and [height] parameters must not be null.
|
||||
///
|
||||
/// * [width]: The width of the icon.
|
||||
/// * [height]: The height of the icon.
|
||||
/// * [color]: The color of the icon. If null, the indicator color from the current theme is used.
|
||||
const MarkedIcon({
|
||||
super.key,
|
||||
this.color,
|
||||
|
|
|
@ -13,10 +13,7 @@ import 'package:flutter_date_time_picker/src/utils/date_time_picker_controller.d
|
|||
import 'package:flutter_date_time_picker/src/widgets/marked_icon.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
/// `MonthDateTimePicker` is a StatelessWidget that represents a picker for a date within a month.
|
||||
/// It provides a grid of dates for the month and allows the user to select a date.
|
||||
class MonthDateTimePicker extends StatelessWidget {
|
||||
/// Creates a new instance of `MonthDateTimePicker`.
|
||||
const MonthDateTimePicker({
|
||||
required this.date,
|
||||
required this.dateTimePickerController,
|
||||
|
@ -25,17 +22,10 @@ class MonthDateTimePicker extends StatelessWidget {
|
|||
Key? key,
|
||||
}) : super(key: key);
|
||||
|
||||
/// The date of the month to display.
|
||||
final DateTime date;
|
||||
|
||||
/// The controller for managing date and time selection.
|
||||
final DateTimePickerController dateTimePickerController;
|
||||
|
||||
/// The size of each date box in the month grid.
|
||||
final double monthDateBoxSize;
|
||||
|
||||
/// The configuration for the date and time picker.
|
||||
final DateTimePickerConfiguration dateTimePickerConfiguration;
|
||||
final double monthDateBoxSize;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
|
|
@ -9,10 +9,7 @@ import 'package:flutter_date_time_picker/src/utils/date_time_picker_controller.d
|
|||
import 'package:flutter_date_time_picker/src/widgets/month_date_time_picker/month_date_time_picker.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
/// `MonthDateTimePickerSheet` is a StatelessWidget that represents a sheet for picking a date within a month.
|
||||
/// It provides a grid of dates for the month and allows the user to select a date.
|
||||
class MonthDateTimePickerSheet extends StatelessWidget {
|
||||
/// Creates a new instance of `MonthDateTimePickerSheet`.
|
||||
const MonthDateTimePickerSheet({
|
||||
required this.dateTimePickerController,
|
||||
required this.dateTimePickerConfiguration,
|
||||
|
@ -21,16 +18,9 @@ class MonthDateTimePickerSheet extends StatelessWidget {
|
|||
super.key,
|
||||
});
|
||||
|
||||
/// The controller for managing date and time selection.
|
||||
final DateTimePickerController dateTimePickerController;
|
||||
|
||||
/// The configuration for the date and time picker.
|
||||
final DateTimePickerConfiguration dateTimePickerConfiguration;
|
||||
|
||||
/// The size of the month date box.
|
||||
final double monthDateBoxSize;
|
||||
|
||||
/// The padding around the month date.
|
||||
final EdgeInsetsGeometry monthDatePadding;
|
||||
|
||||
@override
|
||||
|
@ -50,8 +40,9 @@ class MonthDateTimePickerSheet extends StatelessWidget {
|
|||
padding: monthDatePadding,
|
||||
child: Text(
|
||||
// use localization to get the month name
|
||||
DateFormat.yMMMM(Localizations.localeOf(context).toString())
|
||||
.format(dateTimePickerController.browsingDate),
|
||||
DateFormat.yMMMM(Localizations.localeOf(context).toString()).format(
|
||||
dateTimePickerController.browsingDate,
|
||||
),
|
||||
style: theme.baseTheme.textStyle!.copyWith(fontSize: 25),
|
||||
),
|
||||
),
|
||||
|
@ -103,8 +94,7 @@ class MonthDateTimePickerSheet extends StatelessWidget {
|
|||
),
|
||||
dateTimePickerController: dateTimePickerController,
|
||||
dateTimePickerConfiguration: dateTimePickerConfiguration,
|
||||
monthDateBoxSize: monthDateBoxSize,
|
||||
),
|
||||
monthDateBoxSize: monthDateBoxSize),
|
||||
MonthDateTimePicker(
|
||||
date: dateTimePickerController.browsingDate.month == 12
|
||||
? DateTime(
|
||||
|
@ -116,8 +106,7 @@ class MonthDateTimePickerSheet extends StatelessWidget {
|
|||
dateTimePickerController.browsingDate.month + 1, 1),
|
||||
dateTimePickerController: dateTimePickerController,
|
||||
dateTimePickerConfiguration: dateTimePickerConfiguration,
|
||||
monthDateBoxSize: monthDateBoxSize,
|
||||
),
|
||||
monthDateBoxSize: monthDateBoxSize),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
|
|
@ -8,10 +8,7 @@ import 'package:flutter_date_time_picker/src/extensions/date_time.dart';
|
|||
import 'package:flutter_date_time_picker/src/widgets/overlay_date_time_picker/pickable_date.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
/// `DatePicker` is a StatelessWidget that represents a date picker.
|
||||
/// It provides a way to select a date from a calendar-like interface.
|
||||
class DatePicker extends StatelessWidget {
|
||||
/// Creates a new instance of `DatePicker`.
|
||||
const DatePicker({
|
||||
super.key,
|
||||
required this.controller,
|
||||
|
@ -24,28 +21,13 @@ class DatePicker extends StatelessWidget {
|
|||
required this.dateTimeConstraint,
|
||||
});
|
||||
|
||||
/// The controller for managing date selection.
|
||||
final DateTimePickerController controller;
|
||||
|
||||
/// The configuration for the date picker.
|
||||
final DateTimePickerConfiguration configuration;
|
||||
|
||||
/// The theme for the date picker.
|
||||
final DateTimePickerTheme theme;
|
||||
|
||||
/// The text style for displaying the weekday names.
|
||||
final TextStyle weekdayTextStyle;
|
||||
|
||||
/// Callback function invoked when a date is selected.
|
||||
final void Function(DateTime date) onSelectDate;
|
||||
|
||||
/// The date to display in the picker.
|
||||
final DateTime date;
|
||||
|
||||
/// Whether to show the weekday names.
|
||||
final bool showWeekDays;
|
||||
|
||||
/// The constraint for selecting dates.
|
||||
final DateTimeConstraint dateTimeConstraint;
|
||||
|
||||
@override
|
||||
|
@ -63,8 +45,8 @@ class DatePicker extends StatelessWidget {
|
|||
addedIndex = DateTime.daysPerWeek;
|
||||
}
|
||||
|
||||
int length = DateTime(date.year, date.month).daysInMonth() + daysToSkip % 7;
|
||||
int daysToAdd = (DateTime.daysPerWeek - length) % DateTime.daysPerWeek;
|
||||
int length = DateTime(date.year, date.month).daysInMonth() + daysToSkip;
|
||||
int daysToAdd = DateTime.daysPerWeek - length % DateTime.daysPerWeek;
|
||||
return Column(
|
||||
children: [
|
||||
if (showWeekDays) ...[
|
||||
|
@ -87,7 +69,10 @@ class DatePicker extends StatelessWidget {
|
|||
// The first day in November 2022 is monday
|
||||
// We use it to properly show monday as the first day and sunday as the last one
|
||||
date,
|
||||
style: weekdayTextStyle,
|
||||
style: weekdayTextStyle
|
||||
// .copyWith(
|
||||
// fontStyle: FontStyle.italic,
|
||||
// fontWeight: FontWeight.w200),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
|
@ -11,10 +11,7 @@ import 'package:flutter_date_time_picker/src/widgets/overlay_date_time_picker/da
|
|||
import 'package:flutter_date_time_picker/src/models/date_constraint.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
/// `OverlayDateTimeContent` is a StatefulWidget that represents the content of a date time overlay.
|
||||
/// It provides a way to select a date and navigate between dates within the overlay.
|
||||
class OverlayDateTimeContent extends StatefulWidget {
|
||||
/// Creates a new instance of `OverlayDateTimeContent`.
|
||||
const OverlayDateTimeContent({
|
||||
super.key,
|
||||
required this.theme,
|
||||
|
@ -28,43 +25,20 @@ class OverlayDateTimeContent extends StatefulWidget {
|
|||
required this.dateTimeConstraint,
|
||||
required this.onPreviousPageButtonChild,
|
||||
required this.onNextPageButtonChild,
|
||||
this.extraWidgetBuilder,
|
||||
});
|
||||
|
||||
/// The theme for the date time picker.
|
||||
final DateTimePickerTheme theme;
|
||||
|
||||
/// The text style for displaying the weekday names.
|
||||
final TextStyle weekdayTextStyle;
|
||||
|
||||
/// The size of the content.
|
||||
final Size size;
|
||||
|
||||
/// The controller for managing date selection.
|
||||
final DateTimePickerController controller;
|
||||
|
||||
/// The configuration for the date time picker.
|
||||
final DateTimePickerConfiguration configuration;
|
||||
|
||||
/// Whether to show the weekday names.
|
||||
final bool showWeekDays;
|
||||
|
||||
/// The constraint for selecting dates.
|
||||
final DateTimeConstraint dateTimeConstraint;
|
||||
|
||||
/// A widget builder for adding an extra widget.
|
||||
final Widget? extraWidgetBuilder;
|
||||
|
||||
/// A function to provide the next page button.
|
||||
final Widget Function(void Function()? onPressed)? onNextPageButtonChild;
|
||||
|
||||
/// A function to provide the previous page button.
|
||||
final Widget Function(void Function()? onPressed)? onPreviousPageButtonChild;
|
||||
|
||||
/// Callback function invoked when moving to the next date.
|
||||
final void Function() onNextDate;
|
||||
|
||||
/// Callback function invoked when moving to the previous date.
|
||||
final void Function() onPreviousDate;
|
||||
|
||||
@override
|
||||
|
@ -120,12 +94,13 @@ class _OverlayDateTimeContentState extends State<OverlayDateTimeContent> {
|
|||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
widget.onPreviousPageButtonChild?.call(
|
||||
(widget.onPreviousPageButtonChild != null)
|
||||
? widget.onPreviousPageButtonChild!(
|
||||
(widget.dateTimeConstraint.inMonthRange(previousDate))
|
||||
? _goToPreviousPage
|
||||
: null,
|
||||
) ??
|
||||
IconButton(
|
||||
)
|
||||
: IconButton(
|
||||
onPressed:
|
||||
(widget.dateTimeConstraint.inMonthRange(previousDate))
|
||||
? _goToPreviousPage
|
||||
|
@ -137,13 +112,15 @@ class _OverlayDateTimeContentState extends State<OverlayDateTimeContent> {
|
|||
monthText,
|
||||
style: widget.theme.barTheme.textStyle,
|
||||
),
|
||||
widget.onNextPageButtonChild?.call(
|
||||
(widget.onNextPageButtonChild != null)
|
||||
? widget.onNextPageButtonChild!(
|
||||
(widget.dateTimeConstraint.inMonthRange(nextDate))
|
||||
? _goToNextPage
|
||||
: null,
|
||||
) ??
|
||||
IconButton(
|
||||
onPressed: (widget.dateTimeConstraint.inMonthRange(nextDate))
|
||||
)
|
||||
: IconButton(
|
||||
onPressed:
|
||||
(widget.dateTimeConstraint.inMonthRange(nextDate))
|
||||
? _goToNextPage
|
||||
: null,
|
||||
icon: nextIcon,
|
||||
|
@ -205,8 +182,7 @@ class _OverlayDateTimeContentState extends State<OverlayDateTimeContent> {
|
|||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
widget.extraWidgetBuilder ?? const SizedBox.shrink(),
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
|
|
|
@ -6,21 +6,7 @@ import 'package:flutter/material.dart';
|
|||
import 'package:flutter_date_time_picker/flutter_date_time_picker.dart';
|
||||
import 'package:flutter_date_time_picker/src/widgets/marked_icon.dart';
|
||||
|
||||
/// `PickableDate` is a StatelessWidget that represents a selectable date.
|
||||
/// It provides visual feedback based on its state (marked, selected, disabled, etc.).
|
||||
class PickableDate extends StatelessWidget {
|
||||
/// Creates a new instance of `PickableDate`.
|
||||
///
|
||||
/// The [isMarked], [isSelected], [isDisabled], [isToday], [isOffMonth], [date], [theme], and [onPressed] parameters must not be null.
|
||||
///
|
||||
/// * [isMarked]: Indicates whether the date is marked.
|
||||
/// * [isSelected]: Indicates whether the date is selected.
|
||||
/// * [isDisabled]: Indicates whether the date is disabled.
|
||||
/// * [isToday]: Indicates whether the date is the current date.
|
||||
/// * [isOffMonth]: Indicates whether the date is in the off-month.
|
||||
/// * [date]: The date that this widget represents.
|
||||
/// * [theme]: The theme used for styling the widget.
|
||||
/// * [onPressed]: The callback that is called when the date is pressed.
|
||||
const PickableDate({
|
||||
super.key,
|
||||
required this.isMarked,
|
||||
|
|
|
@ -10,17 +10,7 @@ import 'package:flutter_date_time_picker/src/models/date_box_current_theme.dart'
|
|||
import 'package:flutter_date_time_picker/src/widgets/marked_icon.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
/// `WeekDateTimePicker` is a StatelessWidget that represents a picker for a date within a week.
|
||||
/// It provides a row of dates for the week and allows the user to select a date.
|
||||
class WeekDateTimePicker extends StatelessWidget {
|
||||
/// Creates a new instance of `WeekDateTimePicker`.
|
||||
///
|
||||
/// The [dateTimePickerController], [dateTimePickerConfiguration], [date], and [weekDateBoxSize] parameters must not be null.
|
||||
///
|
||||
/// * [dateTimePickerController]: The controller for the date time picker.
|
||||
/// * [dateTimePickerConfiguration]: The configuration for the date time picker.
|
||||
/// * [date]: The date that this widget represents.
|
||||
/// * [weekDateBoxSize]: The size of the box for each date in the week.
|
||||
const WeekDateTimePicker({
|
||||
required this.dateTimePickerController,
|
||||
required this.dateTimePickerConfiguration,
|
||||
|
|
|
@ -9,17 +9,7 @@ import 'package:flutter_date_time_picker/src/utils/date_time_picker_controller.d
|
|||
import 'package:flutter_date_time_picker/src/widgets/week_date_time_picker/week_date_time_picker.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
/// `WeekDateTimePickerSheet` is a StatelessWidget that represents a sheet for picking a date within a week.
|
||||
/// It provides a header showing the date range for the current week and a PageView of `WeekDateTimePicker` widgets for the previous, current, and next week.
|
||||
class WeekDateTimePickerSheet extends StatelessWidget {
|
||||
/// Creates a new instance of `WeekDateTimePickerSheet`.
|
||||
///
|
||||
/// The [dateTimePickerController], [dateTimePickerConfiguration], and [weekDateBoxSize] parameters must not be null.
|
||||
///
|
||||
/// * [dateTimePickerController]: The controller for the date time picker.
|
||||
/// * [dateTimePickerConfiguration]: The configuration for the date time picker.
|
||||
/// * [weekDateBoxSize]: The size of the box for each date in the week.
|
||||
/// * [showHeader]: Whether to show the header with the date range for the current week. Defaults to false.
|
||||
const WeekDateTimePickerSheet({
|
||||
required this.dateTimePickerController,
|
||||
required this.dateTimePickerConfiguration,
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
name: flutter_date_time_picker
|
||||
description: A Flutter package for date and time picker.
|
||||
version: 4.1.0
|
||||
|
||||
publish_to: https://forgejo.internal.iconica.nl/api/packages/internal/pub
|
||||
version: 4.0.0
|
||||
|
||||
environment:
|
||||
sdk: ">=3.0.0 <4.0.0"
|
||||
|
@ -11,7 +9,7 @@ environment:
|
|||
dependencies:
|
||||
flutter:
|
||||
sdk: flutter
|
||||
intl: ">0.18.0 <1.0.0"
|
||||
intl: any
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
|
Loading…
Reference in a new issue