Skip to content

fix: databse layout issue #8058

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 1 commit into
base: main
Choose a base branch
from

Conversation

asjqkkkk
Copy link
Collaborator

@asjqkkkk asjqkkkk commented Jun 13, 2025

To fix #6770

database reference inline databse
image image

To fix #6940
image

Feature Preview


PR Checklist

  • My code adheres to AppFlowy's Conventions
  • I've listed at least one issue that this PR fixes in the description above.
  • I've added a test(s) to validate changes in this PR, or this PR only contains semantic changes.
  • All existing tests are passing.

Summary by Sourcery

Fix database layout issues by refining padding logic across tab bar, calendar page, and inline database views, and register calendar type for overflow handling.

Bug Fixes:

  • Adjust TabBar view padding to correctly apply horizontal offsets for calendar and inline database layouts
  • Use corrected paddingLeftWithMaxDocumentWidth in CalendarPage for accurate content alignment
  • Ensure inline database views consistently apply horizontal padding from provider

Enhancements:

  • Simplify horizontalPadding default logic in DatabaseViewWidget to always initialize before provider override

Chores:

  • Add calendarType to DatabaseBlockKeys overflowTypes for proper handling

Copy link
Contributor

sourcery-ai bot commented Jun 13, 2025

Reviewer's Guide

This PR refines padding and layout behavior for calendar and inline databases across the tab bar and calendar page, centralizes horizontalPadding propagation in the tab bar extension, simplifies default padding in the database view widget, and adds calendar support to editor overflow types.

Sequence Diagram for Padding Propagation in Tab Bar

sequenceDiagram
    participant _DatabaseTabBarViewState
    participant pageSettingBarExtensionFromState

    _DatabaseTabBarViewState->>_DatabaseTabBarViewState: build()
    Note right of _DatabaseTabBarViewState: Calculates horizontalPadding
    _DatabaseTabBarViewState->>pageSettingBarExtensionFromState: pageSettingBarExtensionFromState(context, state, horizontalPadding)
    Note right of pageSettingBarExtensionFromState: Uses the passed horizontalPadding to create a Padding widget
    pageSettingBarExtensionFromState-->>_DatabaseTabBarViewState: Returns setting bar extension widget
    _DatabaseTabBarViewState->>_DatabaseTabBarViewState: Applies conditional padding to main content based on view type (e.g., isCalendar)
Loading

Class Diagram for UI Layout and Padding Changes

classDiagram
    class _DatabaseTabBarViewState {
        +Widget build(BuildContext context)
        -Widget pageSettingBarExtensionFromState(BuildContext context, DatabaseTabBarState state, double horizontalPadding)
    }

    class _CalendarPageState {
        +Widget build(BuildContext context)
    }

    class _DatabaseViewWidgetState {
        +Widget build(BuildContext context)
    }

    class DatabasePluginWidgetBuilderSize {
        +double horizontalPadding
        +double paddingLeft
        +double paddingLeftWithMaxDocumentWidth
    }

    _DatabaseTabBarViewState ..> DatabasePluginWidgetBuilderSize : "uses"
    _CalendarPageState ..> DatabasePluginWidgetBuilderSize : "uses"
    _DatabaseViewWidgetState ..> DatabasePluginWidgetBuilderSize : "uses"
Loading

File-Level Changes

Change Details Files
Propagate horizontalPadding and adjust padding logic in database tab bar to support calendar view
  • Augment child widget right padding when in calendar layout
  • Pass horizontalPadding into pageSettingBarExtensionFromState
  • Update pageSettingBarExtensionFromState signature and use the passed horizontalPadding for symmetric padding
  • Include right inset for calendar in wrapContent padding logic
tab_bar_view.dart
Use paddingLeftWithMaxDocumentWidth in calendar page for consistent layout
  • Replace context.read(...).paddingLeft with paddingLeftWithMaxDocumentWidth
calendar_page.dart
Simplify horizontalPadding initialization in database view widget
  • Remove conditional grid/board check and always assign default padding
  • Retain override from provider when available
database_view_widget.dart
Add calendar type to document editor database overflow types
  • Include calendarType in the overflowTypes constant
database_view_block_component.dart

Assessment against linked issues

Issue Objective Addressed Explanation
#6770 Ensure calendars created directly and calendars created within grids/databases have consistent layouts.
#6770 Reduce the stretching of calendars, especially in grid/database views, to improve usability.
#6770 Increase vertical space in calendars to display more events per day.
#6940 The inline grid view should have row reorder actions.
#6940 Users should be able to delete or duplicate a row in the inline grid view.
#6940 Users should be able to reorder rows in the inline grid view.

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

  • The unconditional assignment of horizontalPadding = 40.0 in database_view_widget.dart removes the original layout-based logic—please restore the conditional default padding for non-grid/board views to avoid unintended layout shifts.
  • Padding calculations for Calendar and TabBar are now scattered across multiple widgets—consider centralizing horizontalPadding and paddingLeft logic within DatabasePluginWidgetBuilderSize or a shared layout utility to ensure consistency.
  • After adding DatabaseBlockKeys.calendarType to overflowTypes, double-check that the calendar view properly handles overflow in all editor contexts to prevent unexpected clipping.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The unconditional assignment of horizontalPadding = 40.0 in database_view_widget.dart removes the original layout-based logic—please restore the conditional default padding for non-grid/board views to avoid unintended layout shifts.
- Padding calculations for Calendar and TabBar are now scattered across multiple widgets—consider centralizing horizontalPadding and paddingLeft logic within DatabasePluginWidgetBuilderSize or a shared layout utility to ensure consistency.
- After adding DatabaseBlockKeys.calendarType to overflowTypes, double-check that the calendar view properly handles overflow in all editor contexts to prevent unexpected clipping.

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.

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.

[Bug] Inline grid missing reorder/action handle [Bug] Calendar stretches wrongly
1 participant