-
Notifications
You must be signed in to change notification settings - Fork 130
Project re-editing feature #409
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Project re-editing feature #409
Conversation
WalkthroughThis change introduces a new "Open in Simulator" feature to the project editing interface. It adds corresponding localization strings and translations, updates the simulator view and its viewmodel to accept and handle a specific project, and modifies routing logic to support passing project arguments. UI adjustments and supporting methods are included. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~15–20 minutes Suggested labels
Suggested reviewers
Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
✨ Finishing Touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 3
🧹 Nitpick comments (3)
lib/ui/components/cv_html_editor.dart (1)
55-57: Useconst EdgeInsets.allto avoid unnecessary allocationsThe padding value is immutable. Marking it
constlets the widget tree reuse the sameEdgeInsetsinstance and prevents a minor allocation on every rebuild.- padding: EdgeInsets.all(16.0), + padding: const EdgeInsets.all(16.0),lib/ui/views/projects/edit_project_view.dart (2)
168-182: Improve error handling and use localized strings.The navigation logic is correct, but there are opportunities for improvement:
- The hardcoded strings should use localized messages
- The generic error handling could be more specific
Future<void> _openInSimulator() async { try { // Navigate to simulator with the project for editing final result = await Get.toNamed( SimulatorView.id, arguments: widget.project, ); if (result != null) { - SnackBarUtils.showDark('Simulator', 'Returned from simulator'); + // Consider adding localized success message if needed } } catch (e) { - SnackBarUtils.showDark('Error', 'Failed to open project in simulator'); + SnackBarUtils.showDark( + AppLocalizations.of(context)!.edit_project_error, + 'Failed to open project in simulator', // Consider adding this to localizations + ); } }
194-194: Fix parameter naming convention.The parameter name
Contextshould follow Dart naming conventions and be lowercase.-Widget _buildOpenInSimulatorButton(BuildContext Context) { +Widget _buildOpenInSimulatorButton(BuildContext context) {
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (12)
lib/gen_l10n/app_localizations.dart(1 hunks)lib/gen_l10n/app_localizations_ar.dart(1 hunks)lib/gen_l10n/app_localizations_en.dart(1 hunks)lib/gen_l10n/app_localizations_hi.dart(1 hunks)lib/l10n/app_ar.arb(1 hunks)lib/l10n/app_en.arb(1 hunks)lib/l10n/app_hi.arb(1 hunks)lib/ui/components/cv_html_editor.dart(1 hunks)lib/ui/views/projects/edit_project_view.dart(4 hunks)lib/ui/views/simulator/simulator_view.dart(2 hunks)lib/utils/router.dart(1 hunks)lib/viewmodels/simulator/simulator_viewmodel.dart(4 hunks)
🧰 Additional context used
🧠 Learnings (7)
lib/l10n/app_en.arb (2)
Learnt from: JatsuAkaYashvant
PR: #381
File: lib/gen_l10n/app_localizations_en.dart:766-796
Timestamp: 2025-06-17T13:38:03.098Z
Learning: In Flutter localization, ARB files (like app_en.arb) are the source files that get compiled into generated localization classes (like app_localizations_en.dart). Issues with incorrect language content should be fixed in the source ARB files rather than the generated files.
Learnt from: JatsuAkaYashvant
PR: #381
File: lib/gen_l10n/app_localizations_en.dart:797-811
Timestamp: 2025-06-17T13:37:11.440Z
Learning: When fixing localization issues in Flutter, always fix the source ARB files (like app_en.arb, app_hi.arb) rather than the generated Dart files (like app_localizations_en.dart). The generated localization files are auto-generated from ARB files and any manual changes to them will be overwritten when the localization files are regenerated.
lib/l10n/app_hi.arb (2)
Learnt from: JatsuAkaYashvant
PR: #381
File: lib/gen_l10n/app_localizations_en.dart:797-811
Timestamp: 2025-06-17T13:37:11.440Z
Learning: When fixing localization issues in Flutter, always fix the source ARB files (like app_en.arb, app_hi.arb) rather than the generated Dart files (like app_localizations_en.dart). The generated localization files are auto-generated from ARB files and any manual changes to them will be overwritten when the localization files are regenerated.
Learnt from: JatsuAkaYashvant
PR: #381
File: lib/gen_l10n/app_localizations_en.dart:766-796
Timestamp: 2025-06-17T13:38:03.098Z
Learning: In Flutter localization, ARB files (like app_en.arb) are the source files that get compiled into generated localization classes (like app_localizations_en.dart). Issues with incorrect language content should be fixed in the source ARB files rather than the generated files.
lib/gen_l10n/app_localizations_hi.dart (1)
Learnt from: JatsuAkaYashvant
PR: #381
File: lib/gen_l10n/app_localizations_en.dart:797-811
Timestamp: 2025-06-17T13:37:11.440Z
Learning: When fixing localization issues in Flutter, always fix the source ARB files (like app_en.arb, app_hi.arb) rather than the generated Dart files (like app_localizations_en.dart). The generated localization files are auto-generated from ARB files and any manual changes to them will be overwritten when the localization files are regenerated.
lib/gen_l10n/app_localizations_en.dart (1)
Learnt from: JatsuAkaYashvant
PR: #381
File: lib/gen_l10n/app_localizations_en.dart:797-811
Timestamp: 2025-06-17T13:37:11.440Z
Learning: When fixing localization issues in Flutter, always fix the source ARB files (like app_en.arb, app_hi.arb) rather than the generated Dart files (like app_localizations_en.dart). The generated localization files are auto-generated from ARB files and any manual changes to them will be overwritten when the localization files are regenerated.
lib/l10n/app_ar.arb (2)
Learnt from: JatsuAkaYashvant
PR: #381
File: lib/gen_l10n/app_localizations_en.dart:766-796
Timestamp: 2025-06-17T13:38:03.098Z
Learning: In Flutter localization, ARB files (like app_en.arb) are the source files that get compiled into generated localization classes (like app_localizations_en.dart). Issues with incorrect language content should be fixed in the source ARB files rather than the generated files.
Learnt from: JatsuAkaYashvant
PR: #381
File: lib/gen_l10n/app_localizations_en.dart:797-811
Timestamp: 2025-06-17T13:37:11.440Z
Learning: When fixing localization issues in Flutter, always fix the source ARB files (like app_en.arb, app_hi.arb) rather than the generated Dart files (like app_localizations_en.dart). The generated localization files are auto-generated from ARB files and any manual changes to them will be overwritten when the localization files are regenerated.
lib/gen_l10n/app_localizations_ar.dart (2)
Learnt from: JatsuAkaYashvant
PR: #381
File: lib/gen_l10n/app_localizations_en.dart:797-811
Timestamp: 2025-06-17T13:37:11.440Z
Learning: When fixing localization issues in Flutter, always fix the source ARB files (like app_en.arb, app_hi.arb) rather than the generated Dart files (like app_localizations_en.dart). The generated localization files are auto-generated from ARB files and any manual changes to them will be overwritten when the localization files are regenerated.
Learnt from: JatsuAkaYashvant
PR: #381
File: lib/gen_l10n/app_localizations_en.dart:766-796
Timestamp: 2025-06-17T13:38:03.098Z
Learning: In Flutter localization, ARB files (like app_en.arb) are the source files that get compiled into generated localization classes (like app_localizations_en.dart). Issues with incorrect language content should be fixed in the source ARB files rather than the generated files.
lib/gen_l10n/app_localizations.dart (1)
Learnt from: JatsuAkaYashvant
PR: #381
File: lib/gen_l10n/app_localizations_en.dart:797-811
Timestamp: 2025-06-17T13:37:11.440Z
Learning: When fixing localization issues in Flutter, always fix the source ARB files (like app_en.arb, app_hi.arb) rather than the generated Dart files (like app_localizations_en.dart). The generated localization files are auto-generated from ARB files and any manual changes to them will be overwritten when the localization files are regenerated.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: build (ubuntu-latest)
- GitHub Check: build (macos-latest)
- GitHub Check: build (windows-latest)
🔇 Additional comments (20)
lib/l10n/app_hi.arb (1)
373-376: Hindi translation addition looks goodThe new key
"edit_open_in_simulator"and its translation are correctly added in the source ARB file.
No further action needed.lib/gen_l10n/app_localizations_hi.dart (1)
1072-1074: ARB Source File Updated Correctly
- Verified that the key
"edit_open_in_simulator": "सिम्युलेटर में खोलें"exists inlib/l10n/app_hi.arb.- The generated getter in
lib/gen_l10n/app_localizations_hi.dartaccurately reflects the ARB entry.- The Hindi translation “सिम्युलेटर में खोलें” is appropriate.
No further changes are needed.
lib/l10n/app_ar.arb (1)
378-378: LGTM! Proper localization workflow followed.The Arabic translation "فتح في محاكي" (Open in Simulator) is accurate and follows the correct localization workflow by updating the source ARB file rather than the generated localization classes. The JSON formatting is consistent with the rest of the file.
lib/gen_l10n/app_localizations_ar.dart (1)
1056-1058: LGTM - Generated localization addition is correct.The Arabic translation "فتح في محاكي" for "Open in Simulator" looks appropriate. As expected for generated localization files, this change was properly created from the source ARB files.
lib/l10n/app_en.arb (1)
377-377: LGTM - Proper localization key addition.The new localization key "edit_open_in_simulator" with value "Open in Simulator" is correctly added to the ARB source file within the appropriate "@edit_project_view" section. This follows the proper localization workflow.
lib/ui/views/simulator/simulator_view.dart (3)
5-5: LGTM - Appropriate model import.The Project model import is correctly added to support the new project editing functionality.
16-18: LGTM - Safe argument retrieval.The project argument retrieval using nullable casting (
Get.arguments as Project?) is a safe approach that handles cases where no project is passed during navigation.
22-22: LGTM - Proper view model integration.Passing the project to the view model's
onModelReadymethod follows the correct MVVM pattern and enables the simulator to handle project-specific editing scenarios.lib/utils/router.dart (1)
41-45: LGTM - Proper route argument handling.The routing logic correctly extracts the Project argument and passes it through RouteSettings, ensuring the SimulatorView receives the project data via navigation arguments. This implementation is consistent with the existing routing patterns in the file.
lib/ui/views/projects/edit_project_view.dart (3)
12-12: LGTM - Appropriate import addition.The SimulatorView import is correctly added to support the new navigation functionality.
195-202: LGTM - Consistent button implementation.The button widget follows the existing UI patterns and correctly uses the localized string for the title.
227-228: LGTM - Proper UI placement and spacing.The button is well-positioned between the description input and the update button with appropriate spacing.
lib/viewmodels/simulator/simulator_viewmodel.dart (8)
9-9: LGTM!The import of the Project model is necessary for the new project editing functionality.
29-30: LGTM!The private
_projectToEditfield is properly declared and follows Dart naming conventions.
32-37: LGTM!The URL getter correctly handles both general simulator access and project-specific editing. The null check before using the null assertion operator is appropriate, and the URL construction follows REST conventions.
46-49: LGTM!The
setProjectToEditmethod follows proper Flutter state management patterns by updating the field and callingnotifyListeners()to trigger UI updates.
109-109: LGTM!Good catch on fixing the typo from "occured" to "occurred" in the debug print statement.
135-138: LGTM!The enhanced URL matching logic correctly identifies project save/update actions and follows the established pattern of the method.
147-151: LGTM!The modification to
onModelReadycorrectly handles the optional project parameter and maintains existing functionality while adding project editing support.
159-159: LGTM!Proper cleanup of the
_projectToEditfield inonModelDestroyprevents memory leaks and follows good lifecycle management practices.
|
🎉 This PR is included in version 1.2.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
Fixes #410
Description of Changes
This PR introduces several improvements to the project editing workflow and UI components:
1. Simulator Project Editing Integration
SimulatorViewto accept aProjectargumentSimulatorViewModelto handle project-specific URLs2. Rich Text Editor Improvements
CVHtmlEditor3. Edit Project View Enhancements
4. Router Updates
Code Changes
Simulator Integration
Video of working
WhatsApp.Video.2025-07-28.at.17.54.31_804a9fce.mp4
Summary by CodeRabbit
New Features
Localization
UI Improvements