问题
I have two views one over another and want get touches in both views. But now get touches only second view.
How can I configure GestureDetector
that all touches will be send both widgets
import 'package:flutter/material.dart';
class TestPage extends StatefulWidget {
TestPage();
@override
_TestPageState createState() => _TestPageState();
}
class _TestPageState extends State<TestPage> {
@override
Widget build(BuildContext context) {
// TODO: implement build
return Scaffold(
backgroundColor: Colors.blueAccent,
body: Stack(
children: [_renderFirstWidget(), _renderSecondWidget()],
),
);
}
Widget _renderFirstWidget() {
return Center(
child: GestureDetector(
onTap: () {
print('first');
},
child: Container(height: 150, width: 150, color: Colors.greenAccent)),
);
}
Widget _renderSecondWidget() {
return Center(
child: GestureDetector(
onTap: () {
print('second');
},
child: Container(
height: 350,
width: 350,
color: Colors.redAccent.withOpacity(0.3))));
}
}
来源:https://stackoverflow.com/questions/62792718/multiply-gesture-detector-in-flutter