-
Notifications
You must be signed in to change notification settings - Fork 29.1k
Closed
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listd: api docsIssues with https://api.flutter.dev/Issues with https://api.flutter.dev/f: gesturesflutter/packages/flutter/gestures repository.flutter/packages/flutter/gestures repository.frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.r: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer version
Description
In this example, I would expect both print statements to be hit, but only the "inside" GestureDetector's onTap is being triggered.
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Gesture Detector Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: const MyHomePage(),
);
}
}
class MyHomePage extends StatelessWidget {
const MyHomePage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Gesture Detector Demo'),
),
body: GestureDetector(
behavior: HitTestBehavior.translucent,
onTap: () => print('outside gesture detector'),
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
GestureDetector(
onTap: () => print('inside gesture detector'),
behavior: HitTestBehavior.translucent,
child: Container(
color: Colors.green,
height: 100.0,
width: 300.0,
child: const Text(
'Gesture detector - HitTestBehavior.translucent',
),
),
),
],
),
),
),
);
}
}
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listd: api docsIssues with https://api.flutter.dev/Issues with https://api.flutter.dev/f: gesturesflutter/packages/flutter/gestures repository.flutter/packages/flutter/gestures repository.frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.r: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer version
Type
Projects
Status
Done (PR merged)