-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d9cc97a
commit 91d4d1b
Showing
100 changed files
with
7,300 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
## [0.0.6] - 21 November 2019 | ||
Added support for custom day decoration. | ||
Added support for custom disabled days. | ||
|
||
## [0.1.0] - 31 May 2020 | ||
Fixed i18n issue for MonthPicker in case no locale was set. | ||
Fixed selection periods with unselectable dates issue in RangePicker. | ||
Minor changes and fixes. | ||
|
||
## [0.1.1] - 20 June 2020 | ||
Added scrollPhysics property to DatePickerLayoutSettings. | ||
|
||
## [0.1.3] - 23 June 2020 | ||
Added day headers style customization. | ||
Added prev/next icon customization. | ||
Added selected period text styles customization. | ||
|
||
## [0.1.4] - 2 July 2020 | ||
Added firstDayOfWeekIndex customization. | ||
|
||
## [0.1.5] - 29 July 2020 | ||
Added support of the CupertinoApp ancestor (fixed #29). | ||
|
||
## [0.1.6] - 21 August 2020 | ||
Added two customizable fields to DatePickerLayoutSettings: showNextMonthStart, showPrevMonthEnd (implemented #28). | ||
|
||
## [0.1.7] - 25 August 2020 | ||
Added onMonthChange callback for all day based pickers. | ||
Added newPeriod field to UnselectablePeriodError class. | ||
|
||
## [0.1.8] - 26 October 2020 | ||
Fixed selection in RangePicker which is on the edge of date when time changes (#44). | ||
|
||
## [0.1.9] - 23 December 2020 | ||
Increased intl dependency version. | ||
Minor changes. | ||
|
||
## [0.1.10] - 23 December 2020 | ||
Increased intl dependency version according to one used on pub.dev. | ||
|
||
## [0.2.0] - 7 March 2021 | ||
Migrated to null-safety. | ||
Added DatePickerLayoutSettings.hideMonthNavigationRow option. | ||
|
||
## [0.2.1] - 16 March 2021 | ||
Used intl for getting short month name for MonthPicker (fixed #54) | ||
|
||
## [0.2.2] - 20 March 2021 | ||
Added **initiallyShowDate** optional property for DayPicker, WeekPicker and RangePicker. | ||
|
||
## [0.2.3] - 05 April 2021 | ||
Fixed nextTooltip initializing (#57). | ||
|
||
## [0.2.3+1] - 11 April 2021 | ||
Fixed defining DayHeaderStyle in DatePickerStyles.fulfillWithTheme. | ||
|
||
## [0.2.4] - 29 April 2021 | ||
Fixed incorrect new month calculations (#56). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2019 Maria Melnik | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
# flutter_date_pickers | ||
|
||
[![Actions Status](https://github.com/MariaMelnik/flutter_date_pickers/workflows/Test/badge.svg)](https://github.com/MariaMelnik/flutter_date_pickers/actions) | ||
[![Pub](https://img.shields.io/pub/v/flutter_date_pickers.svg)](https://pub.dev/packages/flutter_date_pickers) | ||
[![Likes](https://img.shields.io/badge/dynamic/json?color=blue&label=likes&query=likes&url=http://www.pubscore.gq/likes?package=flutter_date_pickers&style=flat-square&cacheSeconds=90000)](https://pub.dev/packages/flutter_date_pickers) | ||
[![Health](https://img.shields.io/badge/dynamic/json?color=blue&label=health&query=pub_points&url=http://www.pubscore.gq/pub-points?package=flutter_date_pickers&style=flat-square&cacheSeconds=90000)](https://pub.dev/packages/flutter_date_pickers/score) | ||
[![Code size](https://img.shields.io/github/languages/code-size/MariaMelnik/flutter_date_pickers?logo=github&logoColor=white)](https://github.com/MariaMelnik/flutter_date_pickers) | ||
[![License: MIT](https://img.shields.io/badge/license-MIT-purple.svg)](https://opensource.org/licenses/MIT) | ||
[![GitHub stars](https://img.shields.io/github/stars/MariaMelnik/flutter_date_pickers?style=social)](https://github.com/MariaMelnik/flutter_date_pickers/) | ||
<!--[![Coverage](https://codecov.io/gh/MariaMelnik/flutter_date_pickers/branch/master/graph/badge.svg)](https://codecov.io/gh/MariaMelnik/flutter_date_pickers) | ||
[![effective_dart](https://img.shields.io/badge/style-effective_dart-40c4ff.svg)](https://github.com/tenhobi/effective_dart)--> | ||
|
||
|
||
Allows to use date pickers without dialog. | ||
Provides some customizable styles for date pickers. | ||
|
||
A set of date pickers: | ||
* `DayPicker` for one day | ||
* `WeekPicker` for whole week | ||
* `RangePicker` for random range | ||
* `MonthPicker` for month | ||
|
||
![](demoDatePickers2.gif) | ||
|
||
## How to style date picker | ||
Every date picker constructor take a style object as a parameter (if no styles passed - defaults will be used). | ||
|
||
For single value pickers (DayPicker, MonthPicker) it is DatePickerStyles object; | ||
|
||
For range pickers (WeekPicker, RangePickers) it is DatePickerRangeStyles object; | ||
|
||
Customizable styles: | ||
for all date pickers | ||
|
||
| Property | Description | | ||
|---|---| | ||
| TextStyle displayedPeriodTitle | title of the date picker | | ||
| TextStyle currentDateStyle | style for current date | | ||
| TextStyle disabledDateStyle | style for disabled dates (before first and after last date user can pick) | | ||
| TextStyle selectedDateStyle | style for selected date | | ||
| BoxDecoration selectedSingleDateDecoration | decoration for selected date in case single value is selected | | ||
| TextStyle defaultDateTextStyle | style for date which is neither current nor disabled nor selected | | ||
|
||
only for range date pickers (WeekPicker, RangePicker) | ||
|
||
| Property | Description | | ||
|---|---| | ||
| BoxDecoration selectedPeriodStartDecoration | decoration for the first date of the selected range | | ||
| BoxDecoration selectedPeriodLastDecoration | decoration for the first date of the selected range | | ||
| BoxDecoration selectedPeriodMiddleDecoration | Decoration for the date of the selected range which is not first date and not end date of this range | | ||
|
||
## How to make some dates not selectable date picker | ||
By default only dates before `firstDate` and after `lastDate` are not selectable. But you can set custom disabled days. | ||
`DayPicker`, `WeekPicker` and `RangePicker` take a `SelectableDayPredicate selectableDayPredicate` | ||
where you can specify function which returns if some date is disabled or not. | ||
|
||
If some date is disabled for selection it gets `disabledDateStyle`. | ||
|
||
If selected range or week pretends to include such disabled date `UnselectablePeriodException` occurs. | ||
To handle it - pass `onSelectionError` callback to date picker. | ||
|
||
## How to make special decorations for some dates | ||
By default cells are decorated with `datePickerStyles` slyles (or default if no styles was passed to date picker). | ||
If you need special decoration for some days use `eventDecorationBuilder`. | ||
Currently only for `DayPicker`, `WeekPicker` and `RangePicker`. | ||
|
||
- If date is not selected basic styles will be merged with styles from `eventDecorationBuilder`. | ||
- If date is current date styles from `eventDecorationBuilder` win (if there are). | ||
- Otherwise basic styles (`datePickerStyles`) win. | ||
|
||
## What time I will get after selection? | ||
If one day selected: | ||
you will get start of the day (00:00:00) by default. If selected `firstDate` - you will get time of it. | ||
|
||
If range/week selected: | ||
for start you will get start of the day (00:00:00) by default. If selected `firstDate` - you will get time of it. | ||
for end you will get end of the day (23:59:59.999) by default. If selected `lastDate` - you will get time of it. | ||
|
||
If month selected: | ||
you will get start (00:00:00) of the 1 day of month by default. | ||
If selected month same as month of the `firstDate` - you will get `firstDate`. | ||
|
||
## Usage | ||
|
||
```dart | ||
// Create week date picker with passed parameters | ||
Widget buildWeekDatePicker (DateTime selectedDate, DateTime firstAllowedDate, DateTime lastAllowedDate, ValueChanged<DatePeriod> onNewSelected) { | ||
// add some colors to default settings | ||
DatePickerRangeStyles styles = DatePickerRangeStyles( | ||
selectedPeriodLastDecoration: BoxDecoration( | ||
color: Colors.red, | ||
borderRadius: BorderRadius.only( | ||
topRight: Radius.circular(10.0), | ||
bottomRight: Radius.circular(10.0))), | ||
selectedPeriodStartDecoration: BoxDecoration( | ||
color: Colors.green, | ||
borderRadius: BorderRadius.only( | ||
topLeft: Radius.circular(10.0), bottomLeft: Radius.circular(10.0)), | ||
), | ||
selectedPeriodMiddleDecoration: BoxDecoration( | ||
color: Colors.yellow, shape: BoxShape.rectangle), | ||
); | ||
return WeekPicker( | ||
selectedDate: selectedDate, | ||
onChanged: onNewSelected, | ||
firstDate: firstAllowedDate, | ||
lastDate: lastAllowedDate, | ||
datePickerStyles: styles | ||
); | ||
} | ||
``` | ||
|
||
## Example app | ||
Please checkout [example](https://github.com/MariaMelnik/flutter_date_pickers/tree/master/example). | ||
|
||
For help getting started with Flutter, view our | ||
[online documentation](https://flutter.io/docs), which offers tutorials, | ||
samples, guidance on mobile development, and a full API reference. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
linter: | ||
rules: | ||
# STYLE | ||
camel_case_types: true | ||
camel_case_extensions: true | ||
library_names: true | ||
file_names: true | ||
library_prefixes: true | ||
non_constant_identifier_names: true | ||
constant_identifier_names: true | ||
directives_ordering: true | ||
lines_longer_than_80_chars: true | ||
curly_braces_in_flow_control_structures: true | ||
|
||
# DOCUMENTATION | ||
slash_for_doc_comments: true | ||
package_api_docs: true | ||
public_member_api_docs: true | ||
comment_references: true | ||
|
||
# USAGE | ||
implementation_imports: true | ||
avoid_relative_lib_imports: true | ||
prefer_relative_imports: true | ||
prefer_adjacent_string_concatenation: true | ||
prefer_interpolation_to_compose_strings: true | ||
unnecessary_brace_in_string_interps: true | ||
prefer_collection_literals: true | ||
prefer_is_empty: true | ||
prefer_is_not_empty: true | ||
avoid_function_literals_in_foreach_calls: true | ||
prefer_iterable_whereType: true | ||
prefer_function_declarations_over_variables: true | ||
unnecessary_lambdas: true | ||
prefer_equal_for_default_values: true | ||
avoid_init_to_null: true | ||
unnecessary_getters_setters: true | ||
unnecessary_getters: true | ||
prefer_expression_function_bodies: true | ||
unnecessary_this: true | ||
unnecessary_const: true | ||
avoid_catches_without_on_clauses: true | ||
avoid_catching_errors: true | ||
use_rethrow_when_possible: true | ||
|
||
# DESIGN | ||
use_to_and_as_if_applicable: true | ||
one_member_abstracts: true | ||
avoid_classes_with_only_static_members: true | ||
prefer_mixin: true | ||
prefer_final_fields: true | ||
use_setters_to_change_properties: true | ||
avoid_setters_without_getters: true | ||
avoid_returning_null: true | ||
avoid_returning_this: true | ||
type_annotate_public_apis: true | ||
prefer_typing_uninitialized_variables: true | ||
# omit_local_variable_types: true | ||
avoid_types_on_closure_parameters: true | ||
avoid_return_types_on_setters: true | ||
prefer_generic_function_type_aliases: true | ||
avoid_private_typedef_functions: true | ||
use_function_type_syntax_for_parameters: true | ||
avoid_positional_boolean_parameters: true | ||
hash_and_equals: true | ||
avoid_equals_and_hash_code_on_mutable_classes: true | ||
avoid_null_checks_in_equality_operators: true | ||
|
||
|
||
# PEDANTIC | ||
# (duplicated rules are removed) | ||
always_declare_return_types: true | ||
always_require_non_null_named_parameters: true | ||
annotate_overrides: true | ||
avoid_empty_else: true | ||
avoid_shadowing_type_parameters: true | ||
avoid_types_as_parameter_names: true | ||
empty_catches: true | ||
empty_constructor_bodies: true | ||
no_duplicate_case_values: true | ||
null_closures: true | ||
prefer_conditional_assignment: true | ||
prefer_contains: true | ||
prefer_for_elements_to_map_fromIterable: true | ||
prefer_if_null_operators: true | ||
# prefer_single_quotes: true | ||
prefer_spread_collections: true | ||
recursive_getters: true | ||
type_init_formals: true | ||
unawaited_futures: true | ||
unnecessary_new: true | ||
unnecessary_null_in_if_null_operators: true | ||
unrelated_type_equality_checks: true | ||
valid_regexps: true |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
61 changes: 61 additions & 0 deletions
61
flutter_date_pickers-master/example/android/app/build.gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
def localProperties = new Properties() | ||
def localPropertiesFile = rootProject.file('local.properties') | ||
if (localPropertiesFile.exists()) { | ||
localPropertiesFile.withReader('UTF-8') { reader -> | ||
localProperties.load(reader) | ||
} | ||
} | ||
|
||
def flutterRoot = localProperties.getProperty('flutter.sdk') | ||
if (flutterRoot == null) { | ||
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") | ||
} | ||
|
||
def flutterVersionCode = localProperties.getProperty('flutter.versionCode') | ||
if (flutterVersionCode == null) { | ||
flutterVersionCode = '1' | ||
} | ||
|
||
def flutterVersionName = localProperties.getProperty('flutter.versionName') | ||
if (flutterVersionName == null) { | ||
flutterVersionName = '1.0' | ||
} | ||
|
||
apply plugin: 'com.android.application' | ||
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" | ||
|
||
android { | ||
compileSdkVersion 28 | ||
|
||
lintOptions { | ||
disable 'InvalidPackage' | ||
} | ||
|
||
defaultConfig { | ||
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). | ||
applicationId "com.mariamelnik.flutter_date_picker" | ||
minSdkVersion 16 | ||
targetSdkVersion 28 | ||
versionCode flutterVersionCode.toInteger() | ||
versionName flutterVersionName | ||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" | ||
} | ||
|
||
buildTypes { | ||
release { | ||
// TODO: Add your own signing config for the release build. | ||
// Signing with the debug keys for now, so `flutter run --release` works. | ||
signingConfig signingConfigs.debug | ||
} | ||
} | ||
} | ||
|
||
flutter { | ||
source '../..' | ||
} | ||
|
||
dependencies { | ||
testImplementation 'junit:junit:4.12' | ||
androidTestImplementation 'com.android.support.test:runner:1.0.2' | ||
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' | ||
} |
7 changes: 7 additions & 0 deletions
7
flutter_date_pickers-master/example/android/app/src/debug/AndroidManifest.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.mariamelnik.flutter_date_picker"> | ||
<!-- Flutter needs it to communicate with the running application | ||
to allow setting breakpoints, to provide hot reload, etc. | ||
--> | ||
<uses-permission android:name="android.permission.INTERNET"/> | ||
</manifest> |
Oops, something went wrong.