flutter_country_state 0.0.13 flutter_country_state: ^0.0.13 copied to clipboard
A new Flutter package that displays all countries with there respective state.
import 'package:flutter/material.dart';
import 'countrydialog.dart';
import 'dialog.dart';
import 'variables.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> {
int _counter = 0;
void _incrementCounter() {
setState(() {
_counter++;
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: SingleChildScrollView(
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
'You have pushed the button this many times:',
),
Text(
'$_counter',
style: Theme.of(context).textTheme.display1,
),
Text( Variables.pstate ),
Text( Variables.property_country ),
RaisedButton(
child: Text('country'),
onPressed: () {
showGeneralDialog(
barrierColor: Colors.black.withOpacity(0.5),
transitionBuilder: (context, a1, a2, widget) {
return Transform.scale(
scale: a1.value,
child: Opacity(
opacity: a1.value,
child: Dialog(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8.0)),
elevation: 4,
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text('select your country'),
Align(
alignment: Alignment.topRight,
child: GestureDetector(
onTap: () {
Navigator.pop(context);
},
child: Icon(
Icons.cancel,
size: 42,
color: Colors.white,
),
),
),
],
),
Expanded(
child: SingleChildScrollView(
child:
Container(child:ShowMyDialog())
),
),
]
)
)
)
);
},
transitionDuration: Duration(milliseconds: 200),
barrierDismissible: true,
barrierLabel: '',
context: context,
// ignore: missing_return
pageBuilder: (context, animation1, animation2) {}
);
}
),
Container(child: StateDialog(),)
],
),
),
),
floatingActionButton: FloatingActionButton(
onPressed: _incrementCounter,
tooltip: 'Increment',
child: Icon(Icons.add),
),
);
}
}