Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,4 @@ app.*.map.json
/android/app/debug
/android/app/profile
/android/app/release
/android/app/.cxx/
5 changes: 3 additions & 2 deletions lib/components/app_bar.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import 'package:auto_route/auto_route.dart';
import 'package:circle/core/core.dart';
import 'package:fluentui_system_icons/fluentui_system_icons.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:gap/gap.dart';
import 'package:go_router/go_router.dart';


class CustomAppBar extends StatelessWidget {
final String pageTitle;
Expand Down Expand Up @@ -36,7 +37,7 @@ class CustomAppBar extends StatelessWidget {
onPressed: () {
HapticFeedback.mediumImpact();
Feedback.forTap(context);
context.pop();
context.router.back();
},
icon: const Icon(FluentIcons.arrow_left_24_regular),
),
Expand Down
2 changes: 1 addition & 1 deletion lib/components/app_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class AppButton extends StatelessWidget {
break;

case ButtonType.outline:
labelColor = color ?? theme.colorScheme.primary;
labelColor = color ?? theme.colorScheme.onSurface;

style = ElevatedButton.styleFrom(
padding: EdgeInsets.symmetric(
Expand Down
15 changes: 9 additions & 6 deletions lib/components/bottom_nav_bar.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'dart:io';

import 'package:auto_route/annotations.dart';
import 'package:circle/core/theme/constants.dart';
import 'package:fluentui_system_icons/fluentui_system_icons.dart';
import 'package:flutter/material.dart';
Expand All @@ -12,8 +13,10 @@ import '../features/meds/meds.dart';
import '../features/profile/profile.dart';
import '../features/water/water.dart';

@RoutePage(name: BottomNavBar.name)
class BottomNavBar extends ConsumerStatefulWidget {
static const String id = "nav_bar";
static const String path = "/nav_bar";
static const String name = "BottomNavBar";
const BottomNavBar({super.key});

@override
Expand All @@ -28,19 +31,19 @@ class _BottomNavBarState extends ConsumerState<BottomNavBar> {

final List<Widget> pages = [
const HomeScreen(
key: PageStorageKey(HomeScreen.id),
key: PageStorageKey(HomeScreen .path),
),
const WaterScreen(
key: PageStorageKey(WaterScreen.id),
key: PageStorageKey(WaterScreen .path),
),
const EmergencyScreen(
key: PageStorageKey(EmergencyScreen.id),
key: PageStorageKey(EmergencyScreen .path),
),
const MedsScreen(
key: PageStorageKey(MedsScreen.id),
key: PageStorageKey(MedsScreen .path),
),
const ProfileScreen(
key: PageStorageKey(ProfileScreen.id),
key: PageStorageKey(ProfileScreen .path),
),
];

Expand Down
242 changes: 74 additions & 168 deletions lib/core/routes/routes.dart
Original file line number Diff line number Diff line change
@@ -1,184 +1,90 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:go_router/go_router.dart';
import 'package:auto_route/auto_route.dart';
import '../../components/bottom_nav_bar.dart';
import '../../features/auth/auth.dart';
import '../../features/emergency/emergency.dart';
import '../../features/home/home.dart';
import '../../features/meds/meds.dart';
import '../../features/profile/profile.dart';
import '../../features/water/screens/water_empty_screen.dart';
import '../../features/water/water.dart';
import 'routes.gr.dart' as route;

@AutoRouterConfig()
class AppRouter extends RootStackRouter {
@override
RouteType get defaultRouteType => const RouteType.adaptive();

final routerProvider = Provider<GoRouter>((ref) {
return GoRouter(
initialLocation: "/${LoadingScreen.id}",
routes: [
///-------H
GoRoute(
path: "/",
name: BottomNavBar.id,
builder: (BuildContext context, GoRouterState state) =>
const BottomNavBar(),
),
@override
List<AutoRoute> get routes => [
// ////-------Home-------//// //
AutoRoute(page: route.HomeScreen.page, path: HomeScreen.path),

GoRoute(
path: "/${LoadingScreen.id}",
name: LoadingScreen.id,
builder: (BuildContext context, GoRouterState state) =>
const LoadingScreen(),
),
// ////-------Water-------//// //
AutoRoute(page: route.WaterScreen.page, path: WaterScreen.path),
AutoRoute(
page: route.EditDailyGoalScreen.page,
path: EditDailyGoalScreen.path,
),
AutoRoute(
page: route.SuggestedWaterDailyGoalScreen.page,
path: SuggestedWaterDailyGoalScreen.path,
),
AutoRoute(page: route.WaterEmptyScreen.page, path: WaterEmptyScreen.path),

///-------Home-------///
GoRoute(
path: "/${HomeScreen.id}",
name: HomeScreen.id,
builder: (BuildContext context, GoRouterState state) =>
const HomeScreen(),
),
// ////-------Emergency-------//// //
AutoRoute(page: route.EmergencyScreen.page, path: EmergencyScreen.path),
AutoRoute(
page: route.AddEmergencyContactScreen.page,
path: AddEmergencyContactScreen.path,
),
AutoRoute(page: route.CrisisLogsScreen.page, path: CrisisLogsScreen.path),

///------Water-------///
GoRoute(
path: "/${WaterScreen.id}",
name: WaterScreen.id,
builder: (BuildContext context, GoRouterState state) =>
const WaterScreen(),
routes: <GoRoute>[
GoRoute(
path: EditDailyGoalScreen.id,
name: EditDailyGoalScreen.id,
builder: (BuildContext context, GoRouterState state) =>
const EditDailyGoalScreen(),
),
GoRoute(
path: SuggestedWaterDailyGoalScreen.id,
name: SuggestedWaterDailyGoalScreen.id,
builder: (BuildContext context, GoRouterState state) =>
const SuggestedWaterDailyGoalScreen(),
),
GoRoute(
path: WaterEmptyScreen.id,
name: WaterEmptyScreen.id,
builder: (BuildContext context, GoRouterState state) =>
const WaterEmptyScreen(),
),
],
),
// ////-------Profile-------///
AutoRoute(page: route.ProfileScreen.page, path: ProfileScreen.path),
AutoRoute(
page: route.ProfileBasicInfoScreen.page,
path: ProfileBasicInfoScreen.path,
),
AutoRoute(
page: route.ProfileMedicalInfoScreen.page,
path: ProfileMedicalInfoScreen.path,
),
AutoRoute(
page: route.ProfileVitalsInfoScreen.page,
path: ProfileVitalsInfoScreen.path,
),

///------Emergency-------///
GoRoute(
path: "/${EmergencyScreen.id}",
name: EmergencyScreen.id,
builder: (BuildContext context, GoRouterState state) =>
const EmergencyScreen(),
routes: <GoRoute>[
GoRoute(
path: AddEmergencyContactScreen.id,
name: AddEmergencyContactScreen.id,
builder: (BuildContext context, GoRouterState state) =>
const AddEmergencyContactScreen(),
),
GoRoute(
path: CrisisLogsScreen.id,
name: CrisisLogsScreen.id,
builder: (BuildContext context, GoRouterState state) =>
const CrisisLogsScreen(),
),
],
),
// ////-------Medication-------//// //
AutoRoute(page: route.MedsScreen.page, path: MedsScreen.path),
AutoRoute(
page: route.MedsScheduleScreen.page,
path: MedsScheduleScreen.path,
),
AutoRoute(page: route.AddMedsScreen.page, path: AddMedsScreen.path),
AutoRoute(page: route.MedsDetailsScreen.page, path: MedsDetailsScreen.path),

///------Profile-------///
GoRoute(
path: "/${ProfileScreen.id}",
name: ProfileScreen.id,
builder: (BuildContext context, GoRouterState state) =>
const ProfileScreen(),
),
GoRoute(
path: "/${SettingsScreen.id}",
name: SettingsScreen.id,
builder: (BuildContext context, GoRouterState state) =>
const SettingsScreen(),
),
GoRoute(
path: "/${ProfileBasicInfoScreen.id}",
name: ProfileBasicInfoScreen.id,
builder: (BuildContext context, GoRouterState state) =>
const ProfileBasicInfoScreen(),
),
GoRoute(
path: "/${ProfileMedicalInfoScreen.id}",
name: ProfileMedicalInfoScreen.id,
builder: (BuildContext context, GoRouterState state) =>
const ProfileMedicalInfoScreen(),
),
GoRoute(
path: "/${ProfileVitalsInfoScreen.id}",
name: ProfileVitalsInfoScreen.id,
builder: (BuildContext context, GoRouterState state) =>
const ProfileVitalsInfoScreen(),
),
// ////-------Onboarding-------//// //
AutoRoute(
page: route.OnboardingBaseScreen.page,
path: OnboardingBaseScreen.path,
),

///------Medication-------///
GoRoute(
path: "/${MedsScreen.id}",
name: MedsScreen.id,
builder: (BuildContext context, GoRouterState state) =>
const MedsScreen(),
routes: <GoRoute>[
GoRoute(
path: MedsScheduleScreen.id,
name: MedsScheduleScreen.id,
builder: (BuildContext context, GoRouterState state) =>
const MedsScheduleScreen(),
),
GoRoute(
path: AddMedsScreen.id,
name: AddMedsScreen.id,
builder: (BuildContext context, GoRouterState state) =>
const AddMedsScreen(),
),
GoRoute(
path: MedsDetailsScreen.id,
name: MedsDetailsScreen.id,
builder: (BuildContext context, GoRouterState state) =>
const MedsDetailsScreen(),
),
],
),
// ////-------Auth-------//// //
AutoRoute(page: route.SignInScreen.page, path: SignInScreen.path),
AutoRoute(page: route.RegisterScreen.page, path: RegisterScreen.path),
AutoRoute(
page: route.GoogleSignInScreen.page,
path: GoogleSignInScreen.path,
),
AutoRoute(page: route.AuthSuccessScreen.page, path: AuthSuccessScreen.path),

///------ Onboarding Auth-------///
GoRoute(
path: "/auth/${SignInScreen.id}",
name: SignInScreen.id,
builder: (BuildContext context, GoRouterState state) =>
const SignInScreen(),
),
GoRoute(
path: "/auth/${RegisterScreen.id}",
name: RegisterScreen.id,
builder: (BuildContext context, GoRouterState state) =>
const RegisterScreen(),
),
GoRoute(
path: "/auth/${GoogleSignInScreen.id}",
name: GoogleSignInScreen.id,
builder: (BuildContext context, GoRouterState state) =>
const GoogleSignInScreen(),
),
GoRoute(
path: "/auth/${AuthSuccessScreen.id}",
name: AuthSuccessScreen.id,
builder: (BuildContext context, GoRouterState state) =>
const AuthSuccessScreen(),
),
GoRoute(
path: "/${OnboardingBaseScreen.id}",
name: OnboardingBaseScreen.id,
builder: (BuildContext context, GoRouterState state) =>
const OnboardingBaseScreen(),
),
],
);
});
// ////-------Bottom Nav-------//// //
AutoRoute(page: route.BottomNavBar.page, path: BottomNavBar.path),

// ////-------Loading Screen-------//// //
AutoRoute(
page: route.LoadingScreen.page,
path: LoadingScreen.path,
initial: true,
),
];
}
Loading
Loading