Advertisement
Guest User

Untitled

a guest
Jun 29th, 2018
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Dart 1.07 KB | None | 0 0
  1.   Size _getImageSize(Image image) {
  2.     return  Size(image.width.toDouble(), image.height.toDouble());
  3.   }
  4.  
  5.   Widget _buildBody() {
  6.     return FutureBuilder<File>(
  7.         future: _imageFile,
  8.         builder: (BuildContext context, AsyncSnapshot<File> snapshot) {
  9.           if (snapshot.connectionState == ConnectionState.done &&
  10.               snapshot.hasData) {
  11.             // return Image.file(snapshot.data);
  12.              return Container(
  13.                         foregroundDecoration:
  14.                             TextDetectDecoration(_currentLabels, _getImageSize(Image.file(snapshot.data, fit: BoxFit.fitWidth))),
  15.                         child: Image.file(snapshot.data, fit: BoxFit.fitWidth));
  16.          
  17.           } else if (snapshot.error != null) {
  18.             return const Text(
  19.               'Error picking image.',
  20.               textAlign: TextAlign.center,
  21.             );
  22.           } else {
  23.             return const Text(
  24.               'You have not yet picked an image.',
  25.               textAlign: TextAlign.center,
  26.             );
  27.           }
  28.         });
  29.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement