Skip to content

Instantly share code, notes, and snippets.

@rahul-lohra
Created August 12, 2019 02:34
Show Gist options
  • Save rahul-lohra/63fbde46cef069e85779d87d884d7491 to your computer and use it in GitHub Desktop.
Save rahul-lohra/63fbde46cef069e85779d87d884d7491 to your computer and use it in GitHub Desktop.
Stack GestureDetector
import 'package:fix_library_app/RevealWidget.dart';
import 'package:flutter/material.dart';
import 'package:flutter/foundation.dart';
class AppButton extends StatelessWidget {
@override
Widget build(BuildContext context) {
return nestedWidget();
}
Widget nestedWidget() {
return Stack(
children: <Widget>[
getGestureWidget(100, 100, Colors.pink, "outside"),
getGestureWidget(50, 50, Colors.green, "inside"),
],
);
}
Widget getGestureWidget(double width, double height, Color color, String message){
return GestureDetector(
behavior: HitTestBehavior.translucent,
child: Container(
color: color,
width: width,
height: height,
),
onTap: () {
print(message);
},
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment