mirror of
https://github.com/Iconica-Development/flutter_input_library.git
synced 2025-05-18 17:03:45 +02:00
Compare commits
10 commits
Author | SHA1 | Date | |
---|---|---|---|
|
7d64f467bf | ||
|
de5d38ffc7 | ||
|
0da6ba35f2 | ||
|
5bee01e304 | ||
|
f2d1fb5262 | ||
|
815ca7b0b2 | ||
|
b6de3299e0 | ||
|
bc8b1d572b | ||
|
9838220de7 | ||
|
04752e9a53 |
38 changed files with 6278 additions and 6232 deletions
14
.github/workflows/release.yml
vendored
Normal file
14
.github/workflows/release.yml
vendored
Normal file
|
@ -0,0 +1,14 @@
|
|||
name: Iconica Standard Component Release Workflow
|
||||
# Workflow Caller version: 1.0.0
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
call-global-iconica-workflow:
|
||||
uses: Iconica-Development/.github/.github/workflows/component-release.yml@master
|
||||
secrets: inherit
|
||||
permissions: write-all
|
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -35,3 +35,7 @@ example/windows
|
|||
example/web
|
||||
example/android
|
||||
example/ios
|
||||
|
||||
# FVM Version Cache
|
||||
.fvm/
|
||||
.fvmrc
|
||||
|
|
|
@ -1,3 +1,12 @@
|
|||
## 3.7.0
|
||||
|
||||
* Added a 16 pixel padding between the `FlutterFormInputRadioPicker` items that is customizable with the `itemSpacing` parameter.
|
||||
|
||||
## 3.6.0
|
||||
* Added style parameter to `FlutterFormInputMultiLine`
|
||||
* Upgrade flutter_iconica_analysis to 7.0.0
|
||||
* Changed the name of the `CarouselController` to `FlutterInputCarouselController`
|
||||
|
||||
## 3.5.0
|
||||
* Added `selectableTimePredicate` to the `DateTimeInputField` constructor
|
||||
|
||||
|
|
|
@ -45,10 +45,10 @@ packages:
|
|||
dependency: "direct main"
|
||||
description:
|
||||
name: cupertino_icons
|
||||
sha256: e35129dc44c9118cee2a5603506d823bab99c68393879edb440e0090d07586be
|
||||
sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.5"
|
||||
version: "1.0.8"
|
||||
fake_async:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -68,15 +68,15 @@ packages:
|
|||
path: ".."
|
||||
relative: true
|
||||
source: path
|
||||
version: "3.3.0"
|
||||
version: "3.6.0"
|
||||
flutter_lints:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
name: flutter_lints
|
||||
sha256: aeb0b80a8b3709709c9cc496cdc027c5b3216796bc0af0ce1007eaf24464fd4c
|
||||
sha256: a25a15ebbdfc33ab1cd26c63a6ee519df92338a9c10f122adda92938253bef04
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.0.1"
|
||||
version: "2.0.3"
|
||||
flutter_test:
|
||||
dependency: "direct dev"
|
||||
description: flutter
|
||||
|
@ -118,10 +118,10 @@ packages:
|
|||
dependency: transitive
|
||||
description:
|
||||
name: lints
|
||||
sha256: "5e4a9cd06d447758280a8ac2405101e0e2094d2a1dbdd3756aec3fe7775ba593"
|
||||
sha256: "0a217c6c989d21039f1498c3ed9f3ed71b354e69873f13a8dfc3c9fe76f1b452"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.0.1"
|
||||
version: "2.1.1"
|
||||
matcher:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
|
@ -4,5 +4,5 @@
|
|||
/// A library for creating input fields in Flutter.
|
||||
library flutter_input_library;
|
||||
|
||||
export 'src/inputs/inputs.dart';
|
||||
export 'src/utils/utils.dart';
|
||||
export "src/inputs/inputs.dart";
|
||||
export "src/utils/utils.dart";
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
|
||||
// ignore_for_file: avoid_positional_boolean_parameters
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import "package:flutter/material.dart";
|
||||
|
||||
import 'package:flutter_input_library/src/inputs/bool/bool_field.dart';
|
||||
import "package:flutter_input_library/src/inputs/bool/bool_field.dart";
|
||||
|
||||
class FlutterFormInputBool extends StatelessWidget {
|
||||
const FlutterFormInputBool({
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
|
||||
// ignore_for_file: avoid_positional_boolean_parameters
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_input_library/flutter_input_library.dart';
|
||||
import "package:flutter/material.dart";
|
||||
import "package:flutter_input_library/flutter_input_library.dart";
|
||||
|
||||
class BoolFormField extends FormField<bool> {
|
||||
BoolFormField({
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
//
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import "package:flutter/material.dart";
|
||||
|
||||
import 'package:flutter_input_library/src/inputs/carousel/carousel_form.dart';
|
||||
import "package:flutter_input_library/src/inputs/carousel/carousel_form.dart";
|
||||
|
||||
class FlutterFormInputCarousel extends StatelessWidget {
|
||||
const FlutterFormInputCarousel({
|
||||
|
|
|
@ -2,15 +2,15 @@
|
|||
//
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
import 'dart:async';
|
||||
import "dart:async";
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_input_library/src/inputs/carousel/carousel_options.dart';
|
||||
import 'package:flutter_input_library/src/inputs/carousel/carousel_state.dart';
|
||||
import 'package:flutter_input_library/src/inputs/carousel/carousel_utils.dart';
|
||||
import "package:flutter/material.dart";
|
||||
import "package:flutter_input_library/src/inputs/carousel/carousel_options.dart";
|
||||
import "package:flutter_input_library/src/inputs/carousel/carousel_state.dart";
|
||||
import "package:flutter_input_library/src/inputs/carousel/carousel_utils.dart";
|
||||
|
||||
abstract class CarouselController {
|
||||
factory CarouselController() => CarouselControllerImpl();
|
||||
abstract class FlutterInputCarouselController {
|
||||
factory FlutterInputCarouselController() => CarouselControllerImpl();
|
||||
bool get ready;
|
||||
|
||||
Future<void> get onReady;
|
||||
|
@ -28,7 +28,7 @@ abstract class CarouselController {
|
|||
void stopAutoPlay();
|
||||
}
|
||||
|
||||
class CarouselControllerImpl implements CarouselController {
|
||||
class CarouselControllerImpl implements FlutterInputCarouselController {
|
||||
final Completer<void> _readyCompleter = Completer<void>();
|
||||
|
||||
CarouselState? _state;
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
//
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_input_library/src/inputs/carousel/carousel_slider.dart';
|
||||
import "package:flutter/material.dart";
|
||||
import "package:flutter_input_library/src/inputs/carousel/carousel_slider.dart";
|
||||
|
||||
class CarouselFormField extends FormField<int> {
|
||||
CarouselFormField({
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
//
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import "package:flutter/material.dart";
|
||||
|
||||
enum CarouselPageChangedReason { timed, manual, controller }
|
||||
|
||||
|
|
|
@ -4,17 +4,17 @@
|
|||
///
|
||||
library carousel_slider;
|
||||
|
||||
import 'dart:async';
|
||||
import "dart:async";
|
||||
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_input_library/src/inputs/carousel/carousel_controller.dart';
|
||||
import 'package:flutter_input_library/src/inputs/carousel/carousel_options.dart';
|
||||
import 'package:flutter_input_library/src/inputs/carousel/carousel_state.dart';
|
||||
import 'package:flutter_input_library/src/inputs/carousel/carousel_utils.dart';
|
||||
import "package:flutter/gestures.dart";
|
||||
import "package:flutter/material.dart";
|
||||
import "package:flutter_input_library/src/inputs/carousel/carousel_controller.dart";
|
||||
import "package:flutter_input_library/src/inputs/carousel/carousel_options.dart";
|
||||
import "package:flutter_input_library/src/inputs/carousel/carousel_state.dart";
|
||||
import "package:flutter_input_library/src/inputs/carousel/carousel_utils.dart";
|
||||
|
||||
export 'carousel_controller.dart';
|
||||
export 'carousel_options.dart';
|
||||
export "carousel_controller.dart";
|
||||
export "carousel_options.dart";
|
||||
|
||||
typedef ExtendedIndexedWidgetBuilder = Widget Function(
|
||||
BuildContext context,
|
||||
|
@ -26,25 +26,25 @@ class CarouselSlider extends StatefulWidget {
|
|||
CarouselSlider({
|
||||
required this.items,
|
||||
required this.options,
|
||||
CarouselController? carouselController,
|
||||
FlutterInputCarouselController? carouselController,
|
||||
super.key,
|
||||
}) : itemBuilder = null,
|
||||
itemCount = items != null ? items.length : 0,
|
||||
_carouselController = carouselController != null
|
||||
? carouselController as CarouselControllerImpl
|
||||
: CarouselController() as CarouselControllerImpl;
|
||||
: FlutterInputCarouselController() as CarouselControllerImpl;
|
||||
|
||||
/// The on demand item builder constructor/
|
||||
CarouselSlider.builder({
|
||||
required this.itemCount,
|
||||
required this.itemBuilder,
|
||||
required this.options,
|
||||
CarouselController? carouselController,
|
||||
FlutterInputCarouselController? carouselController,
|
||||
super.key,
|
||||
}) : items = null,
|
||||
_carouselController = carouselController != null
|
||||
? carouselController as CarouselControllerImpl
|
||||
: CarouselController() as CarouselControllerImpl;
|
||||
: FlutterInputCarouselController() as CarouselControllerImpl;
|
||||
|
||||
/// [CarouselOptions] to create a [CarouselState] with.
|
||||
final CarouselOptions options;
|
||||
|
@ -81,6 +81,7 @@ class CarouselSliderState extends State<CarouselSlider>
|
|||
/// [mode] is related to why the page is being changed.
|
||||
CarouselPageChangedReason mode = CarouselPageChangedReason.controller;
|
||||
|
||||
// ignore: use_setters_to_change_properties
|
||||
void changeMode(CarouselPageChangedReason mode) {
|
||||
this.mode = mode;
|
||||
}
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
//
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_input_library/src/inputs/carousel/carousel_slider.dart';
|
||||
import "package:flutter/material.dart";
|
||||
import "package:flutter_input_library/src/inputs/carousel/carousel_slider.dart";
|
||||
|
||||
class CarouselState {
|
||||
CarouselState(
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
//
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_input_library/src/inputs/date_picker/date_picker_field.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import "package:flutter/material.dart";
|
||||
import "package:flutter_input_library/src/inputs/date_picker/date_picker_field.dart";
|
||||
import "package:intl/intl.dart";
|
||||
|
||||
enum FlutterFormDateTimeType {
|
||||
date,
|
||||
|
|
|
@ -2,11 +2,11 @@
|
|||
//
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
import 'dart:async';
|
||||
import "dart:async";
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_input_library/src/inputs/date_picker/date_picker.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import "package:flutter/material.dart";
|
||||
import "package:flutter_input_library/src/inputs/date_picker/date_picker.dart";
|
||||
import "package:intl/intl.dart";
|
||||
|
||||
class DateTimeInputField extends StatefulWidget {
|
||||
const DateTimeInputField({
|
||||
|
@ -65,7 +65,7 @@ class _DateInputFieldState extends State<DateTimeInputField> {
|
|||
late final DateTime initialDate;
|
||||
late final DateTimeRange initialDateRange;
|
||||
late final TimeOfDay? initialTime;
|
||||
String currentValue = '';
|
||||
String currentValue = "";
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
|
@ -97,32 +97,34 @@ class _DateInputFieldState extends State<DateTimeInputField> {
|
|||
FlutterFormDateTimeType inputType, [
|
||||
DateFormat? dateFormat,
|
||||
]) async {
|
||||
var userInput = '';
|
||||
var userInput = "";
|
||||
switch (inputType) {
|
||||
case FlutterFormDateTimeType.date:
|
||||
var unformatted = await showDatePicker(
|
||||
initialDate: initialDate,
|
||||
context: context,
|
||||
firstDate: firstDate,
|
||||
lastDate: lastDate,
|
||||
selectableDayPredicate: widget.selectableDayPredicate,
|
||||
);
|
||||
userInput = unformatted != null
|
||||
? widget.dateFormat.format(unformatted)
|
||||
: userInput;
|
||||
if (context.mounted) {
|
||||
var unformatted = await showDatePicker(
|
||||
initialDate: initialDate,
|
||||
context: context,
|
||||
firstDate: firstDate,
|
||||
lastDate: lastDate,
|
||||
selectableDayPredicate: widget.selectableDayPredicate,
|
||||
);
|
||||
userInput = unformatted != null
|
||||
? widget.dateFormat.format(unformatted)
|
||||
: userInput;
|
||||
}
|
||||
|
||||
case FlutterFormDateTimeType.dateTime:
|
||||
await getInputFromUser(FlutterFormDateTimeType.date)
|
||||
.then((value) async {
|
||||
if (value != '') {
|
||||
if (value != "") {
|
||||
var secondInput =
|
||||
await getInputFromUser(FlutterFormDateTimeType.time);
|
||||
if (secondInput != '') {
|
||||
if (secondInput != "") {
|
||||
var date = widget.dateFormat.parse(value);
|
||||
var time = dateFormat != null
|
||||
? dateFormat.parse('01 01 1970 $secondInput')
|
||||
: DateFormat('dd MM yyyy HH:mm')
|
||||
.parse('01 01 1970 $secondInput');
|
||||
? dateFormat.parse("01 01 1970 $secondInput")
|
||||
: DateFormat("dd MM yyyy HH:mm")
|
||||
.parse("01 01 1970 $secondInput");
|
||||
userInput = widget.dateFormat.format(
|
||||
DateTime(
|
||||
date.year,
|
||||
|
@ -145,13 +147,14 @@ class _DateInputFieldState extends State<DateTimeInputField> {
|
|||
initialDateRange: initialDateRange,
|
||||
).then(
|
||||
(value) => value != null
|
||||
? '${widget.dateFormat.format(value.start)} - '
|
||||
'${widget.dateFormat.format(value.end)}'
|
||||
: '',
|
||||
? "${widget.dateFormat.format(value.start)} - "
|
||||
"${widget.dateFormat.format(value.end)}"
|
||||
: "",
|
||||
);
|
||||
}
|
||||
|
||||
case FlutterFormDateTimeType.time:
|
||||
var locale = MaterialLocalizations.of(context);
|
||||
if (context.mounted) {
|
||||
userInput = await showTimePicker(
|
||||
initialEntryMode: widget.timePickerEntryMode,
|
||||
|
@ -164,9 +167,8 @@ class _DateInputFieldState extends State<DateTimeInputField> {
|
|||
initialTime: initialTimeOfDay,
|
||||
).then(
|
||||
(value) => value == null
|
||||
? ''
|
||||
: MaterialLocalizations.of(context)
|
||||
.formatTimeOfDay(value, alwaysUse24HourFormat: true),
|
||||
? ""
|
||||
: locale.formatTimeOfDay(value, alwaysUse24HourFormat: true),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -185,12 +187,12 @@ class _DateInputFieldState extends State<DateTimeInputField> {
|
|||
? () async {
|
||||
var userInput = await getInputFromUser(
|
||||
widget.inputType,
|
||||
DateFormat('dd MM yyyy HH:mm'),
|
||||
DateFormat("dd MM yyyy HH:mm"),
|
||||
);
|
||||
setState(() {
|
||||
currentValue = userInput != '' ? userInput : currentValue;
|
||||
currentValue = userInput != "" ? userInput : currentValue;
|
||||
widget.onChanged
|
||||
?.call(userInput != '' ? userInput : currentValue);
|
||||
?.call(userInput != "" ? userInput : currentValue);
|
||||
});
|
||||
}
|
||||
: null,
|
||||
|
@ -199,7 +201,7 @@ class _DateInputFieldState extends State<DateTimeInputField> {
|
|||
InputDecoration(
|
||||
suffixIcon: widget.showIcon ? Icon(widget.icon) : null,
|
||||
focusColor: Theme.of(context).primaryColor,
|
||||
label: widget.label ?? const Text('Date'),
|
||||
label: widget.label ?? const Text("Date"),
|
||||
),
|
||||
enabled: widget.enabled,
|
||||
);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import "package:flutter/material.dart";
|
||||
|
||||
class FlutterFormInputDropdown extends StatelessWidget {
|
||||
const FlutterFormInputDropdown({
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
export 'bool/bool.dart';
|
||||
export 'carousel/carousel.dart';
|
||||
export 'date_picker/date_picker.dart';
|
||||
export 'dropdown/dropdown.dart';
|
||||
export 'number_picker/number_picker.dart';
|
||||
export 'phone/countries.dart';
|
||||
export 'phone/phone.dart';
|
||||
export 'phone/phone_number_model.dart';
|
||||
export 'radio/radio_picker.dart';
|
||||
export 'scroll_picker/scroll_picker.dart';
|
||||
export 'slider/slider.dart';
|
||||
export 'text/password.dart';
|
||||
export 'text/plain_text.dart';
|
||||
export "bool/bool.dart";
|
||||
export "carousel/carousel.dart";
|
||||
export "date_picker/date_picker.dart";
|
||||
export "dropdown/dropdown.dart";
|
||||
export "number_picker/number_picker.dart";
|
||||
export "phone/countries.dart";
|
||||
export "phone/phone.dart";
|
||||
export "phone/phone_number_model.dart";
|
||||
export "radio/radio_picker.dart";
|
||||
export "scroll_picker/scroll_picker.dart";
|
||||
export "slider/slider.dart";
|
||||
export "text/password.dart";
|
||||
export "text/plain_text.dart";
|
||||
|
|
|
@ -2,11 +2,11 @@
|
|||
//
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
import 'dart:math' as math;
|
||||
import "dart:math" as math;
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import "package:flutter/material.dart";
|
||||
|
||||
import 'package:flutter_input_library/src/inputs/number_picker/number_picker_field.dart';
|
||||
import "package:flutter_input_library/src/inputs/number_picker/number_picker_field.dart";
|
||||
|
||||
class DecimalNumberPicker extends StatelessWidget {
|
||||
const DecimalNumberPicker({
|
||||
|
@ -28,8 +28,8 @@ class DecimalNumberPicker extends StatelessWidget {
|
|||
this.integerZeroPad = false,
|
||||
this.integerDecoration,
|
||||
this.decimalDecoration,
|
||||
}) : assert(minValue <= value, 'value must be greater than minValue'),
|
||||
assert(value <= maxValue, 'value must be less than maxValue');
|
||||
}) : assert(minValue <= value, "value must be greater than minValue"),
|
||||
assert(value <= maxValue, "value must be less than maxValue");
|
||||
final int minValue;
|
||||
final int maxValue;
|
||||
final double value;
|
||||
|
|
|
@ -2,12 +2,12 @@
|
|||
//
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
import 'dart:math' as math;
|
||||
import "dart:math" as math;
|
||||
|
||||
import 'package:flutter/gestures.dart' show DragStartBehavior;
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import "package:flutter/gestures.dart" show DragStartBehavior;
|
||||
import "package:flutter/material.dart";
|
||||
import "package:flutter/rendering.dart";
|
||||
import "package:flutter/widgets.dart";
|
||||
|
||||
/// Infinite ListView
|
||||
///
|
||||
|
@ -274,18 +274,18 @@ class InfiniteListViewState extends State<InfiniteListView> {
|
|||
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
|
||||
super.debugFillProperties(properties);
|
||||
properties
|
||||
.add(EnumProperty<Axis>('scrollDirection', widget.scrollDirection));
|
||||
.add(EnumProperty<Axis>("scrollDirection", widget.scrollDirection));
|
||||
properties.add(
|
||||
FlagProperty(
|
||||
'reverse',
|
||||
"reverse",
|
||||
value: widget.reverse,
|
||||
ifTrue: 'reversed',
|
||||
ifTrue: "reversed",
|
||||
showName: true,
|
||||
),
|
||||
);
|
||||
properties.add(
|
||||
DiagnosticsProperty<ScrollController>(
|
||||
'controller',
|
||||
"controller",
|
||||
widget.controller,
|
||||
showName: false,
|
||||
defaultValue: null,
|
||||
|
@ -293,7 +293,7 @@ class InfiniteListViewState extends State<InfiniteListView> {
|
|||
);
|
||||
properties.add(
|
||||
DiagnosticsProperty<ScrollPhysics>(
|
||||
'physics',
|
||||
"physics",
|
||||
widget.physics,
|
||||
showName: false,
|
||||
defaultValue: null,
|
||||
|
@ -301,16 +301,16 @@ class InfiniteListViewState extends State<InfiniteListView> {
|
|||
);
|
||||
properties.add(
|
||||
DiagnosticsProperty<EdgeInsetsGeometry>(
|
||||
'padding',
|
||||
"padding",
|
||||
widget.padding,
|
||||
defaultValue: null,
|
||||
),
|
||||
);
|
||||
properties.add(
|
||||
DoubleProperty('itemExtent', widget.itemExtent, defaultValue: null),
|
||||
DoubleProperty("itemExtent", widget.itemExtent, defaultValue: null),
|
||||
);
|
||||
properties.add(
|
||||
DoubleProperty('cacheExtent', widget.cacheExtent, defaultValue: null),
|
||||
DoubleProperty("cacheExtent", widget.cacheExtent, defaultValue: null),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
//
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import "package:flutter/material.dart";
|
||||
|
||||
import 'package:flutter_input_library/src/inputs/number_picker/number_picker_field.dart';
|
||||
import "package:flutter_input_library/src/inputs/number_picker/number_picker_field.dart";
|
||||
|
||||
class FlutterFormInputNumberPicker extends StatelessWidget {
|
||||
const FlutterFormInputNumberPicker({
|
||||
|
@ -16,7 +16,7 @@ class FlutterFormInputNumberPicker extends StatelessWidget {
|
|||
this.initialValue,
|
||||
this.validator,
|
||||
this.axis = Axis.vertical,
|
||||
}) : assert(minValue < maxValue, 'minValue must be less than maxValue');
|
||||
}) : assert(minValue < maxValue, "minValue must be less than maxValue");
|
||||
|
||||
final int minValue;
|
||||
final int maxValue;
|
||||
|
|
|
@ -2,11 +2,11 @@
|
|||
//
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
import 'dart:async';
|
||||
import "dart:async";
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_input_library/src/inputs/number_picker/infinite_listview.dart';
|
||||
import "package:flutter/material.dart";
|
||||
import "package:flutter/services.dart";
|
||||
import "package:flutter_input_library/src/inputs/number_picker/infinite_listview.dart";
|
||||
|
||||
typedef TextMapper = String Function(String numberText);
|
||||
|
||||
|
@ -29,8 +29,8 @@ class NumberPicker extends StatefulWidget {
|
|||
this.zeroPad = false,
|
||||
this.textMapper,
|
||||
this.infiniteLoop = false,
|
||||
}) : assert(minValue <= value, 'value must be greater than minValue'),
|
||||
assert(value <= maxValue, 'value must be less than maxValue');
|
||||
}) : assert(minValue <= value, "value must be greater than minValue"),
|
||||
assert(value <= maxValue, "value must be less than maxValue");
|
||||
|
||||
/// Min value user can pick
|
||||
final int minValue;
|
||||
|
@ -248,7 +248,7 @@ class NumberPickerState extends State<NumberPicker> {
|
|||
|
||||
String _getDisplayedValue(int value) {
|
||||
var text = widget.zeroPad
|
||||
? value.toString().padLeft(widget.maxValue.toString().length, '0')
|
||||
? value.toString().padLeft(widget.maxValue.toString().length, "0")
|
||||
: value.toString();
|
||||
if (widget.textMapper != null) {
|
||||
return widget.textMapper!(text);
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -3,9 +3,9 @@
|
|||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
// ignore: depend_on_referenced_packages
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_input_library/flutter_input_library.dart';
|
||||
import "package:collection/collection.dart";
|
||||
import "package:flutter/material.dart";
|
||||
import "package:flutter_input_library/flutter_input_library.dart";
|
||||
|
||||
class FlutterFormInputPhone extends StatefulWidget {
|
||||
const FlutterFormInputPhone({
|
||||
|
@ -20,7 +20,7 @@ class FlutterFormInputPhone extends StatefulWidget {
|
|||
this.numberFieldStyle,
|
||||
this.dialCodeSelectorStyle,
|
||||
this.enabled = true,
|
||||
this.priorityCountries = const ['NL', 'BE', 'LU'],
|
||||
this.priorityCountries = const ["NL", "BE", "LU"],
|
||||
this.textAlignVertical = TextAlignVertical.top,
|
||||
this.dialCodeSelectorPadding = const EdgeInsets.only(top: 6),
|
||||
});
|
||||
|
@ -82,7 +82,7 @@ class _FlutterFormInputPhoneState extends State<FlutterFormInputPhone> {
|
|||
Widget build(BuildContext context) {
|
||||
var inputDecoration = widget.decoration ??
|
||||
InputDecoration(
|
||||
label: widget.label ?? const Text('Phone number'),
|
||||
label: widget.label ?? const Text("Phone number"),
|
||||
);
|
||||
|
||||
return FlutterFormInputPlainText(
|
||||
|
@ -122,7 +122,7 @@ class _FlutterFormInputPhoneState extends State<FlutterFormInputPhone> {
|
|||
const SizedBox(
|
||||
width: 4,
|
||||
),
|
||||
Text('+${country.dialCode}'),
|
||||
Text("+${country.dialCode}"),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
// ignore: depend_on_referenced_packages
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_input_library/src/inputs/radio/radio_picker_field.dart';
|
||||
import "package:collection/collection.dart";
|
||||
import "package:flutter/material.dart";
|
||||
import "package:flutter_input_library/src/inputs/radio/radio_picker_field.dart";
|
||||
|
||||
class FlutterFormInputRadioPicker extends StatelessWidget {
|
||||
const FlutterFormInputRadioPicker({
|
||||
|
@ -14,18 +14,21 @@ class FlutterFormInputRadioPicker extends StatelessWidget {
|
|||
this.onSaved,
|
||||
this.onChanged,
|
||||
this.initialValue,
|
||||
this.itemSpacing = 16.0,
|
||||
});
|
||||
|
||||
final Function(RadioItem?)? onSaved;
|
||||
final String? initialValue;
|
||||
final Function(RadioItem?)? onChanged;
|
||||
final List<RadioItem> items;
|
||||
final double itemSpacing;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => RadioPickerFormField(
|
||||
onSaved: (value) => onSaved?.call(value),
|
||||
onChanged: (value) => onChanged?.call(value),
|
||||
initialValue: items.firstWhereOrNull((i) => i.value == initialValue),
|
||||
itemSpacing: itemSpacing,
|
||||
items: items,
|
||||
);
|
||||
}
|
||||
|
@ -34,6 +37,7 @@ class RadioPickerFormField extends FormField<RadioItem?> {
|
|||
RadioPickerFormField({
|
||||
required FormFieldSetter<RadioItem> super.onSaved,
|
||||
required List<RadioItem> items,
|
||||
required double itemSpacing,
|
||||
void Function(RadioItem value)? onChanged,
|
||||
super.initialValue,
|
||||
super.key,
|
||||
|
@ -46,6 +50,7 @@ class RadioPickerFormField extends FormField<RadioItem?> {
|
|||
},
|
||||
items: items,
|
||||
initialValue: initialValue,
|
||||
itemSpacing: itemSpacing,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_input_library/src/inputs/radio/radio_picker.dart';
|
||||
import "package:flutter/material.dart";
|
||||
import "package:flutter_input_library/src/inputs/radio/radio_picker.dart";
|
||||
|
||||
class RadioPicker extends StatefulWidget {
|
||||
const RadioPicker({
|
||||
required this.onChanged,
|
||||
required this.items,
|
||||
this.itemSpacing = 16.0,
|
||||
this.initialValue,
|
||||
super.key,
|
||||
});
|
||||
|
@ -13,12 +14,15 @@ class RadioPicker extends StatefulWidget {
|
|||
final Function(RadioItem) onChanged;
|
||||
final List<RadioItem> items;
|
||||
|
||||
/// The spacing between each item.
|
||||
final double itemSpacing;
|
||||
|
||||
@override
|
||||
State<RadioPicker> createState() => _RadioPickerState();
|
||||
}
|
||||
|
||||
class _RadioPickerState extends State<RadioPicker> {
|
||||
late var value = widget.initialValue;
|
||||
late RadioItem? value = widget.initialValue;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => Wrap(
|
||||
|
@ -42,6 +46,9 @@ class _RadioPickerState extends State<RadioPicker> {
|
|||
),
|
||||
],
|
||||
),
|
||||
if (widget.items.last != item) ...[
|
||||
SizedBox(width: widget.itemSpacing),
|
||||
],
|
||||
],
|
||||
],
|
||||
);
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
export 'scroll_picker_decoration.dart';
|
||||
export 'scroll_picker_type_extensions.dart';
|
||||
export 'scroll_picker_widget.dart';
|
||||
export "scroll_picker_decoration.dart";
|
||||
export "scroll_picker_type_extensions.dart";
|
||||
export "scroll_picker_widget.dart";
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
//
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import "package:flutter/material.dart";
|
||||
|
||||
class ScrollPickerDecoration {
|
||||
const ScrollPickerDecoration({
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
//
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_input_library/src/inputs/scroll_picker/scroll_picker_decoration.dart';
|
||||
import "package:flutter/material.dart";
|
||||
import "package:flutter_input_library/src/inputs/scroll_picker/scroll_picker_decoration.dart";
|
||||
|
||||
class ScrollPicker extends StatefulWidget {
|
||||
const ScrollPicker({
|
||||
|
|
|
@ -35,7 +35,7 @@ class TypeUtils {
|
|||
WeekDay end,
|
||||
) {
|
||||
if (start.index > end.index) {
|
||||
throw ArgumentError('Start month must be before or equal to end month.');
|
||||
throw ArgumentError("Start month must be before or equal to end month.");
|
||||
}
|
||||
|
||||
var result = <DateTime>[];
|
||||
|
@ -49,7 +49,7 @@ class TypeUtils {
|
|||
/// Creates list of Datetime with the months from start to end.
|
||||
List<DateTime> createMonthList(Month start, Month end, {int? year}) {
|
||||
if (start.index > end.index) {
|
||||
throw ArgumentError('Start month must be before or equal to end month.');
|
||||
throw ArgumentError("Start month must be before or equal to end month.");
|
||||
}
|
||||
|
||||
var result = <DateTime>[];
|
||||
|
@ -65,7 +65,7 @@ class TypeUtils {
|
|||
/// Creates a list of Datetime with the years from start to end.
|
||||
List<DateTime> createYearList(int start, int end) {
|
||||
if (start > end) {
|
||||
throw ArgumentError('Start year must be before or equal to year month.');
|
||||
throw ArgumentError("Start year must be before or equal to year month.");
|
||||
}
|
||||
|
||||
var result = <DateTime>[];
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
//
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_input_library/src/inputs/scroll_picker/scroll_picker_decoration.dart';
|
||||
import 'package:flutter_input_library/src/inputs/scroll_picker/scroll_picker_field.dart';
|
||||
import "package:flutter/material.dart";
|
||||
import "package:flutter_input_library/src/inputs/scroll_picker/scroll_picker_decoration.dart";
|
||||
import "package:flutter_input_library/src/inputs/scroll_picker/scroll_picker_field.dart";
|
||||
|
||||
class FlutterFormInputScrollPicker<T> extends StatelessWidget {
|
||||
const FlutterFormInputScrollPicker({
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
//
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_input_library/src/inputs/slider/slider_field.dart';
|
||||
import "package:flutter/material.dart";
|
||||
import "package:flutter_input_library/src/inputs/slider/slider_field.dart";
|
||||
|
||||
class FlutterFormInputSlider extends StatelessWidget {
|
||||
const FlutterFormInputSlider({
|
||||
|
@ -15,7 +15,7 @@ class FlutterFormInputSlider extends StatelessWidget {
|
|||
this.initialValue,
|
||||
this.validator,
|
||||
this.focusNode,
|
||||
}) : assert(minValue < maxValue, 'minValue must be less than maxValue');
|
||||
}) : assert(minValue < maxValue, "minValue must be less than maxValue");
|
||||
|
||||
final int minValue;
|
||||
final int maxValue;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
//
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import "package:flutter/material.dart";
|
||||
|
||||
/// Creates a slider with the given input parameters
|
||||
class SliderFormField extends FormField<double> {
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
//
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import "package:flutter/material.dart";
|
||||
import "package:flutter/services.dart";
|
||||
|
||||
/// Generates a [TextFormField] for passwords. It requires a
|
||||
/// [FlutterFormInputController] as the [controller] parameter and an
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
//
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import "package:flutter/material.dart";
|
||||
import "package:flutter/services.dart";
|
||||
|
||||
class FlutterFormInputPlainText extends StatelessWidget {
|
||||
const FlutterFormInputPlainText({
|
||||
|
@ -53,7 +53,7 @@ class FlutterFormInputPlainText extends StatelessWidget {
|
|||
Widget build(BuildContext context) {
|
||||
var inputDecoration = decoration ??
|
||||
InputDecoration(
|
||||
label: label ?? const Text('Plain text'),
|
||||
label: label ?? const Text("Plain text"),
|
||||
);
|
||||
|
||||
return TextFormField(
|
||||
|
@ -96,6 +96,7 @@ class FlutterFormInputMultiLine extends StatelessWidget {
|
|||
this.validator,
|
||||
this.onFieldSubmitted,
|
||||
this.textCapitalization = TextCapitalization.sentences,
|
||||
this.style,
|
||||
});
|
||||
|
||||
final Widget? label;
|
||||
|
@ -113,12 +114,14 @@ class FlutterFormInputMultiLine extends StatelessWidget {
|
|||
final Function(String?)? onChanged;
|
||||
final Function(String?)? onFieldSubmitted;
|
||||
final TextCapitalization textCapitalization;
|
||||
final TextStyle? style;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: FlutterFormInputPlainText(
|
||||
style: style,
|
||||
label: label,
|
||||
textAlignVertical: TextAlignVertical.top,
|
||||
expands: true,
|
||||
|
|
|
@ -2,4 +2,4 @@
|
|||
//
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
export 'validators/validators.dart';
|
||||
export "validators/validators.dart";
|
||||
|
|
|
@ -2,4 +2,4 @@
|
|||
//
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
export 'email/email.dart';
|
||||
export "email/email.dart";
|
||||
|
|
11
pubspec.yaml
11
pubspec.yaml
|
@ -1,13 +1,16 @@
|
|||
name: flutter_input_library
|
||||
description: A new Flutter package project.
|
||||
version: 3.5.0
|
||||
version: 3.7.0
|
||||
repository: https://github.com/Iconica-Development/flutter_input_library
|
||||
|
||||
publish_to: https://forgejo.internal.iconica.nl/api/packages/internal/pub
|
||||
|
||||
environment:
|
||||
sdk: ^3.0.0
|
||||
sdk: ">=3.0.0 <4.0.0"
|
||||
flutter: ">=1.17.0"
|
||||
|
||||
dependencies:
|
||||
collection: ^1.18.0
|
||||
flutter:
|
||||
sdk: flutter
|
||||
intl: ">=0.18.0 <1.0.0"
|
||||
|
@ -18,6 +21,4 @@ dev_dependencies:
|
|||
flutter_iconica_analysis:
|
||||
git:
|
||||
url: https://github.com/Iconica-Development/flutter_iconica_analysis
|
||||
ref: 6.0.0
|
||||
|
||||
flutter:
|
||||
ref: 7.0.0
|
||||
|
|
Loading…
Reference in a new issue