**I wrapped expanded container in a row with gesture detector. I wanted gesture detector to use all the available space when user press the container. But when I use container without decoration, gesture detector detects only the child of the container, not its constraints. When I add decoration with borders Gesture detector works as I expect. **
Widget build(BuildContext context, WidgetRef ref) {
return SizedBox(
height: 120,
child: Card(
color: Colors.white24,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0),
side: const BorderSide(color: Colors.white, width: 3)),
semanticContainer: true,
elevation: 5,
child: Padding(
padding: const EdgeInsets.only(left: 20, right: 5),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: GestureDetector(
onTap: () async {
var weatherData =
//await WeatherModel().getCityWeather(widget.apiary.apiaryLocation);
await WeatherModel().getLocationWeather(
apiary.latitude!, apiary.longitude!);
if (weatherData == null) {}
Navigator.push(context,
MaterialPageRoute(builder: (context) {
return ApiaryHomePage(
locationWeather: weatherData,
apiary: apiary,
);
}));
},
child: Container(
height: 100,
decoration: BoxDecoration(border: Border.all()),
child: Row(
children: [
Text(
'${(index + 1)}',
style: const TextStyle(
fontSize: 30,
color: Colors.white,
fontWeight: FontWeight.bold),
),
const SizedBox(
width: 20,
),
Text(
title,
style: const TextStyle(
fontSize: 30,
color: Colors.white,
fontWeight: FontWeight.bold),
),
],
),
),
),
),
SizedBox(
child: Row(
children: [
IconButton(
onPressed: () =>
EditApiaryPage.show(context, apiary: apiary),
icon: const Icon(
Icons.edit,
color: Colors.green,
size: 32,
)),
IconButton(
onPressed: () {
AlertDialogs().showAlertDialog(context, () {
final database = ref
.read<FirestoreDatabase?>(databaseProvider);
database!.deleteApiary(apiary.apiaryId);
}, AppLocalizations.of(context)!.deleteApiary);
},
icon: const Icon(
Icons.delete,
color: Colors.red,
size: 32,
)),
],
),
)
],
),
)),
);