From 2376a1905ad10fe0e33063af5d89a581a4a35b9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aar=C3=B3n=20Montes?= Date: Sat, 22 May 2021 12:38:31 -0600 Subject: [PATCH 1/2] Upading Flutter SDK version --- .gitignore | 3 ++ .../ios/Flutter/flutter_export_environment.sh | 15 +++++++ example/pubspec.lock | 39 ++++++++++--------- pubspec.lock | 39 ++++++++++--------- pubspec.yaml | 3 +- 5 files changed, 60 insertions(+), 39 deletions(-) create mode 100644 example/ios/Flutter/flutter_export_environment.sh diff --git a/.gitignore b/.gitignore index 446ed0d..cc36960 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,9 @@ .DS_Store .dart_tool/ +.vscode/ +.fvm/ + .packages .pub/ diff --git a/example/ios/Flutter/flutter_export_environment.sh b/example/ios/Flutter/flutter_export_environment.sh new file mode 100644 index 0000000..4769dac --- /dev/null +++ b/example/ios/Flutter/flutter_export_environment.sh @@ -0,0 +1,15 @@ +#!/bin/sh +# This is a generated file; do not edit or check into version control. +export "FLUTTER_ROOT=C:\flutter" +export "FLUTTER_APPLICATION_PATH=C:\Users\Aaron\Documents\ProyectosPersonales\dropdown_formfield\example" +export "FLUTTER_TARGET=lib\main.dart" +export "FLUTTER_BUILD_DIR=build" +export "SYMROOT=${SOURCE_ROOT}/../build\ios" +export "OTHER_LDFLAGS=$(inherited) -framework Flutter" +export "FLUTTER_FRAMEWORK_DIR=C:\flutter\bin\cache\artifacts\engine\ios" +export "FLUTTER_BUILD_NAME=1.0.0" +export "FLUTTER_BUILD_NUMBER=1" +export "DART_OBFUSCATION=false" +export "TRACK_WIDGET_CREATION=false" +export "TREE_SHAKE_ICONS=false" +export "PACKAGE_CONFIG=.packages" diff --git a/example/pubspec.lock b/example/pubspec.lock index 3c1e837..7faac7e 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -7,42 +7,42 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.4.2" + version: "2.5.0-nullsafety.1" boolean_selector: dependency: transitive description: name: boolean_selector url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.1.0-nullsafety.1" characters: dependency: transitive description: name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.0.0" + version: "1.1.0-nullsafety.3" charcode: dependency: transitive description: name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.1.3" + version: "1.2.0-nullsafety.1" clock: dependency: transitive description: name: clock url: "https://pub.dartlang.org" source: hosted - version: "1.0.1" + version: "1.1.0-nullsafety.1" collection: dependency: transitive description: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.14.13" + version: "1.15.0-nullsafety.3" cupertino_icons: dependency: "direct main" description: @@ -63,7 +63,7 @@ packages: name: fake_async url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.2.0-nullsafety.1" flutter: dependency: "direct main" description: flutter @@ -80,21 +80,21 @@ packages: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.8" + version: "0.12.10-nullsafety.1" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.1.8" + version: "1.3.0-nullsafety.3" path: dependency: transitive description: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.7.0" + version: "1.8.0-nullsafety.1" sky_engine: dependency: transitive description: flutter @@ -106,55 +106,56 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.7.0" + version: "1.8.0-nullsafety.2" stack_trace: dependency: transitive description: name: stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.9.5" + version: "1.10.0-nullsafety.1" stream_channel: dependency: transitive description: name: stream_channel url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.1.0-nullsafety.1" string_scanner: dependency: transitive description: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.0.5" + version: "1.1.0-nullsafety.1" term_glyph: dependency: transitive description: name: term_glyph url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.2.0-nullsafety.1" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.17" + version: "0.2.19-nullsafety.2" typed_data: dependency: transitive description: name: typed_data url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.3.0-nullsafety.3" vector_math: dependency: transitive description: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.0.8" + version: "2.1.0-nullsafety.3" sdks: - dart: ">=2.9.0-14.0.dev <3.0.0" + dart: ">=2.10.0-110 <2.11.0" + flutter: ">=1.17.0" diff --git a/pubspec.lock b/pubspec.lock index 9477cdd..ed3ea9d 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -7,49 +7,49 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.4.2" + version: "2.5.0-nullsafety.1" boolean_selector: dependency: transitive description: name: boolean_selector url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.1.0-nullsafety.1" characters: dependency: transitive description: name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.0.0" + version: "1.1.0-nullsafety.3" charcode: dependency: transitive description: name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.1.3" + version: "1.2.0-nullsafety.1" clock: dependency: transitive description: name: clock url: "https://pub.dartlang.org" source: hosted - version: "1.0.1" + version: "1.1.0-nullsafety.1" collection: dependency: transitive description: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.14.13" + version: "1.15.0-nullsafety.3" fake_async: dependency: transitive description: name: fake_async url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.2.0-nullsafety.1" flutter: dependency: "direct main" description: flutter @@ -66,21 +66,21 @@ packages: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.8" + version: "0.12.10-nullsafety.1" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.1.8" + version: "1.3.0-nullsafety.3" path: dependency: transitive description: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.7.0" + version: "1.8.0-nullsafety.1" sky_engine: dependency: transitive description: flutter @@ -92,55 +92,56 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.7.0" + version: "1.8.0-nullsafety.2" stack_trace: dependency: transitive description: name: stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.9.5" + version: "1.10.0-nullsafety.1" stream_channel: dependency: transitive description: name: stream_channel url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.1.0-nullsafety.1" string_scanner: dependency: transitive description: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.0.5" + version: "1.1.0-nullsafety.1" term_glyph: dependency: transitive description: name: term_glyph url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.2.0-nullsafety.1" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.17" + version: "0.2.19-nullsafety.2" typed_data: dependency: transitive description: name: typed_data url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.3.0-nullsafety.3" vector_math: dependency: transitive description: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.0.8" + version: "2.1.0-nullsafety.3" sdks: - dart: ">=2.9.0-14.0.dev <3.0.0" + dart: ">=2.10.0-110 <2.11.0" + flutter: ">=1.17.0" diff --git a/pubspec.yaml b/pubspec.yaml index 49e0fb5..9572889 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -5,7 +5,8 @@ author: Carlos E. Torres homepage: https://github.com/cetorres/dropdown_formfield environment: - sdk: ">=2.1.0 <3.0.0" + sdk: ">=2.7.0 <3.0.0" + flutter: ">=1.17.0" dependencies: flutter: From bd85bca30c555d6993451221d44b102ce03bd9d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aar=C3=B3n=20Montes?= Date: Sat, 22 May 2021 12:39:10 -0600 Subject: [PATCH 2/2] Updating dropdown implemenation to add styles props and adding comments for documentation --- lib/dropdown_formfield.dart | 41 ++++++++++++++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 3 deletions(-) diff --git a/lib/dropdown_formfield.dart b/lib/dropdown_formfield.dart index a8389a2..6e16d36 100644 --- a/lib/dropdown_formfield.dart +++ b/lib/dropdown_formfield.dart @@ -3,22 +3,52 @@ library dropdown_formfield; import 'package:flutter/material.dart'; class DropDownFormField extends FormField { + /// String value to indicate widget title final String titleText; + + /// String value to indicate hint text final String hintText; + + /// Boolean value to indicate when the widget value is required final bool required; + + /// String value to indicate error text final String errorText; + + /// Dynamic value to indicate the initial value for the widget final dynamic value; + + /// Dynamic list of values to fill the dropdown list final List dataSource; + + /// String value to indicate the field to display from dataSource final String textField; + + /// String value to indicate the field to take as value from dataSource final String valueField; + + /// Function to call when the dropdown changes its value final Function onChanged; + + /// Boolean value to indicate when input is filled by default color final bool filled; + + /// Color value to indicate the fill color when filled is true + final Color filledColor; + + /// Value to stylize the title label + final TextStyle labelStyle; + + /// Value to stylize the hint text + final TextStyle hintStyle; + + /// Value to indicate the content padding final EdgeInsets contentPadding; DropDownFormField( {FormFieldSetter onSaved, FormFieldValidator validator, - bool autovalidate = false, + AutovalidateMode autovalidateMode = AutovalidateMode.disabled, this.titleText = 'Title', this.hintText = 'Select one option', this.required = false, @@ -29,11 +59,14 @@ class DropDownFormField extends FormField { this.valueField, this.onChanged, this.filled = true, + this.filledColor = const Color.fromARGB(255, 237, 237, 238), + this.labelStyle, + this.hintStyle, this.contentPadding = const EdgeInsets.fromLTRB(12, 12, 8, 0)}) : super( onSaved: onSaved, validator: validator, - autovalidate: autovalidate, + autovalidateMode: autovalidateMode, initialValue: value == '' ? null : value, builder: (FormFieldState state) { return Container( @@ -44,14 +77,16 @@ class DropDownFormField extends FormField { decoration: InputDecoration( contentPadding: contentPadding, labelText: titleText, + labelStyle: labelStyle, filled: filled, + fillColor: filledColor ), child: DropdownButtonHideUnderline( child: DropdownButton( isExpanded: true, hint: Text( hintText, - style: TextStyle(color: Colors.grey.shade500), + style: hintStyle??TextStyle(color: Colors.grey.shade500), ), value: value == '' ? null : value, onChanged: (dynamic newValue) {