76 lines
2.2 KiB
Dart
76 lines
2.2 KiB
Dart
// ignore_for_file: prefer_const_constructors, prefer_const_literals_to_create_immutables, file_names, use_build_context_synchronously, library_private_types_in_public_api
|
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:smilet/Aktivitet/Activity.dart';
|
|
import 'package:smilet/Leaderboard/Leaderboard.dart';
|
|
import 'package:smilet/LoginPage.dart';
|
|
import 'package:smilet/Profile/Profile.dart';
|
|
import 'package:smilet/User.dart';
|
|
|
|
class Meny extends StatefulWidget {
|
|
final User user;
|
|
final Map schoolDetails;
|
|
|
|
const Meny({super.key, required this.user, required this.schoolDetails});
|
|
|
|
@override
|
|
_MenyState createState() => _MenyState();
|
|
}
|
|
|
|
class _MenyState extends State<Meny> with TickerProviderStateMixin {
|
|
late String schoolName;
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
schoolName =
|
|
"${schoolDetails["school"].toString().toUpperCase()}-${schoolDetails["institution"].toString().toUpperCase()}";
|
|
}
|
|
|
|
int currentPageIndex = 0;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
automaticallyImplyLeading: false,
|
|
centerTitle: true,
|
|
title: Image.asset(
|
|
'assets/images/ml_logo.png',
|
|
height: 40,
|
|
),
|
|
),
|
|
bottomNavigationBar: NavigationBar(
|
|
onDestinationSelected: (int index) {
|
|
setState(() {
|
|
currentPageIndex = index;
|
|
});
|
|
},
|
|
indicatorColor: Colors.amber,
|
|
selectedIndex: currentPageIndex,
|
|
destinations: const <Widget>[
|
|
NavigationDestination(
|
|
icon: Icon(Icons.calendar_month),
|
|
label: 'Aktiviteter',
|
|
),
|
|
NavigationDestination(
|
|
icon: Icon(Icons.list_alt),
|
|
label: 'Leaderboard',
|
|
),
|
|
NavigationDestination(
|
|
icon: Icon(Icons.person),
|
|
label: 'Profil',
|
|
),
|
|
],
|
|
),
|
|
body: <Widget>[
|
|
Activity(
|
|
schoolName: schoolName,
|
|
user: user,
|
|
),
|
|
Leaderboard(),
|
|
Profile(user: user, schoolDetails: schoolDetails),
|
|
][currentPageIndex]);
|
|
}
|
|
}
|