Flutter screenshot without using RepaintBoundary

Viewed 118

I am working on a drawing app. I can get a screenshot of a widget using RepaintBoundary but I need to update it with a button which is outside. In my case, I can clear the list of points with a FlatButton but my Container is not clearing because of RepaintBoundary I need to get a screenshot of my Container without RepaintBoundary or I should update my Container from outside they both works for me. Thanks.

 return
          SingleChildScrollView(//physics: NeverScrollableScrollPhysics(),
          child: Column(
            children: <Widget>[
              RepaintBoundary(
                key: _signKey,
                child: new Container(
                  width: 100.0 * MediaQuery.of(context).devicePixelRatio ,
                  height: 150.0 * MediaQuery.of(context).devicePixelRatio,
                  color: Colors.black12,
                  child: GestureDetector(
                    onPanUpdate: (DragUpdateDetails details) {
                      setState(() {
                        RenderBox object = context.findRenderObject();
                        Offset _localPosition =
                        object.globalToLocal(details.globalPosition);
                        points = new List.from(points)
                          ..add(_localPosition);
                      });
                    },
                    onPanEnd: (DragEndDetails details) => points.add(null),
                    child: new CustomPaint(
                      painter: new DrawingPainter(points: points),
                      size: Size.infinite,
                    ),
                  ),
                ),
              ),
              Row(
                children: <Widget>[
                  FlatButton( //Button to clear container
                    padding: EdgeInsets.fromLTRB(20, 10, 20, 10),
                    shape: RoundedRectangleBorder(
                        borderRadius: BorderRadius.circular(8)),
                    color: Colors.redAccent,
                    textColor: Colors.black,
                    onPressed: (){
                      setState(() {
                        points.clear();
                      });
                    },
                    child: Text('Sil'),
                  ),
                ],
              ),
            ],
          ),
        );
0 Answers
Related