Skip to content

Commit

Permalink
fix(#58): corrige erro de navegação
Browse files Browse the repository at this point in the history
  • Loading branch information
GabrielCostaDeOliveira committed Dec 23, 2024
1 parent 2f00182 commit 0e6095a
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions lib/ui/login/view/login_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ class _LoginScreenState extends State<LoginScreen> {
@override
void initState() {
super.initState();
_future = Provider.of<LoginViewModel>(context, listen: false)
.validateToken();
_future =
Provider.of<LoginViewModel>(context, listen: false).validateToken();
}

@override
Expand All @@ -57,7 +57,6 @@ class _LoginScreenState extends State<LoginScreen> {
if (snapshot.connectionState == ConnectionState.waiting) {
return _loadingScreen(viewModel);
} else if (!snapshot.hasError) {
viewModel.loginWithDeviceAuth();
return _authDevice(viewModel);
} else {
return _emailAndPassword(viewModel);
Expand All @@ -72,9 +71,10 @@ class _LoginScreenState extends State<LoginScreen> {
}

Widget _authDevice(LoginViewModel viewModel) {

Log.d("Mostrando tela de autorização do dispositivo");


viewModel.loginWithDeviceAuth().then((_) => viewModel.goToHome());

return Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Expand Down Expand Up @@ -187,9 +187,7 @@ class _LoginScreenState extends State<LoginScreen> {
child: ElevatedButton(
onPressed: () {
viewModel.loginWithEmailAndPassword().then((_) {

viewModel.goToHome();

}).catchError((e) => showDialog<Object>(
context: context,
builder: (BuildContext context) =>
Expand Down

0 comments on commit 0e6095a

Please sign in to comment.