Last active
March 20, 2020 21:49
-
-
Save shihaohong/31c9d7394f02595a04ff45b587aee23c to your computer and use it in GitHub Desktop.
tapdown magic
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
void main() { | |
runApp(MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
theme: ThemeData.dark(), | |
home: Scaffold( | |
appBar: AppBar(title: const Text('Tapdown')), | |
body: GestureDetector( | |
onTap: () => print('tap down bottom'), | |
child: Container( | |
color: Colors.blue.withOpacity(0.8), | |
child: Center( | |
child: Container( | |
width: 100, | |
height: 100, | |
color: Colors.green.withOpacity(0.8), | |
child: GestureDetector( | |
behavior: HitTestBehavior.deferToChild, | |
onTap: () => print('tap down top'), | |
child: Center( | |
child: Container( | |
width: 50, | |
height: 50, | |
color: Colors.yellow, | |
), | |
), | |
), | |
), | |
), | |
), | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment