以下是我的代码,我已经拍摄了图像的屏幕截图并显示在此处,但是图像显示了边框
class ResultImage extends StatelessWidget {
final Image image;
// File file;
ResultImage({Key key, this.image}) : super(key: key);
@override
Widget build(BuildContext context) {
// file=File(image);
return Scaffold(
appBar: AppBar(
title: Text("View Image"),
actions: <Widget>[
IconButton(
icon: Icon(Icons.share),
tooltip: 'Share',
onPressed: () => {},
),
],
),
body: Container(
child: image,
));
}
}
答案 0 :(得分:1)
通过应用height: double.infinity,width: double.infinity
来解决问题,从而解决了问题。
class ResultImage extends StatelessWidget {
final Image image;
// File file;
ResultImage({Key key, this.image}) : super(key: key);
@override
Widget build(BuildContext context) {
// file=File(image);
return Scaffold(
appBar: AppBar(
title: Text("View Image"),
actions: <Widget>[
IconButton(
icon: Icon(Icons.share),
tooltip: 'Share',
onPressed: () => {},
),
],
),
body: Container(
height: double.infinity,
width: double.infinity,
child: image,
));
}
}
答案 1 :(得分:0)
尝试一下;
class ResultImage extends StatelessWidget {
final Image image;
// File file;
ResultImage({Key key, this.image}) : super(key: key);
@override
Widget build(BuildContext context) {
// file=File(image);
return Scaffold(
appBar: AppBar(
title: Text("View Image"),
actions: <Widget>[
IconButton(
icon: Icon(Icons.share),
tooltip: 'Share',
onPressed: () => {},
),
],
),
body: Expanded(
child: image,
));
),
),
);
}
}
答案 2 :(得分:-1)
应将图片适合度设置为'fit:BoxFit.fill',例如-
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(
title: new Text('Stack'),
),
body:
GestureDetector(
child: Container(
decoration: new BoxDecoration(
image: new DecorationImage(
image: AssetImage('images/splash.png'),
fit: BoxFit.fill),
),
),
onTap: () {},
),
);
}