Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import 'package:flutter/material.dart';
- void main() {
- runApp(MaterialApp(home: Home()));
- }
- class Home extends StatefulWidget {
- @override
- _HomeState createState() => _HomeState();
- }
- class _HomeState extends State<Home> {
- TextEditingController pedidoController = TextEditingController();
- TextEditingController nomeController = TextEditingController();
- TextEditingController mesaController = TextEditingController();
- TextEditingController descricaoController = TextEditingController();
- String _infoText = "Confirmar";
- void _resetfields() {
- pedidoController.text = "";
- nomeController.text = "";
- mesaController.text = "";
- descricaoController.text = "";
- setState(() {
- _infoText = "Confirmar";
- });
- }
- void _relatorio() {
- setState(() {
- print(pedidoController.text);
- print(nomeController.text);
- print(mesaController.text);
- print(descricaoController);
- _infoText = "Pedido confirmado!";
- });
- }
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- appBar: AppBar(
- title: Text("Comanda"),
- centerTitle: true,
- backgroundColor: Colors.orangeAccent,
- actions: <Widget>[
- IconButton(
- icon: Icon(Icons.refresh),
- onPressed: _resetfields,
- )
- ],
- ),
- backgroundColor: Colors.white,
- body: Stack(
- children: <Widget>[
- Image.asset(
- "images/back.jpg",
- fit: BoxFit.fill,
- height: 1000.0,
- ),
- Form(
- child: SingleChildScrollView(
- padding: EdgeInsets.fromLTRB(15.0, 20.0, 15.0, 0.0),
- child: Column(
- children: <Widget>[
- Container(
- padding: EdgeInsets.only(bottom: 10.0),
- child: TextField(
- keyboardType: TextInputType.number,
- decoration: InputDecoration(
- labelText: "Número do pedido",
- border: OutlineInputBorder(
- borderRadius: BorderRadius.circular(20.0)),
- labelStyle: TextStyle(
- color: Colors.white, fontSize: 20.0,)),
- controller: pedidoController,
- ),
- ),
- Container(
- padding: EdgeInsets.only(bottom: 10.0),
- child: TextFormField(
- keyboardType: TextInputType.text,
- decoration: InputDecoration(
- border: OutlineInputBorder(
- borderRadius: BorderRadius.circular(32.0)),
- labelText: "Nome:",
- labelStyle: TextStyle(
- color: Colors.white, fontSize: 20.0)),
- controller: nomeController,
- ),
- ),
- Container(
- padding: EdgeInsets.only(bottom: 10.0),
- child: TextField(
- keyboardType: TextInputType.number,
- decoration: InputDecoration(
- labelText: "Numero da mesa:",
- border: OutlineInputBorder(
- borderRadius: BorderRadius.circular(32.0)),
- labelStyle: TextStyle(
- color: Colors.white, fontSize: 20.0)),
- controller: mesaController,
- ),
- ),
- Container(
- padding: EdgeInsets.only(bottom: 10.0),
- child: TextFormField(
- keyboardType: TextInputType.text,
- decoration: InputDecoration(
- labelText: "Descrição do pedido:",
- border: OutlineInputBorder(
- borderRadius: BorderRadius.circular(62.0),),
- labelStyle: TextStyle(
- color: Colors.white, fontSize: 20.0)),
- controller: descricaoController,
- ),
- ),
- Padding(
- padding: EdgeInsets.only(top: 10.0),
- child: Container(
- child: FlatButton(
- color: Colors.orange,
- textColor: Colors.white,
- disabledColor: Colors.grey,
- disabledTextColor: Colors.black,
- padding: EdgeInsets.all(8.0),
- splashColor: Colors.orangeAccent,
- onPressed: _relatorio,
- shape: RoundedRectangleBorder(borderRadius: new BorderRadius.circular(40.0)),
- child: Text(
- "Enviar pedido",
- style: TextStyle(fontSize: 20.0),
- ),
- ),
- ),
- ),
- Text(
- _infoText,
- textAlign: TextAlign.end,
- style: TextStyle(color: Colors.white, fontSize: 20.0),
- ),
- ],
- )),
- ),
- ],
- ));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement