Fix formatting
This commit is contained in:
parent
4018983b51
commit
c1fa40e492
@ -4,7 +4,6 @@ import 'package:shared_preferences/shared_preferences.dart';
|
|||||||
import 'package:google_fonts/google_fonts.dart';
|
import 'package:google_fonts/google_fonts.dart';
|
||||||
import 'variables.dart';
|
import 'variables.dart';
|
||||||
|
|
||||||
|
|
||||||
class SideMenu extends StatefulWidget {
|
class SideMenu extends StatefulWidget {
|
||||||
final Widget body;
|
final Widget body;
|
||||||
final int selectedIndex;
|
final int selectedIndex;
|
||||||
@ -29,17 +28,15 @@ class _SideMenuState extends State<SideMenu> {
|
|||||||
|
|
||||||
prefs.remove('token');
|
prefs.remove('token');
|
||||||
prefs.remove('id');
|
prefs.remove('id');
|
||||||
|
|
||||||
setState(() {
|
setState(() {
|
||||||
loggedIn = false;
|
loggedIn = false;
|
||||||
user = null;
|
user = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(content: Text('Successfully logged out')));
|
||||||
const SnackBar(content: Text('Successfully logged out')));
|
|
||||||
Navigator.pushReplacementNamed(context, '/login');
|
Navigator.pushReplacementNamed(context, '/login');
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,13 +44,11 @@ class _SideMenuState extends State<SideMenu> {
|
|||||||
void didChangeDependencies() {
|
void didChangeDependencies() {
|
||||||
super.didChangeDependencies();
|
super.didChangeDependencies();
|
||||||
|
|
||||||
api
|
api.isLoggedIn(context).then((value) {
|
||||||
.isLoggedIn(context).then((value) {
|
|
||||||
setState(() {
|
setState(() {
|
||||||
loggedIn = value; // Update the second variable here
|
loggedIn = value; // Update the second variable here
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -80,19 +75,16 @@ Widget build(BuildContext context) {
|
|||||||
DrawerHeader(
|
DrawerHeader(
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
const Image(
|
const Image(image: AssetImage('assets/logo.png'), height: 100),
|
||||||
image: AssetImage('assets/logo.png'),
|
|
||||||
height: 100,
|
|
||||||
),
|
|
||||||
Text(
|
Text(
|
||||||
'SkanTravels',
|
'SkanTravels',
|
||||||
style: GoogleFonts.jacquesFrancois(
|
style: GoogleFonts.jacquesFrancois(
|
||||||
fontSize: 20,
|
fontSize: 20,
|
||||||
color: Color(0xFF1862E7),
|
color: const Color(0xFF1862E7),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
)
|
),
|
||||||
),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
title: const Text('Home'),
|
title: const Text('Home'),
|
||||||
@ -130,7 +122,7 @@ Widget build(BuildContext context) {
|
|||||||
leading: const Icon(Icons.logout),
|
leading: const Icon(Icons.logout),
|
||||||
selected: false,
|
selected: false,
|
||||||
onTap: _logout,
|
onTap: _logout,
|
||||||
)
|
),
|
||||||
]
|
]
|
||||||
: [
|
: [
|
||||||
ListTile(
|
ListTile(
|
||||||
@ -148,8 +140,9 @@ Widget build(BuildContext context) {
|
|||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.pushReplacementNamed(context, '/login');
|
Navigator.pushReplacementNamed(context, '/login');
|
||||||
},
|
},
|
||||||
)
|
),
|
||||||
])
|
]
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -34,9 +34,9 @@ class _LoginPageState extends State<LoginPage> {
|
|||||||
prefs.setString('token', jsonUser.token);
|
prefs.setString('token', jsonUser.token);
|
||||||
prefs.setString('id', jsonUser.id);
|
prefs.setString('id', jsonUser.id);
|
||||||
|
|
||||||
setState(()
|
setState(() {
|
||||||
{loggedIn == true;});
|
loggedIn == true;
|
||||||
|
});
|
||||||
|
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(content: Text('Successfully logged in')));
|
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(content: Text('Successfully logged in')));
|
||||||
@ -54,10 +54,7 @@ class _LoginPageState extends State<LoginPage> {
|
|||||||
child: Container(
|
child: Container(
|
||||||
constraints: const BoxConstraints(minWidth: 100, maxWidth: 400),
|
constraints: const BoxConstraints(minWidth: 100, maxWidth: 400),
|
||||||
child: Column(children: [
|
child: Column(children: [
|
||||||
const Image(
|
const Image(image: AssetImage('assets/logo.png'), height: 200),
|
||||||
image: AssetImage('assets/logo.png'),
|
|
||||||
height: 200,
|
|
||||||
),
|
|
||||||
Text(
|
Text(
|
||||||
'SkanTravels',
|
'SkanTravels',
|
||||||
style: GoogleFonts.jacquesFrancois(
|
style: GoogleFonts.jacquesFrancois(
|
||||||
|
Loading…
Reference in New Issue
Block a user