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)
Bug Description
The right trim handle on
TrimSlideris 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 outerSizedBox(line 572) constrains theGestureDetectortowidth: _fullLayout.width:But
_fullLayout.width = constraints.maxWidth - 2 * _horizontalMargin, while_rect.right = _fullLayout.width + _horizontalMargin. This means the right handle is always_horizontalMarginpixels outside theGestureDetector's hit test area.The
GestureDetectorcan only receive touch events within its bounds (0to_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):
The right handle's touchable zone is only to the left of where it appears, making it feel broken.
Fix
Change the outer
SizedBoxwidth to include both margins:For non-extended trim, this equals
constraints.maxWidth, so theGestureDetectorfills the parent. The internalPadding(horizontal: _horizontalMargin)still correctly offsets the thumbnails, and_rectpositions remain within the now-widerGestureDetectorbounds. Both handles get a full symmetric 24dp touch area.Environment
video_editor: ^3.0.0