Git Product home page Git Product logo

Comments (10)

ronytesler avatar ronytesler commented on August 15, 2024 1

make sure you implement these:

@OverRide
bool operator ==(Object other) =>
identical(this, other) ||
other is Person &&
runtimeType == other.runtimeType &&
name == other.name;

@OverRide
int get hashCode => name.hashCode;

from multi_select_flutter.

ronytesler avatar ronytesler commented on August 15, 2024

I have the same problem

from multi_select_flutter.

gurkanucar avatar gurkanucar commented on August 15, 2024

make sure you implement these:

@OverRide
bool operator ==(Object other) =>
identical(this, other) ||
other is Person &&
runtimeType == other.runtimeType &&
name == other.name;

@OverRide
int get hashCode => name.hashCode;

i think it's happening because of reference type datas. Maybe if we compare fields of object, this problem can solve.

from multi_select_flutter.

kjawadDeveloper1 avatar kjawadDeveloper1 commented on August 15, 2024

Any solution. I have simple String ?

from multi_select_flutter.

sarakisar97 avatar sarakisar97 commented on August 15, 2024

I have the same problem, Any solution?

from multi_select_flutter.

jonnyjohnson1 avatar jonnyjohnson1 commented on August 15, 2024

Having the same issue when passing List<Map<String, dynamic>> type to the initial value.

from multi_select_flutter.

TrongTaiDev avatar TrongTaiDev commented on August 15, 2024

Hi all,
In my case, don't use in-line block code
items: categoriesAll .map((e) => MultiSelectItem(e, e.nameTr)) .toList()

Let try:
List<MultiSelectItem<T>> temp = []; <List<T> your-list>.forEach((element) { temp.add(MultiSelectItem<T>(element, element.nameTr)); });

and
items: temp

from multi_select_flutter.

ElixirMike avatar ElixirMike commented on August 15, 2024

also having same problem, any resolution?

from multi_select_flutter.

Xellly avatar Xellly commented on August 15, 2024

Still does not work.

from multi_select_flutter.

pmatatias avatar pmatatias commented on August 15, 2024

hi... im newbie in flutter
i had tried this solution issue#11, but no luck, or maybe I didn't implement in the right way.

so this is my dumb solution 😄 .
i add my own function to compare between initialValue with item list.
image

this is items list:

List<DropdownList> initval = [];

List<DropdownList> myItem = [
    DropdownList(text: "User1", value: 1),
    DropdownList(text: "User2", value: 2),
    DropdownList(text: "User3", value: 3),
    DropdownList(text: "User4", value: 4),
    DropdownList(text: "User5", value: 5),
    DropdownList(text: "User6", value: 6),
    DropdownList(text: "User7", value: 7),
    DropdownList(text: "User8", value: 8),
    DropdownList(text: "User9", value: 9),
    DropdownList(text: "User10", value: 10),
  ]

this is initial value :

List<DropdownList> initialValue = [
    DropdownList(text: "User3", value: 3),
    DropdownList(text: "User7", value: 7)
  ];

then i add new loop function to get the selected item.

 if (initialValue != null || initialValue.isNotEmpty) {
      for (var i in initialValue) {
        final idx = myItem.indexWhere((element) => element.value == i.value);

        initval.add(myItem[idx]);
      }
    }

and last

Container(
    padding: const EdgeInsets.all(8),
    child: MultiSelectChipField(
      items: myItem
          .map(
              (item) => MultiSelectItem<DropdownList?>(item, item.text))
          .toList(),
      initialValue: initval,
      scroll: false,
      selectedChipColor: const Color(0xFF234875),
      selectedTextStyle: const TextStyle(color: Colors.white),
      headerColor: const Color(0xFFDBE2EF),
      onTap: (values) {
        _selectedValue = values;
      },
   ),
),

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.