Initial commit
This commit is contained in:
111
lib/app.dart
Normal file
111
lib/app.dart
Normal file
@ -0,0 +1,111 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:marianum_mobile/data/incommingPackets/talkNotificationsPacket.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
import 'data/accountModel.dart';
|
||||
import 'screen/pages/files/files.dart';
|
||||
import 'screen/pages/more/overhang.dart';
|
||||
import 'screen/pages/talk/chatOverview.dart';
|
||||
import 'screen/pages/timetable/timetable.dart';
|
||||
import 'screen/settings/settings.dart';
|
||||
|
||||
class App extends StatefulWidget {
|
||||
const App({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<App> createState() => _AppState();
|
||||
}
|
||||
|
||||
class _AppState extends State<App> {
|
||||
int currentPage = 0;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final PageController pageController = PageController();
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text("Marianum Fulda"),
|
||||
actions: <Widget>[
|
||||
IconButton(
|
||||
padding: const EdgeInsets.only(right: 15),
|
||||
icon: const Icon(Icons.settings),
|
||||
onPressed: () {
|
||||
Navigator.push(context, MaterialPageRoute(builder: (context) => const Settings()));
|
||||
},
|
||||
)
|
||||
],
|
||||
),
|
||||
body: PageView(
|
||||
controller: pageController,
|
||||
children: const [
|
||||
Timetable(),
|
||||
Talk(),
|
||||
Files(),
|
||||
Overhang(),
|
||||
],
|
||||
onPageChanged: (page) {
|
||||
setState(() {
|
||||
currentPage = page;
|
||||
});
|
||||
},
|
||||
),
|
||||
|
||||
bottomNavigationBar: BottomNavigationBar(
|
||||
items: [
|
||||
const BottomNavigationBarItem(icon: Icon(Icons.calendar_month), label: "Vertretung"),
|
||||
BottomNavigationBarItem(icon: Stack(
|
||||
children: [
|
||||
const Icon(Icons.chat),
|
||||
|
||||
Consumer<TalkNotificationsPacket>(
|
||||
builder: (context, data, child) {
|
||||
return Visibility(
|
||||
visible: data.amount != 0,
|
||||
child: Positioned(
|
||||
right: 0,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(1),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.red,
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
),
|
||||
constraints: const BoxConstraints(
|
||||
minWidth: 12,
|
||||
minHeight: 12,
|
||||
),
|
||||
child: Text(
|
||||
"${data.amount}",
|
||||
style: const TextStyle(
|
||||
color: Colors.black,
|
||||
fontSize: 10,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
)
|
||||
],
|
||||
), label: "Talk"),
|
||||
const BottomNavigationBarItem(icon: Icon(Icons.folder), label: "Dateien"),
|
||||
const BottomNavigationBarItem(icon: Icon(Icons.list), label: "Mehr"),
|
||||
],
|
||||
selectedItemColor: Theme.of(context).primaryColor,
|
||||
unselectedItemColor: Colors.grey,
|
||||
showUnselectedLabels: true,
|
||||
showSelectedLabels: true,
|
||||
|
||||
currentIndex: currentPage,
|
||||
onTap: (item) {
|
||||
setState(() {
|
||||
currentPage = item;
|
||||
pageController.jumpToPage(item);
|
||||
});
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user