I'd like to make all the free spase in a widget clicable i.e. all the free space in the raw
GestureDetector(
onTap: () {
Navigator.push(
...
);
},
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SampleImage(image1),
Expanded(
child: Text('some text'),
),
],
),
)
But some free space still isn't clicable.
How to achive that?
CodePudding user response:
From docs it says
By default a GestureDetector with an invisible child ignores touches; this behavior can be controlled with [behavior].
That's why that empty space doen't catch a touch action.
Adding behavior
property with opaque
enum should solve the issue.
GestureDetector(
behavior: HitTestBehavior.opaque,