1
resposta

[Projeto] Projeto + desafio concluido

MyAppDelete.gif

  Future  _showMyDialog() async {
    print('Botao funcionando ${_showMyDialog}()');
    return showDialog (
      context: context,
      barrierDismissible: false, // user must tap button!
      builder: (BuildContext context) {
        return AlertDialog(
          title: const Text('Deseja deletar sua tareda?'),
          content: SingleChildScrollView(
            child: ListBody(
              children: const  [
                //Text('Gostaria de aprovar esta mensagem?'),
                Text('Cuidado: Deletado não tem como recuperar mais.'),
              ],
            ),
          ),
          actions:  [
            TextButton(
              child: const Text('No',style: TextStyle(color: Colors.white),),
              onPressed: () {
                Navigator.of(context).pop();
              },
            ),
            TextButton(
              child: const Text('Yes',style: TextStyle(color: Colors.white),),
              onPressed: () {
                TaskDao().delete(widget.name);
                Navigator.of(context).pop();
              },
            ),
          ],

          elevation: 24.0,
          backgroundColor: Colors.blue,
          //shape: CircleBorder(),
        );
      },
    );
  }
                    SizedBox(
                      height: 52,
                      width: 52,
                      child: ElevatedButton(
                          onLongPress: () {
                            _showMyDialog();
                          },
                          onPressed: () {
                            setState(() {
                              widget.nivel++;
                              if (widget.nivel / widget.difficulty > 10) {
                                widget.maestryLevel++;
                                if (widget.maestryLevel <= 7) {
                                  widget.nivel = 1;
                                }
                              }
                            });
                            //print(nivel);
                          },
                          child: Column(
                            mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                            crossAxisAlignment: CrossAxisAlignment.end,
                            children: const [
                              Icon(Icons.arrow_drop_up),
                              Text(
                                "UP",
                                style: TextStyle(fontSize: 12),
                              ),
                            ],
                          )),
                    ),
1 resposta

Adorei sua implementação do Dialog!

Quer mergulhar em tecnologia e aprendizagem?

Receba a newsletter que o nosso CEO escreve pessoalmente, com insights do mercado de trabalho, ciência e desenvolvimento de software