forked from eatvio/eatvio_app
fix: refactor files
This commit is contained in:
254
lib/core/app_router.dart
Normal file
254
lib/core/app_router.dart
Normal file
@@ -0,0 +1,254 @@
|
||||
import 'package:eatvio_app/core/initialization_cubit/initialization_cubit.dart';
|
||||
import 'package:eatvio_app/core/token_storage.dart';
|
||||
import 'package:eatvio_app/features/auth/auth_screen/auth_screen.dart';
|
||||
import 'package:eatvio_app/features/blog_post/presentation/pages/blog_post_screen.dart';
|
||||
import 'package:eatvio_app/features/blog_post_create/presentation/pages/blog_post_create_screen.dart';
|
||||
import 'package:eatvio_app/features/bottom_navigation_bar/presentation/widgets/bottom_navigation_bar_widget.dart';
|
||||
import 'package:eatvio_app/features/calendar/presentation/pages/calendar_screen.dart';
|
||||
import 'package:eatvio_app/features/chat/presentation/pages/chat_screen.dart';
|
||||
import 'package:eatvio_app/features/chat/presentation/pages/chat_select_screen.dart';
|
||||
import 'package:eatvio_app/features/chat/presentation/pages/photo_view_screen.dart';
|
||||
import 'package:eatvio_app/features/complaining/presentation/complaining_screen.dart';
|
||||
import 'package:eatvio_app/features/consultant/become_consultant/presentation/pages/become_consultant_screen.dart';
|
||||
import 'package:eatvio_app/features/consultant/become_consultant/presentation/pages/stepper_become_consultant_screen.dart';
|
||||
import 'package:eatvio_app/features/diary/presentation/pages/diary_screen.dart';
|
||||
import 'package:eatvio_app/features/diets/presentation/pages/about_diet_screen.dart';
|
||||
import 'package:eatvio_app/features/feed/models/diets_pagination_model.dart';
|
||||
import 'package:eatvio_app/features/feed/models/feed_blog_post_model.dart';
|
||||
import 'package:eatvio_app/features/feed/models/recipes_model.dart';
|
||||
import 'package:eatvio_app/features/feed/presentation/pages/feed_screen.dart';
|
||||
import 'package:eatvio_app/features/menu/presentation/pages/menu_screen.dart';
|
||||
import 'package:eatvio_app/features/notifications/presentation/pages/notifications_screen.dart';
|
||||
import 'package:eatvio_app/features/plans/models/plan_pagination_model.dart';
|
||||
import 'package:eatvio_app/features/plans/presentation/pages/about_plan_screen.dart';
|
||||
import 'package:eatvio_app/features/profile/presentation/pages/profile_screen.dart';
|
||||
import 'package:eatvio_app/features/recipes/presentation/pages/about_recipes_screen.dart';
|
||||
import 'package:eatvio_app/features/recipes/presentation/pages/recipe_create_screen.dart';
|
||||
import 'package:eatvio_app/features/recipes/presentation/pages/recipe_edit_screen.dart';
|
||||
import 'package:eatvio_app/features/registration/presentation/pages/registration_screen.dart';
|
||||
import 'package:eatvio_app/features/settings/entities/settings_entity.dart';
|
||||
import 'package:eatvio_app/features/settings/presentation/pages/change_email_screen.dart';
|
||||
import 'package:eatvio_app/features/settings/presentation/pages/change_password_screen.dart';
|
||||
import 'package:eatvio_app/features/settings/presentation/pages/general_info_screen.dart';
|
||||
import 'package:eatvio_app/features/settings/presentation/pages/other_info_screen.dart';
|
||||
import 'package:eatvio_app/features/settings/presentation/pages/physical_activity_screen.dart';
|
||||
import 'package:eatvio_app/features/settings/presentation/pages/physical_form_screen.dart';
|
||||
import 'package:eatvio_app/features/settings/presentation/pages/pressure_screen.dart';
|
||||
import 'package:eatvio_app/features/settings/presentation/pages/settings_screen.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
|
||||
class AppRouter {
|
||||
static GlobalKey<NavigatorState> navigatorKey = GlobalKey<NavigatorState>();
|
||||
|
||||
static GoRouter appRouter = GoRouter(
|
||||
initialLocation: '/auth-screen',
|
||||
navigatorKey: navigatorKey,
|
||||
routes: [
|
||||
GoRoute(
|
||||
path: '/auth-screen',
|
||||
name: 'authScreen',
|
||||
redirect: (context, state) async {
|
||||
if (await TokenStorage.haveTokenInStorage()) {
|
||||
return '/my-profile-screen';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
builder: (context, state) => AuthScreen.builder(context),
|
||||
routes: [
|
||||
GoRoute(
|
||||
path: 'registration-screen',
|
||||
name: 'registrationScreen',
|
||||
builder: (context, state) => const RegistrationScreen(),
|
||||
),
|
||||
],
|
||||
),
|
||||
ShellRoute(
|
||||
builder: (context, state, child) {
|
||||
return BottomNavigationBarWidget(child: child);
|
||||
},
|
||||
routes: [
|
||||
GoRoute(
|
||||
path: '/my-profile-screen',
|
||||
name: 'myProfileScreen',
|
||||
redirect: (context, state) async {
|
||||
await context.read<InitializationCubit>().runInitialization();
|
||||
return null;
|
||||
},
|
||||
builder: (context, state) => ProfileScreen(),
|
||||
),
|
||||
GoRoute(
|
||||
path: '/feed-screen',
|
||||
name: 'feedScreen',
|
||||
builder: (context, state) => FeedScreen(),
|
||||
),
|
||||
GoRoute(
|
||||
path: '/diary-screen',
|
||||
name: 'diaryScreen',
|
||||
builder: (context, state) => DiaryScreen(),
|
||||
),
|
||||
GoRoute(
|
||||
path: '/chat-select-screen',
|
||||
name: 'chatSelectScreen',
|
||||
builder: (context, state) => ChatSelectScreen(),
|
||||
),
|
||||
GoRoute(
|
||||
path: '/notifications-screen',
|
||||
name: 'notificationsScreen',
|
||||
builder: (context, state) => NotificationsScreen(),
|
||||
),
|
||||
GoRoute(
|
||||
path: '/menu-screen',
|
||||
name: 'menuScreen',
|
||||
builder: (context, state) => MenuScreen(),
|
||||
),
|
||||
],
|
||||
),
|
||||
GoRoute(
|
||||
path: '/about-plan-screen',
|
||||
name: 'aboutPlanScreen',
|
||||
builder: (context, state) => AboutPlanScreen(
|
||||
planModel: state.extra as PlanModel,
|
||||
),
|
||||
),
|
||||
GoRoute(
|
||||
path: '/about-recipes-screen',
|
||||
name: 'aboutRecipesScreen',
|
||||
builder: (context, state) => AboutRecipesScreen(
|
||||
recipes: state.extra as Recipes,
|
||||
),
|
||||
),
|
||||
GoRoute(
|
||||
path: '/recipe-create-screen',
|
||||
name: 'recipeCreateScreen',
|
||||
builder: (context, state) => RecipeCreateScreen(),
|
||||
),
|
||||
GoRoute(
|
||||
path: '/recipe-edit-screen',
|
||||
name: 'recipeEditScreen',
|
||||
builder: (context, state) => RecipeEditScreen(
|
||||
recipeID: state.extra as String,
|
||||
),
|
||||
),
|
||||
GoRoute(
|
||||
path: '/profile-screen',
|
||||
name: 'profileScreen',
|
||||
builder: (context, state) => ProfileScreen(
|
||||
author: state.extra as Author,
|
||||
),
|
||||
),
|
||||
GoRoute(
|
||||
path: '/about-diet-screen',
|
||||
name: 'aboutDietScreen',
|
||||
builder: (context, state) {
|
||||
final data = state.extra as Map<String, dynamic>;
|
||||
return AboutDietScreen(
|
||||
diet: data['diet'] as Diet,
|
||||
index: data['index'] as int,
|
||||
navigateToComments: data['navigateToComments'] as bool,
|
||||
);
|
||||
},
|
||||
),
|
||||
GoRoute(
|
||||
path: '/blog-post-create-screen',
|
||||
name: 'blogPostCreateScreen',
|
||||
builder: (context, state) => BlogPostCreateScreen(),
|
||||
),
|
||||
GoRoute(
|
||||
path: '/blog-post-screen',
|
||||
name: 'blogPostScreen',
|
||||
builder: (context, state) => BlogPostScreen(blogPost: state.extra as FeedBlogPostModel),
|
||||
),
|
||||
GoRoute(
|
||||
path: '/chat-screen',
|
||||
name: 'chatScreen',
|
||||
builder: (context, state) => ChatScreen(chatId: state.extra as String),
|
||||
),
|
||||
GoRoute(
|
||||
path: '/settings-screen',
|
||||
name: 'settingsScreen',
|
||||
builder: (context, state) => SettingsScreen(),
|
||||
routes: [
|
||||
GoRoute(
|
||||
path: 'general-info-screen',
|
||||
name: 'generalInfoScreen',
|
||||
builder: (context, state) => GeneralInfoScreen(
|
||||
settingsEntity: state.extra as SettingsEntity,
|
||||
),
|
||||
),
|
||||
GoRoute(
|
||||
path: 'other-info-screen',
|
||||
name: 'otherInfoScreen',
|
||||
builder: (context, state) => OtherInfoScreen(
|
||||
settingsEntity: state.extra as SettingsEntity,
|
||||
),
|
||||
),
|
||||
GoRoute(
|
||||
path: 'physical-activity-screen',
|
||||
name: 'physicalActivityScreen',
|
||||
builder: (context, state) => PhysicalActivityScreen(
|
||||
settingsEntity: state.extra as SettingsEntity,
|
||||
),
|
||||
),
|
||||
GoRoute(
|
||||
path: 'physical-form-screen',
|
||||
name: 'physicalFormScreen',
|
||||
builder: (context, state) => PhysicalFormScreen(
|
||||
settingsEntity: state.extra as SettingsEntity,
|
||||
),
|
||||
),
|
||||
GoRoute(
|
||||
path: 'pressure-screen',
|
||||
name: 'pressureScreen',
|
||||
builder: (context, state) => PressureScreen(
|
||||
settingsEntity: state.extra as SettingsEntity,
|
||||
),
|
||||
),
|
||||
GoRoute(
|
||||
path: 'change-password-screen',
|
||||
name: 'changePasswordScreen',
|
||||
builder: (context, state) => ChangePasswordScreen(
|
||||
settingsEntity: state.extra as SettingsEntity,
|
||||
),
|
||||
),
|
||||
GoRoute(
|
||||
path: 'change-email-screen',
|
||||
name: 'changeEmailScreen',
|
||||
builder: (context, state) => ChangeEmailScreen(
|
||||
settingsEntity: state.extra as SettingsEntity,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
GoRoute(
|
||||
path: '/become-consultant-screen',
|
||||
name: 'becomeConsultantScreen',
|
||||
builder: (context, state) => BecomeConsultantScreen(),
|
||||
),
|
||||
GoRoute(
|
||||
path: '/stepper-become-consultant-screen',
|
||||
name: 'stepperBecomeConsultantScreen',
|
||||
builder: (context, state) => StepperBecomeConsultantScreen(),
|
||||
),
|
||||
GoRoute(
|
||||
path: '/calendar-screen',
|
||||
name: 'calendarScreen',
|
||||
builder: (context, state) => CalendarScreen(),
|
||||
),
|
||||
GoRoute(
|
||||
path: '/photo-view-screen/:index',
|
||||
name: 'photoViewScreen',
|
||||
builder: (context, state) => PhotoViewScreen(
|
||||
imageUrls: state.extra as List<String>,
|
||||
index: int.parse(state.pathParameters['index']!),
|
||||
),
|
||||
),
|
||||
GoRoute(
|
||||
path: '/complaining-screen',
|
||||
name: 'complainingScreen',
|
||||
builder: (context, state) => ComplainingScreen(),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
@@ -5,7 +5,7 @@ import 'package:eatvio_app/core/token_storage.dart';
|
||||
import 'package:eatvio_app/features/bottom_navigation_bar/presentation/bloc/new_messages_cubit/new_messages_cubit.dart';
|
||||
import 'package:eatvio_app/features/bottom_navigation_bar/presentation/bloc/notifications_cubit/notifications_cubit.dart';
|
||||
import 'package:eatvio_app/features/chat/repositories/chat_repository.dart';
|
||||
import 'package:eatvio_app/locator_service.dart';
|
||||
import 'package:eatvio_app/core/locator_service.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
class InitializationCubit extends Cubit<InitializationState> {
|
||||
|
||||
120
lib/core/locator_service.dart
Normal file
120
lib/core/locator_service.dart
Normal file
@@ -0,0 +1,120 @@
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:eatvio_app/core/const.dart';
|
||||
import 'package:eatvio_app/core/data/diet/repositories/diet_repository.dart';
|
||||
import 'package:eatvio_app/core/data/diet/services/diet_service.dart';
|
||||
import 'package:eatvio_app/core/initialization_cubit/initialization_cubit.dart';
|
||||
import 'package:eatvio_app/features/blog_post_create/bloc/blog_post_create_cubit/blog_post_create_cubit.dart';
|
||||
import 'package:eatvio_app/features/blog_post_create/repositories/blog_post_repository.dart';
|
||||
import 'package:eatvio_app/features/blog_post_create/services/blog_post_service.dart';
|
||||
import 'package:eatvio_app/features/bottom_navigation_bar/presentation/bloc/new_messages_cubit/new_messages_cubit.dart';
|
||||
import 'package:eatvio_app/features/bottom_navigation_bar/presentation/bloc/notifications_cubit/notifications_cubit.dart';
|
||||
import 'package:eatvio_app/features/bottom_navigation_bar/presentation/bloc/profile_avatar_cubit/profile_avatar_cubit.dart';
|
||||
import 'package:eatvio_app/features/calendar/presentation/bloc/calendar_cubit.dart';
|
||||
import 'package:eatvio_app/features/calendar/repositories/calendar_repository.dart';
|
||||
import 'package:eatvio_app/features/calendar/services/calendar_service.dart';
|
||||
import 'package:eatvio_app/features/chat/presentation/bloc/chat_room_cubit/chat_room_cubit.dart';
|
||||
import 'package:eatvio_app/features/chat/presentation/bloc/chat_select_cubit/chat_select_cubit.dart';
|
||||
import 'package:eatvio_app/features/chat/repositories/chat_repository.dart';
|
||||
import 'package:eatvio_app/features/chat/services/chat_service.dart';
|
||||
import 'package:eatvio_app/features/consultant/become_consultant/presentation/bloc/register_consultant_cubit/register_consultant_cubit.dart';
|
||||
import 'package:eatvio_app/features/consultant/become_consultant/repositories/consultant_repository.dart';
|
||||
import 'package:eatvio_app/features/consultant/become_consultant/services/consultant_service.dart';
|
||||
import 'package:eatvio_app/features/diary/presentation/bloc/diary_cubit.dart';
|
||||
import 'package:eatvio_app/features/diary/repositories/diary_repository.dart';
|
||||
import 'package:eatvio_app/features/diary/services/diary_service.dart';
|
||||
import 'package:eatvio_app/features/diets/presentation/bloc/about_diet_cubit.dart';
|
||||
import 'package:eatvio_app/features/feed/presentation/bloc/comments_cubit/comments_cubit.dart';
|
||||
import 'package:eatvio_app/features/feed/presentation/bloc/diets_cubit/diets_cubit.dart';
|
||||
import 'package:eatvio_app/features/feed/presentation/bloc/feed_cubit/feed_cubit.dart';
|
||||
import 'package:eatvio_app/features/feed/presentation/bloc/recipes_cubit/recipes_cubit.dart';
|
||||
import 'package:eatvio_app/features/feed/repositories/feed_repository.dart';
|
||||
import 'package:eatvio_app/features/feed/services/feed_service.dart';
|
||||
import 'package:eatvio_app/features/glossary/repositories/glossary_repository.dart';
|
||||
import 'package:eatvio_app/features/glossary/services/glossary_service.dart';
|
||||
import 'package:eatvio_app/features/plans/presentation/bloc/plans_cubit/plans_cubit.dart';
|
||||
import 'package:eatvio_app/features/plans/repositories/plans_repository.dart';
|
||||
import 'package:eatvio_app/features/plans/services/plans_service.dart';
|
||||
import 'package:eatvio_app/features/profile/presentation/bloc/profile_cubit/profile_cubit.dart';
|
||||
import 'package:eatvio_app/features/profile/repositories/profile_repository.dart';
|
||||
import 'package:eatvio_app/features/profile/services/profile_service.dart';
|
||||
import 'package:eatvio_app/features/recipes/presentation/bloc/recipe_create_cubit.dart';
|
||||
import 'package:eatvio_app/features/recipes/reporitories/recipe_repository.dart';
|
||||
import 'package:eatvio_app/features/recipes/services/recipe_service.dart';
|
||||
import 'package:eatvio_app/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart';
|
||||
import 'package:eatvio_app/features/registration/repositories/registration_repository.dart';
|
||||
import 'package:eatvio_app/features/registration/services/registration_service.dart';
|
||||
import 'package:eatvio_app/features/settings/presentation/bloc/settings_cubit/settings_cubit.dart';
|
||||
import 'package:eatvio_app/features/settings/repositories/service_repository.dart';
|
||||
import 'package:eatvio_app/features/settings/services/settings_service.dart';
|
||||
import 'package:get_it/get_it.dart';
|
||||
|
||||
final sl = GetIt.instance;
|
||||
|
||||
Future<void> init() async {
|
||||
// Cubit singletons
|
||||
sl.registerLazySingleton<InitializationCubit>(() => InitializationCubit(chatRepository: sl()));
|
||||
sl.registerLazySingleton<NewMessagesCubit>(() => NewMessagesCubit());
|
||||
sl.registerLazySingleton<NotificationsCubit>(() => NotificationsCubit());
|
||||
|
||||
// Cubit factories
|
||||
sl.registerFactory<RegistrationCubit>(() => RegistrationCubit(registrationRepository: sl()));
|
||||
sl.registerFactory<ChatRoomCubit>(() => ChatRoomCubit(chatRepository: sl(), initializationCubit: sl()));
|
||||
sl.registerFactory<FeedCubit>(() => FeedCubit(feedRepository: sl()));
|
||||
sl.registerFactory<RecipesCubit>(() => RecipesCubit(feedRepository: sl(), recipeRepository: sl()));
|
||||
sl.registerFactory<CalendarCubit>(() => CalendarCubit(calendarRepository: sl()));
|
||||
sl.registerFactory<ProfileCubit>(() => ProfileCubit(profileRepository: sl(), chatRepository: sl()));
|
||||
sl.registerFactory<ProfileAvatarCubit>(() => ProfileAvatarCubit(profileRepository: sl()));
|
||||
sl.registerFactory<RecipeCreateCubit>(() => RecipeCreateCubit(recipeRepository: sl()));
|
||||
sl.registerFactory<DietsCubit>(() => DietsCubit(feedRepository: sl(), dietsRepository: sl()));
|
||||
sl.registerFactory<CommentsCubit>(() => CommentsCubit(feedRepository: sl()));
|
||||
sl.registerFactory<ChatSelectCubit>(() => ChatSelectCubit(chatRepository: sl()));
|
||||
sl.registerFactory<PlansCubit>(() => PlansCubit(plansRepository: sl()));
|
||||
sl.registerFactory<SettingsCubit>(() => SettingsCubit(profileRepository: sl(), settingsRepository: sl()));
|
||||
sl.registerFactory<RegisterConsultantCubit>(() => RegisterConsultantCubit(consultantRepository: sl()));
|
||||
sl.registerFactory<DiaryCubit>(() => DiaryCubit(diaryRepository: sl(), glossaryRepository: sl()));
|
||||
sl.registerFactory<AboutDietCubit>(() => AboutDietCubit(dietsRepository: sl()));
|
||||
sl.registerFactory<BlogPostCreateCubit>(() => BlogPostCreateCubit(blogPostRepository: sl()));
|
||||
|
||||
// Repository
|
||||
sl.registerLazySingleton<ChatRepository>(() => ChatRepository(chatService: sl()));
|
||||
sl.registerLazySingleton<FeedRepository>(() => FeedRepository(feedService: sl()));
|
||||
sl.registerLazySingleton<RegistrationRepository>(() => RegistrationRepository(registrationService: sl()));
|
||||
sl.registerLazySingleton<CalendarRepository>(() => CalendarRepository(calendarService: sl()));
|
||||
sl.registerLazySingleton<ProfileRepository>(() => ProfileRepository(profileService: sl()));
|
||||
sl.registerLazySingleton<RecipeRepository>(() => RecipeRepository(recipeService: sl()));
|
||||
sl.registerLazySingleton<PlansRepository>(() => PlansRepository(plansService: sl()));
|
||||
sl.registerLazySingleton<SettingsRepository>(() => SettingsRepository(settingsService: sl()));
|
||||
sl.registerLazySingleton<ConsultantRepository>(() => ConsultantRepository(consultantService: sl()));
|
||||
sl.registerLazySingleton<DiaryRepository>(() => DiaryRepository(diaryService: sl()));
|
||||
sl.registerLazySingleton<GlossaryRepository>(() => GlossaryRepository(glossaryService: sl()));
|
||||
sl.registerLazySingleton<DietRepository>(() => DietRepository(dietsService: sl()));
|
||||
sl.registerLazySingleton<BlogPostRepository>(() => BlogPostRepository(blogPostService: sl()));
|
||||
|
||||
// Services
|
||||
sl.registerLazySingleton<ChatService>(() => ChatService(sl()));
|
||||
sl.registerLazySingleton<FeedService>(() => FeedService(sl()));
|
||||
sl.registerLazySingleton<RegistrationService>(() => RegistrationService(sl()));
|
||||
sl.registerLazySingleton<CalendarService>(() => CalendarService(sl()));
|
||||
sl.registerLazySingleton<ProfileService>(() => ProfileService(sl()));
|
||||
sl.registerLazySingleton<RecipeService>(() => RecipeService(sl()));
|
||||
sl.registerLazySingleton<PlansService>(() => PlansService(sl()));
|
||||
sl.registerLazySingleton<SettingsService>(() => SettingsService(sl()));
|
||||
sl.registerLazySingleton<ConsultantService>(() => ConsultantService(sl()));
|
||||
sl.registerLazySingleton<DiaryService>(() => DiaryService(sl()));
|
||||
sl.registerLazySingleton<GlossaryService>(() => GlossaryService(sl()));
|
||||
sl.registerLazySingleton<DietService>(() => DietService(sl()));
|
||||
sl.registerLazySingleton<BlogPostService>(() => BlogPostService(sl()));
|
||||
|
||||
// External
|
||||
sl.registerLazySingleton(
|
||||
() => Dio(
|
||||
BaseOptions(
|
||||
baseUrl: baseUrl,
|
||||
headers: {
|
||||
'accept': 'application/json',
|
||||
'content-type': 'application/json',
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
144
lib/core/theme/app_decoration.dart
Normal file
144
lib/core/theme/app_decoration.dart
Normal file
@@ -0,0 +1,144 @@
|
||||
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class AppDecoration {
|
||||
// Fill decorations
|
||||
static BoxDecoration get fillOnPrimary => BoxDecoration(
|
||||
color: theme.colorScheme.onPrimary,
|
||||
);
|
||||
|
||||
// Outline decorations
|
||||
static BoxDecoration get outlineBlueA => BoxDecoration(
|
||||
color: theme.colorScheme.onPrimary,
|
||||
border: Border.all(
|
||||
color: appTheme.blueA400,
|
||||
width: 1,
|
||||
),
|
||||
);
|
||||
|
||||
static BoxDecoration get outlinePrimary => BoxDecoration(
|
||||
color: theme.colorScheme.onPrimary,
|
||||
border: Border.all(
|
||||
color: theme.colorScheme.primary,
|
||||
width: 1,
|
||||
),
|
||||
);
|
||||
|
||||
static BoxDecoration get fillDeepOrange => BoxDecoration(
|
||||
color: appTheme.deepOrange900.withOpacity(0.8),
|
||||
);
|
||||
|
||||
static BoxDecoration get fillGray => BoxDecoration(
|
||||
color: appTheme.gray50,
|
||||
);
|
||||
|
||||
static BoxDecoration get fillGray100 => BoxDecoration(
|
||||
color: appTheme.gray100,
|
||||
);
|
||||
|
||||
static BoxDecoration get fillGray60002 => BoxDecoration(
|
||||
color: appTheme.gray60002,
|
||||
);
|
||||
|
||||
static BoxDecoration get fillGreenA => BoxDecoration(
|
||||
color: appTheme.greenA700.withOpacity(0.8),
|
||||
);
|
||||
|
||||
static BoxDecoration get fillPrimary => BoxDecoration(
|
||||
color: theme.colorScheme.primary,
|
||||
);
|
||||
|
||||
static BoxDecoration get fillWhiteA => BoxDecoration(
|
||||
color: appTheme.whiteA700,
|
||||
);
|
||||
|
||||
static BoxDecoration get outlineBlueGray => BoxDecoration(
|
||||
border: Border.all(
|
||||
color: appTheme.black,
|
||||
width: 1,
|
||||
strokeAlign: strokeAlignOutside,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
class BorderRadiusStyle {
|
||||
// Circle borders
|
||||
static BorderRadius get circleBorder8 => BorderRadius.circular(
|
||||
8,
|
||||
);
|
||||
|
||||
// Rounded borders
|
||||
static BorderRadius get roundedBorder1 => BorderRadius.circular(
|
||||
1,
|
||||
);
|
||||
|
||||
// Outline decorations
|
||||
static BoxDecoration get outlineBlack => BoxDecoration(
|
||||
color: appTheme.whiteA700,
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: appTheme.black900.withOpacity(0.15),
|
||||
spreadRadius: 2,
|
||||
blurRadius: 2,
|
||||
offset: Offset(
|
||||
0,
|
||||
2,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
static BoxDecoration get outlineBlueGray => BoxDecoration(
|
||||
border: Border.all(
|
||||
color: appTheme.black,
|
||||
width: 1,
|
||||
strokeAlign: strokeAlignOutside,
|
||||
),
|
||||
);
|
||||
|
||||
// Circle borders
|
||||
static BorderRadius get circleBorder17 => BorderRadius.circular(
|
||||
17,
|
||||
);
|
||||
|
||||
static BorderRadius get circleBorder20 => BorderRadius.circular(
|
||||
20,
|
||||
);
|
||||
|
||||
static BorderRadius get circleBorder62 => BorderRadius.circular(
|
||||
62,
|
||||
);
|
||||
|
||||
// Custom borders
|
||||
static BorderRadius get customBorderBL8 => BorderRadius.only(
|
||||
bottomLeft: Radius.circular(8),
|
||||
);
|
||||
|
||||
static BorderRadius get customBorderTL5 => BorderRadius.vertical(
|
||||
top: Radius.circular(5),
|
||||
);
|
||||
|
||||
static BorderRadius get customBorderTL51 => BorderRadius.only(
|
||||
topLeft: Radius.circular(5),
|
||||
bottomRight: Radius.circular(5),
|
||||
);
|
||||
|
||||
// Rounded borders
|
||||
static BorderRadius get roundedBorder12 => BorderRadius.circular(
|
||||
12,
|
||||
);
|
||||
|
||||
static BorderRadius get roundedBorder5 => BorderRadius.circular(
|
||||
5,
|
||||
);
|
||||
|
||||
static BorderRadius get roundedBorder8 => BorderRadius.circular(
|
||||
8,
|
||||
);
|
||||
}
|
||||
|
||||
double get strokeAlignInside => BorderSide.strokeAlignInside;
|
||||
|
||||
double get strokeAlignCenter => BorderSide.strokeAlignCenter;
|
||||
|
||||
double get strokeAlignOutside => BorderSide.strokeAlignOutside;
|
||||
23
lib/core/theme/custom_button_style.dart
Normal file
23
lib/core/theme/custom_button_style.dart
Normal file
@@ -0,0 +1,23 @@
|
||||
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
/// A class that offers pre-defined button styles for customizing button appearance.
|
||||
class CustomButtonStyles {
|
||||
// Outline button style
|
||||
static ButtonStyle get outlinePrimaryTL15 => OutlinedButton.styleFrom(
|
||||
backgroundColor: appTheme.blueA400,
|
||||
side: BorderSide(
|
||||
color: theme.colorScheme.primary,
|
||||
width: 0,
|
||||
),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(15),
|
||||
),
|
||||
);
|
||||
|
||||
// text button style
|
||||
static ButtonStyle get none => ButtonStyle(
|
||||
backgroundColor: WidgetStateProperty.all<Color>(Colors.transparent),
|
||||
elevation: WidgetStateProperty.all<double>(0),
|
||||
);
|
||||
}
|
||||
228
lib/core/theme/custom_text_style.dart
Normal file
228
lib/core/theme/custom_text_style.dart
Normal file
@@ -0,0 +1,228 @@
|
||||
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
/// A collection of pre-defined text styles for customizing text appearance,
|
||||
/// categorized by different font families and weights.
|
||||
/// Additionally, this class includes extensions on [TextStyle] to easily apply specific font families to text.
|
||||
|
||||
class CustomTextStyles {
|
||||
// Headline style
|
||||
static get headlineSmallMulish => theme.textTheme.headlineSmall!.mulish;
|
||||
|
||||
// Title text style
|
||||
static get titleMediumSegoeUI => theme.textTheme.titleMedium!.segoeUI.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
);
|
||||
|
||||
static get bodyMediumBlack900 => theme.textTheme.bodyMedium!.copyWith(
|
||||
color: appTheme.black900,
|
||||
);
|
||||
|
||||
static get bodyMediumBlack90013 => theme.textTheme.bodyMedium!.copyWith(
|
||||
color: appTheme.black900,
|
||||
fontSize: 13,
|
||||
);
|
||||
|
||||
static get bodyMediumBluegray800 => theme.textTheme.bodyMedium!.copyWith(
|
||||
color: appTheme.black,
|
||||
);
|
||||
|
||||
static get bodyMediumBluegray800_1 => theme.textTheme.bodyMedium!.copyWith(
|
||||
color: appTheme.black,
|
||||
);
|
||||
|
||||
static get bodyMediumBluegray800_2 => theme.textTheme.bodyMedium!.copyWith(
|
||||
color: appTheme.black,
|
||||
);
|
||||
|
||||
static get bodyMediumWhiteA700 => theme.textTheme.bodyMedium!.copyWith(
|
||||
color: appTheme.whiteA700,
|
||||
);
|
||||
|
||||
static get bodySmallMulishBlack900 => theme.textTheme.bodySmall!.mulish.copyWith(
|
||||
color: appTheme.black900,
|
||||
fontSize: 12,
|
||||
);
|
||||
|
||||
static get bodySmallMulishBluegray800 => theme.textTheme.bodySmall!.mulish.copyWith(
|
||||
color: appTheme.black,
|
||||
fontSize: 12,
|
||||
);
|
||||
|
||||
static get bodySmallMulishBluegray80012 => theme.textTheme.bodySmall!.mulish.copyWith(
|
||||
color: appTheme.black,
|
||||
fontSize: 12,
|
||||
);
|
||||
|
||||
static get bodySmallMulishBluegray80012_1 => theme.textTheme.bodySmall!.mulish.copyWith(
|
||||
color: appTheme.black,
|
||||
fontSize: 12,
|
||||
);
|
||||
|
||||
static get bodySmallMulishBluegray900 => theme.textTheme.bodySmall!.mulish.copyWith(
|
||||
color: appTheme.blueGray900,
|
||||
fontSize: 12,
|
||||
);
|
||||
|
||||
static get bodySmallMulishGray600 => theme.textTheme.bodySmall!.mulish.copyWith(
|
||||
color: appTheme.gray600,
|
||||
);
|
||||
|
||||
static get bodySmallMulishPrimary => theme.textTheme.bodySmall!.mulish.copyWith(
|
||||
color: theme.colorScheme.primary,
|
||||
fontSize: 12,
|
||||
);
|
||||
|
||||
static get bodySmallSegoeUIBlack900 => theme.textTheme.bodySmall!.segoeUI.copyWith(
|
||||
color: appTheme.black900,
|
||||
fontSize: 12,
|
||||
);
|
||||
|
||||
// Label text style
|
||||
static get labelLargeGray60003 => theme.textTheme.labelLarge!.copyWith(
|
||||
color: appTheme.gray60003,
|
||||
);
|
||||
|
||||
static get labelLargeWhiteA700 => theme.textTheme.labelLarge!.copyWith(
|
||||
color: appTheme.whiteA700,
|
||||
);
|
||||
|
||||
// Title text style
|
||||
static get titleMedium16 => theme.textTheme.titleMedium!.copyWith(
|
||||
fontSize: 16,
|
||||
);
|
||||
|
||||
static get titleMediumBlack => theme.textTheme.titleMedium!.copyWith(
|
||||
fontSize: 17,
|
||||
fontWeight: FontWeight.w900,
|
||||
);
|
||||
|
||||
static get titleMediumBlack900 => theme.textTheme.titleMedium!.copyWith(
|
||||
color: appTheme.black900,
|
||||
);
|
||||
|
||||
static get titleMediumSemiBold => theme.textTheme.titleMedium!.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
);
|
||||
|
||||
static get titleMediumWhiteA700 => theme.textTheme.titleMedium!.copyWith(
|
||||
color: appTheme.whiteA700,
|
||||
fontWeight: FontWeight.w600,
|
||||
);
|
||||
|
||||
static get titleSmallBlue800 => theme.textTheme.titleSmall!.copyWith(
|
||||
color: appTheme.blue800,
|
||||
fontWeight: FontWeight.w800,
|
||||
);
|
||||
|
||||
static get titleSmallBluegray800 => theme.textTheme.titleSmall!.copyWith(
|
||||
color: appTheme.black,
|
||||
);
|
||||
|
||||
static get titleSmallBluegray800Bold => theme.textTheme.titleSmall!.copyWith(
|
||||
color: appTheme.black,
|
||||
fontWeight: FontWeight.w700,
|
||||
);
|
||||
|
||||
static get titleSmallBluegray800ExtraBold => theme.textTheme.titleSmall!.copyWith(
|
||||
color: appTheme.black,
|
||||
fontWeight: FontWeight.w800,
|
||||
);
|
||||
|
||||
static get titleSmallBold => theme.textTheme.titleSmall!.copyWith(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w700,
|
||||
);
|
||||
|
||||
static get titleSmallGreenA70001 => theme.textTheme.titleSmall!.copyWith(
|
||||
color: appTheme.greenA70001,
|
||||
);
|
||||
|
||||
static get titleSmallGreenA70001ExtraBold => theme.textTheme.titleSmall!.copyWith(
|
||||
color: appTheme.greenA70001,
|
||||
fontWeight: FontWeight.w800,
|
||||
);
|
||||
|
||||
static get titleSmallLightgreen300 => theme.textTheme.titleSmall!.copyWith(
|
||||
color: appTheme.lightGreen300,
|
||||
fontWeight: FontWeight.w800,
|
||||
);
|
||||
|
||||
static get titleSmallRed200 => theme.textTheme.titleSmall!.copyWith(
|
||||
color: appTheme.red200,
|
||||
fontWeight: FontWeight.w800,
|
||||
);
|
||||
|
||||
static get titleSmallSecondaryContainer => theme.textTheme.titleSmall!.copyWith(
|
||||
color: theme.colorScheme.secondaryContainer,
|
||||
fontWeight: FontWeight.w800,
|
||||
);
|
||||
|
||||
static get titleSmallSecondaryContainer_1 => theme.textTheme.titleSmall!.copyWith(
|
||||
color: theme.colorScheme.secondaryContainer,
|
||||
);
|
||||
|
||||
static get titleSmallSegoeUIOnPrimary => theme.textTheme.titleSmall!.segoeUI.copyWith(
|
||||
color: theme.colorScheme.onPrimary,
|
||||
);
|
||||
}
|
||||
|
||||
extension on TextStyle {
|
||||
TextStyle get mulish {
|
||||
return copyWith();
|
||||
}
|
||||
|
||||
TextStyle get segoeUI {
|
||||
return copyWith();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class TextStyles {
|
||||
static const headingXLSemibold = TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w600,
|
||||
height: 1.255,
|
||||
);
|
||||
|
||||
static const textLSemibold = TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w600,
|
||||
height: 1.255,
|
||||
);
|
||||
|
||||
static const textMSemibold = TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
height: 1.255,
|
||||
);
|
||||
|
||||
static const textMMedium = TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
height: 1,
|
||||
);
|
||||
|
||||
static const textMMediumAuto = TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
height: 1.255,
|
||||
);
|
||||
|
||||
static const textSSemibold = TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w600,
|
||||
height: 1.255,
|
||||
);
|
||||
|
||||
static const textSMedium = TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w500,
|
||||
height: 1.255,
|
||||
);
|
||||
|
||||
static const textXSSemibold = TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w500,
|
||||
height: 1.255,
|
||||
);
|
||||
}
|
||||
185
lib/core/theme/theme_helper.dart
Normal file
185
lib/core/theme/theme_helper.dart
Normal file
@@ -0,0 +1,185 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
|
||||
/// Helper class for managing themes and colors.
|
||||
class ThemeHelper {
|
||||
// The current app theme
|
||||
var _appTheme = 'primary';
|
||||
|
||||
// A map of custom color themes supported by the app
|
||||
Map<String, PrimaryColors> _supportedCustomColor = {
|
||||
'primary': PrimaryColors(),
|
||||
};
|
||||
|
||||
// A map of color schemes supported by the app
|
||||
Map<String, ColorScheme> _supportedColorScheme = {
|
||||
'primary': ColorSchemes.primaryColorScheme,
|
||||
};
|
||||
|
||||
/// Returns the primary colors for the current theme.
|
||||
PrimaryColors _getThemeColors() {
|
||||
//throw exception to notify given theme is not found or not generated by the generator
|
||||
if (!_supportedCustomColor.containsKey(_appTheme)) {
|
||||
throw Exception(
|
||||
"$_appTheme is not found.Make sure you have added this theme class in JSON Try running flutter pub run build_runner",
|
||||
);
|
||||
}
|
||||
//return theme from map
|
||||
|
||||
return _supportedCustomColor[_appTheme] ?? PrimaryColors();
|
||||
}
|
||||
|
||||
/// Returns the current theme data.
|
||||
ThemeData _getThemeData() {
|
||||
//throw exception to notify given theme is not found or not generated by the generator
|
||||
if (!_supportedColorScheme.containsKey(_appTheme)) {
|
||||
throw Exception(
|
||||
"$_appTheme is not found.Make sure you have added this theme class in JSON Try running flutter pub run build_runner",
|
||||
);
|
||||
}
|
||||
//return theme from map
|
||||
|
||||
var colorScheme = _supportedColorScheme[_appTheme] ?? ColorSchemes.primaryColorScheme;
|
||||
return ThemeData(
|
||||
textTheme: GoogleFonts.mulishTextTheme(),
|
||||
visualDensity: VisualDensity.standard,
|
||||
colorScheme: colorScheme,
|
||||
scaffoldBackgroundColor: colorScheme.onPrimary,
|
||||
appBarTheme: AppBarTheme(
|
||||
scrolledUnderElevation: 0,
|
||||
elevation: 0,
|
||||
systemOverlayStyle: SystemUiOverlayStyle(
|
||||
statusBarIconBrightness: Brightness.dark,
|
||||
statusBarBrightness: Brightness.light,
|
||||
systemNavigationBarColor: Colors.white,
|
||||
statusBarColor: Colors.white,
|
||||
systemNavigationBarIconBrightness: Brightness.dark,
|
||||
),
|
||||
),
|
||||
outlinedButtonTheme: OutlinedButtonThemeData(
|
||||
style: OutlinedButton.styleFrom(
|
||||
backgroundColor: Colors.transparent,
|
||||
side: BorderSide(
|
||||
color: colorScheme.primary,
|
||||
width: 1,
|
||||
),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
),
|
||||
visualDensity: const VisualDensity(
|
||||
vertical: -4,
|
||||
horizontal: -4,
|
||||
),
|
||||
padding: EdgeInsets.zero,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// Returns the primary colors for the current theme.
|
||||
PrimaryColors themeColor() => _getThemeColors();
|
||||
|
||||
/// Returns the current theme data.
|
||||
ThemeData themeData() => _getThemeData();
|
||||
}
|
||||
|
||||
/// Class containing the supported color schemes.
|
||||
class ColorSchemes {
|
||||
static final primaryColorScheme = ColorScheme.light(
|
||||
// Primary colors
|
||||
primary: Color(0XFF323F4B),
|
||||
|
||||
// On colors(text colors)
|
||||
onPrimary: Color(0XFFFFFFFF),
|
||||
onPrimaryContainer: Color(0XFF0B3F56),
|
||||
);
|
||||
}
|
||||
|
||||
/// Class containing custom colors for a primary theme.
|
||||
class PrimaryColors {
|
||||
// Blue
|
||||
Color get blue400 => Color(0XFF43A6F2);
|
||||
|
||||
Color get blueA400 => Color(0XFF2F80ED);
|
||||
|
||||
// BlueGray
|
||||
Color get blueGray400 => Color(0XFF7B8794);
|
||||
|
||||
Color get black900 => Color(0XFF000000);
|
||||
|
||||
// Blue
|
||||
Color get blue800 => Color(0XFF1F78B4);
|
||||
|
||||
// BlueGray
|
||||
Color get blueGray300 => Color(0XFF9AA5B1);
|
||||
|
||||
Color get black => Color(0XFF323F4B);
|
||||
|
||||
Color get blueGray900 => Color(0XFF2A2F4C);
|
||||
|
||||
// DeepOrange
|
||||
Color get deepOrange900 => Color(0XFF9A4A00);
|
||||
|
||||
// Gray
|
||||
Color get gray100 => Color(0XFFF0F2F5);
|
||||
|
||||
Color get gray200 => Color(0XFFF0F0F0);
|
||||
|
||||
Color get gray400 => Color(0XFFC1C1C1);
|
||||
|
||||
Color get gray40001 => Color(0XFFC8C8C8);
|
||||
|
||||
Color get gray50 => Color(0XFFF6FAFF);
|
||||
|
||||
Color get gray500 => Color(0XFFA3A3A3);
|
||||
|
||||
Color get gray600 => Color(0XFF6D6D6D);
|
||||
|
||||
Color get gray60001 => Color(0XFF848484);
|
||||
|
||||
Color get gray60002 => Color(0XFF757575);
|
||||
|
||||
Color get gray60003 => Color(0XFF707070);
|
||||
|
||||
// Green
|
||||
Color get greenA700 => Color(0XFF019A3E);
|
||||
|
||||
Color get greenA70001 => Color(0XFF00BE13);
|
||||
|
||||
// LightGreen
|
||||
Color get lightGreen300 => Color(0XFFB2DF8A);
|
||||
|
||||
Color get lightGreenA700 => Color(0XFF18FF14);
|
||||
|
||||
// Red
|
||||
Color get red200 => Color(0XFFE3A6A6);
|
||||
|
||||
// Teal
|
||||
Color get teal100 => Color(0XFFA6CEE3);
|
||||
|
||||
Color get teal900 => Color(0XFF0B3F56);
|
||||
|
||||
// White
|
||||
Color get whiteA700 => Color(0XFFFFFFFF);
|
||||
|
||||
Color get backgroundAvatar => Color(0xFFEBF4FF);
|
||||
|
||||
Color get cardBackground => Color(0xFFF7FAFF);
|
||||
|
||||
Color get dividerColor => Color(0xFFF1F2F6);
|
||||
|
||||
Color get gray => Color(0xFF6D6F71);
|
||||
|
||||
Color get lightGray600 => Color(0xFFB0B0B0);
|
||||
|
||||
Color get lightGray => Color(0xFFCECECE);
|
||||
|
||||
Color get transparentBlue => Color(0xFF2F80ED).withOpacity(0.1);
|
||||
|
||||
Color get lightGray0 => Color(0xFFF6F6F6);
|
||||
}
|
||||
|
||||
PrimaryColors get appTheme => ThemeHelper().themeColor();
|
||||
|
||||
ThemeData get theme => ThemeHelper().themeData();
|
||||
@@ -1,5 +1,5 @@
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:eatvio_app/locator_service.dart';
|
||||
import 'package:eatvio_app/core/locator_service.dart';
|
||||
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
||||
|
||||
abstract class TokenStorage {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import 'package:eatvio_app/theme/theme_helper.dart';
|
||||
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
||||
import 'package:fluttertoast/fluttertoast.dart';
|
||||
|
||||
const int _toastDuration = 2;
|
||||
|
||||
41
lib/core/widgets/base_button.dart
Normal file
41
lib/core/widgets/base_button.dart
Normal file
@@ -0,0 +1,41 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class BaseButton extends StatelessWidget {
|
||||
BaseButton({
|
||||
Key? key,
|
||||
required this.text,
|
||||
this.onPressed,
|
||||
this.buttonStyle,
|
||||
this.buttonTextStyle,
|
||||
this.isDisabled,
|
||||
this.height,
|
||||
this.width,
|
||||
this.margin,
|
||||
this.alignment,
|
||||
}) : super(
|
||||
key: key,
|
||||
);
|
||||
|
||||
final String text;
|
||||
|
||||
final VoidCallback? onPressed;
|
||||
|
||||
final ButtonStyle? buttonStyle;
|
||||
|
||||
final TextStyle? buttonTextStyle;
|
||||
|
||||
final bool? isDisabled;
|
||||
|
||||
final double? height;
|
||||
|
||||
final double? width;
|
||||
|
||||
final EdgeInsets? margin;
|
||||
|
||||
final Alignment? alignment;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import 'package:eatvio_app/theme/theme_helper.dart';
|
||||
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class BookmarkButton extends StatelessWidget {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import 'package:eatvio_app/theme/theme_helper.dart';
|
||||
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class BottomSheetHandlerBar extends StatelessWidget {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import 'package:eatvio_app/theme/theme_helper.dart';
|
||||
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class CustomDivider extends StatelessWidget {
|
||||
|
||||
133
lib/core/widgets/custom_drop_down.dart
Normal file
133
lib/core/widgets/custom_drop_down.dart
Normal file
@@ -0,0 +1,133 @@
|
||||
import 'package:eatvio_app/core/data/selectionPopupModel/selection_popup_model.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class CustomDropDown extends StatelessWidget {
|
||||
const CustomDropDown({
|
||||
this.alignment,
|
||||
this.width,
|
||||
this.focusNode,
|
||||
this.icon,
|
||||
this.autofocus = true,
|
||||
this.textStyle,
|
||||
this.items,
|
||||
this.hintText,
|
||||
this.hintStyle,
|
||||
this.prefix,
|
||||
this.prefixConstraints,
|
||||
this.suffix,
|
||||
this.suffixConstraints,
|
||||
this.contentPadding,
|
||||
this.borderDecoration,
|
||||
this.fillColor,
|
||||
this.filled = true,
|
||||
this.validator,
|
||||
this.onChanged,
|
||||
this.value,
|
||||
});
|
||||
|
||||
final Alignment? alignment;
|
||||
final double? width;
|
||||
final FocusNode? focusNode;
|
||||
final Widget? icon;
|
||||
final bool? autofocus;
|
||||
final TextStyle? textStyle;
|
||||
final List<SelectionPopupModel>? items;
|
||||
final String? hintText;
|
||||
final TextStyle? hintStyle;
|
||||
final Widget? prefix;
|
||||
final BoxConstraints? prefixConstraints;
|
||||
final Widget? suffix;
|
||||
final BoxConstraints? suffixConstraints;
|
||||
final EdgeInsets? contentPadding;
|
||||
final InputBorder? borderDecoration;
|
||||
final Color? fillColor;
|
||||
final bool? filled;
|
||||
final SelectionPopupModel? value;
|
||||
final FormFieldValidator<SelectionPopupModel>? validator;
|
||||
final Function(SelectionPopupModel)? onChanged;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return alignment != null
|
||||
? Align(
|
||||
alignment: alignment ?? Alignment.center,
|
||||
child: _buildDropDownWidget(context),
|
||||
)
|
||||
: _buildDropDownWidget(context);
|
||||
}
|
||||
|
||||
_buildDropDownWidget(BuildContext context) {
|
||||
return DropdownButtonFormField<SelectionPopupModel>(
|
||||
focusNode: focusNode ?? FocusNode(),
|
||||
icon: Icon(Icons.keyboard_arrow_down_rounded),
|
||||
autofocus: autofocus!,
|
||||
value: value,
|
||||
isDense: true,
|
||||
isExpanded: true,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
items: items?.map((SelectionPopupModel item) {
|
||||
return DropdownMenuItem<SelectionPopupModel>(
|
||||
value: item,
|
||||
child: Text(
|
||||
item.title,
|
||||
style: hintStyle ??
|
||||
TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: Colors.black,
|
||||
),
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
decoration: _buildInputDecoration(context),
|
||||
validator: validator,
|
||||
onChanged: onDropDownChanged,
|
||||
);
|
||||
}
|
||||
|
||||
void onDropDownChanged(value) {
|
||||
onChanged!(value!);
|
||||
}
|
||||
|
||||
InputDecoration _buildInputDecoration(BuildContext context) {
|
||||
return InputDecoration(
|
||||
labelStyle: TextStyle(
|
||||
fontSize: 16,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
hintText: hintText ?? "",
|
||||
hintStyle: hintStyle ??
|
||||
TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: Colors.grey.shade400,
|
||||
height: 1,
|
||||
),
|
||||
prefixIcon: prefix,
|
||||
prefixIconConstraints: prefixConstraints,
|
||||
suffixIcon: suffix,
|
||||
isDense: true,
|
||||
suffixIconConstraints: suffixConstraints,
|
||||
contentPadding: EdgeInsets.symmetric(vertical: 16, horizontal: 12),
|
||||
fillColor: Color(0xFFF6F6F6),
|
||||
filled: filled,
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: const BorderRadius.all(Radius.circular(20)),
|
||||
borderSide: BorderSide.none,
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: const BorderRadius.all(Radius.circular(20)),
|
||||
borderSide: BorderSide.none,
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: const BorderRadius.all(Radius.circular(20)),
|
||||
borderSide: BorderSide.none,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
116
lib/core/widgets/custom_outlined_button.dart
Normal file
116
lib/core/widgets/custom_outlined_button.dart
Normal file
@@ -0,0 +1,116 @@
|
||||
import 'package:eatvio_app/core/theme/custom_text_style.dart';
|
||||
import 'package:eatvio_app/core/widgets/base_button.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class CustomOutlinedButton extends BaseButton {
|
||||
CustomOutlinedButton({
|
||||
Key? key,
|
||||
this.decoration,
|
||||
this.leftIcon,
|
||||
this.rightIcon,
|
||||
this.label,
|
||||
VoidCallback? onPressed,
|
||||
ButtonStyle? buttonStyle,
|
||||
TextStyle? buttonTextStyle,
|
||||
bool? isDisabled,
|
||||
Alignment? alignment,
|
||||
double? height,
|
||||
double? width,
|
||||
EdgeInsets? margin,
|
||||
required String text,
|
||||
}) : super(
|
||||
text: text,
|
||||
onPressed: onPressed,
|
||||
buttonStyle: buttonStyle,
|
||||
isDisabled: isDisabled,
|
||||
buttonTextStyle: buttonTextStyle,
|
||||
height: height,
|
||||
alignment: alignment,
|
||||
width: width,
|
||||
margin: margin,
|
||||
);
|
||||
|
||||
final BoxDecoration? decoration;
|
||||
final Widget? leftIcon;
|
||||
final Widget? rightIcon;
|
||||
final Widget? label;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (alignment != null) {
|
||||
return Align(
|
||||
alignment: alignment ?? Alignment.center,
|
||||
child: Container(
|
||||
height: this.height ?? 30,
|
||||
width: this.width ?? double.maxFinite,
|
||||
margin: margin,
|
||||
decoration: decoration,
|
||||
child: OutlinedButton(
|
||||
style: buttonStyle!,
|
||||
onPressed: isDisabled ?? false ? null : onPressed ?? () {},
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
leftIcon ?? SizedBox.shrink(),
|
||||
Text(
|
||||
text,
|
||||
style: buttonTextStyle ?? CustomTextStyles.titleSmallBold,
|
||||
),
|
||||
rightIcon ?? SizedBox.shrink(),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
return Container(
|
||||
height: this.height ?? 30,
|
||||
width: this.width ?? double.maxFinite,
|
||||
margin: margin,
|
||||
decoration: decoration,
|
||||
child: OutlinedButton(
|
||||
style: buttonStyle!,
|
||||
onPressed: isDisabled ?? false ? null : onPressed ?? () {},
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
leftIcon ?? SizedBox.shrink(),
|
||||
Text(
|
||||
text,
|
||||
style: buttonTextStyle ?? CustomTextStyles.titleSmallBold,
|
||||
),
|
||||
rightIcon ?? SizedBox.shrink(),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/*_buildAppBarbuildOutlinedButtonWidget() {
|
||||
return Container(
|
||||
height: this.height ?? 30,
|
||||
width: this.width ?? double.maxFinite,
|
||||
margin: margin,
|
||||
decoration: decoration,
|
||||
child: OutlinedButton(
|
||||
style: buttonStyle!,
|
||||
onPressed: isDisabled ?? false ? null : onPressed ?? () {},
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
leftIcon ?? SizedBox.shrink(),
|
||||
Text(
|
||||
text,
|
||||
style: buttonTextStyle ?? CustomTextStyles.titleSmallBold,
|
||||
),
|
||||
rightIcon ?? SizedBox.shrink(),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}*/
|
||||
}
|
||||
138
lib/core/widgets/custom_text_form_field.dart
Normal file
138
lib/core/widgets/custom_text_form_field.dart
Normal file
@@ -0,0 +1,138 @@
|
||||
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
class CustomTextFormField extends StatelessWidget {
|
||||
CustomTextFormField({
|
||||
this.alignment,
|
||||
this.width,
|
||||
this.controller,
|
||||
this.focusNode,
|
||||
this.autofocus = false,
|
||||
this.textStyle,
|
||||
this.obscureText = false,
|
||||
this.textInputAction,
|
||||
this.textInputType,
|
||||
this.maxLines,
|
||||
this.hintText,
|
||||
this.hintStyle,
|
||||
this.prefix,
|
||||
this.prefixConstraints,
|
||||
this.suffix,
|
||||
this.suffixText,
|
||||
this.suffixConstraints,
|
||||
this.contentPadding,
|
||||
this.inputFormatters,
|
||||
this.borderDecoration,
|
||||
this.fillColor,
|
||||
this.filled = true,
|
||||
this.validator,
|
||||
this.keyboardType,
|
||||
this.onFieldSubmitted,
|
||||
this.onSaved,
|
||||
this.initialValue,
|
||||
this.onChanged,
|
||||
this.onEditingComplete,
|
||||
this.minLines = 1,
|
||||
this.maxLength,
|
||||
super.key,
|
||||
});
|
||||
|
||||
final Alignment? alignment;
|
||||
final double? width;
|
||||
final TextEditingController? controller;
|
||||
final FocusNode? focusNode;
|
||||
final bool autofocus;
|
||||
final TextStyle? textStyle;
|
||||
final bool? obscureText;
|
||||
final List<TextInputFormatter>? inputFormatters;
|
||||
final TextInputAction? textInputAction;
|
||||
final TextInputType? textInputType;
|
||||
final int? maxLines;
|
||||
final int minLines;
|
||||
final String? hintText;
|
||||
final TextStyle? hintStyle;
|
||||
final Widget? prefix;
|
||||
final BoxConstraints? prefixConstraints;
|
||||
final Widget? suffix;
|
||||
final String? suffixText;
|
||||
final BoxConstraints? suffixConstraints;
|
||||
final EdgeInsets? contentPadding;
|
||||
final InputBorder? borderDecoration;
|
||||
final Color? fillColor;
|
||||
final bool? filled;
|
||||
final TextInputType? keyboardType;
|
||||
final FormFieldValidator<String>? validator;
|
||||
final String? initialValue;
|
||||
final Function(String)? onFieldSubmitted;
|
||||
final Function()? onEditingComplete;
|
||||
final void Function(String?)? onSaved;
|
||||
final void Function(String)? onChanged;
|
||||
final int? maxLength;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Align(
|
||||
alignment: alignment ?? Alignment.center,
|
||||
child: TextFormField(
|
||||
minLines: minLines,
|
||||
maxLength: maxLength,
|
||||
onChanged: onChanged,
|
||||
controller: controller,
|
||||
focusNode: focusNode ?? null,
|
||||
autofocus: autofocus,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
obscureText: obscureText!,
|
||||
textInputAction: textInputAction,
|
||||
maxLines: maxLines ?? 1,
|
||||
initialValue: initialValue,
|
||||
cursorColor: appTheme.blueA400,
|
||||
decoration: InputDecoration(
|
||||
suffixText: suffixText,
|
||||
hintText: hintText ?? "",
|
||||
hintStyle: TextStyle(
|
||||
fontSize: 16,
|
||||
color: Colors.grey.shade400,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
prefixIcon: prefix,
|
||||
prefixIconConstraints: prefixConstraints,
|
||||
suffixIcon: suffix,
|
||||
suffixStyle: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Color(0xFF323F4B),
|
||||
),
|
||||
suffixIconConstraints: suffixConstraints,
|
||||
isDense: false,
|
||||
contentPadding: EdgeInsets.symmetric(vertical: 16, horizontal: 12),
|
||||
fillColor: Color(0xFFF6F6F6),
|
||||
filled: true,
|
||||
border: borderDecoration ??
|
||||
OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
borderSide: BorderSide.none,
|
||||
),
|
||||
enabledBorder: borderDecoration ??
|
||||
OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
borderSide: BorderSide.none,
|
||||
),
|
||||
focusedBorder: borderDecoration ??
|
||||
OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
borderSide: BorderSide.none,
|
||||
),
|
||||
),
|
||||
keyboardType: keyboardType,
|
||||
validator: validator,
|
||||
onSaved: onSaved,
|
||||
inputFormatters: inputFormatters,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
import 'package:eatvio_app/core/theme/custom_text_style.dart';
|
||||
import 'package:eatvio_app/core/utils/localization_utils.dart';
|
||||
import 'package:eatvio_app/features/diets/presentation/widgets/info_bouble.dart';
|
||||
import 'package:eatvio_app/features/diets/presentation/widgets/type_badges.dart';
|
||||
import 'package:eatvio_app/features/feed/models/diets_pagination_model.dart';
|
||||
import 'package:eatvio_app/generated/l10n.dart';
|
||||
import 'package:eatvio_app/theme/custom_text_style.dart';
|
||||
import 'package:eatvio_app/theme/theme_helper.dart';
|
||||
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import 'package:eatvio_app/theme/custom_text_style.dart';
|
||||
import 'package:eatvio_app/theme/theme_helper.dart';
|
||||
import 'package:eatvio_app/core/theme/custom_text_style.dart';
|
||||
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user