mirror of
https://gitlab.com/comunic/comunicmobile
synced 2025-06-19 08:15:16 +00:00
Clean code
This commit is contained in:
@ -1,12 +1,14 @@
|
||||
import 'package:comunic/helpers/account_helper.dart';
|
||||
import 'package:comunic/ui/screens/conversations_list_screen.dart';
|
||||
import 'package:comunic/ui/screens/friends_list_screen.dart';
|
||||
import 'package:comunic/ui/screens/menus_screen.dart';
|
||||
import 'package:comunic/ui/screens/newest_posts.dart';
|
||||
import 'package:comunic/ui/tiles/custom_bottom_navigation_bar_item.dart';
|
||||
import 'package:comunic/ui/widgets/navbar_widget.dart';
|
||||
import 'package:comunic/utils/intl_utils.dart';
|
||||
import 'package:comunic/utils/ui_utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'login_route.dart';
|
||||
|
||||
/// Main route of the application
|
||||
///
|
||||
/// @author Pierre HUBERT
|
||||
@ -38,8 +40,16 @@ class _HomeRouteState extends State<HomeRoute> {
|
||||
|
||||
/// Handles a new tab being tapped
|
||||
void _onTap(BarCallbackActions action) {
|
||||
if (_currTab != action) history.add(action);
|
||||
_changeTab(action);
|
||||
/// Check more quick actions
|
||||
switch (action) {
|
||||
case BarCallbackActions.ACTION_LOGOUT:
|
||||
_logoutRequested();
|
||||
break;
|
||||
|
||||
default:
|
||||
if (_currTab != action) history.add(action);
|
||||
_changeTab(action);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
@ -86,4 +96,18 @@ class _HomeRouteState extends State<HomeRoute> {
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// Handle logout requests from user
|
||||
Future<void> _logoutRequested() async {
|
||||
if (!await showConfirmDialog(
|
||||
context: context,
|
||||
message: tr("Do you really want to sign out from the application ?"),
|
||||
title: tr("Sign out"))) return;
|
||||
|
||||
await AccountHelper().signOut();
|
||||
|
||||
Navigator.pushReplacement(context, MaterialPageRoute(builder: (c){
|
||||
return LoginRoute();
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user