Added custom Appbar for each page
This commit is contained in:
parent
cc47f9bee7
commit
3e7dd1b0c7
@ -68,8 +68,10 @@ class _AppState extends State<App> {
|
|||||||
context,
|
context,
|
||||||
controller: tabController,
|
controller: tabController,
|
||||||
navBarStyle: NavBarStyle.style3,
|
navBarStyle: NavBarStyle.style3,
|
||||||
backgroundColor: Colors.white70,
|
decoration: const NavBarDecoration(
|
||||||
screenTransitionAnimation: ScreenTransitionAnimation(animateTabTransition: true, curve: Curves.ease, duration: Duration(milliseconds: 200)),
|
border: Border.symmetric(vertical: BorderSide.none, horizontal: BorderSide(color: Colors.grey, width: 2))
|
||||||
|
),
|
||||||
|
screenTransitionAnimation: const ScreenTransitionAnimation(animateTabTransition: true, curve: Curves.ease, duration: Duration(milliseconds: 200)),
|
||||||
screens: [
|
screens: [
|
||||||
const Timetable(),
|
const Timetable(),
|
||||||
const ChatList(),
|
const ChatList(),
|
||||||
|
@ -42,25 +42,40 @@ class _FilesState extends State<Files> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Consumer<FilesProps>(
|
return Scaffold(
|
||||||
builder: (context, value, child) {
|
appBar: AppBar(
|
||||||
if(value.primaryLoading()) return const Center(child: CircularProgressIndicator());
|
title: const Text("Dateien"),
|
||||||
|
actions: [
|
||||||
|
IconButton(
|
||||||
|
icon: const Icon(Icons.search),
|
||||||
|
onPressed: () => {},
|
||||||
|
),
|
||||||
|
IconButton(
|
||||||
|
icon: const Icon(Icons.sort),
|
||||||
|
onPressed: () => {},
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
body: Consumer<FilesProps>(
|
||||||
|
builder: (context, value, child) {
|
||||||
|
if(value.primaryLoading()) return const Center(child: CircularProgressIndicator());
|
||||||
|
|
||||||
if(value.listFilesResponse.files.isEmpty) {
|
if(value.listFilesResponse.files.isEmpty) {
|
||||||
return const ErrorView(text: "Der Ordner ist leer", icon: Icons.folder_off_outlined);
|
return const ErrorView(text: "Der Ordner ist leer", icon: Icons.folder_off_outlined);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<CacheableFile> files = value.listFilesResponse.files.toList();
|
List<CacheableFile> files = value.listFilesResponse.files.toList();
|
||||||
files.sort((a, b) => a.isDirectory ? -1 : 1);
|
files.sort((a, b) => a.isDirectory ? -1 : 1);
|
||||||
|
|
||||||
return ListView.builder(
|
return ListView.builder(
|
||||||
itemCount: files.length,
|
itemCount: files.length,
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
CacheableFile file = files.skip(index).first;
|
CacheableFile file = files.skip(index).first;
|
||||||
return FileElement(file, updateAppBar);
|
return FileElement(file, updateAppBar);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,71 +36,82 @@ class _ChatListState extends State<ChatList> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|
||||||
return Consumer<ChatListProps>(
|
return Scaffold(
|
||||||
builder: (context, data, child) {
|
appBar: AppBar(
|
||||||
|
title: const Text("Talk"),
|
||||||
|
actions: [
|
||||||
|
IconButton(
|
||||||
|
icon: const Icon(Icons.search),
|
||||||
|
onPressed: () => {},
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
body: Consumer<ChatListProps>(
|
||||||
|
builder: (context, data, child) {
|
||||||
|
|
||||||
if(data.primaryLoading()) {
|
if(data.primaryLoading()) {
|
||||||
return const Center(child: CircularProgressIndicator());
|
return const Center(child: CircularProgressIndicator());
|
||||||
}
|
}
|
||||||
|
|
||||||
List<ListTile> chats = List<ListTile>.empty(growable: true);
|
List<ListTile> chats = List<ListTile>.empty(growable: true);
|
||||||
|
|
||||||
for (var chatRoom in data.getRoomsResponse.sortByLastActivity()) {
|
for (var chatRoom in data.getRoomsResponse.sortByLastActivity()) {
|
||||||
|
|
||||||
CircleAvatar circleAvatar = CircleAvatar(
|
CircleAvatar circleAvatar = CircleAvatar(
|
||||||
foregroundImage: chatRoom.type == GetRoomResponseObjectConversationType.oneToOne ? Image.network("https://cloud.marianum-fulda.de/avatar/${chatRoom.name}/128").image : null,
|
foregroundImage: chatRoom.type == GetRoomResponseObjectConversationType.oneToOne ? Image.network("https://cloud.marianum-fulda.de/avatar/${chatRoom.name}/128").image : null,
|
||||||
backgroundColor: Theme.of(context).primaryColor,
|
backgroundColor: Theme.of(context).primaryColor,
|
||||||
foregroundColor: Colors.white,
|
foregroundColor: Colors.white,
|
||||||
child: chatRoom.type == GetRoomResponseObjectConversationType.group ? const Icon(Icons.group) : const Icon(Icons.person),
|
child: chatRoom.type == GetRoomResponseObjectConversationType.group ? const Icon(Icons.group) : const Icon(Icons.person),
|
||||||
);
|
);
|
||||||
|
|
||||||
chats.add(ListTile(
|
chats.add(ListTile(
|
||||||
title: Text(chatRoom.displayName),
|
title: Text(chatRoom.displayName),
|
||||||
subtitle: Text("${Jiffy.unixFromSecondsSinceEpoch(chatRoom.lastMessage.timestamp).fromNow()}: ${RichObjectStringProcessor.parseToString(chatRoom.lastMessage.message.replaceAll("\n", " "), chatRoom.lastMessage.messageParameters)}", overflow: TextOverflow.ellipsis),
|
subtitle: Text("${Jiffy.unixFromSecondsSinceEpoch(chatRoom.lastMessage.timestamp).fromNow()}: ${RichObjectStringProcessor.parseToString(chatRoom.lastMessage.message.replaceAll("\n", " "), chatRoom.lastMessage.messageParameters)}", overflow: TextOverflow.ellipsis),
|
||||||
trailing: Visibility(
|
trailing: Visibility(
|
||||||
visible: chatRoom.unreadMessages > 0,
|
visible: chatRoom.unreadMessages > 0,
|
||||||
child: Container(
|
child: Container(
|
||||||
padding: const EdgeInsets.all(1),
|
padding: const EdgeInsets.all(1),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Theme.of(context).primaryColor,
|
color: Theme.of(context).primaryColor,
|
||||||
borderRadius: BorderRadius.circular(30),
|
borderRadius: BorderRadius.circular(30),
|
||||||
),
|
),
|
||||||
constraints: const BoxConstraints(
|
constraints: const BoxConstraints(
|
||||||
minWidth: 20,
|
minWidth: 20,
|
||||||
minHeight: 20,
|
minHeight: 20,
|
||||||
),
|
),
|
||||||
child: Text(
|
child: Text(
|
||||||
"${chatRoom.unreadMessages}",
|
"${chatRoom.unreadMessages}",
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
fontSize: 15,
|
fontSize: 15,
|
||||||
|
),
|
||||||
|
textAlign: TextAlign.center,
|
||||||
),
|
),
|
||||||
textAlign: TextAlign.center,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
leading: circleAvatar,
|
||||||
leading: circleAvatar,
|
onTap: () async {
|
||||||
onTap: () async {
|
Navigator.of(context).push(MaterialPageRoute(builder: (context) {
|
||||||
Navigator.of(context).push(MaterialPageRoute(builder: (context) {
|
return ChatView(
|
||||||
return ChatView(
|
room: chatRoom,
|
||||||
room: chatRoom,
|
selfId: username,
|
||||||
selfId: username,
|
avatar: circleAvatar,
|
||||||
avatar: circleAvatar,
|
);
|
||||||
);
|
}));
|
||||||
}));
|
},
|
||||||
},
|
));
|
||||||
));
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return RefreshIndicator(
|
return RefreshIndicator(
|
||||||
color: Theme.of(context).primaryColor,
|
color: Theme.of(context).primaryColor,
|
||||||
onRefresh: () {
|
onRefresh: () {
|
||||||
Provider.of<ChatListProps>(context, listen: false).run(renew: true);
|
Provider.of<ChatListProps>(context, listen: false).run(renew: true);
|
||||||
return Future.delayed(const Duration(seconds: 3));
|
return Future.delayed(const Duration(seconds: 3));
|
||||||
},
|
},
|
||||||
child: ListView(children: chats),
|
child: ListView(children: chats),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -26,80 +26,85 @@ class _TimetableState extends State<Timetable> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Consumer<TimetableProps>(
|
return Scaffold(
|
||||||
builder: (context, value, child) {
|
appBar: AppBar(
|
||||||
if(value.primaryLoading()) {
|
title: const Text("Vertretungsplan"),
|
||||||
return const Center(child: CircularProgressIndicator());
|
),
|
||||||
}
|
body: Consumer<TimetableProps>(
|
||||||
|
builder: (context, value, child) {
|
||||||
|
if(value.primaryLoading()) {
|
||||||
|
return const Center(child: CircularProgressIndicator());
|
||||||
|
}
|
||||||
|
|
||||||
TimetableProps timetable = Provider.of<TimetableProps>(context, listen: false);
|
TimetableProps timetable = Provider.of<TimetableProps>(context, listen: false);
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
child: WeekView(value),
|
child: WeekView(value),
|
||||||
onHorizontalDragUpdate: (details) {
|
onHorizontalDragUpdate: (details) {
|
||||||
if(!draggable) return;
|
if(!draggable) return;
|
||||||
if(details.delta.dx > 5) {
|
if(details.delta.dx > 5) {
|
||||||
draggable = false;
|
draggable = false;
|
||||||
timetable.switchWeek(previous: true);
|
timetable.switchWeek(previous: true);
|
||||||
} else if(details.delta.dx < 5) {
|
} else if(details.delta.dx < 5) {
|
||||||
draggable = false;
|
draggable = false;
|
||||||
timetable.switchWeek();
|
timetable.switchWeek();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onHorizontalDragEnd: (details) {
|
onHorizontalDragEnd: (details) {
|
||||||
draggable = true;
|
draggable = true;
|
||||||
},
|
},
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
// Flexible(
|
|
||||||
// child:
|
|
||||||
// ),
|
|
||||||
|
|
||||||
Visibility(
|
|
||||||
visible: false,
|
|
||||||
child: Container(
|
|
||||||
padding: const EdgeInsets.only(top: 5, bottom: 5),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
border: Border(
|
|
||||||
top: BorderSide(width: 2, color: Theme.of(context).disabledColor)
|
|
||||||
)
|
|
||||||
),
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
|
|
||||||
children: [
|
|
||||||
IconButton(
|
|
||||||
onPressed: () => timetable.switchWeek(previous: true),
|
|
||||||
icon: const Icon(Icons.navigate_before_sharp),
|
|
||||||
color: Theme.of(context).primaryColor,
|
|
||||||
iconSize: 30,
|
|
||||||
),
|
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
IconButton(
|
|
||||||
onPressed: () => timetable.nearest(),
|
|
||||||
icon: const Icon(Icons.home),
|
|
||||||
color: Theme.of(context).primaryColor,
|
|
||||||
iconSize: 30,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
IconButton(
|
|
||||||
onPressed: () => timetable.switchWeek(),
|
|
||||||
icon: const Icon(Icons.navigate_next_sharp),
|
|
||||||
color: Theme.of(context).primaryColor,
|
|
||||||
iconSize: 30,
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)
|
|
||||||
],
|
// Flexible(
|
||||||
);
|
// child:
|
||||||
},
|
// ),
|
||||||
|
|
||||||
|
Visibility(
|
||||||
|
visible: false,
|
||||||
|
child: Container(
|
||||||
|
padding: const EdgeInsets.only(top: 5, bottom: 5),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
border: Border(
|
||||||
|
top: BorderSide(width: 2, color: Theme.of(context).disabledColor)
|
||||||
|
)
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
|
||||||
|
children: [
|
||||||
|
IconButton(
|
||||||
|
onPressed: () => timetable.switchWeek(previous: true),
|
||||||
|
icon: const Icon(Icons.navigate_before_sharp),
|
||||||
|
color: Theme.of(context).primaryColor,
|
||||||
|
iconSize: 30,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
IconButton(
|
||||||
|
onPressed: () => timetable.nearest(),
|
||||||
|
icon: const Icon(Icons.home),
|
||||||
|
color: Theme.of(context).primaryColor,
|
||||||
|
iconSize: 30,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
IconButton(
|
||||||
|
onPressed: () => timetable.switchWeek(),
|
||||||
|
icon: const Icon(Icons.navigate_next_sharp),
|
||||||
|
color: Theme.of(context).primaryColor,
|
||||||
|
iconSize: 30,
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user