Git Product home page Git Product logo

custom_dropdown's Introduction

CustomDropDown

A flutter dropdown field for displaying data objects.

Installation

Add the CustomDropDown package to pubspec.yaml dependencies

custom_dropdown:
    git:
      url: https://github.com/Smile-Group-Africa/custom_dropdown.git

Import the package in your dart file

import 'package:custom_dropdown/custom_dropdown.dart';

Usage

Create data object

class Person extends CustomDropdownData{  
  final int id;  
  final String name;  
  
  Person({  
    this.id,  
    this.name,  
  });  
  
  @override  
  CustomDropdownModel toDropdownDataModel() {  
    return CustomDropdownModel(name: this.name, value: this.id);  
  }  
}

Use dropdown widget with list of data

List<Person> people = [  
  Person(id: 1, name: "Boris"),  
  Person(id: 2, name: "Didier"),  
  Person(id: 3, name: "Innocent"),  
  Person(id: 4, name: "Jean-François"),  
  Person(id: 5, name: "Jean-Jacques"),  
];

...

CustomDropDown(  
  onChanged: (int id){  
    print("selected id = $id");  
  },  
  items: people,  
)

API Reference

Property Default Description Type
items required List of data List<T extends CustomDropdownData>
onChanged required Provide selected item value Function(int)
hint optional A hint text String

custom_dropdown's People

Contributors

agnamc9 avatar

Stargazers

 avatar

Watchers

 avatar  avatar

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.