fix: Robotic arm UI #2776
Conversation
Reviewer's GuideThis PR overhauls the Robotic Arm UI to use dynamic, screen-relative sizing for improved responsiveness, refines widget styling (borders, radii, paddings, button themes), refactors the angle input dialog for auto-focus and modular helpers, and cleans up unused imports and constants. Class diagram for updated Robotic Arm UI widgetsclassDiagram
class RoboticArmControls {
+build(context)
-screenHeight
-responsive paddings, heights, and widget styling
}
class AngleInputTopDialog {
+build(context)
-_focusNode
-controller
+_angleButton(angle)
+dispose()
+initState()
}
class PlaybackSummaryDialog {
+build(context)
-responsive constraints and paddings
}
class TimelineScrollView {
+build(context)
-boxWidth
-boxHeight
-timeLineHeight
}
class ServoCard {
+build(context)
-sliderSize (responsive)
}
RoboticArmControls --> AngleInputTopDialog : opens
RoboticArmControls --> PlaybackSummaryDialog : opens
RoboticArmControls --> TimelineScrollView : uses
RoboticArmControls --> ServoCard : uses
ServoCard --> RoboticArmStateProvider : uses
TimelineScrollView --> RoboticArmStateProvider : uses
PlaybackSummaryDialog --> RoboticArmStateProvider : uses
AngleInputTopDialog --> RoboticArmStateProvider : uses
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey @rahul31124 - I've reviewed your changes - here's some feedback:
- In TimelineScrollView you reference
screenHeightwithout defining it — addfinal screenHeight = MediaQuery.of(context).size.height;at the top of build to avoid errors. - Extract recurring fractional sizing values (like
screenHeight * 0.026or0.083) into named constants or a helper to reduce magic numbers and improve readability. - You repeat the same border radius, padding, and side styles across multiple widgets — consider centralizing these into shared style constants or theme extensions to enforce consistency.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In TimelineScrollView you reference `screenHeight` without defining it — add `final screenHeight = MediaQuery.of(context).size.height;` at the top of build to avoid errors.
- Extract recurring fractional sizing values (like `screenHeight * 0.026` or `0.083`) into named constants or a helper to reduce magic numbers and improve readability.
- You repeat the same border radius, padding, and side styles across multiple widgets — consider centralizing these into shared style constants or theme extensions to enforce consistency.
## Individual Comments
### Comment 1
<location> `lib/view/widgets/robotic_arm_summary.dart:374` </location>
<code_context>
return Container(
- width: 70,
- padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 8),
+ width: MediaQuery.of(context).size.width * 0.09,
+ padding: const EdgeInsets.symmetric(vertical: 4, horizontal: 2),
decoration: BoxDecoration(
</code_context>
<issue_to_address>
Stat card width now depends on screen width, which may cause layout issues on very small or large screens.
Consider adding min and max width constraints to prevent the cards from becoming unusably small or large on different devices.
Suggested implementation:
```
padding: const EdgeInsets.symmetric(vertical: 4, horizontal: 2),
decoration: BoxDecoration(
```
```
decoration: BoxDecoration(
```
```
),
);
```
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
@AsCress @marcnause, could you please test and confirm if the UI has improved? |
|
Build successful. APKs to test: https://github.com/fossasia/pslab-android/actions/runs/16348276857/artifacts/3555625323 |
|
@rahul31124 Merging #2779 introduced conflicts with this PR. Could you please have a look and resolve them? |
|
Hello @marcnause, I have resolved the conflicts |
Fixes #2711
Changes
Improved the responsiveness of the Robotic Arm UI
robotic_arm_.webm
Checklist:
strings.xml,dimens.xmlandcolors.xmlwithout hard coding any value.strings.xml,dimens.xmlorcolors.xml.Summary by Sourcery
Revamp the Robotic Arm UI for better responsiveness and unified styling across all widgets, replacing hardcoded dimensions and styles with relative sizing, streamlined layouts, and dynamic elements.
Enhancements: