WIP: Persistent Bottom navigation bar, moved appbar layer to page view

This commit is contained in:
Elias Müller 2023-03-17 23:31:42 +01:00
parent 35f2e3fe74
commit cc47f9bee7
5 changed files with 196 additions and 90 deletions

117
.idea/codeStyles/Project.xml generated Normal file

@ -0,0 +1,117 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<codeStyleSettings language="XML">
<option name="FORCE_REARRANGE_MODE" value="1" />
<indentOptions>
<option name="CONTINUATION_INDENT_SIZE" value="4" />
</indentOptions>
<arrangement>
<rules>
<section>
<rule>
<match>
<AND>
<NAME>xmlns:android</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>xmlns:.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:id</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:name</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>name</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>style</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
<order>ANDROID_ATTRIBUTE_ORDER</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>.*</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
</rules>
</arrangement>
</codeStyleSettings>
</code_scheme>
</component>

5
.idea/codeStyles/codeStyleConfig.xml generated Normal file

@ -0,0 +1,5 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
</state>
</component>

@ -58,6 +58,13 @@
</list>
</value>
</entry>
<entry key="badges">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dev/badges-3.0.2/lib" />
</list>
</value>
</entry>
<entry key="better_open_file">
<value>
<list>
@ -611,6 +618,13 @@
</list>
</value>
</entry>
<entry key="persistent_bottom_nav_bar">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dev/persistent_bottom_nav_bar-5.0.2/lib" />
</list>
</value>
</entry>
<entry key="petitparser">
<value>
<list>
@ -1016,6 +1030,7 @@
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/args-2.4.0/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/asn1lib-1.4.0/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/async-2.10.0/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/badges-3.0.2/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/better_open_file-3.6.4/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/boolean_selector-2.1.1/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/bubble-1.2.1/lib" />
@ -1090,6 +1105,7 @@
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/path_provider_platform_interface-2.0.6/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/path_provider_windows-2.1.5/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/pedantic-1.11.1/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/persistent_bottom_nav_bar-5.0.2/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/petitparser-5.1.0/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/platform-3.1.0/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/plugin_platform_interface-2.1.4/lib" />

@ -4,12 +4,15 @@ import 'dart:async';
import 'package:flutter/material.dart';
import 'package:marianum_mobile/data/chatList/chatListProps.dart';
import 'package:marianum_mobile/screen/pages/timetable/timetable.dart';
import 'package:persistent_bottom_nav_bar/persistent_tab_view.dart';
import 'package:provider/provider.dart';
import 'screen/pages/files/files.dart';
import 'screen/pages/more/overhang.dart';
import 'screen/pages/talk/chatList.dart';
import 'screen/settings/settings.dart';
import 'package:badges/badges.dart' as badges;
class App extends StatefulWidget {
const App({Key? key}) : super(key: key);
@ -59,97 +62,60 @@ class _AppState extends State<App> {
@override
Widget build(BuildContext context) {
final PageController pageController = PageController();
return Scaffold(
resizeToAvoidBottomInset: false,
appBar: _appBar,
body: Column(
children: [
Visibility(
visible: false,
child: LinearProgressIndicator(
backgroundColor: Colors.transparent,
valueColor: AlwaysStoppedAnimation(Theme.of(context).primaryColor),
minHeight: 5,
),
PersistentTabController tabController = PersistentTabController(initialIndex: 0);
return PersistentTabView(
context,
controller: tabController,
navBarStyle: NavBarStyle.style3,
backgroundColor: Colors.white70,
screenTransitionAnimation: ScreenTransitionAnimation(animateTabTransition: true, curve: Curves.ease, duration: Duration(milliseconds: 200)),
screens: [
const Timetable(),
const ChatList(),
Files(setAppBar),
const Overhang(),
],
items: [
PersistentBottomNavBarItem(
activeColorPrimary: Theme.of(context).primaryColor,
inactiveColorPrimary: Theme.of(context).disabledColor,
icon: const Icon(Icons.calendar_month),
title: "Vertretung"
),
PersistentBottomNavBarItem(
activeColorPrimary: Theme.of(context).primaryColor,
inactiveColorPrimary: Theme.of(context).disabledColor,
icon: Consumer<ChatListProps>(
builder: (context, value, child) {
if(value.primaryLoading()) return const SizedBox.shrink();
int messages = value.getRoomsResponse.data.map((e) => e.unreadMessages).reduce((a, b) => a+b);
return badges.Badge(
showBadge: messages > 0,
badgeStyle: const badges.BadgeStyle(
badgeColor: Colors.white
),
badgeContent: Text("$messages", style: const TextStyle(color: Colors.black)),
child: const Icon(Icons.chat),
);
},
),
Flexible(
child: PageView(
controller: pageController,
children: [
const Timetable(),
const ChatList(),
Files(setAppBar),
const 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<ChatListProps>(
builder: (context, value, child) {
if(value.primaryLoading()) return const SizedBox.shrink();
int messages = value.getRoomsResponse.data.map((e) => e.unreadMessages).reduce((a, b) => a+b);
return Visibility(
visible: messages > 0,
child: Positioned(
right: 0,
top: 0,
child: Container(
padding: const EdgeInsets.all(1),
decoration: BoxDecoration(
color: Theme.of(context).primaryColor,
borderRadius: BorderRadius.circular(6),
),
constraints: const BoxConstraints(
minWidth: 13,
minHeight: 13,
),
child: Text(
"$messages",
style: const TextStyle(
color: Colors.white,
fontSize: 10,
),
textAlign: TextAlign.center,
),
),
),
);
},
)
],
), label: "Talk"),
const BottomNavigationBarItem(icon: Icon(Icons.folder), label: "Dateien"),
const BottomNavigationBarItem(icon: Icon(Icons.more_horiz), label: "Mehr"),
],
selectedItemColor: Theme.of(context).primaryColor,
unselectedItemColor: Colors.grey,
showUnselectedLabels: true,
showSelectedLabels: true,
type: BottomNavigationBarType.fixed,
currentIndex: currentPage,
onTap: (item) {
setAppBar(context, null);
setState(() {
currentPage = item;
pageController.jumpToPage(item);
});
},
),
title: "Talk"
),
PersistentBottomNavBarItem(
activeColorPrimary: Theme.of(context).primaryColor,
inactiveColorPrimary: Theme.of(context).disabledColor,
icon: const Icon(Icons.folder),
title: "Dateien"
),
PersistentBottomNavBarItem(
activeColorPrimary: Theme.of(context).primaryColor,
inactiveColorPrimary: Theme.of(context).disabledColor,
icon: const Icon(Icons.more_horiz),
title: "Mehr"
),
],
);
}
}

@ -62,6 +62,8 @@ dependencies:
flowder:
git:
url: https://github.com/Harsh223/flowder.git
persistent_bottom_nav_bar: ^5.0.2
badges: ^3.0.2
dependency_overrides:
xml: ^6.2.2