Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
Dionnie123 committed Mar 9, 2024
1 parent 5a6796b commit 7b2fa41
Show file tree
Hide file tree
Showing 27 changed files with 324 additions and 437 deletions.
144 changes: 56 additions & 88 deletions .idea/libraries/Dart_Packages.xml

Large diffs are not rendered by default.

7 changes: 2 additions & 5 deletions .idea/libraries/Flutter_Plugins.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# dionniebee

flutter clean && flutter pub get && flutter pub run build_runner build --delete-conflicting-outputs
flutter run -d chrome --web-port 8000 --web-renderer html
flutter run -d chrome --web-port 8000 --web-renderer html

# STACKED COMMANDS
42 changes: 42 additions & 0 deletions dionniebee.iml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,48 @@
<excludeFolder url="file://$MODULE_DIR$/windows/flutter/ephemeral/.plugin_symlinks/app_links/example/.pub" />
<excludeFolder url="file://$MODULE_DIR$/windows/flutter/ephemeral/.plugin_symlinks/app_links/example/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/windows/flutter/ephemeral/.plugin_symlinks/app_links/example/build" />
<excludeFolder url="file://$MODULE_DIR$/linux/flutter/ephemeral/.plugin_symlinks/app_links/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/linux/flutter/ephemeral/.plugin_symlinks/app_links/.pub" />
<excludeFolder url="file://$MODULE_DIR$/linux/flutter/ephemeral/.plugin_symlinks/app_links/build" />
<excludeFolder url="file://$MODULE_DIR$/linux/flutter/ephemeral/.plugin_symlinks/app_links/example/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/linux/flutter/ephemeral/.plugin_symlinks/app_links/example/.pub" />
<excludeFolder url="file://$MODULE_DIR$/linux/flutter/ephemeral/.plugin_symlinks/app_links/example/build" />
<excludeFolder url="file://$MODULE_DIR$/linux/flutter/ephemeral/.plugin_symlinks/gtk/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/linux/flutter/ephemeral/.plugin_symlinks/gtk/.pub" />
<excludeFolder url="file://$MODULE_DIR$/linux/flutter/ephemeral/.plugin_symlinks/gtk/build" />
<excludeFolder url="file://$MODULE_DIR$/linux/flutter/ephemeral/.plugin_symlinks/gtk/example/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/linux/flutter/ephemeral/.plugin_symlinks/gtk/example/.pub" />
<excludeFolder url="file://$MODULE_DIR$/linux/flutter/ephemeral/.plugin_symlinks/gtk/example/build" />
<excludeFolder url="file://$MODULE_DIR$/windows/flutter/ephemeral/.plugin_symlinks/cloud_firestore/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/windows/flutter/ephemeral/.plugin_symlinks/cloud_firestore/.pub" />
<excludeFolder url="file://$MODULE_DIR$/windows/flutter/ephemeral/.plugin_symlinks/cloud_firestore/build" />
<excludeFolder url="file://$MODULE_DIR$/windows/flutter/ephemeral/.plugin_symlinks/cloud_firestore/example/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/windows/flutter/ephemeral/.plugin_symlinks/cloud_firestore/example/.pub" />
<excludeFolder url="file://$MODULE_DIR$/windows/flutter/ephemeral/.plugin_symlinks/cloud_firestore/example/build" />
<excludeFolder url="file://$MODULE_DIR$/windows/flutter/ephemeral/.plugin_symlinks/firebase_auth/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/windows/flutter/ephemeral/.plugin_symlinks/firebase_auth/.pub" />
<excludeFolder url="file://$MODULE_DIR$/windows/flutter/ephemeral/.plugin_symlinks/firebase_auth/build" />
<excludeFolder url="file://$MODULE_DIR$/windows/flutter/ephemeral/.plugin_symlinks/firebase_auth/example/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/windows/flutter/ephemeral/.plugin_symlinks/firebase_auth/example/.pub" />
<excludeFolder url="file://$MODULE_DIR$/windows/flutter/ephemeral/.plugin_symlinks/firebase_auth/example/build" />
<excludeFolder url="file://$MODULE_DIR$/windows/flutter/ephemeral/.plugin_symlinks/firebase_core/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/windows/flutter/ephemeral/.plugin_symlinks/firebase_core/.pub" />
<excludeFolder url="file://$MODULE_DIR$/windows/flutter/ephemeral/.plugin_symlinks/firebase_core/build" />
<excludeFolder url="file://$MODULE_DIR$/windows/flutter/ephemeral/.plugin_symlinks/firebase_core/example/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/windows/flutter/ephemeral/.plugin_symlinks/firebase_core/example/.pub" />
<excludeFolder url="file://$MODULE_DIR$/windows/flutter/ephemeral/.plugin_symlinks/firebase_core/example/build" />
<excludeFolder url="file://$MODULE_DIR$/windows/flutter/ephemeral/.plugin_symlinks/firebase_storage/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/windows/flutter/ephemeral/.plugin_symlinks/firebase_storage/.pub" />
<excludeFolder url="file://$MODULE_DIR$/windows/flutter/ephemeral/.plugin_symlinks/firebase_storage/build" />
<excludeFolder url="file://$MODULE_DIR$/windows/flutter/ephemeral/.plugin_symlinks/firebase_storage/example/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/windows/flutter/ephemeral/.plugin_symlinks/firebase_storage/example/.pub" />
<excludeFolder url="file://$MODULE_DIR$/windows/flutter/ephemeral/.plugin_symlinks/firebase_storage/example/build" />
<excludeFolder url="file://$MODULE_DIR$/windows/flutter/ephemeral/.plugin_symlinks/permission_handler_windows/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/windows/flutter/ephemeral/.plugin_symlinks/permission_handler_windows/.pub" />
<excludeFolder url="file://$MODULE_DIR$/windows/flutter/ephemeral/.plugin_symlinks/permission_handler_windows/build" />
<excludeFolder url="file://$MODULE_DIR$/windows/flutter/ephemeral/.plugin_symlinks/permission_handler_windows/example/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/windows/flutter/ephemeral/.plugin_symlinks/permission_handler_windows/example/.pub" />
<excludeFolder url="file://$MODULE_DIR$/windows/flutter/ephemeral/.plugin_symlinks/permission_handler_windows/example/build" />
</content>
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Dart SDK" level="project" />
Expand Down
6 changes: 3 additions & 3 deletions lib/app/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ import 'package:dionniebee/ui/views/validation_example/validation_example_view.d
import 'package:dionniebee/services/foo_service.dart';
import 'package:dionniebee/services/supabase_auth_service.dart';
import 'package:dionniebee/services/user_service.dart';
import 'package:dionniebee/services/toast_service.dart';
import 'package:dionniebee/services/loader_service.dart';
import 'package:dionniebee/services/fluttertoast_contextless/fluttertoast_service.dart';
import 'package:dionniebee/services/loader_overlay_contextless/loader_service.dart';
import 'package:dionniebee/ui/bottom_sheets/cart_info/cart_info_sheet.dart';
// @stacked-import

Expand All @@ -47,7 +47,7 @@ import 'package:dionniebee/ui/bottom_sheets/cart_info/cart_info_sheet.dart';
],
dependencies: [
LazySingleton(classType: LoaderService),
LazySingleton(classType: ToastService),
LazySingleton(classType: FlutterToastService),
LazySingleton(classType: RouterService),
LazySingleton(classType: BottomSheetService),
InitializableSingleton(
Expand Down
6 changes: 3 additions & 3 deletions lib/app/app.locator.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 35 additions & 0 deletions lib/app/constants/theme-default.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import 'package:dionniebee/ui/common/colors.dart';
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';

class AppTheme {
static ThemeData lightTheme = ThemeData(
fontFamily: GoogleFonts.varelaRound().fontFamily,
useMaterial3: false,
appBarTheme: AppBarTheme(
backgroundColor: kcPrimaryColor,
foregroundColor: Colors.white,
titleTextStyle: TextStyle(
color: Colors.white,
fontFamily: GoogleFonts.varelaRound().fontFamily,
fontWeight: FontWeight.bold,
fontSize: 18)),
brightness: Brightness.light,
colorSchemeSeed: kcPrimaryColor,
);

static ThemeData darkTheme = ThemeData(
fontFamily: GoogleFonts.varelaRound().fontFamily,
useMaterial3: false,
appBarTheme: AppBarTheme(
backgroundColor: kcPrimaryColor,
foregroundColor: Colors.white,
titleTextStyle: TextStyle(
color: Colors.white,
fontFamily: GoogleFonts.varelaRound().fontFamily,
fontWeight: FontWeight.bold,
fontSize: 18)),
brightness: Brightness.dark,
colorSchemeSeed: kcPrimaryColor,
);
}
41 changes: 6 additions & 35 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import 'package:dionniebee/app/constants/theme-default.dart';
import 'package:dionniebee/app/helpers/lifecycle_manager/lifecycle_manager.dart';
import 'package:dionniebee/ui/common/colors.dart';
import 'package:dionniebee/ui/widgets/loader_manager/loader_manager.dart';
import 'package:dionniebee/ui/widgets/toast_manager/toast_manager.dart';
import 'package:dionniebee/services/loader_overlay_contextless/loader_manager.dart';
import 'package:dionniebee/services/fluttertoast_contextless/fluttertoast_manager.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
Expand Down Expand Up @@ -46,7 +47,7 @@ class MainApp extends StatelessWidget {
initialEntries: [
if (child != null) ...[
OverlayEntry(
builder: (context) => ToastManager(child: child),
builder: (context) => FlutterToastManager(child: child),
),
],
],
Expand All @@ -55,38 +56,8 @@ class MainApp extends StatelessWidget {
scrollBehavior: AppScrollBehavior(),
debugShowCheckedModeBanner: false,
themeMode: ThemeMode.light,
theme: ThemeData(
fontFamily: GoogleFonts.varelaRound().fontFamily,
useMaterial3: false,
appBarTheme: AppBarTheme(
backgroundColor: kcPrimaryColor,
foregroundColor: Colors.white,
titleTextStyle: TextStyle(
color: Colors.white,
fontFamily: GoogleFonts.varelaRound().fontFamily,
fontWeight: FontWeight.bold,
fontSize: 18)),
brightness: Brightness.light,
textTheme:
GoogleFonts.varelaRoundTextTheme(Theme.of(context).textTheme),
colorSchemeSeed: kcPrimaryColor,
),
darkTheme: ThemeData(
fontFamily: GoogleFonts.varelaRound().fontFamily,
useMaterial3: false,
appBarTheme: AppBarTheme(
backgroundColor: kcPrimaryColor,
foregroundColor: Colors.white,
titleTextStyle: TextStyle(
color: Colors.white,
fontFamily: GoogleFonts.varelaRound().fontFamily,
fontWeight: FontWeight.bold,
fontSize: 18)),
brightness: Brightness.dark,
textTheme:
GoogleFonts.varelaRoundTextTheme(Theme.of(context).textTheme),
colorSchemeSeed: kcPrimaryColor,
),
theme: AppTheme.lightTheme,
darkTheme: AppTheme.darkTheme,
routerDelegate: stackedRouter.delegate(),
routeInformationParser: stackedRouter.defaultRouteParser(),
),
Expand Down
Empty file.
88 changes: 88 additions & 0 deletions lib/services/fluttertoast_contextless/fluttertoast_manager.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
import 'package:dionniebee/app/app.locator.dart';
import 'package:dionniebee/services/fluttertoast_contextless/fluttertoast_service.dart';
import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart';

class FlutterToastManager extends StatefulWidget {
final Widget child;
const FlutterToastManager({super.key, required this.child});

@override
State<FlutterToastManager> createState() => _FlutterToastManagerState();
}

class _FlutterToastManagerState extends State<FlutterToastManager> {
final FlutterToastService _toastService = locator<FlutterToastService>();
late FToast fToast;

@override
void initState() {
fToast = FToast();
fToast.init(context);

showToast(String? message) {
fToast.showToast(
child: Container(
padding:
const EdgeInsets.symmetric(horizontal: 24.0, vertical: 12.0),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(25.0),
color: Colors.black.withOpacity(0.8),
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
const Icon(Icons.check, color: Colors.white),
const SizedBox(
width: 12.0,
),
Text(
message.toString(),
style: const TextStyle(color: Colors.white),
),
],
),
),
fadeDuration: const Duration(milliseconds: 500),
gravity: ToastGravity.BOTTOM,
toastDuration: const Duration(seconds: 2));
}

welcomeToast() {
fToast.showToast(
child: Container(
padding:
const EdgeInsets.symmetric(horizontal: 24.0, vertical: 12.0),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(25.0),
color: Colors.black.withOpacity(0.8),
),
child: const Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(Icons.check, color: Colors.white),
SizedBox(
width: 12.0,
),
Text(
"Welcome",
style: TextStyle(color: Colors.white),
),
],
),
),
fadeDuration: const Duration(milliseconds: 500),
gravity: ToastGravity.BOTTOM,
toastDuration: const Duration(seconds: 2));
}

_toastService.welcomeToast = welcomeToast;
_toastService.showToast = showToast;
super.initState();
}

@override
Widget build(BuildContext context) {
return widget.child;
}
}
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
import 'package:dionniebee/services/loader_service.dart';

enum ToastType {
welcome,
}

typedef ToastBuilder = Function();

class ToastService {
class FlutterToastService {
var _toastCustomBuilders = <ToastType, ToastBuilder>{};

ToastBuilder? welcomeToast;
Function(String? message)? showToast;
Map<ToastType, ToastBuilder> _toastBuilders = <ToastType, ToastBuilder>{};

void registerCustomToastBuilders(Map<ToastType, ToastBuilder> builders) {
_toastBuilders = builders;
_toastCustomBuilders = builders;
}

show(String message) {
return showToast != null ? showToast!(message) : null;
}

welcome(ToastType type) {
return _toastCustomBuilders[ToastType.welcome]?.call();
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:dionniebee/app/app.locator.dart';
import 'package:dionniebee/services/loader_service.dart';
import 'package:dionniebee/services/loader_overlay_contextless/loader_service.dart';
import 'package:flutter/material.dart';
import 'package:loader_overlay/loader_overlay.dart';

Expand Down Expand Up @@ -28,7 +28,7 @@ class _LoaderManagerState extends State<LoaderManager> {
LoaderType.show: () => showLoader(),
};

_loaderService.hideToast = () => hideLoader();
_loaderService.hideLoader = () => hideLoader();
_loaderService.registerCustomLoaderBuilders(customBuilders);
super.initState();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class LoaderService {
Map<LoaderType, LoaderBuilder> _loaderCustomBuilders =
<LoaderType, LoaderBuilder>{};

LoaderBuilder? hideToast;
LoaderBuilder? hideLoader;

void registerCustomLoaderBuilders(Map<LoaderType, LoaderBuilder> builders) {
_loaderCustomBuilders = builders;
Expand All @@ -17,6 +17,6 @@ class LoaderService {
}

hide() {
return hideToast?.call();
return hideLoader?.call();
}
}
Loading

0 comments on commit 7b2fa41

Please sign in to comment.