import 'package:flutter/material.dart'; import 'package:insparkspokalen_ui/info/informationPage.dart'; import 'package:insparkspokalen_ui/info/AdminInformationPage.dart'; import 'package:insparkspokalen_ui/ProfileInfoTab/ProfilePage.dart'; import 'package:insparkspokalen_ui/ProfileInfoTab/ProfilePageAdmin.dart'; class BaseScaffold extends StatelessWidget { final String title; final int selectedIndex; final Function(int) onTap; final Widget body; final String role; // USER el ADMIN const BaseScaffold({ super.key, required this.title, required this.selectedIndex, required this.onTap, required this.body, required this.role, //USER el ADMIN }); @override Widget build(BuildContext context) { return Scaffold( backgroundColor: const Color(0xFF2E2E2E), appBar: AppBar( backgroundColor: const Color(0xFF2E2E2E), centerTitle: true, title: Text( title, style: const TextStyle( color: Color(0xFFDAA520), fontSize: 20, fontWeight: FontWeight.bold, ), ), actions: [ IconButton( icon: const Icon(Icons.info, color: Color(0xFFDAA520)), onPressed: () { if (role == 'ADMIN') { Navigator.push( context, MaterialPageRoute( builder: (context) => const AdminInformationPage(), ), ); } else { Navigator.push( context, MaterialPageRoute( builder: (context) => const InformationPage(), ), ); } }, ), /* const SizedBox(width: 8), const Icon(Icons.person_outline, color: Color(0xFFDAA520)), const SizedBox(width: 12), */ IconButton( icon: const Icon(Icons.person_outline, color: Color(0xFFDAA520)), onPressed: () { if (role == 'ADMIN') { Navigator.push( context, MaterialPageRoute( builder: (context) => const ProfilePageAdmin(), ), ); } else { Navigator.push( context, MaterialPageRoute( builder: (context) => const ProfilePage(), ), ); } }, ), const SizedBox(width: 12), ], ), body: body, bottomNavigationBar: BottomNavigationBar( backgroundColor: const Color(0xFF2E2E2E), type: BottomNavigationBarType.fixed, selectedItemColor: const Color(0xFFDAA520), unselectedItemColor: Colors.grey, currentIndex: selectedIndex, onTap: onTap, items: const [ BottomNavigationBarItem(icon: Icon(Icons.home), label: 'Hem'), BottomNavigationBarItem(icon: Icon(Icons.calendar_month), label: 'Kalender'), BottomNavigationBarItem(icon: Icon(Icons.leaderboard), label: 'Topplista'), BottomNavigationBarItem(icon: Icon(Icons.pause_presentation), label: 'Uppdrag'), BottomNavigationBarItem(icon: Icon(Icons.group), label: 'Grupper'), ], ), ); } }