Skip to content

Commit

Permalink
update the app theme
Browse files Browse the repository at this point in the history
  • Loading branch information
warrenrhodes committed Oct 2, 2024
1 parent c423f5a commit 60bd76f
Show file tree
Hide file tree
Showing 14 changed files with 345 additions and 165 deletions.
6 changes: 6 additions & 0 deletions sabitou_clients/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:flutter_web_plugins/flutter_web_plugins.dart';
import 'package:get/get.dart';
import 'package:get_storage/get_storage.dart';

import 'routes/app_routes.dart';
import 'services/internationalization/app_translations.dart';
import 'services/internationalization/internationalization.dart';
import 'themes/app_themes.dart';
Expand All @@ -26,17 +28,21 @@ class MyApp extends StatelessWidget {
supportedLocales: AppInternationalization.supportedLocales,
locale: Get.deviceLocale,
fallbackLocale: const Locale('en'),
getPages: AppRouter.pageRoutes,
localizationsDelegates: const [
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
],
darkTheme: ThemeService.darkTheme,
theme: ThemeService.lightTheme,
themeMode: ThemeService.to.themeMode,
);
}
}

Future<void> _initServices() async {
setUrlStrategy(PathUrlStrategy());
await GetStorage.init();

// Initialize the services and repositories.
Expand Down
88 changes: 88 additions & 0 deletions sabitou_clients/lib/routes/app_routes.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:get_storage/get_storage.dart';

import '../screens/connection/connection_view.dart';
import '../screens/dashboard/dashboard_view.dart';
import '../screens/registration/registration_view.dart';
import '../utils/constants.dart';
import 'middleware_page.dart';
import 'pages_routes.dart';

/// The app routes.
final class AppRouter {
/// The list of app routes.
static List<GetPage<dynamic>> get pageRoutes => [
GetPage(
name: PagesRoutes.home.pattern,
middlewares: [HomeMiddleware()],
page: () => const MiddlewarePage(
child: DashboardView(),
),
),
GetPage(
name: PagesRoutes.connection.pattern,
page: () => const MiddlewarePage(
child: ConnectionView(),
),
),
GetPage(
name: PagesRoutes.registration.pattern,
page: () => const MiddlewarePage(
child: RegistrationView(),
),
),
];

/// Navigates to nex page.
static void push(String uri, {Object? extra}) {
Get.toNamed(uri, arguments: extra);
}

/// Navigates to next page and replace all the stack page.
static void go(String uri, {Object? extra}) {
Get.offAllNamed(uri, arguments: extra);
}

/// Navigates to next page and replace the previous page.
static void pushReplacementNamed(
String uri, {
Object? extra,
}) {
Get.offNamed(uri, arguments: extra);
}

/// Gets the current route name.
static String getCurrentLocation(BuildContext context) {
return Get.currentRoute;
}

/// Checks if there are routes to pop.
static bool canPop(BuildContext context) {
return Get.key.currentState?.canPop() ??
false; // Check if there are routes to pop
}

/// Pops the current route.
static void onPop(BuildContext context) {
Get.back(); // Use Get.back() to pop the current route
}
}

/// The first open time middleware.
class HomeMiddleware extends GetMiddleware {
final _box = GetStorage();

@override
RouteSettings? redirect(String? route) {
final bool isFirstOpenTime =
_box.read(PreferencesKey.isFirstOpenTime) ?? true;

if (isFirstOpenTime) {
return RouteSettings(name: PagesRoutes.connection.pattern);
}

/// [TODO] verify whether the user is registered or not.
return null;
}
}
5 changes: 1 addition & 4 deletions sabitou_clients/lib/routes/middleware_page.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'package:flutter/material.dart';
import 'package:shadcn_ui/shadcn_ui.dart';

/// The middle page.
final class MiddlewarePage extends StatelessWidget {
Expand All @@ -11,8 +10,6 @@ final class MiddlewarePage extends StatelessWidget {

@override
Widget build(BuildContext context) {
return ShadApp(
home: child,
);
return child;
}
}
12 changes: 12 additions & 0 deletions sabitou_clients/lib/screens/connection/connection_view.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import 'package:flutter/material.dart';

/// The login view.
final class ConnectionView extends StatelessWidget {
/// Constructor of new [ConnectionView].
const ConnectionView({super.key});

@override
Widget build(BuildContext context) {
return const Placeholder();
}
}
14 changes: 14 additions & 0 deletions sabitou_clients/lib/screens/dashboard/dashboard_view.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import 'package:flutter/material.dart';

/// The home screen.
final class DashboardView extends StatelessWidget {
/// Constructor of new [DashboardView].
const DashboardView({
super.key,
});

@override
Widget build(BuildContext context) {
return const Placeholder();
}
}
1 change: 0 additions & 1 deletion sabitou_clients/lib/screens/dashboard_screen.dart

This file was deleted.

1 change: 0 additions & 1 deletion sabitou_clients/lib/screens/login_screen.dart

This file was deleted.

12 changes: 12 additions & 0 deletions sabitou_clients/lib/screens/registration/registration_view.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import 'package:flutter/material.dart';

/// The registration screen.
final class RegistrationView extends StatelessWidget {
/// Constructor of new [RegistrationView].
const RegistrationView({super.key});

@override
Widget build(BuildContext context) {
return const Placeholder();
}
}
1 change: 0 additions & 1 deletion sabitou_clients/lib/screens/signup_screen.dart

This file was deleted.

8 changes: 4 additions & 4 deletions sabitou_clients/lib/themes/app_colors.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,20 @@ class AppColors {
static const Color grey500 = Color(0xFF667085);
static const Color grey600 = Color(0xFF5d6679);
static const Color grey700 = Color(0xFF48505e);
static const Color grey800 = Color(0xFF383e49);
static const Color grey900 = Color(0xFF2b2f38);
static const Color grey800 = Color(0xFF1e293b);
static const Color grey900 = Color(0xFF0f172a);

// Primary
static const Color primary50 = Color(0xFFe8f1fd);
static const Color primary100 = Color(0xFFb6d3fa);
static const Color primary200 = Color(0xFF93bdf8);
static const Color primary300 = Color(0xFF629ff4);
static const Color primary400 = Color(0xFF448df2);
static const Color primary500 = Color(0xFF1570ef);
static const Color primary500 = Color(0xFF2563eb);
static const Color primary600 = Color(0xFF1366d9);
static const Color primary700 = Color(0xFF0f50aa);
static const Color primary800 = Color(0xFF0c3e83);
static const Color primary900 = Color(0xFF092f64);
static const Color primary900 = Color(0xFF020817);

// Error
static const Color error50 = Color(0xFFfeeceb);
Expand Down
Loading

0 comments on commit 60bd76f

Please sign in to comment.