Skip to content

TrimSlider right handle nearly impossible to grab — GestureDetector too narrow #207

Description

@hamtown15

Bug Description

The right trim handle on TrimSlider is extremely difficult to grab on touch devices. The left handle works fine, but the right handle requires precise targeting to the left of where it visually appears, which is unintuitive.

Root Cause

In lib/src/widgets/trim/trim_slider.dart, the outer SizedBox (line 572) constrains the GestureDetector to width: _fullLayout.width:

return SizedBox(
    width: _fullLayout.width,  // Too narrow — excludes handle positions
    child: Stack(children: [
        // ...
        GestureDetector(
            onHorizontalDragStart: _onHorizontalDragStart,
            // ...
        ),
    ]),
);

But _fullLayout.width = constraints.maxWidth - 2 * _horizontalMargin, while _rect.right = _fullLayout.width + _horizontalMargin. This means the right handle is always _horizontalMargin pixels outside the GestureDetector's hit test area.

The GestureDetector can only receive touch events within its bounds (0 to _fullLayout.width). Since the right handle is painted at _fullLayout.width + _horizontalMargin, touches directly on it are rejected by Flutter's hit testing.

Touch area analysis (default config, edgesSize=10):

Handle Touch area Notes
Left ~27px Full 24dp + margin overlap into GestureDetector
Right ~14px Reduced because handle is outside GestureDetector bounds

The right handle's touchable zone is only to the left of where it appears, making it feel broken.

Fix

Change the outer SizedBox width to include both margins:

// Before:
return SizedBox(
    width: _fullLayout.width,
    child: Stack(children: [

// After:
return SizedBox(
    width: _fullLayout.width + _horizontalMargin * 2,
    child: Stack(children: [

For non-extended trim, this equals constraints.maxWidth, so the GestureDetector fills the parent. The internal Padding(horizontal: _horizontalMargin) still correctly offsets the thumbnails, and _rect positions remain within the now-wider GestureDetector bounds. Both handles get a full symmetric 24dp touch area.

Environment

  • video_editor: ^3.0.0
  • Flutter 3.29
  • Tested on Android (Samsung Galaxy, Exynos)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions