flutter-defer-pointer
flutter-defer-pointer copied to clipboard
Not working with padding arround
return Padding(
padding: const EdgeInsets.only(top: 16),
child: DeferredPointerHandler(
child: SizedBox(
width: 100,
height: 100,
child: Stack(
clipBehavior: Clip.none,
children: [
// Hang button off the bottom of the content
Positioned(
bottom: -30,
child: DeferPointer(child: TextButton(onPressed: () => print("lol"), child: Text("lol"))),
),
// Content
Positioned.fill(
child: Container(
decoration: BoxDecoration(color: Colors.green, boxShadow: [
BoxShadow(color: Colors.black.withOpacity(1), blurRadius: 4, spreadRadius: 4),
]),
),
),
],
),
),
),
);

The lol button is not clickable outside the green block.
I think this is because the padding is tightly wrapping your content, giving you only 16px of more area to detect hits.
Try swapping the Padding and the DeferredPointerHandler? Or just put a single DeferredPointerHandler at the top of your app to keep it simple if you want.