-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #70 from ProximaEPFL/ms1-navigation
Milestone 1 application navigation (flow and UI)
- Loading branch information
Showing
22 changed files
with
580 additions
and
224 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import "package:flutter/material.dart"; | ||
|
||
class NotImplemented extends StatelessWidget { | ||
const NotImplemented({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return const Center( | ||
child: Text("Feature not yet implemented :("), | ||
); | ||
} | ||
} |
22 changes: 0 additions & 22 deletions
22
lib/views/bottom_navigation_bar/navigation_bar_routes.dart
This file was deleted.
Oops, something went wrong.
File renamed without changes.
6 changes: 3 additions & 3 deletions
6
...pages/home/posts/post_card/post_card.dart → ...ome_content/feed/post_card/post_card.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
lib/views/navigation/bottom_navigation_bar/navigation_bar_routes.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import "package:flutter/material.dart"; | ||
import "package:proxima/utils/ui/not_implemented.dart"; | ||
import "package:proxima/views/home_content/feed/post_feed.dart"; | ||
import "package:proxima/views/navigation/routes.dart"; | ||
|
||
/// This enum is used to create the navigation bar routes. | ||
/// It contains the name and icon of the routes. | ||
enum NavigationbarRoutes { | ||
feed("Feed", Icon(Icons.home), null), | ||
challenge("Challenge", Icon(Icons.emoji_events), null), | ||
addPost( | ||
"New post", | ||
CircleAvatar( | ||
child: Icon(Icons.add), | ||
), | ||
Routes.newPost, | ||
), | ||
group("Group", Icon(Icons.group), null), | ||
map("Map", Icon(Icons.place), null); | ||
|
||
static const defaultLabelText = "Proxima"; | ||
|
||
final String name; | ||
final Widget icon; | ||
|
||
// Non-null if it requires a push | ||
final Routes? routeDestination; | ||
|
||
const NavigationbarRoutes( | ||
this.name, | ||
this.icon, | ||
this.routeDestination, | ||
); | ||
|
||
Widget page() { | ||
if (routeDestination != null) { | ||
throw Exception("Route must be pushed."); | ||
} | ||
|
||
// TODO implement other routes | ||
switch (this) { | ||
case feed: | ||
return const PostFeed(); | ||
case _: | ||
return const NotImplemented(); | ||
} | ||
} | ||
|
||
String pageLabel() { | ||
switch (this) { | ||
case challenge: | ||
return "Your challenges"; | ||
case _: | ||
return defaultLabelText; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
lib/views/navigation/leading_back_button/leading_back_button.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import "package:flutter/material.dart"; | ||
|
||
class LeadingBackButton extends StatelessWidget { | ||
static const leadingBackButtonKey = Key("leadingBackButtonKey"); | ||
|
||
final VoidCallback? onPressed; | ||
|
||
const LeadingBackButton({ | ||
super.key, | ||
this.onPressed, | ||
}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Padding( | ||
padding: const EdgeInsets.all(8.0), | ||
child: IconButton( | ||
key: leadingBackButtonKey, | ||
onPressed: onPressed ?? () => Navigator.pop(context), | ||
icon: const Icon(Icons.arrow_back), | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import "package:flutter/material.dart"; | ||
import "package:hooks_riverpod/hooks_riverpod.dart"; | ||
import "package:proxima/viewmodels/login_view_model.dart"; | ||
import "package:proxima/views/navigation/routes.dart"; | ||
|
||
/// This widget is the top bar of the home page | ||
/// It contains the feed sort option and the user profile picture | ||
class AppTopBar extends HookConsumerWidget { | ||
static const homeTopBarKey = Key("homeTopBar"); | ||
static const profilePictureKey = Key("profilePicture"); | ||
static const logoutButtonKey = Key("logoutButton"); | ||
|
||
final String labelText; | ||
|
||
const AppTopBar({super.key, required this.labelText}); | ||
|
||
@override | ||
Widget build(BuildContext context, WidgetRef ref) { | ||
final title = Text( | ||
labelText, | ||
style: Theme.of(context).textTheme.headlineMedium, | ||
); | ||
|
||
Widget userAvatar = CircleAvatar( | ||
child: Stack( | ||
children: [ | ||
const Center(child: Text("PR")), | ||
Material( | ||
shape: const CircleBorder(), | ||
clipBehavior: Clip.hardEdge, | ||
color: Colors.transparent, | ||
child: InkWell( | ||
key: profilePictureKey, | ||
onTap: () => { | ||
Navigator.pushNamed(context, Routes.profile.name), | ||
}, | ||
), | ||
), | ||
], | ||
), | ||
); | ||
|
||
return Row( | ||
key: homeTopBarKey, | ||
mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
crossAxisAlignment: CrossAxisAlignment.center, | ||
children: [ | ||
title, | ||
// Temporary logout button | ||
IconButton( | ||
key: logoutButtonKey, | ||
onPressed: () => ref.read(loginServiceProvider).signOut(), | ||
icon: const Icon(Icons.logout), | ||
), | ||
userAvatar, | ||
], | ||
); | ||
} | ||
} |
Oops, something went wrong.