Skip to content

fix: Robotic arm UI #2776

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

Open
wants to merge 3 commits into
base: flutter
Choose a base branch
from
Open

Conversation

rahul31124
Copy link
Collaborator

@rahul31124 rahul31124 commented Jul 9, 2025

Changes

Improved the responsiveness of the Robotic Arm UI
robotic_arm_.webm

Checklist:

  • No hard coding: I have used resources from strings.xml, dimens.xml and colors.xml without hard coding any value.
  • No end of file edits: No modifications done at end of resource files strings.xml, dimens.xml or colors.xml.
  • Code reformatting: I have reformatted code and fixed indentation in every file included in this pull request.
  • No extra space: My code does not contain any extra lines or extra spaces than the ones that are necessary.

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:

  • Replace fixed widths, heights and paddings with MediaQuery-based relative sizing across controls, dialogs, summary view, timeline and servo cards
  • Standardize border radii, colors and spacing by using smaller corner radii, unified border styles and updated color schemes
  • Refactor AngleInputTopDialog to include a FocusNode, dynamic positioning and a reusable angle button builder
  • Convert the summary dialog to a scrollable, constrained layout that adapts to different screen sizes
  • Adjust timeline and servo card layouts, icon/text sizes, and scrollbar thickness based on screen dimensions
  • Add new string constants for 'Timeline', 'Frequency' and 'Max Angle'

Copy link

sourcery-ai bot commented Jul 9, 2025

Reviewer's Guide

This 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 widgets

classDiagram
  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
Loading

File-Level Changes

Change Details Files
Responsive sizing using MediaQuery
  • Introduced screenHeight/screenWidth variables
  • Replaced fixed width/height/padding/fontSize/iconSize with proportional calculations
  • Adjusted box and timeline dimensions based on screen metrics
lib/view/widgets/robotic_arm_controls.dart
lib/view/widgets/robotic_arm_dialog.dart
lib/view/widgets/robotic_arm_summary.dart
lib/view/widgets/robotic_arm_timeline.dart
lib/view/widgets/servo_card.dart
lib/view/robotic_arm_screen.dart
Updated UI styling and theming
  • Reduced borderRadius values and switched to black/grey outlines
  • Modified Material elevations and shape details
  • Restyled TextButtons via styleFrom with consistent side, padding, and typography
lib/view/widgets/robotic_arm_controls.dart
lib/view/widgets/robotic_arm_dialog.dart
lib/view/widgets/robotic_arm_summary.dart
lib/view/widgets/robotic_arm_timeline.dart
lib/view/widgets/servo_card.dart
Refactored angle-input dialog
  • Replaced custom container layout with elevated Material wrapper
  • Added FocusNode to auto-focus TextField and manage disposal
  • Extracted _angleButton helper and reorganized controls into a responsive Column
lib/view/widgets/robotic_arm_dialog.dart
Cleanup and import adjustments
  • Removed unused color import
  • Appended new string constants in constants.dart
  • Ensured no end-of-file edits in resource files
lib/view/widgets/robotic_arm_dialog.dart
lib/constants.dart

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @rahul31124 - I've reviewed your changes - here's some feedback:

  • 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.
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>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@rahul31124
Copy link
Collaborator Author

@AsCress @marcnause, could you please test and confirm if the UI has improved?

Copy link

github-actions bot commented Jul 9, 2025

@rahul31124 rahul31124 added Status: Review Required Requested reviews from peers and maintainers Fix Solution to an existing issue in app labels Jul 10, 2025
@marcnause
Copy link
Contributor

@rahul31124 Merging #2779 introduced conflicts with this PR. Could you please have a look and resolve them?

@rahul31124
Copy link
Collaborator Author

Hello @marcnause, I have resolved the conflicts

@marcnause marcnause self-requested a review July 13, 2025 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fix Solution to an existing issue in app Status: Review Required Requested reviews from peers and maintainers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants