Giter Club home page Giter Club logo

multiselect_dropdown_flutter's People

Contributors

msitbon avatar sanjaysodani avatar sanjaysodani-sq avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

multiselect_dropdown_flutter's Issues

Can't get data with await

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

import 'package:multiselect_dropdown_flutter/multiselect_dropdown_flutter.dart';

void main() {
  runApp(const MyApp());
}

class Controller extends GetxController {

  var names = <Map<String, dynamic>>[].obs;

  @override
  void onInit() {
    super.onInit();
    fetchDataFromNetwork();
  }

  Future<void> fetchDataFromNetwork() async {
    // Эмулируем задержку, как будто данные загружаются из сети
    await Future.delayed(Duration(seconds: 1));

    // Получаем данные (в данном случае, данные получаются с сервера)
    final List<Map<String, dynamic>> data = [
      {'id': 'dog', 'label': 'Dog'},
      {'id': 'cat', 'label': 'Cat'},
      {'id': 'mouse', 'label': 'Mouse'},
      {'id': 'rabbit', 'label': 'Rabbit'},
    ];

    names.assignAll(data);
  }
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      title: 'MultiSelect Dropdown demo',
      home: MultiSelectExample(),
    );
  }
}

class MultiSelectExample extends StatelessWidget {
  
  const MultiSelectExample({super.key});
  
  @override
  Widget build(BuildContext context) {

    final Controller ctrl = Get.put(Controller());

    return Scaffold(
      body: Padding(
        padding: const EdgeInsets.all(20),
        child: Column(
          children: [
            MultiSelectDropdown(
              list: ctrl.names,
              initiallySelected: const [],
              onChange: (newList) {
                // your logic
                // typically setting state
              },
              numberOfItemsLabelToShow: 2, // label to be shown for 2 items
              whenEmpty:
                  'Choose from the list', // text to show when selected list is empty
            ),
          ],
        ),
      ),
    );
  }
}

pubspec.yaml:

dependencies:
  flutter:
    sdk: flutter
  multiselect_dropdown_flutter: ^0.0.7
  get: ^5.0.0-release-candidate-4
```

result: can't select anything from dropdown like it have no any data.

I have some issues with this package

Hello, please help ...

/C:/flutter/.pub-cache/hosted/pub.dartlang.org/multiselect_dropdown_flutter-0.0.7/lib/multiselect_dropdown_flutter.dart:386:18: Error: The method 'MenuAnchor' isn't defined for the class '_MultiSelectDropdownState'.

  • '_MultiSelectDropdownState' is from 'package:multiselect_dropdown_flutter/multiselect_dropdown_flutter.dart' ('/C:/flutter/.pub-cache/hosted/pub.dartlang.org/multiselect_dropdown_flutter-0.0.7/lib/multiselect_dropdown_flutter.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'MenuAnchor'.
    child: MenuAnchor(
    ^^^^^^^^^^
    /C:/flutter/.pub-cache/hosted/pub.dartlang.org/multiselect_dropdown_flutter-0.0.7/lib/multiselect_dropdown_flutter.dart:388:20: Error: The method 'MenuStyle' isn't defined for the class '_MultiSelectDropdownState'.
  • '_MultiSelectDropdownState' is from 'package:multiselect_dropdown_flutter/multiselect_dropdown_flutter.dart' ('/C:/flutter/.pub-cache/hosted/pub.dartlang.org/multiselect_dropdown_flutter-0.0.7/lib/multiselect_dropdown_flutter.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'MenuStyle'.
    style: MenuStyle(
    ^^^^^^^^^

Thanks

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.