Giter Club home page Giter Club logo

dropdown_formfield's Introduction

Hi there, I'm Carlos ๐Ÿ‘‹

Donate

I'm a software engineer, computer scientist, researcher, geek, and a spiritist!

  • ๐Ÿ‘จ๐Ÿผโ€๐Ÿ’ป I'm currently working as a Principal Member of Technical Staff on Oracle Health's Clinical Digital Assistant team at Oracle and some other personal apps projects.
  • ๐ŸŽ“ I'm also pursuing my Ph.D. in Computer Science at UCCS started in Fall 2021.
  • ๐Ÿ’พ My past work can be found at NeoTreks and Cacira.
  • ๐ŸŒฑ Iโ€™m currently learning everything I can! ๐Ÿคฃ
  • ๐Ÿ‘ฏ Iโ€™m looking to collaborate on mobile apps development.
  • ๐Ÿฅ… Goals: contribute more to open source projects.
  • ๐Ÿ’ฌ Ask me about anything.
  • โšก Fun facts: I love to play guitar, drums, and World of Warcraft in my free time.

Open-source research projects

Other open-source projects

Connect with me

website Twitter LinkedIn

My interests

  • AI/ML research and development.
  • Full stack development with Node.JS, Python, React, Solid, Svelte, HTML, JS, CSS.
  • Mobile app development using Flutter and Swift (iOS native).
  • Agile project management.
  • Databases like MySQL, Postgres, and MongoDB.
  • Self-improvement and self-knowledge through Spiritism.

Gists

My Github stats

dropdown_formfield's People

Contributors

cetorres avatar georgeherby avatar rafaelplantard avatar schmidt-kevin avatar yschermer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

dropdown_formfield's Issues

I'm VSCode (flutter) and Andriod Studio

Anyone help, i have problem with adding dropdown_formfield

Error message "The current Dart SDK version is 3.1.2.

Because androidesp32cambtapp depends on dropdown_formfield any which doesn't support null safety, version solving failed.

The lower bound of "sdk: '>=2.1.0 <3.0.0'" must be 2.12.0 or higher to enable null safety.
For details, see https://dart.dev/null-safety
exit code 65"

I think the issue : that dropdown_formfield "sdk: '>=2.1.0 <3.0.0'". how can i get dropdown_formfield that is "sdk: '>=2.12.0 <3.1.2'"

Add property "enabled"

Every FormField has property "enabled" which allows to lock UI controls while some network operation with API happens, for example.

problem with a standard or default value for the dropdown list

when I give a default value fro the dropdown it is displayed correctly as the chosen item from the dropdown.
But when it gets validated it has a null value, and only works if i really choose the item in the dropdown. It seems that value only then gets updated?

Null safe library

I am trying to use your beautiful package but get this error "The library 'package:dropdown_formfield/dropdown_formfield.dart' is legacy, and shouldn't be imported into a null safe library. (Documentation)"
Could you please advice?

onSaved and validator error

When i set an initial value (because i want the field to be with a initial value) when i validate or save the form i get an error because the value received by the onSaved or validator is null.

This is probably happening because when i set an initial value the onChanged method is not being called and the value is not being updated internally.

Besides this error, this is a great component. Thanks a lot for you effort

Initial value

Add an option to set an initial value of the form field.

onSaved value is null when no onChanged event is triggered even when value is set

Nexus 5X API 29 x86 (android-x86 emulator)
Flutter 1.9.1 + hotfix.4

Only line changed in code example is:
_myActivity = 'Running'; from _myActivity = '';

When putting a breakpoint at onSaved, and then pressing on the save button without selecting anything then value = null. Yet, the dropdown shows the right text.

Problem occured to me when updating a form, inserting initial values, and then clicking on save without changing the initial values. In the mean time, I just check for when it is null, and don't update that field.

import 'package:dropdown_formfield/dropdown_formfield.dart';
import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  String _myActivity;
  String _myActivityResult;
  final formKey = new GlobalKey<FormState>();

  @override
  void initState() {
    super.initState();
    _myActivity = 'Running';
    _myActivityResult = '';
  }

  _saveForm() {
    var form = formKey.currentState;
    if (form.validate()) {
      form.save();
      setState(() {
        _myActivityResult = _myActivity;
      });
    }
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Dropdown Formfield Example'),
      ),
      body: Center(
        child: Form(
          key: formKey,
          child: Column(
            mainAxisAlignment: MainAxisAlignment.start,
            children: <Widget>[
              Container(
                padding: EdgeInsets.all(16),
                child: DropDownFormField(
                  titleText: 'My workout',
                  hintText: 'Please choose one',
                  value: _myActivity,
                  onSaved: (value) {
                    setState(() {
                      _myActivity = value;
                    });
                  },
                  onChanged: (value) {
                    setState(() {
                      _myActivity = value;
                    });
                  },
                  dataSource: [
                    {
                      "display": "Running",
                      "value": "Running",
                    },
                    {
                      "display": "Climbing",
                      "value": "Climbing",
                    },
                    {
                      "display": "Walking",
                      "value": "Walking",
                    },
                    {
                      "display": "Swimming",
                      "value": "Swimming",
                    },
                    {
                      "display": "Soccer Practice",
                      "value": "Soccer Practice",
                    },
                    {
                      "display": "Baseball Practice",
                      "value": "Baseball Practice",
                    },
                    {
                      "display": "Football Practice",
                      "value": "Football Practice",
                    },
                  ],
                  textField: 'display',
                  valueField: 'value',
                ),
              ),
              Container(
                padding: EdgeInsets.all(8),
                child: RaisedButton(
                  child: Text('Save'),
                  onPressed: _saveForm,
                ),
              ),
              Container(
                padding: EdgeInsets.all(16),
                child: Text(_myActivityResult),
              )
            ],
          ),
        ),
      ),
    );
  }
}

Error: [ E/flutter (10956): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: NoSuchMethodError: The method 'call' was called on null. ]

After the flutter update, I'm having the following problem

E/flutter (10956): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: NoSuchMethodError: The method 'call' was called on null.
E/flutter (10956): Receiver: null
E/flutter (10956): Tried calling: call()
E/flutter (10956): #0 new DropDownFormField..
package:material_dropdown_formfield/material_dropdown_formfield.dart:157
E/flutter (10956): #1 _DropdownButtonState._handleTap.
package:flutter/โ€ฆ/material/dropdown.dart:1219
E/flutter (10956): #2 _rootRunUnary (dart:async/zone.dart:1192:38)
E/flutter (10956): #3 _CustomZone.runUnary (dart:async/zone.dart:1085:19)
E/flutter (10956): #4 _FutureListener.handleValue (dart:async/future_impl.dart:141:18)
E/flutter (10956): #5 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:682:45)
E/flutter (10956): #6 Future._propagateToListeners (dart:async/future_impl.dart:711:32)
E/flutter (10956): #7 Future._completeWithValue (dart:async/future_impl.dart:526:5)
E/flutter (10956): #8 Future._asyncComplete. (dart:async/future_impl.dart:556:7)
E/flutter (10956): #9 _rootRun (dart:async/zone.dart:1184:13)
E/flutter (10956): #10 _CustomZone.run (dart:async/zone.dart:1077:19)
E/flutter (10956): #11 _CustomZone.runGuarded (dart:async/zone.dart:979:7)
E/flutter (10956): #12 _CustomZone.bindCallbackGuarded. (dart:async/zone.dart:1019:23)
E/flutter (10956): #13 _microtaskLoop (dart:async/schedule_microtask.dart:43:21)
E/flutter (10956): #14 _startMicrotaskLoop (dart:async/schedule_microtask.dart:52:5)
E/flutter (10956):

How to set font size of text label and hint ?

`library dropdown_formfield;

import 'package:flutter/material.dart';

class DropDownFormField extends FormField {
final String titleText;
final String hintText;
final bool required;
final String errorText;
final dynamic value;
final List dataSource;
final String textField;
final String valueField;
final Function onChanged;
final bool filled;
final EdgeInsets contentPadding;

DropDownFormField(
{FormFieldSetter onSaved,
FormFieldValidator validator,
bool autovalidate = false,
this.titleText = 'Title',
this.hintText = 'Select one option',
this.required = false,
this.errorText = 'Please select one option',
this.value,
this.dataSource,
this.textField,
this.valueField,
this.onChanged,
this.filled = true,
this.contentPadding = const EdgeInsets.fromLTRB(12, 12, 8, 0)})
: super(
onSaved: onSaved,
validator: validator,
autovalidate: autovalidate,
initialValue: value == '' ? null : value,
builder: (FormFieldState state) {
return Container(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
InputDecorator(

                decoration: InputDecoration(
                  contentPadding: contentPadding,
                  labelText: titleText,
                  filled: filled,
                ),
                child: DropdownButtonHideUnderline(
                  child: DropdownButton<dynamic>(
                    isExpanded: true,
                    hint: Text(
                      hintText,
                      style: TextStyle(color: Colors.grey.shade500),
                    ),
                    value: value == '' ? null : value,
                    onChanged: (dynamic newValue) {
                      state.didChange(newValue);
                      onChanged(newValue);
                    },
                    items: dataSource.map((item) {
                      return DropdownMenuItem<dynamic>(
                        value: item[valueField],
                        child: Text(item[textField],
                            overflow: TextOverflow.ellipsis),
                      );
                    }).toList(),
                  ),
                ),
              ),
              SizedBox(height: state.hasError ? 5.0 : 0.0),
              Text(
                state.hasError ? state.errorText : '',
                style: TextStyle(
                    color: Colors.redAccent.shade700,
                    fontSize: state.hasError ? 12.0 : 0.0),
              ),
            ],
          ),
        );
      },
    );

}
`

Add focusNode

Please add a focusNode so when a user presses the next button on their keyboard, we can focus and unfocus the DropDownFormField.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.