-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
recreating project with a new version of flutter to solve incompatibi…
…lities
- Loading branch information
0 parents
commit c65e9a4
Showing
455 changed files
with
117,354 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,29 @@ | ||
# Miscellaneous | ||
*.class | ||
*.log | ||
*.pyc | ||
*.swp | ||
.DS_Store | ||
.atom/ | ||
.buildlog/ | ||
.history | ||
.svn/ | ||
|
||
# IntelliJ related | ||
*.iml | ||
*.ipr | ||
*.iws | ||
.idea/ | ||
|
||
# The .vscode folder contains launch configuration and tasks you configure in | ||
# VS Code which you may wish to be included in version control, so this line | ||
# is commented out by default. | ||
#.vscode/ | ||
|
||
# Flutter/Dart/Pub related | ||
# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock. | ||
/pubspec.lock | ||
**/doc/api/ | ||
.dart_tool/ | ||
.packages | ||
build/ |
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,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: db747aa1331bd95bc9b3874c842261ca2d302cd5 | ||
channel: stable | ||
|
||
project_type: package |
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,137 @@ | ||
## [4.4.0] 07 / 11 / 2021 | ||
- upgraded phone parser dependency which fix some validity issues | ||
- added swedish language | ||
- added turkish language | ||
|
||
## [4.3.1] 23 / 10 / 2021 | ||
- fix a focus issue when opening country selection | ||
- search bar in country selection is no auto focus false except for the web | ||
|
||
|
||
## [4.3.0] 18 / 10 / 2021 | ||
- Added most of textfield params to the phone input. | ||
- Added method to select the current national number from the controller | ||
- Changed how controllers worked under the hood | ||
- Fix an issue where a phone number could not start with its country code | ||
- uses phone_numbers_parser v4.1.0 | ||
|
||
## [4.2.0] 16 / 10 / 2021 | ||
- [deprecated] PhoneValidator.invalid in favor of PhoneValidator.valid as the naming did not make sens and was backward. | ||
|
||
## [4.1.0 ] 15 / 10 / 2021 | ||
- expose onEditingComplete and textInputAction | ||
- Update phone_number_parser library to 4.0.1, that library has breaking changes which could be reflected in the usage here | ||
|
||
## [4.0.0] 01 / 10 / 2021 | ||
|
||
### Fixes | ||
- fix phone number type, thanks @emrsi | ||
- fix reset and usage as a FormField in general | ||
- fix onChanged & onSaved | ||
- fix late initialization error when no country was selected in bottom sheet selector | ||
|
||
### UI | ||
- added localized phone formatter | ||
- added DraggableModalBottomSheet, thanks @emrsi | ||
|
||
# Validation | ||
- Add PhoneValidator class to easily customize validation and defaults localization error messagees | ||
- Add PhoneFormField `validator` property | ||
- **[BREAKING CHANGE]** Remove `PhoneFormField` properties `errorText` & `phoneNumberType`. Define `validator` property instead with `PhoneValidator.invalid*` | ||
|
||
# Misc | ||
- refactored internals | ||
- [Breaking] light parser was removed. | ||
- [Breaking] exposed `autoFillHints` and removed the `withHint` param | ||
- [Breaking] renamed all instances of `dialCode` to `countryCode` as dial code was semantically incorrect. | ||
|
||
### Note | ||
This major version was a big rework of the library and is packed with fixes. | ||
Thus it was decided that it was not worth it to keep backward compatibility and therefor there are multiple breaking changes | ||
|
||
## [3.0.0] - 27 / 08 / 2021 | ||
- removed deprecated selector config | ||
- added controllers to control the value | ||
- added support for copy pasting | ||
|
||
## [2.0.0] - 16 / 08 / 2021 | ||
|
||
- deprecating SelectorConfig in favor of CountrySelectorNavigator | ||
- added unit tests | ||
- fixes for auto fill and copy paste | ||
|
||
## [1.2.0] - 25 / 05 / 2021 | ||
* Minor release introducing SelectorConfig. | ||
* Fix problems with input focussing in cover sheet. | ||
|
||
``` | ||
// cover sheet | ||
PhoneFormField( | ||
// ... | ||
selectorConfig: SelectorConfigCoverSheet() | ||
) | ||
// dialog | ||
PhoneFormField( | ||
// ... | ||
selectorConfig: SelectorConfigBottomSheet() | ||
) | ||
// bottom sheet | ||
PhoneFormField( | ||
// ... | ||
selectorConfig: SelectorConfigBottomSheet(null) | ||
) | ||
``` | ||
|
||
## [1.1.3] - 25 / 05 / 2021 | ||
* fix initial value not setting up correctly | ||
* Added different types of Country selector display: SelectorDisplay.coversBody, SelectorDisplay.coversLower. The old value is coversLower and the new default value is coversBody. | ||
|
||
## [1.1.2] - 20 / 05 / 2021 | ||
* minor changelog fix. | ||
|
||
## [1.1.1] - 20 / 05 / 2021 | ||
* Added key to exported widgets. | ||
|
||
## [1.1.0] - 19 / 05 / 2021 | ||
* [Breaking] : some classes from the package phone_numbers_parser aren't exported anymore. Mostly classes that are not intended to be used with this package. | ||
* Added example for widgets FlagDialCodeChip and CountrySelector | ||
* Added default values for FlagDialCodeChip and removed some unused values. | ||
|
||
## [1.0.2] - 23 / 04 / 2021 | ||
* Upped dependency phone_numbers_parser to 0.1.3 | ||
* Added phoneNumberType input to validate against specific types (mobile, fixed line) | ||
|
||
## [1.0.1] - 23 / 04 / 2021 | ||
* Fixed validity issue (issue #1) | ||
* Allow country to be searched by dial code (issue #2) | ||
* Sort country search results to have more meaningful results at the top | ||
* Upped dependency phone_numbers_parser to 0.1.0 | ||
|
||
## [1.0.0] - 21 / 04 / 2021 | ||
|
||
* Reworked internal so the PhoneFormField behaves exactly like a TextFormField | ||
|
||
## [0.0.6] - 15 / 04 / 2021 | ||
|
||
* InputDecoration renamed to decoration to match formField | ||
|
||
## [0.0.5] - 15 / 04 / 2021 | ||
|
||
* Match cursor color with border color | ||
|
||
## [0.0.4] - 13 / 04 / 2021 | ||
|
||
* Default font size 14 | ||
|
||
## [0.0.3] - 13 / 04 / 2021 | ||
|
||
* Breaking: inputBorder parameter replaced by inputDecoration for more maneability | ||
|
||
## [0.0.2] - 12 / 04 / 2021 | ||
|
||
* Fix unresponsive onSave | ||
|
||
|
||
## [0.0.1] - 12 / 04 / 2021 | ||
|
||
* initial release |
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 @@ | ||
Copyright [2021-2030] Cedric Vanden Bosch | ||
|
||
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,189 @@ | ||
# phone_form_field | ||
|
||
Flutter phone input integrated with flutter internationalization | ||
|
||
## Features | ||
|
||
- Totally cross platform, this is a dart only package / dependencies | ||
- Internationalization | ||
- Phone formatting localized by region | ||
- Phone number validation (built-in validators included for main use cases) | ||
- Support autofill and copy paste | ||
- Extends Flutter's FormField | ||
- Uses dart phone_numbers_parser for parsing | ||
|
||
|
||
## Demo | ||
|
||
Demo available at https://cedvdb.github.io/phone_form_field/ | ||
|
||
|
||
## Usage | ||
|
||
```dart | ||
// works without any param | ||
PhoneFormField(); | ||
// all params | ||
PhoneFormField( | ||
key: Key('phone-field') | ||
controller: null, // controller & initialValue value | ||
initialValue: null, // can't be supplied simultaneously | ||
shouldFormat: true // default | ||
defaultCountry: 'US', // default | ||
decoration: InputDecoration( | ||
labelText: 'Phone', // default to null | ||
border: OutlineInputBorder() // default to UnderlineInputBorder(), | ||
// ... | ||
), | ||
validator: PhoneValidator.validMobile(), // default PhoneValidator.valid() | ||
selectorNavigator: const BottomSheetNavigator(), // default to bottom sheet but you can customize how the selector is shown by extending CountrySelectorNavigator | ||
showFlagInInput: true, // default | ||
flagSize: 16, // default | ||
autofillHints: [AutofillHints.telephoneNumber], // default to null | ||
enabled: true, // default | ||
autofocus: false, // default | ||
autovalidateMode: AutovalidateMode.onUserInteraction, // default | ||
onSaved: (PhoneNumber p) => print('saved $p'), // default null | ||
onChanged: (PhoneNumber p) => print('saved $p'), // default null | ||
// ... + other textfield params | ||
) | ||
``` | ||
|
||
## Validation | ||
|
||
### Built-in validators | ||
|
||
* required : `PhoneValidator.required` | ||
* valid : `PhoneValidator.valid` (default value when no validator supplied) | ||
* valid mobile number : `PhoneValidator.validMobile` | ||
* valid fixed line number : `PhoneValidator.validFixedLine` | ||
* valid type : `PhoneValidator.validType` | ||
* valid country : `PhoneValidator.validCountry` | ||
* none : `PhoneValidator.none` (this can be used to disable default valid validator) | ||
|
||
### Validators details | ||
|
||
* Each validator has an optional `errorText` property to override built-in translated text | ||
* Most of them have an optional `allowEmpty` (default is true) preventing to flag an empty field as valid. Consider using a composed validator with a first `PhoneValidator.required` when a different text is needed for empty field. | ||
|
||
### Composing validators | ||
|
||
Validator can be a composed set of validators built-in or custom validator using `PhoneValidator.compose`, see example below. | ||
|
||
Note that when composing validators, the sorting is important as the error message displayed is the first validator failing. | ||
|
||
```dart | ||
PhoneFormField( | ||
// ... | ||
validator: PhoneValidator.compose([ | ||
// list of validators to use | ||
PhoneValidator.required(errorText: "You must enter a value"), | ||
PhoneValidator.validMobile(), | ||
// .. | ||
]), | ||
) | ||
``` | ||
|
||
## Country selector | ||
|
||
Here are the list of the parameters available for all built-in country selector : | ||
|
||
| Name | Default value | Description | | ||
|---|---|---| | ||
| countries | null | Countries available in list view (all countries are listed when omitted) | | ||
| favorites | null | List of country code `['FR','UK']` to display on top of the list | | ||
| addSeparator | true | Whether to add a separator between favorite countries and others one. Useless if `favorites` parameter is null | | ||
| showCountryCode | true | Whether to display the country dial code as listTile item subtitle | | ||
| sortCountries | false | Whether the countries should appear in alphabetic order, if false the countries are displayed in the same order as `countries` property (Note that favorite countries are listed in supplied order whatever the value of this parameter) | | ||
| noResultMessage | null | The message to be displayed in place of the list when search result is empty (a default localised message is used when omitted) | | ||
|
||
### Built-in country selector | ||
|
||
* **DialogNavigator** | ||
Open a dialog to select the country. | ||
No extra parameters | ||
|
||
* **BottomSheetNavigator** | ||
Open a bottom sheet expanding to all available space in both axis | ||
No extra parameters | ||
|
||
* **ModalBottomSheetNavigator** | ||
Open a modal bottom sheet expanded horizontally | ||
Extra parameters: | ||
* `height` (double, default null) | ||
Allow to determine the height of the bottom sheet, will expand to all available height when omitted | ||
|
||
* **DraggableModalBottomSheetNavigator** | ||
Open a modal bottom sheet expanded horizontally which may be dragged from a minimum to a maximum of current available height. | ||
Uses internally the `DraggableScrollableSheet` flutter widget | ||
Extra parameters: | ||
* `initialChildSize` (double, default: `0.5`) factor of current available height used when opening | ||
* `minChildSize` (double, default: `0.Z5`) : maximum factor of current available height | ||
* `minChildSize` (double, default: `0.Z5`) : minimum factor of current available height | ||
* `borderRadius` (BorderRadiusGeometry, default: 16px circular radius on top left/right) | ||
|
||
|
||
### Custom Country Selector Navigator | ||
|
||
You can use your own country selector by creating a class that implements `CountrySelectorNavigator` | ||
It has one required method `navigate` expected to return the selected country: | ||
|
||
```dart | ||
class CustomCountrySelectorNavigator implements CountrySelectorNavigator { | ||
Future<Country?> navigate(BuildContext context) { | ||
// ask user for a country and return related `Country` class | ||
} | ||
} | ||
// usage | ||
PhoneFormField( | ||
// ... | ||
selectorNavigator: CustomCountrySelectorNavigator(), | ||
// ... | ||
) | ||
``` | ||
|
||
## Internationalization | ||
|
||
Include the delegate | ||
|
||
```dart | ||
return MaterialApp( | ||
localizationsDelegates: [ | ||
GlobalMaterialLocalizations.delegate, | ||
PhoneFieldLocalization.delegate | ||
], | ||
supportedLocales: [ | ||
const Locale('en', ''), | ||
const Locale('es', ''), | ||
const Locale('fr', ''), | ||
const Locale('ru', ''), | ||
// ... | ||
], | ||
``` | ||
|
||
That's it. | ||
|
||
|
||
A bunch of languages are built-in: | ||
|
||
- 'ar', | ||
- 'de', | ||
- 'en', | ||
- 'es', | ||
- 'fr', | ||
- 'hin', | ||
- 'it', | ||
- 'nl', | ||
- 'pt', | ||
- 'ru', | ||
- 'tr', | ||
- 'zh', | ||
- 'sv', | ||
|
||
|
||
If one of the language you target is not supported you can submit a | ||
pull request with the translated file in src/l10n |
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,4 @@ | ||
include: package:flutter_lints/flutter.yaml | ||
|
||
# Additional information about this file can be found at | ||
# https://dart.dev/guides/language/analysis-options |
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 @@ | ||
rm docs/* -rf && cd example && flutter build web --release && cd .. && mv example/build/web/* docs |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.