-
Notifications
You must be signed in to change notification settings - Fork 34
Marcelo Sanchez - Code challenge for SuperFormula #14
base: master
Are you sure you want to change the base?
Conversation
- Integrate `bloc` for state management to enhance app scalability and maintainability. - Utilize `equatable` to simplify equality comparisons for state objects. - Introduce a new splash screen for a better initial user experience.
- Integrate shimmer library to implement TrSkeleton loading skeleton. - Create TrSkeleton widget to enhance UI loading states with shimmer effects.
- Wrap home_page with BlocProvider to manage state using HomeBloc. - Implement BlocListener for state changes listening and handling in home_page. - Use BlocBuilder for reactive UI updates based on HomeBloc states. - Add HomeBloc to handle the business logic of home_page.
- Implement TabBar with 'All Restaurants' and 'My Favorites' tabs in HomePage.
- Implement a skeleton loader UI component for single restaurant views. - Enhance user experience by providing a visual cue during data loading.
- Decouple TabView logic into distinct widgets for improved maintainability. - Facilitate separate lifecycle management and state handling for each tab.
Integrate oxidized package to handle HTTP responses in YelpRepository with Result type, enhancing error handling and success response processing. This change improves code maintainability and readability by distinctly separating success and error cases.
Ensure null safety in model properties and JSON parsing methods. - Utilize `@JsonKey` to handle custom keys and default values, enhancing data integrity and reducing runtime errors.
- Utilize oxidized Result to handle success and error states in home_bloc.
Implemented a new restaurant detail page with a hero image animation. The page layout has been refactored into smaller widgets for better readability and maintainability. This includes widgets for displaying restaurant information such as name, rating, and status.
…tion - New models and entities are implemented for API calls. - Added a new repository and API to fetch restaurant details. - Optimized the loading and management of the favorites list. Additionally, animation is introduced to provide a more organic UI experience for loaded items, and functions related to managing all restaurants and favorite restaurants are distributed across two separate Blocs.
User comments provide valuable feedback and personal experiences for each restaurant. This commit includes the implementation of a comment section within the restaurant review UI, allowing users to read through the opinions and stories shared by others. Additionally, necessary adjustments to the layout were made to accommodate variable-length comments without causing overflow issues.
This commit removes tests that no longer align with our current application structure following recent architectural changes. It also introduces new unit tests to cover the updated models and entities, ensuring our testing suite accurately reflects the application's current state and functionality.
… changes - Updated Google Play Console configurations to align with the latest platform requirements. - Applied and integrated previously stashed changes into the main development branch, ensuring compatibility and functionality with the current app version. - Conducted thorough testing to validate that all features behave as expected post-update and that the integration of stashed changes does not introduce any regression.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your time! 😄
I really like how you split widgets and use const
constructors. I also like how you've written tests and created the widget tree.
I have some comments about some Dart coding choices I'd like you to clarify!
...res/home_page/children/all_restaurant/presenter/bloc/all_restaurant/all_restaurant_bloc.dart
Outdated
Show resolved
Hide resolved
lib/features/home_page/children/all_restaurant/presenter/page/all_restaurants_tab.dart
Show resolved
Hide resolved
lib/features/home_page/children/favorite_restaurants/domain/entities/category_entity.dart
Outdated
Show resolved
Hide resolved
Hi Alberto! :D Thank you very much for the feedback. I have already
replied to some of your questions, and addressed some comments you
left.
Hope you are having a nice weekend.
Cheers!
El vie, 1 mar 2024 a las 16:29, Alberto Miola
***@***.***>) escribió:
…
@alberto-sf commented on this pull request.
Thank you for your time! 😄
I really like how you split widgets and use const constructors. I also like how you've written tests and created the widget tree.
I have some comments about some Dart coding choices I'd like you to clarify!
________________________________
In lib/core/app_init.dart:
> @@ -0,0 +1,9 @@
+import 'package:flutter_dotenv/flutter_dotenv.dart';
+import 'package:restaurantour/core/helpers/hive_helper.dart';
+
+class AppInit {
why did you create a class with a single static member instead of just having a top-level function? like
import 'package:flutter_dotenv/flutter_dotenv.dart';
import 'package:restaurantour/core/helpers/hive_helper.dart';
Future<void> initializeApp() async {
await dotenv.load(fileName: ".env");
await HiveHelper().init();
}
________________________________
In lib/core/helpers/dio_helper.dart:
> @@ -0,0 +1,16 @@
+import 'package:dio/dio.dart';
+import 'package:flutter_dotenv/flutter_dotenv.dart';
+
+class DioHelper {
+ static final Dio _dio = Dio(
same question here 🙂 why not just using the equivalent
import 'package:dio/dio.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';
final dio = Dio(
BaseOptions(...)
):
________________________________
In lib/core/models/Failure.dart:
> @@ -0,0 +1,27 @@
+import 'package:equatable/equatable.dart';
+
+abstract class Failure extends Equatable {
this could have been a sealed class
________________________________
In lib/features/home_page/children/all_restaurant/presenter/bloc/all_restaurant/all_restaurant_bloc.dart:
> + AllRestaurantBloc({required this.hiveHelper, required this.yelpRepository})
+ : super(AllRestaurantInitial()) {
+ on<IniEvent>(_onInitEvent);
+ }
+
+ final HiveHelper hiveHelper;
+ final YelpRepository yelpRepository;
+
+ Future<void> _onInitEvent(
+ IniEvent event,
+ Emitter<AllRestaurantState> emit,
+ ) async {
+ emit(
+ const LoadingState(),
+ );
+ final yelpRepo = yelpRepository;
why not using yelpRepository directly?
________________________________
In lib/features/home_page/children/all_restaurant/presenter/page/all_restaurants_tab.dart:
> + const _Page();
+
+ @OverRide
+ Widget build(BuildContext context) {
+ return BlocListener<AllRestaurantBloc, AllRestaurantState>(
+ listener: (context, state) {
+ if (state is ErrorState) {
+ ScaffoldMessenger.of(context).showSnackBar(
+ const SnackBar(
+ content: Text('Something went wrong, please come back later.'),
+ duration: Duration(seconds: 3),
+ ),
+ );
+ }
+ },
+ child: const _Body(),
very nice 😄 I like when const constructors and reusable widgets are created!
________________________________
In lib/features/home_page/children/favorite_restaurants/domain/entities/category_entity.dart:
> @@ -0,0 +1,9 @@
+class CategoryEntity {
this is ok but with Dart 3 records this could just have been
typedef CategoryEntity = ({String title, String alias})
which also has ==, hash code and to String defined for you (something that your class has not)
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: ***@***.***>
--
Marcelo Sánchez Melgar || Flutter Developer || MEFN Fullstack developer
Ph:+(591) 75293301
|
Hello @MarceKalEl , I'm having an issue running your project,
could you update the readme with instructions on how to run the app? |
sure updating now.
El mié, 6 mar 2024 a las 16:20, Diego Garcia ***@***.***>)
escribió:
… Hello @MarceKalEl <https://github.com/MarceKalEl> , I'm having an issue
running your project,
Error (Xcode): No file or variants found for asset: .env.
could you update the readme with instructions on how to run the app?
—
Reply to this email directly, view it on GitHub
<Superformula/flutter_test#14 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AFOWLSIPAQYCDV4DSGER3EDYW53CXAVCNFSM6AAAAABDM7YMTCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOBRG4YTKNJVGU>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
--
*Marcelo Sánchez Melgar || Flutter Developer || MEFN Fullstack developer*
*Ph:+(591) 75293301*
|
hi @diegog-sf so sorry for the inconvenience, I have just updated the project and updated the readme. Is uploaded already an empty .env file, you will need to add the yelp appkey. If you need to use mine, please let me know. |
Hi all!
Description:
This PR introduces a series of enhancements and structural refinements to our Flutter project, acknowledging the limitations posed by external dependencies and optimizing our architecture and feature set. A key focus has been placed on adhering to Clean Architecture principles, albeit with a tailored approach to suit the already established repository patterns within the project. Below are the key highlights and rationale behind these changes:
Constant JSON Usage: In response to Yelp API's rate limiting, I've opted to utilize a constant JSON for data handling. This approach ensures that our development and testing processes remain uninterrupted by external API constraints, allowing us to simulate a stable data environment.
Clean Architecture Adaptation: While our project's scope and existing repository layout did not necessitate a full-blown Clean Architecture implementation, I've made strides in aligning with its principles where feasible. This adaptation ensures a scalable and maintainable codebase, facilitating easier future enhancements and feature additions.
BLoC and Feature-First Paradigm: The presentation layer has been restructured to leverage the BLoC pattern, emphasizing a feature-first approach. This reorganization enhances readability, maintainability, and the ease of feature scalability, aligning with Flutter's reactive programming model.
Splash Screen Introduction: To improve the user experience and provide a seamless app startup, a splash screen has been implemented. This addition not only enhances the aesthetic appeal but also prepares the app's state and resources in the background, leading to a smoother transition for the user.
Functional Programming with Oxidized: Embracing functional programming concepts, I've integrated Oxidized into the project. This inclusion allows for more expressive and concise code, particularly in handling success and error states, thereby improving overall code quality and readability.
This PR lays the groundwork for a more robust, scalable, and maintainable application, setting a solid foundation for future developments and enhancements. Your feedback and contributions to these changes are highly valued as I continue to refine and expand our project's capabilities.
I am looking forward to your feedback and suggestions on how we can further improve this implementation. Your insights are invaluable to enhancing the project's quality and functionality.
Finally I've added some unit testings and fix some stuff in the app that didn't satisfied my own demands. Now I consider done, some minor stuff might be added yet for sure. like optimizing Imports (I'll try to get a time to do it the next days). Or extracting the hardcoded strings onto a l10n file or package. And for sure, suggestions from your end will be welcome.
Finally I'd like to mention that I have enjoyed developing this small project. Actually I do enjoy doing flutter stuff.
Thanks for taking the time to review this PR. I appreciate the opportunity to present my work to you. I hope you find the project to your liking and look forward to potentially moving to the next stage
Warm regards.
Grabacion.de.pantalla.2024-02-17.a.la.s.23.27.00.mov