From 4e4852d0d12132615ebba7d19e437a8881182ad0 Mon Sep 17 00:00:00 2001 From: EngDann Date: Sat, 28 Dec 2024 16:33:58 -0300 Subject: [PATCH] =?UTF-8?q?feat(#59):=20Adiciona=20bot=C3=A3o=20de=20requi?= =?UTF-8?q?si=C3=A7=C3=A3o=20ao=20inv=C3=A9s=20do=20elevatedButton?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../view/register_account_view.dart | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/lib/ui/register_account/view/register_account_view.dart b/lib/ui/register_account/view/register_account_view.dart index ed81652..65a92c3 100644 --- a/lib/ui/register_account/view/register_account_view.dart +++ b/lib/ui/register_account/view/register_account_view.dart @@ -1,7 +1,7 @@ -import 'package:aranduapp/ui/login/view/login_view.dart'; import 'package:aranduapp/ui/shared/OrDivider.dart'; import 'package:aranduapp/ui/shared/TextAndLink.dart'; import 'package:aranduapp/ui/shared/TextName.dart'; +import 'package:aranduapp/ui/shared/requestbutton.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import 'package:aranduapp/core/log/Log.dart'; @@ -135,18 +135,22 @@ class RegisterAccountScreen extends StatelessWidget { }); } - return SizedBox( - width: 291, - height: 64, - child: ElevatedButton( - onPressed: () async { - viewModel.registerCommand.execute(); + return Requestbutton( + command: viewModel.registerCommand, + onErrorCallback: (String e) { + showDialog( + context: context, + builder: (BuildContext context) => ErrorPopUp(content: Text(e)), + ); }, - child: viewModel.registerCommand.running - ? const CircularProgressIndicator(value: null) - : const Text('Registrar'), - ), - ); + onSuccessCallback: () { + ScaffoldMessenger.of(context).showSnackBar( + const SnackBar( + content: Text( + 'Bem-vindo(a) a bordo! Sua conta foi criada com sucesso!')), + ); + }, + nameButton: 'Enviar'); }, ); }