Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class CrearView extends StatefulWidget {
- const CrearView(this.data);
- final DocumentSnapshot data;
- @override
- _CrearViewState createState() => _CrearViewState();
- }
- class _CrearViewState extends State<CrearView> {
- TextEditingController _c;
- @override
- initState() {
- _c = new TextEditingController();
- super.initState();
- }
- DateTime fin = DateTime.now();
- DateTime _date = new DateTime.now();
- GlobalKey globalKey = new GlobalKey();
- Future<Null> _selectDate(BuildContext context) async {
- final DateTime picked = await showDatePicker(
- context: context,
- initialDate: _date,
- firstDate: new DateTime(2019),
- lastDate: new DateTime(2025),
- );
- if (picked != null && picked != _date) {
- print("Date selected: $picked");
- setState(() {
- fin = picked;
- });
- }
- }
- @override
- Widget build(BuildContext context) {
- return AlertDialog(
- title: new Text("Generar Código QR "),
- content: Container(
- child: SingleChildScrollView(
- child: Column(
- children: <Widget>[
- TextField(
- enabled: true,
- maxLength: 15,
- maxLengthEnforced: true,
- textInputAction: TextInputAction.none,
- controller: _c,
- decoration: new InputDecoration(
- hintText: 'Ingresar nombre del QR',
- ),
- ),
- Row(
- crossAxisAlignment: CrossAxisAlignment.center,
- mainAxisAlignment: MainAxisAlignment.start,
- children: <Widget>[
- IconButton(
- icon: Icon(Icons.date_range),
- onPressed: () {
- _selectDate(context);
- setState(() {});
- },
- ),
- Center(
- child: Text("Valido Hasta: " +
- (fin.day + 1).toString() +
- "/" +
- fin.month.toString() +
- "/" +
- fin.year.toString()),
- )
- ],
- ),
- Text(
- "-Apretan mini Calendario para cambiar validez.-",
- style: TextStyle(fontSize: 12.0),
- textAlign: TextAlign.center,
- )
- ],
- )),
- ),
- actions: <Widget>[
- Container(
- child: Row(
- children: <Widget>[
- CupertinoButton(
- child: Text(
- "Cancelar",
- style: TextStyle(color: Colors.red),
- ),
- onPressed: () {
- Navigator.pop(context);
- }),
- CupertinoButton(
- child: Text("Generar"),
- onPressed: () {
- _subirQR(widget.data["condo"], widget.data.documentID,_c.text, fin);
- Navigator.of(context).pop();
- },
- ),
- ],
- ),
- )
- ]);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement