mirrored_repositories/CoffeeWala-Admin/lib/screens
import 'package:flutter/material.dart';
import 'package:coffeewala_admin/models/brew.dart';

int i=1;

class BrewTile extends StatefulWidget {
  final Brew brew;
  BrewTile({this.brew, index});
  

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

class _BrewTileState extends State<BrewTile> {
  

  @override
  Widget build(BuildContext context) {
    //i++;
    return Padding(
      padding: EdgeInsets.only(top: 8.0),
      child: Card(
        margin: EdgeInsets.fromLTRB(20.0, 6.0, 20.0, 0.0),
        child: ListTile(
          leading: CircleAvatar(
            radius: 25.0,
            backgroundColor: Colors.brown[widget.brew.strength],
          ),
          title: Text(widget.brew.name),
          subtitle: Wrap(children: [
            Text('${widget.brew.sugars} sugar packet(s) | '),
            Text(' ${widget.brew.coffees} | '),
            Text(' ${widget.brew.strength} |'),
            Text(' Snacks - ${widget.brew.snacks} || '),
            Text(' Order No - ${i++}', style: TextStyle(color: Colors.black),),
            //Text(' OB - ${i--}', style: TextStyle(color: Colors.white),)
          ],),
          onTap: () {
            showAlertDialog(context);
          },
        ),
      ),
    );
  }
}


showAlertDialog(BuildContext context) {
  // set up the buttons
  Widget cancelButton = FlatButton(
    child: Text("NO"),
    onPressed: () {
      Navigator.pop(context);
    },
  );
  Widget continueButton = FlatButton(
    child: Text("YES"),
    onPressed: () {
      Navigator.pop(context);
    },
  );

  // set up the AlertDialog
  AlertDialog alert = AlertDialog(
    title: Text("Is this Order finished?"),
    content:
        Text("This will send the card to archives list."),
    actions: [
      cancelButton,
      continueButton,
    ],
  );

  // show the dialog
  showDialog(
    context: context,
    builder: (BuildContext context) {
      return alert;
    },
  );
}
