Git Product home page Git Product logo

Comments (1)

CHB61 avatar CHB61 commented on July 17, 2024

@lozthiensu Hello,

Now that I'm looking at this code, I believe the initial null check for state (FormFieldState) is not necessary. In previous versions, there was

  • MultiSelectField - not a FormField and by default not drawn with a bottom border
  • MultiSelectFormField - FormField and drawn with bottom border
    and now there's only the FormField version, so state shouldn't be null.

However it has always been possible to override this default bottom border by providing a decoration parameter to the MultiSelectDialogField or MultiSelectBottomSheetField.

I am able to override the default black border with this example

MultiSelectDialogField(
  onConfirm: (val) {
    _selectedAnimals = val;
  },
  items: _items,
  decoration: BoxDecoration(
    border: Border(
      bottom: BorderSide(
        color: Colors.blue,
      ),
    ),
  ),
),

Doing this removes the default behavior of switching to a red underline when the FormFieldState has an error. If you wanted to retain that, you'd have to do something like

border: Border(
  bottom: BorderSide(
    color: _multiSelectKey.currentState != null &&
            _multiSelectKey.currentState.hasError
        ? Colors.red
        : Colors.blue,
  ),
),

and then setState after you call validate on the _multiSelectKey.

Can you provide an example where you are unable to achieve what you want?

from multi_select_flutter.

Related Issues (20)

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.