flutter_slidable icon indicating copy to clipboard operation
flutter_slidable copied to clipboard

Slidable cannot take Semantics as Action

Open developer01-dufour-one opened this issue 4 years ago • 1 comments

Semantics are useful for the accessibility functions. When embedding a SlidableAction into a Semantics widget, an exception is raised at runtime because an internal "hasSize " call does not work. Crashes on both iOS and Android.

Slidable(
....
  children:[
      SlidableAction(
      ....
      ),
]

versus

Slidable(
....
  children:[
      Semantics(child: SlidableAction(
      ....
      ),),
]

Error message: ======== Exception caught by rendering library ==================================== The following assertion was thrown during paint(): RenderBox was not laid out: RenderClipRect#4089d 'package:flutter/src/rendering/box.dart': Failed assertion: line 1927 pos 12: 'hasSize'

Either the assertion indicates an error in the framework itself, or we should provide substantially more information in this error message to help you determine and fix the underlying cause. In either case, please report this assertion by filing a bug on GitHub: https://github.com/flutter/flutter/issues/new?template=2_bug.md

The relevant error-causing widget was: Slidable-[<'Cortado'>] Slidable:file:///D:/_Projects/Mobile/thecoffeecorner/thecoffeecorner/lib/screens/home/components/page_coffees.dart:49:30 When the exception was thrown, this was the stack: #2 RenderBox.size (package:flutter/src/rendering/box.dart:1927:12) .......................... The following RenderObject was being processed when the exception was fired: RenderClipRect#4089d ... needs compositing ... parentData: top=0.0; right=0.0; bottom=0.0; left=0.0; offset=Offset(0.0, 0.0) (can use size) ... constraints: BoxConstraints(w=360.0, h=56.0) ... size: MISSING RenderObject: RenderClipRect#4089d needs compositing parentData: top=0.0; right=0.0; bottom=0.0; left=0.0; offset=Offset(0.0, 0.0) (can use size) constraints: BoxConstraints(w=360.0, h=56.0)

size: MISSING ... child: RenderFractionallySizedOverflowBox#4026f NEEDS-PAINT ... needs compositing ... parentData: (can use size) ... constraints: BoxConstraints(w=360.0, h=56.0) ... size: MISSING

developer01-dufour-one avatar Jan 03 '22 08:01 developer01-dufour-one

Can you try with a CustomSlidableAction and put the Semantics above its child instead?

letsar avatar Jul 10 '22 14:07 letsar