after
This commit is contained in:
@@ -125,9 +125,12 @@
|
||||
// }
|
||||
// }
|
||||
|
||||
import 'dart:developer';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:prosappco/blocs/authentication_bloc/authentication_bloc.dart';
|
||||
import 'package:injector/injector.dart';
|
||||
import 'package:prosappco/blocs/setting_bloc/setting_bloc.dart';
|
||||
import 'package:prosappco/components/general_drawer_item.dart';
|
||||
|
||||
class ConfigurationScreen extends StatelessWidget {
|
||||
@@ -135,36 +138,45 @@ class ConfigurationScreen extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocListener<AuthenticationBloc, AuthenticationState>(
|
||||
listener: (context, state) {
|
||||
if (state.status == AuthenticationStatus.unauthenticated) {
|
||||
Navigator.pop(context);
|
||||
}
|
||||
},
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Configuración'),
|
||||
final settingBloc = Injector.appInstance.get<SettingBloc>();
|
||||
|
||||
return BlocProvider<SettingBloc>(
|
||||
create: (context) => settingBloc,
|
||||
child: BlocListener<SettingBloc, SettingState>(
|
||||
listener: (context, state) {
|
||||
if (state is SettingLogoutSuccess) {
|
||||
Navigator.pop(context);
|
||||
}
|
||||
},
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Configuración'),
|
||||
),
|
||||
body: ListView(
|
||||
children: [
|
||||
GeneralDrawerItem(
|
||||
label: 'Acerca de la aplicación',
|
||||
onTap: () {},
|
||||
trailing: true,
|
||||
),
|
||||
GeneralDrawerItem(
|
||||
label: 'Cerrar sesión',
|
||||
onTap: () {
|
||||
try {
|
||||
settingBloc.add(SettingLogoutRequest());
|
||||
} catch (e) {
|
||||
log('xd conigura ${e.toString()}');
|
||||
}
|
||||
},
|
||||
),
|
||||
GeneralDrawerItem(
|
||||
label: 'Eliminar cuenta',
|
||||
onTap: () {},
|
||||
color: Theme.of(context).colorScheme.error,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
body: ListView(children: [
|
||||
GeneralDrawerItem(
|
||||
label: 'Acerca de la aplicación',
|
||||
onTap: () {},
|
||||
trailing: true,
|
||||
),
|
||||
GeneralDrawerItem(
|
||||
label: 'Cerrar sesión',
|
||||
onTap: () {
|
||||
context
|
||||
.read<AuthenticationBloc>()
|
||||
.add(AuthenticationLogoutRequested());
|
||||
},
|
||||
),
|
||||
GeneralDrawerItem(
|
||||
label: 'Eliminar cuenta',
|
||||
onTap: () {},
|
||||
color: Theme.of(context).colorScheme.error,
|
||||
)
|
||||
]),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user