Skip to content

opt.: add a btn to minimize ai dialog#1004

Merged
lollipopkit merged 3 commits intomainfrom
lollipopkit/issue1003
Jan 14, 2026
Merged

opt.: add a btn to minimize ai dialog#1004
lollipopkit merged 3 commits intomainfrom
lollipopkit/issue1003

Conversation

@lollipopkit
Copy link
Copy Markdown
Owner

@lollipopkit lollipopkit commented Jan 14, 2026

Fixes #1003

Summary by CodeRabbit

  • New Features

    • Added minimize/maximize toggle in the AI assistant header so users can collapse the sheet while keeping input accessible.
    • Smooth animated transitions when minimizing or restoring the sheet for a polished experience.
  • Improvements

    • Condensed layout when minimized and full content when expanded for clearer focus.
    • Improved placement of error messages and streaming indicators; toggling unfocuses the input to dismiss the keyboard.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Jan 14, 2026

📝 Walkthrough

Walkthrough

Adds a minimize/maximize toggle to the Ask AI sheet: introduces private _isMinimized, animates sheet height between two factors, adds a toggle IconButton that unfocuses on toggle, and conditionally renders the chat list, input area, and disclaimer based on minimized state.

Changes

Cohort / File(s) Summary
Ask AI Dialog Minimization Feature
lib/view/page/ssh/page/ask_ai.dart
Adds private _isMinimized state; computes heightFactor (0.18 vs 0.85); animates height with TweenAnimationBuilder + FractionallySizedBox; adds minimize/unminimize IconButton (unfocuses on toggle); conditionally renders/omits main chat ListView, input area, and disclaimer; preserves streaming, error, message history, and command handling logic within new branches.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related issues

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'opt.: add a btn to minimize ai dialog' clearly and concisely describes the main change—adding a minimize button to the AI dialog, matching the code changes that introduce _isMinimized state and toggle functionality.
Linked Issues check ✅ Passed The code changes fully implement the objective from issue #1003 by adding minimize button functionality with animated height transitions and state management for the AI dialog.
Out of Scope Changes check ✅ Passed All changes in ask_ai.dart are directly related to implementing the minimize button feature, with no unrelated modifications detected.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch lollipopkit/issue1003


📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6a38fcf and a429beb.

📒 Files selected for processing (1)
  • lib/view/page/ssh/page/ask_ai.dart
🧰 Additional context used
📓 Path-based instructions (1)
lib/view/**/*.dart

📄 CodeRabbit inference engine (CLAUDE.md)

lib/view/**/*.dart: Prefer widgets/utilities from fl_lib for common UI (e.g., CustomAppBar, context.showRoundDialog, Input, Btnx.cancelOk)
Prefer using libL10n strings before adding new ones to project l10n
Split UI into build, actions, and utils; use extension on to separate concerns

Files:

  • lib/view/page/ssh/page/ask_ai.dart
🔇 Additional comments (4)
lib/view/page/ssh/page/ask_ai.dart (4)

87-87: LGTM!

Clean state variable addition for tracking the minimized state.


391-404: Good fix addressing the previous review feedback.

The TweenAnimationBuilder pattern with Tween<double>(end: heightFactor) correctly animates the height transitions. When begin is null, Flutter uses the current animated value as the starting point for subsequent animations, making this work seamlessly for toggle scenarios.


417-426: LGTM!

Good implementation of the minimize toggle:

  • Icons correctly indicate the action (unfold_more to expand, unfold_less to minimize)
  • Dismissing focus before toggling prevents keyboard layout issues
  • Uses libL10n.fold per coding guidelines

431-503: LGTM!

Clean conditional rendering implementation:

  • Spread operator with conditional (if (!_isMinimized) ...[]) cleanly separates the two states
  • Minimized view shows only the header with minimal height
  • Expanded view preserves all existing functionality (conversation, streaming, input, error handling)
  • Uses Btn.icon and Input from fl_lib per coding guidelines

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.


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

Copy link
Copy Markdown
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.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@lib/view/page/ssh/page/ask_ai.dart`:
- Around line 393-399: AnimatedSize is wrapping a FractionallySizedBox with
heightFactor, which won't animate because FractionallySizedBox sizes from parent
constraints rather than intrinsic size; replace the
AnimatedSize+FractionallySizedBox combination by animating the heightFactor
directly (e.g., use TweenAnimationBuilder<double> targeting heightFactor) or
compute an explicit height and use AnimatedContainer; update the widget that
uses AnimatedSize/FractionallySizedBox and heightFactor to either wrap
FractionallySizedBox in a TweenAnimationBuilder<double> that rebuilds with the
animated heightFactor value or replace it with an AnimatedContainer using an
explicit height variable so height transitions animate smoothly.
🧹 Nitpick comments (1)
lib/view/page/ssh/page/ask_ai.dart (1)

412-421: Consider dynamic tooltip based on minimized state.

The tooltip is always libL10n.fold regardless of whether the dialog is minimized or expanded. For better UX, consider using a state-dependent tooltip (e.g., "Expand" when minimized, "Minimize" when expanded).

💡 Suggested improvement
                  IconButton(
                    icon: Icon(_isMinimized ? Icons.unfold_more : Icons.unfold_less),
-                   tooltip: libL10n.fold,
+                   tooltip: _isMinimized ? libL10n.unfold : libL10n.fold,
                    onPressed: () {

Note: This assumes libL10n.unfold exists. If not, you may need to add a new localization string or use an existing alternative.

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d7f3b41 and 6a38fcf.

📒 Files selected for processing (1)
  • lib/view/page/ssh/page/ask_ai.dart
🧰 Additional context used
📓 Path-based instructions (1)
lib/view/**/*.dart

📄 CodeRabbit inference engine (CLAUDE.md)

lib/view/**/*.dart: Prefer widgets/utilities from fl_lib for common UI (e.g., CustomAppBar, context.showRoundDialog, Input, Btnx.cancelOk)
Prefer using libL10n strings before adding new ones to project l10n
Split UI into build, actions, and utils; use extension on to separate concerns

Files:

  • lib/view/page/ssh/page/ask_ai.dart
🔇 Additional comments (3)
lib/view/page/ssh/page/ask_ai.dart (3)

87-87: LGTM!

The _isMinimized state field is correctly declared and initialized.


426-498: LGTM!

The conditional rendering logic correctly shows the full content when expanded and minimal UI when minimized. The collection-if syntax is properly used for conditional widget inclusion.


475-496: LGTM!

The input area properly uses Input from fl_lib as per coding guidelines, handles keyboard insets correctly, and appropriately disables the send button during streaming or when input is empty.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

@lollipopkit lollipopkit merged commit 8589b3b into main Jan 14, 2026
2 checks passed
@lollipopkit lollipopkit deleted the lollipopkit/issue1003 branch January 14, 2026 07:15
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.

opt.: add a btn to minimize ai dialog

1 participant