Skip to content

Commit

Permalink
Merge branch 'version_4' of https://github.com/danvick/flutter_form_b…
Browse files Browse the repository at this point in the history
…uilder into version_4

# Conflicts:
#	lib/src/fields/form_builder_country_picker.dart
#	lib/src/fields/form_builder_date_time_picker.dart
#	lib/src/fields/form_builder_dropdown.dart
#	lib/src/fields/form_builder_range_slider.dart
  • Loading branch information
danvick committed Oct 2, 2020
2 parents 859a40c + a6fa0e5 commit adfe909
Show file tree
Hide file tree
Showing 29 changed files with 175 additions and 174 deletions.
16 changes: 0 additions & 16 deletions example/ios/Flutter/flutter_export_environment.sh

This file was deleted.

2 changes: 1 addition & 1 deletion example/lib/sources/complete_form.dart
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ class CompleteFormState extends State<CompleteForm> {
]),
),
FormBuilderTextField(
autovalidate: true,
autovalidateMode: AutovalidateMode.always,
name: 'age',
decoration: InputDecoration(
labelText: 'Age',
Expand Down
3 changes: 3 additions & 0 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ dependencies:
widget_with_codeview: ^1.0.3
cupertino_icons: any

dependency_overrides:
modal_bottom_sheet: ^0.2.1+1-dev

dev_dependencies:
flutter_test:
sdk: flutter
Expand Down
4 changes: 2 additions & 2 deletions lib/src/fields/form_builder_checkbox.dart
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class FormBuilderCheckbox extends FormBuilderField<bool> {
ValueTransformer valueTransformer,
bool enabled = true,
FormFieldSetter onSaved,
bool autovalidate = false,
AutovalidateMode autovalidateMode = AutovalidateMode.disabled,
VoidCallback onReset,
FocusNode focusNode,
@required this.title,
Expand All @@ -97,7 +97,7 @@ class FormBuilderCheckbox extends FormBuilderField<bool> {
valueTransformer: valueTransformer,
onChanged: onChanged,
readOnly: readOnly,
autovalidate: autovalidate,
autovalidateMode: autovalidateMode,
onSaved: onSaved,
enabled: enabled,
onReset: onReset,
Expand Down
4 changes: 2 additions & 2 deletions lib/src/fields/form_builder_checkbox_group.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class FormBuilderCheckboxGroup<T> extends FormBuilderField<List<T>> {
ValueTransformer valueTransformer,
bool enabled = true,
FormFieldSetter onSaved,
bool autovalidate = false,
AutovalidateMode autovalidateMode = AutovalidateMode.disabled,
VoidCallback onReset,
FocusNode focusNode,
@required this.options,
Expand Down Expand Up @@ -66,7 +66,7 @@ class FormBuilderCheckboxGroup<T> extends FormBuilderField<List<T>> {
valueTransformer: valueTransformer,
onChanged: onChanged,
readOnly: readOnly,
autovalidate: autovalidate,
autovalidateMode: autovalidateMode,
onSaved: onSaved,
enabled: enabled,
onReset: onReset,
Expand Down
4 changes: 2 additions & 2 deletions lib/src/fields/form_builder_chips_input.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class FormBuilderChipsInput<T> extends FormBuilderField<List<T>> {
ValueTransformer valueTransformer,
bool enabled = true,
FormFieldSetter onSaved,
bool autovalidate = false,
AutovalidateMode autovalidateMode = AutovalidateMode.disabled,
VoidCallback onReset,
FocusNode focusNode,
@required this.chipBuilder,
Expand All @@ -62,7 +62,7 @@ class FormBuilderChipsInput<T> extends FormBuilderField<List<T>> {
valueTransformer: valueTransformer,
onChanged: onChanged,
readOnly: readOnly,
autovalidate: autovalidate,
autovalidateMode: autovalidateMode,
onSaved: onSaved,
enabled: enabled,
onReset: onReset,
Expand Down
4 changes: 2 additions & 2 deletions lib/src/fields/form_builder_choice_chips.dart
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ class FormBuilderChoiceChip<T> extends FormBuilderField<T> {
ValueTransformer valueTransformer,
bool enabled = true,
FormFieldSetter onSaved,
bool autovalidate = false,
AutovalidateMode autovalidateMode = AutovalidateMode.disabled,
VoidCallback onReset,
FocusNode focusNode,
@required this.options,
Expand Down Expand Up @@ -283,7 +283,7 @@ class FormBuilderChoiceChip<T> extends FormBuilderField<T> {
valueTransformer: valueTransformer,
onChanged: onChanged,
readOnly: readOnly,
autovalidate: autovalidate,
autovalidateMode: autovalidateMode,
onSaved: onSaved,
enabled: enabled,
onReset: onReset,
Expand Down
50 changes: 25 additions & 25 deletions lib/src/fields/form_builder_color_picker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@ class FormBuilderColorPickerField extends FormBuilderField<Color> {
final VoidCallback onEditingComplete;
final ValueChanged<String> onFieldSubmitted;
final List<TextInputFormatter> inputFormatters;
final double cursorWidth ;
final double cursorWidth;
final Radius cursorRadius;
final Color cursorColor;
final Brightness keyboardAppearance;
final EdgeInsets scrollPadding ;
final bool enableInteractiveSelection ;
final EdgeInsets scrollPadding;
final bool enableInteractiveSelection;
final InputCounterWidgetBuilder buildCounter;

FormBuilderColorPickerField({
Expand All @@ -68,7 +68,7 @@ class FormBuilderColorPickerField extends FormBuilderField<Color> {
Color initialValue,
FormFieldValidator validator,
bool enabled = true,
bool autovalidate = false,
AutovalidateMode autovalidateMode = AutovalidateMode.disabled,
ValueTransformer valueTransformer,
ValueChanged onChanged,
FormFieldSetter<Color> onSaved,
Expand All @@ -84,27 +84,27 @@ class FormBuilderColorPickerField extends FormBuilderField<Color> {
this.textInputAction,
this.style,
this.strutStyle,
this. textDirection,
this. autofocus = false,
this. obscureText = false,
this. autocorrect = true,
this. maxLengthEnforced = true,
this. maxLines = 1,
this. expands = false,
this. showCursor,
this. minLines,
this. maxLength,
this. onEditingComplete,
this. onFieldSubmitted,
this.textDirection,
this.autofocus = false,
this.obscureText = false,
this.autocorrect = true,
this.maxLengthEnforced = true,
this.maxLines = 1,
this.expands = false,
this.showCursor,
this.minLines,
this.maxLength,
this.onEditingComplete,
this.onFieldSubmitted,
// FormFieldValidator<String> validator,
this. inputFormatters,
this. cursorWidth = 2.0,
this. cursorRadius,
this. cursorColor,
this. keyboardAppearance,
this. scrollPadding = const EdgeInsets.all(20.0),
this. enableInteractiveSelection = true,
this. buildCounter,
this.inputFormatters,
this.cursorWidth = 2.0,
this.cursorRadius,
this.cursorColor,
this.keyboardAppearance,
this.scrollPadding = const EdgeInsets.all(20.0),
this.enableInteractiveSelection = true,
this.buildCounter,
}) : super(
key: key,
initialValue: initialValue,
Expand All @@ -113,7 +113,7 @@ class FormBuilderColorPickerField extends FormBuilderField<Color> {
valueTransformer: valueTransformer,
onChanged: onChanged,
readOnly: readOnly,
autovalidate: autovalidate,
autovalidateMode: autovalidateMode,
onSaved: onSaved,
enabled: enabled,
onReset: onReset,
Expand Down
1 change: 1 addition & 0 deletions lib/src/fields/form_builder_country_picker.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

6 changes: 3 additions & 3 deletions lib/src/fields/form_builder_date_range_picker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class FormBuilderDateRangePicker extends FormBuilderField {
ValueTransformer valueTransformer,
bool enabled = true,
FormFieldSetter onSaved,
bool autovalidate = false,
AutovalidateMode autovalidateMode = AutovalidateMode.disabled,
VoidCallback onReset,
FocusNode focusNode,
@required this.firstDate,
Expand Down Expand Up @@ -123,7 +123,7 @@ class FormBuilderDateRangePicker extends FormBuilderField {
valueTransformer: valueTransformer,
onChanged: onChanged,
readOnly: readOnly,
autovalidate: autovalidate,
autovalidateMode: autovalidateMode,
onSaved: onSaved,
enabled: enabled,
onReset: onReset,
Expand Down Expand Up @@ -227,7 +227,7 @@ class FormBuilderDateRangePickerState extends FormBuilderFieldState {
selectableDayPredicate: widget.selectableDayPredicate,
);
if (picked != null) {
if(picked.length == 1){
if (picked.length == 1) {
picked.add(picked[0]);
}
didChange(picked);
Expand Down
15 changes: 11 additions & 4 deletions lib/src/fields/form_builder_date_time_picker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ class FormBuilderDateTimePicker extends FormBuilderField {
ValueTransformer valueTransformer,
bool enabled = true,
FormFieldSetter onSaved,
bool autovalidate = false,
AutovalidateMode autovalidateMode = AutovalidateMode.disabled,
VoidCallback onReset,
FocusNode focusNode,
this.inputType = InputType.both,
Expand Down Expand Up @@ -226,7 +226,7 @@ class FormBuilderDateTimePicker extends FormBuilderField {
valueTransformer: valueTransformer,
onChanged: onChanged,
readOnly: readOnly,
autovalidate: autovalidate,
autovalidateMode: autovalidateMode,
onSaved: onSaved,
enabled: enabled,
onReset: onReset,
Expand All @@ -240,7 +240,8 @@ class FormBuilderDateTimePicker extends FormBuilderField {
format: state.dateFormat,
validator: validator,
onShowPicker: state.onShowPicker,
autovalidate: autovalidate,
autovalidate: autovalidateMode != AutovalidateMode.disabled &&
autovalidateMode != null,
resetIcon: resetIcon,
textDirection: textDirection,
textAlign: textAlign,
Expand Down Expand Up @@ -300,12 +301,18 @@ class _FormBuilderDateTimePickerState extends FormBuilderFieldState {
DateFormat get dateFormat =>
widget.format ?? _dateTimeFormats[widget.inputType];

Map _dateTimeFormats;
Map _dateTimeFormats = {
InputType.both: DateFormat.yMd().add_Hms(),
InputType.date: DateFormat.yMd(),
InputType.time: DateFormat.Hm(),
};

@override
void initState() {
super.initState();
_textFieldController = widget.controller ?? TextEditingController();
_textFieldController.text =
initialValue == null ? '' : dateFormat.format(initialValue);
// effectiveFocusNode.addListener(_handleFocus);
}

Expand Down
5 changes: 3 additions & 2 deletions lib/src/fields/form_builder_dropdown.dart
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ class FormBuilderDropdown<T> extends FormBuilderField<T> {
ValueTransformer valueTransformer,
bool enabled = true,
FormFieldSetter onSaved,
bool autovalidate = false,
AutovalidateMode autovalidateMode = AutovalidateMode.disabled,
VoidCallback onReset,
FocusNode focusNode,
@required this.items,
Expand Down Expand Up @@ -221,7 +221,7 @@ class FormBuilderDropdown<T> extends FormBuilderField<T> {
valueTransformer: valueTransformer,
onChanged: onChanged,
readOnly: readOnly,
autovalidate: autovalidate,
autovalidateMode: autovalidateMode,
onSaved: onSaved,
enabled: enabled,
onReset: onReset,
Expand All @@ -239,6 +239,7 @@ class FormBuilderDropdown<T> extends FormBuilderField<T> {
? decoration.floatingLabelBehavior
: FloatingLabelBehavior.always,
),
isEmpty: state.value == null,
child: Row(
children: <Widget>[
Expanded(
Expand Down
4 changes: 2 additions & 2 deletions lib/src/fields/form_builder_filter_chips.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class FormBuilderFilterChip extends FormBuilderField<dynamic> {
ValueTransformer valueTransformer,
bool enabled = true,
FormFieldSetter onSaved,
bool autovalidate = false,
AutovalidateMode autovalidateMode = AutovalidateMode.disabled,
VoidCallback onReset,
FocusNode focusNode,
@required this.options,
Expand Down Expand Up @@ -78,7 +78,7 @@ class FormBuilderFilterChip extends FormBuilderField<dynamic> {
valueTransformer: valueTransformer,
onChanged: onChanged,
readOnly: readOnly,
autovalidate: autovalidate,
autovalidateMode: autovalidateMode,
onSaved: onSaved,
enabled: enabled,
onReset: onReset,
Expand Down
39 changes: 20 additions & 19 deletions lib/src/fields/form_builder_image_picker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class FormBuilderImagePicker extends FormBuilderField {
final Widget galleryLabel;
final EdgeInsets bottomSheetPadding;

FormBuilderImagePicker( {
FormBuilderImagePicker({
Key key,
//From Super
@required String name,
Expand All @@ -50,7 +50,7 @@ class FormBuilderImagePicker extends FormBuilderField {
ValueTransformer valueTransformer,
bool enabled = true,
FormFieldSetter onSaved,
bool autovalidate = false,
AutovalidateMode autovalidateMode = AutovalidateMode.disabled,
VoidCallback onReset,
FocusNode focusNode,
this.previewWidth = 130,
Expand Down Expand Up @@ -78,7 +78,7 @@ class FormBuilderImagePicker extends FormBuilderField {
valueTransformer: valueTransformer,
onChanged: onChanged,
readOnly: readOnly,
autovalidate: autovalidate,
autovalidateMode: autovalidateMode,
onSaved: onSaved,
enabled: enabled,
onReset: onReset,
Expand Down Expand Up @@ -143,22 +143,23 @@ class FormBuilderImagePicker extends FormBuilderField {
}).toList()),
if (!state.readOnly && !state.hasMaxImages)
GestureDetector(
child: placeholderImage != null?
Image(
width: previewWidth,
height: previewHeight,
image: placeholderImage,
) : Container(
width: previewWidth,
height: previewHeight,
child: Icon(Icons.camera_enhance,
color: state.readOnly
? disabledColor
: iconColor ?? primaryColor),
color: (state.readOnly
? disabledColor
: iconColor ?? primaryColor)
.withAlpha(50)),
child: placeholderImage != null
? Image(
width: previewWidth,
height: previewHeight,
image: placeholderImage,
)
: Container(
width: previewWidth,
height: previewHeight,
child: Icon(Icons.camera_enhance,
color: state.readOnly
? disabledColor
: iconColor ?? primaryColor),
color: (state.readOnly
? disabledColor
: iconColor ?? primaryColor)
.withAlpha(50)),
onTap: () {
showModalBottomSheet(
context: state.context,
Expand Down
4 changes: 2 additions & 2 deletions lib/src/fields/form_builder_location_field.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class FormBuilderLocationField extends FormBuilderField<CameraPosition> {
ValueTransformer valueTransformer,
bool enabled = true,
FormFieldSetter onSaved,
bool autovalidate = false,
AutovalidateMode autovalidateMode = AutovalidateMode.disabled,
VoidCallback onReset,
FocusNode focusNode,
this.allowClear = true,
Expand Down Expand Up @@ -93,7 +93,7 @@ class FormBuilderLocationField extends FormBuilderField<CameraPosition> {
valueTransformer: valueTransformer,
onChanged: onChanged,
readOnly: readOnly,
autovalidate: autovalidate,
autovalidateMode: autovalidateMode,
onSaved: onSaved,
enabled: enabled,
onReset: onReset,
Expand Down
Loading

0 comments on commit adfe909

Please sign in to comment.