enhanced_drop_down 0.1.1
enhanced_drop_down: ^0.1.1 copied to clipboard
A completely customizable drop down widget with a label. You can edit the label's name, the data for the drop down, the default value presented, provide a url to fetch data and get the value the user [...]
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);
},
),
)]
)
);
}
}