Skip to content

fix: UI for the app bar and optimized filter selection logic#43

Merged
kienvo merged 6 commits intofossasia:mainfrom
Vishveshwara:appbar_fix
Jun 13, 2025
Merged

fix: UI for the app bar and optimized filter selection logic#43
kienvo merged 6 commits intofossasia:mainfrom
Vishveshwara:appbar_fix

Conversation

@Vishveshwara
Copy link
Copy Markdown
Contributor

@Vishveshwara Vishveshwara commented Jun 4, 2025

Updated UI for the Appbar

Fixes #42
Fixes #52

Previous UI:
WhatsApp Image 2025-06-03 at 16 09 36_c132aeab

Updated UI
WhatsApp Image 2025-06-04 at 12 35 02_738fcff6

Summary by Sourcery

Revise the UI of the app bar in the image editor to use a flexibleSpace layout with centered title and action buttons, and update the empty-state prompt in the image list for clearer user guidance.

Enhancements:

  • Revamp ImageEditor AppBar to replace title/actions with a SafeArea flexibleSpace containing a centered header and Import/Open buttons, increase toolbar height, and update typography and button styles.
  • Enhance ImageList empty state message to prompt importing or opening the editor and adjust its font size and weight.

@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai Bot commented Jun 4, 2025

Reviewer's Guide

Refactored the AppBar in ImageEditor to replace the default title/actions with a flexibleSpace-based layout featuring a centered title and two buttons, adjusted toolbar dimensions and styling, and updated the empty-state prompt text and style in the image list widget.

File-Level Changes

Change Details Files
Refactor AppBar layout to use flexibleSpace with custom centered content
  • Removed title and actions properties
  • Set toolbarHeight to 100
  • Added flexibleSpace with SafeArea → Stack → Center → Column structure
  • Moved ‘Select Your Filter’ text and buttons into the new layout
lib/view/image_editor.dart
Adjust text and button styling in the new AppBar layout
  • Increased title fontSize to 20 and weight to w600
  • Added 6px vertical spacing between title and buttons
  • Configured TextButton minimumSize (100×36), padding (14×8), border radius, and fontSize 14 with weight w600
lib/view/image_editor.dart
Update empty-state prompt and typography in image list widget
  • Changed message to include 'open the editor' instruction
  • Reduced fontSize from 16 to 13 and weight from w500 to w400
lib/view/widget/image_list.dart

Possibly linked issues

  • #0: The PR refactors and updates the AppBar layout in the image editor (filter) screen to fix the UI issue shown in the issue.

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

@Vishveshwara
Copy link
Copy Markdown
Contributor Author

@AsCress @kienvo Does this look good? do you guys have any suggestions?

Copy link
Copy Markdown
Contributor

@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 @Vishveshwara - I've reviewed your changes - here's some feedback:

  • Consider extracting the repeated TextButton style into a shared widget or helper method to reduce duplication.
  • Since your flexibleSpace only has a single centered Column, you can simplify the layout by dropping the Stack wrapper.
  • The AppBar uses a hardcoded toolbarHeight of 100; consider using theme-based or responsive sizing to maintain consistency across devices.
Here's what I looked at during the review
  • 🟡 General issues: 2 issues found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Documentation: all looks good

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.

Comment thread lib/view/image_editor.dart Outdated
),
const SizedBox(height: 6),
Row(
mainAxisAlignment: MainAxisAlignment.center,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

suggestion: Duplicate TextButton styles

Extract the shared style into a variable or custom widget to avoid duplication.

Suggested implementation:

        toolbarHeight: 100,
        title: null,
        actions: const [],
        flexibleSpace: SafeArea(
          child: Stack(
            children: [
              Center(
                child: Column(

            // Place this at the top of your widget/class/file, outside of build:
            final ButtonStyle sharedTextButtonStyle = TextButton.styleFrom(
              backgroundColor: Colors.white.withOpacity(0.2),
              foregroundColor: Colors.white,
            );

            // ...then, wherever you use the TextButton:
            padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0),
            child: TextButton(
              style: sharedTextButtonStyle,

  • Replace all other duplicated TextButton.styleFrom(...) usages in this file with sharedTextButtonStyle.
  • If the shared style needs to be accessed in multiple widgets, consider moving it to a separate file or making it a static member of a relevant class.
  • Adjust the placement of the sharedTextButtonStyle variable as needed to ensure it is in scope for all usages.

Comment thread lib/view/widget/image_list.dart Outdated
"Please import an image to continue!",
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w500),
"Please import an image or open the editor to continue!",
style: TextStyle(fontSize: 13, fontWeight: FontWeight.w400),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nitpick (performance): Make TextStyle const

Using const here allows for compile-time optimization since TextStyle is immutable.

@Vishveshwara
Copy link
Copy Markdown
Contributor Author

@Dhruv1797 is this UI good? do you have any suggestions?

@Dhruv1797 Dhruv1797 self-requested a review June 5, 2025 11:08
@Dhruv1797
Copy link
Copy Markdown
Contributor

The app bar is much better now, showing the complete screen name along with the "Import Image" and "Open Editor" buttons. No suggestions from my side right now. Nice work! 👌
@AsCress @kienvo do you guys have any suggestions ? please review it once.

@AsCress AsCress changed the title fix: Fixed UI for the app bar fix: UI for the app bar Jun 5, 2025
Copy link
Copy Markdown
Collaborator

@AsCress AsCress left a comment

Choose a reason for hiding this comment

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

@kienvo Looks good to me.

@kienvo
Copy link
Copy Markdown
Member

kienvo commented Jun 5, 2025

Better use icons.

@Vishveshwara
Copy link
Copy Markdown
Contributor Author

@kienvo @AsCress does this look good?

WhatsApp Image 2025-06-09 at 18 39 48_464f6250
WhatsApp Image 2025-06-09 at 18 39 48_ff8fd505

@Vishveshwara
Copy link
Copy Markdown
Contributor Author

Updated UI @kienvo @Dhruv1797 @AsCress

updated.UI.mp4

@Vishveshwara
Copy link
Copy Markdown
Contributor Author

Vishveshwara commented Jun 11, 2025

Fixes #52
converted image_list.dart to a stateless widget and optimized the selection logic

selection.logic.fix.mp4

@Vishveshwara Vishveshwara changed the title fix: UI for the app bar fix: UI for the app bar and optimized filter selection logic Jun 11, 2025
@kienvo kienvo merged commit 423b36c into fossasia:main Jun 13, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The Image selection is causing rebuilds everytime a different image is selected AppBar UI for the filter screen needs to be fixed

4 participants