enhanced_drop_down 0.1.2

  • Readme
  • Changelog
  • Example
  • Installing
  • 76

Enhanced Dropdown Widget #

A completely customizable drop down widget, which wraps a label and a dropdown widget together into one component.

Usage #

To use this package add enhanced_drop_down as a dependency in your pubspec.yaml file..

API #

An Enhanced Dropdown Widget (or EDW), is based on flutter's dropdown widget, but enhances it in the following manner:

  • Attached to the dropdown is a label, to help point out to the user what values the dropdown might have

  • You can pass in the data source from where the dropdown will get its values

  • You can pass a default value to be the visible choice when the dropdown is not selected

  • You want to know what choice the user made, so a callback function must be supplied to get the user's choice back

  • In case you are relying on an external source to provide the data for the dropdown, you can pass in the url to fetch that data

Please be aware that currently, the parsing of the url is in JSON and only valid for key-value pairs that are in String format and type

Instantiating an EDW is as follows: #

new EnhancedDropDownWidget(
    dropdownLabelTitle: "Label",
    defaultOptionText: "Select One",
    urlToFetchData: "https://pub.dev/",
    dataSource: ["Option A", "Option B"],
    valueReturned: (chosen) {

      },
    )

[0.1.2] - Shortened description of package and formatted main dart file

[0.1.1] - Fixing initial values and changes according to Flutter package scoring. Enabled parsing of urls to populate drop down.

[0.1.0] - Initial Version

example/example.dart

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

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

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);

  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {

  String _selected = "";

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: Text('Requesting Location Permission'),
        ),
        body:Column(
            crossAxisAlignment: CrossAxisAlignment.center,
            children: <Widget>[
              Center(
                child: new EnhancedDropDown(
                  dropdownLabelTitle: "Label",
                  defaultOptionText: "Select One",
                  urlToFetchData: "https://pub.dev/",
                  dataSource: ["Option A", "Option B"],
                  valueReturned: (chosen) {
                    _selected = chosen;
                    print(_selected);
                  },
                ),
              )]
        )
    );
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  enhanced_drop_down: ^0.1.2

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:enhanced_drop_down/enhanced_drop_down.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
52
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
76
Learn more about scoring.

We analyzed this package on Dec 4, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.6.1
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.6

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
http ^0.12.0+2 0.12.0+2
Transitive dependencies
async 2.4.0
charcode 1.1.2
collection 1.14.11 1.14.12
http_parser 3.1.3
meta 1.1.7 1.1.8
path 1.6.4
pedantic 1.8.0+1
sky_engine 0.0.99
source_span 1.5.5
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test