@@ -27,7 +27,7 @@ class PreviewImageWidget extends StatefulWidget {
2727}
2828
2929class PreviewImageState extends State <PreviewImageWidget > {
30- final GlobalKey globalKey = new GlobalKey ();
30+ final GlobalKey pipCaptureKey = new GlobalKey ();
3131
3232 List <String > _listImageIcon = [];
3333 List <Offset > _imageOffset = [];
@@ -82,15 +82,15 @@ class PreviewImageState extends State<PreviewImageWidget> {
8282 getBottomListView ()
8383 ]))),
8484 floatingActionButton: FloatingActionButton (
85- onPressed: _capturePng ,
85+ onPressed: _captureImage ,
8686 tooltip: 'save' ,
8787 child: Icon (Icons .save),
8888 ));
8989 }
9090
9191 Widget getPIPImageWidget () {
9292 return RepaintBoundary (
93- key: globalKey ,
93+ key: pipCaptureKey ,
9494 child: new Center (child: new DrawPIPWidget (_originImage, _image)),
9595 );
9696 }
@@ -138,9 +138,9 @@ class PreviewImageState extends State<PreviewImageWidget> {
138138 padding: EdgeInsets .all (20 ), height: 140 , child: listView);
139139 }
140140
141- Future <void > _capturePng () async {
141+ Future <void > _captureImage () async {
142142 RenderRepaintBoundary boundary =
143- globalKey .currentContext.findRenderObject ();
143+ pipCaptureKey .currentContext.findRenderObject ();
144144 var image = await boundary.toImage ();
145145 ByteData byteData = await image.toByteData (format: ImageByteFormat .png);
146146 Uint8List pngBytes = byteData.buffer.asUint8List ();
@@ -157,17 +157,17 @@ class PreviewImageState extends State<PreviewImageWidget> {
157157 barrierDismissible: false ,
158158 builder: (BuildContext context) {
159159 return AlertDialog (
160- title: Text ('Save success ' ),
160+ title: Text ('PIP Path ' ),
161161 content: SingleChildScrollView (
162162 child: ListBody (
163163 children: < Widget > [
164- Text ('Image is save in ${ path } ' ),
164+ Text ('Image is save in $path ' ),
165165 ],
166166 ),
167167 ),
168168 actions: < Widget > [
169169 FlatButton (
170- child: Text ('exit ' ),
170+ child: Text ('退出 ' ),
171171 onPressed: () {
172172 Navigator .of (context).pop ();
173173 },
0 commit comments