currency_dropdown 0.0.3 currency_dropdown: ^0.0.3 copied to clipboard
Currency dropdown widget.
import 'package:currency_dropdown/currency_dropdown.dart';
import 'package:flutter/material.dart';
void main() => runApp(new MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new MaterialApp(
title: 'Flutter Demo',
theme: new ThemeData(
primarySwatch: Colors.green,
),
home: new MyHomePage(title: 'Flutter Currency Drop down'),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
final String title;
@override
_MyHomePageState createState() => new _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
String currencyValue = 'INR';
String currencySymbol = '';
_onCurrencyChanged(val, symbol) {
setState(() {
currencyValue = val;
currencySymbol = symbol;
});
}
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(
title: new Text(widget.title),
),
body: Padding(
padding: const EdgeInsets.all(10.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text('Currency'),
CurrencyDropDown(
currencyValue: currencyValue, onChanged: _onCurrencyChanged),
],
),
),
);
}
}