I'm implementing a Drawing App in Flutter. I'm referring this tutorial but Somehow I got stuck by an
Brief: As you can see I have two container. One for Drawing and below one for 'Draw Above'. But points drawn its beyond.I want user can draw within the upper container. So my question is - How to cancel Gesture detection, if it goes beyond a particular container's bounds?
Code snippet:
final GestureDetector paintGesture = GestureDetector(
onPanUpdate: (DragUpdateDetails details) {
setState(() {
RenderBox object = context.findRenderObject();
Offset _localPosition = object.localToGlobal(details.globalPosition);
_points = new List.from(_points)..add(_localPosition);
});
},
onPanEnd: (DragEndDetails details) {
_points.add(null);
},
child: sketchArea,
);
final Container sketchArea = Container(
//margin: EdgeInsets.all(1.0),
//alignment: Alignment.topLeft,
color: Colors.white,
child: new CustomPaint(
painter: new Signature(points: _points),
size: Size.infinite,
),
);
Scaffold:
return new Scaffold(
body: Container(
child: Column(
children: <Widget>[
Expanded(
child: paintGesture,
),
Expanded(
child: Center(
child: Container(
child: Text(
_selectedInput,
style: TextStyle(
color: Colors.black,
fontSize: 40.0,
),
),
),
),
),
],
),
),
);