Skip to content

Add inline add more tile for gallery permissions#2553

Merged
renefloor merged 3 commits intofeat/design-refreshfrom
feature/improve-gallery-picker-layout
Mar 19, 2026
Merged

Add inline add more tile for gallery permissions#2553
renefloor merged 3 commits intofeat/design-refreshfrom
feature/improve-gallery-picker-layout

Conversation

@renefloor
Copy link
Contributor

@renefloor renefloor commented Mar 19, 2026

Submit a pull request

Fixes FLU-387

CLA

  • I have signed the Stream CLA (required).
  • The code changes follow best practices
  • Code changes are tested (add some information if not applicable)

Description of the pull request

This adds a nice plus button instead of the one in the top row.

Screenshots / Videos

Before After
image image

Summary by CodeRabbit

Release Notes

  • New Features

    • Added support for custom "add more" tiles in the photo gallery interface to improve the limited-permission flow.
  • Improvements

    • Simplified attachment picker components by removing header customization parameters.
  • Localization

    • Updated "Add more files" label to "Add more" across all supported languages for consistency.
  • Tests

    • Added widget tests for photo gallery grid view functionality.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 19, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e719f8ab-c9c9-43b9-988e-aa3a6af8e443

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/improve-gallery-picker-layout
📝 Coding Plan
  • Generate coding plan for human review comments

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link

codecov bot commented Mar 19, 2026

Codecov Report

❌ Patch coverage is 24.32432% with 28 lines in your changes missing coverage. Please review.
✅ Project coverage is 64.67%. Comparing base (a0e886b) to head (7d79322).
⚠️ Report is 1 commits behind head on feat/design-refresh.

Files with missing lines Patch % Lines
...tachment_picker/options/stream_gallery_picker.dart 0.00% 27 Missing ⚠️
...croll_view/photo_gallery/stream_photo_gallery.dart 0.00% 1 Missing ⚠️
Additional details and impacted files
@@                   Coverage Diff                   @@
##           feat/design-refresh    #2553      +/-   ##
=======================================================
+ Coverage                64.56%   64.67%   +0.10%     
=======================================================
  Files                      426      426              
  Lines                    26126    26138      +12     
=======================================================
+ Hits                     16869    16905      +36     
+ Misses                    9257     9233      -24     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@renefloor renefloor force-pushed the feature/improve-gallery-picker-layout branch from cbc65f8 to 821e209 Compare March 19, 2026 14:14
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/stream_chat_flutter/lib/src/message_input/attachment_picker/stream_attachment_picker.dart (1)

279-325: ⚠️ Potential issue | 🟠 Major

Unused constructor parameters: color, elevation, clipBehavior, and shape.

The OptionDrawer constructor still accepts color, elevation, clipBehavior, and shape parameters, but the build method no longer uses them—it only renders a Container with margin and child.

This appears to be an incomplete refactor. The parameters should either be:

  1. Removed if they're no longer needed, or
  2. Used in the build method (e.g., wrapped in a Material or Card widget).

Based on the context snippets, no current callers use these parameters, so removing them would be the cleaner approach.

🔧 Proposed fix: Remove unused parameters
 class OptionDrawer extends StatelessWidget {
   /// Creates a widget that will be shown in the attachment picker.
   const OptionDrawer({
     super.key,
     required this.child,
-    this.color,
-    this.elevation = 2,
     this.margin,
-    this.clipBehavior = Clip.hardEdge,
-    this.shape = _kDefaultOptionDrawerShape,
   });

   /// The widget below this widget in the tree.
   final Widget child;

-  /// The background color of the options card.
-  ///
-  /// Defaults to [StreamColorTheme.barsBg].
-  final Color? color;
-
-  /// The elevation of the options card.
-  ///
-  /// The default value is 2.
-  final double elevation;
-
   /// The margin of the options card.
   final EdgeInsetsGeometry? margin;

-  /// The clip behavior of the options card.
-  ///
-  /// The default value is [Clip.hardEdge].
-  final Clip clipBehavior;
-
-  /// The shape of the options card.
-  final ShapeBorder shape;
-
   `@override`
   Widget build(BuildContext context) {

Additionally, consider whether the _kDefaultOptionDrawerShape constant (lines 270-275) is still needed if it's no longer referenced.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@packages/stream_chat_flutter/lib/src/message_input/attachment_picker/stream_attachment_picker.dart`
around lines 279 - 325, The OptionDrawer constructor exposes unused parameters
(color, elevation, clipBehavior, shape) and references
_kDefaultOptionDrawerShape, but build() only uses margin and child; remove the
unused constructor fields and their assignments (color, elevation, clipBehavior,
shape) and delete _kDefaultOptionDrawerShape if no other code references it,
leaving OptionDrawer with only key, child, margin and the used defaults;
alternatively, if you prefer to preserve the visual card behavior, wrap the
returned Container in a Material/Card and wire the existing fields into that
widget (use elevation, color, clipBehavior, and shape) — pick one approach and
apply it consistently in the OptionDrawer class and its constructor.
🧹 Nitpick comments (2)
packages/stream_chat_flutter/lib/src/message_input/attachment_picker/options/stream_gallery_picker.dart (1)

158-199: Consider using Material.color for background styling instead of overlayColor.

The _AddMoreTile implementation is functionally correct. However, the overlayColor resolver returns colorScheme.backgroundSurfaceCard in the default state (line 176), which isn't the typical usage pattern for overlayColor (intended for splash/highlight effects, not backgrounds).

If a background color is needed, consider setting it on the Material widget's color property instead:

♻️ Optional: Use Material.color for background
     return Material(
+      color: colorScheme.backgroundSurfaceCard,
       child: InkWell(
         onTap: onTap,
         overlayColor: WidgetStateProperty.resolveWith((states) {
           if (states.contains(WidgetState.pressed)) return colorScheme.statePressed;
           if (states.contains(WidgetState.hovered)) return colorScheme.stateHover;
           if (states.contains(WidgetState.focused)) return colorScheme.stateFocused;
-          return colorScheme.backgroundSurfaceCard;
+          return null;
         }),
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@packages/stream_chat_flutter/lib/src/message_input/attachment_picker/options/stream_gallery_picker.dart`
around lines 158 - 199, The overlayColor resolver in _AddMoreTile is being used
to provide a default background (colorScheme.backgroundSurfaceCard) which is not
idiomatic; instead set the background on the Material widget via its color
property and reserve overlayColor for interactive highlights
(pressed/hovered/focused) only. Update the Material(...) that wraps the InkWell
to pass color: colorScheme.backgroundSurfaceCard, and change the overlayColor
resolver in the InkWell to return only the state-specific colors (or null for
the default case) so overlayColor is not used as the persistent background.
packages/stream_chat_flutter_core/test/paged_value_grid_view_test.dart (1)

39-125: Good test coverage for the core functionality.

The tests effectively verify:

  • Items render starting at index 0 without leading builder
  • Leading item renders before paged items
  • itemBuilder receives correct (non-offset) indices
  • Edge case with a single paged item

Consider adding a test for the load-more indicator behavior with leadingItemBuilder to ensure the indicator still renders at the correct position:

📝 Suggested additional test
testWidgets('renders load-more indicator at correct position with leading item', (tester) async {
  final controller = _TestController(['a', 'b'], nextPageKey: 1);
  final builtIndices = <int>[];

  await tester.pumpWidget(
    _wrap(
      _buildGrid(
        controller,
        leadingItemBuilder: (_) => const Text('leading'),
        builtIndices: builtIndices,
      ),
    ),
  );
  await tester.pump();

  expect(find.text('leading'), findsOneWidget);
  expect(find.text('item-0'), findsOneWidget);
  expect(find.text('item-1'), findsOneWidget);
  expect(find.text('load-more-indicator'), findsOneWidget);
  expect(builtIndices, [0, 1]); // itemBuilder indices should not include leading or load-more
});
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/stream_chat_flutter_core/test/paged_value_grid_view_test.dart`
around lines 39 - 125, Add a new widget test named "renders load-more indicator
at correct position with leading item" that uses _TestController (with
nextPageKey: 1) and _buildGrid with a leadingItemBuilder to assert the leading
Text appears, the paged items 'item-0' and 'item-1' appear, and the
'load-more-indicator' is rendered; also verify the builtIndices list collected
by the itemBuilder equals [0,1] (i.e., itemBuilder indices are not offset by the
leading item or the indicator). Use the same test harness helpers (_wrap,
_buildGrid, _TestController, builtIndices) and follow existing test style
(pumpWidget then pump) to ensure consistent behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In
`@packages/stream_chat_flutter/lib/src/message_input/attachment_picker/stream_attachment_picker.dart`:
- Around line 279-325: The OptionDrawer constructor exposes unused parameters
(color, elevation, clipBehavior, shape) and references
_kDefaultOptionDrawerShape, but build() only uses margin and child; remove the
unused constructor fields and their assignments (color, elevation, clipBehavior,
shape) and delete _kDefaultOptionDrawerShape if no other code references it,
leaving OptionDrawer with only key, child, margin and the used defaults;
alternatively, if you prefer to preserve the visual card behavior, wrap the
returned Container in a Material/Card and wire the existing fields into that
widget (use elevation, color, clipBehavior, and shape) — pick one approach and
apply it consistently in the OptionDrawer class and its constructor.

---

Nitpick comments:
In `@packages/stream_chat_flutter_core/test/paged_value_grid_view_test.dart`:
- Around line 39-125: Add a new widget test named "renders load-more indicator
at correct position with leading item" that uses _TestController (with
nextPageKey: 1) and _buildGrid with a leadingItemBuilder to assert the leading
Text appears, the paged items 'item-0' and 'item-1' appear, and the
'load-more-indicator' is rendered; also verify the builtIndices list collected
by the itemBuilder equals [0,1] (i.e., itemBuilder indices are not offset by the
leading item or the indicator). Use the same test harness helpers (_wrap,
_buildGrid, _TestController, builtIndices) and follow existing test style
(pumpWidget then pump) to ensure consistent behavior.

In
`@packages/stream_chat_flutter/lib/src/message_input/attachment_picker/options/stream_gallery_picker.dart`:
- Around line 158-199: The overlayColor resolver in _AddMoreTile is being used
to provide a default background (colorScheme.backgroundSurfaceCard) which is not
idiomatic; instead set the background on the Material widget via its color
property and reserve overlayColor for interactive highlights
(pressed/hovered/focused) only. Update the Material(...) that wraps the InkWell
to pass color: colorScheme.backgroundSurfaceCard, and change the overlayColor
resolver in the InkWell to return only the state-specific colors (or null for
the default case) so overlayColor is not used as the persistent background.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ba5d54b8-4a08-4752-ad34-31b3be4ab06e

📥 Commits

Reviewing files that changed from the base of the PR and between a0e886b and cbc65f8.

📒 Files selected for processing (18)
  • packages/stream_chat_flutter/lib/src/localization/translations.dart
  • packages/stream_chat_flutter/lib/src/message_input/attachment_picker/options/stream_gallery_picker.dart
  • packages/stream_chat_flutter/lib/src/message_input/attachment_picker/stream_attachment_picker.dart
  • packages/stream_chat_flutter/lib/src/scroll_view/photo_gallery/stream_photo_gallery.dart
  • packages/stream_chat_flutter_core/lib/src/paged_value_scroll_view.dart
  • packages/stream_chat_flutter_core/test/paged_value_grid_view_test.dart
  • packages/stream_chat_localizations/example/lib/add_new_lang.dart
  • packages/stream_chat_localizations/lib/src/stream_chat_localizations_ca.dart
  • packages/stream_chat_localizations/lib/src/stream_chat_localizations_de.dart
  • packages/stream_chat_localizations/lib/src/stream_chat_localizations_en.dart
  • packages/stream_chat_localizations/lib/src/stream_chat_localizations_es.dart
  • packages/stream_chat_localizations/lib/src/stream_chat_localizations_fr.dart
  • packages/stream_chat_localizations/lib/src/stream_chat_localizations_hi.dart
  • packages/stream_chat_localizations/lib/src/stream_chat_localizations_it.dart
  • packages/stream_chat_localizations/lib/src/stream_chat_localizations_ja.dart
  • packages/stream_chat_localizations/lib/src/stream_chat_localizations_ko.dart
  • packages/stream_chat_localizations/lib/src/stream_chat_localizations_no.dart
  • packages/stream_chat_localizations/lib/src/stream_chat_localizations_pt.dart

@renefloor renefloor merged commit 8000c79 into feat/design-refresh Mar 19, 2026
8 of 9 checks passed
@renefloor renefloor deleted the feature/improve-gallery-picker-layout branch March 19, 2026 14:43
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.

2 participants