flutter - Flutter - 纵向和横向图像显示的空白
问题描述
如果我在图像中进行横向或纵向,我会一直看到很多空白区域。我确实需要可滑动的,所以不想过多地调整代码,但我确实希望它看起来可以表示
我的代码有问题吗?
我确实添加了一张在横向和纵向模式下都发生的图片
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: new Text(
"1 Alif-laam-meem آلم, Pg2",
style: new TextStyle(color: styling.appBarTextcolor),
),
leading: new IconButton(
icon: new Icon(styling.appBarBackArrowIcon),
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => NavDrawer(),
));
})),
body: LayoutBuilder(builder:
(BuildContext context, BoxConstraints viewportConstraints) {
return SingleChildScrollView(
child: Stack(children: <Widget>[
new Slidable(
delegate: new SlidableDrawerDelegate(),
actionExtentRatio: styling.sizeofenglishandforward,
child: SafeArea(
top: true,
bottom: true,
right: true,
left: true,
child: new Container(
child: new Image.asset(
"test/assets/Para 1 - Alif-laam-meem no color/quranpg2-1.png",
// fit: BoxFit.fitidth,
fit: BoxFit.cover,
),
),
),
actions: <Widget>[
new IconSlideAction(
caption: styling.englishIconText,
color: styling.englishIconColorstripe,
icon: styling.englishIcon,
foregroundColor: styling.englishIconColor,
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => Changepg2topg2Color()),
);
}),
new IconSlideAction(
caption: styling.forwardIconText,
color: styling.forwardIconColorstripe,
icon: styling.forwardIcon,
foregroundColor: styling.forwardIconColor,
// onTap: () {
// Navigator.push(
// context,
// MaterialPageRoute(builder: (context) => Changepg2topg3()),
// );
// }
),
// ),
],
secondaryActions: <Widget>[
new IconSlideAction(
caption: styling.backIconText,
color: styling.backIconColorstripe,
icon: styling.backIcon,
foregroundColor: styling.backIconColor,
// onTap: () => _showSnackBar('More'),
),
new IconSlideAction(
caption: styling.arabicIconText,
color: styling.arabicIconColorstripe,
icon: styling.arabicIcon,
foregroundColor: styling.arabicIconColor,
// onTap: () =>
),
],
),
]));
}));
}
}
解决方案
SafeArea
正在阻止您的图像进入屏幕的某些受限区域,例如凹槽区域下方。或者对于某些设备NavigationKeys
,屏幕底部有。尝试删除这些
干杯:)
child: SafeArea(
top: true,
bottom: true,
right: true,
left: true,
推荐阅读
- jenkins - Jenkins Gradle 失败,无法将缓存值写入“/home/bldadm/.gradle/daemon/4.8/registry.bin”
- perl - 如何在perl中将字节数组转换为int64
- javascript - Google Apps 脚本:如何从二维数组中删除特定字符
- javascript - Javascript 在页面加载时隐藏 div 在按钮之间切换
- php - Laravel 7 中的分页 + URL 参数
- selenium-webdriver - 使用代理 InvalidArgumentError 运行 webdriver
- mongodb - 将 2 个数组对象合并为 1 个
- c# - 如何检查是否已在 Blazor 中设置属性?
- javascript - Vue.js 将数组中的值发送到端点的问题
- c++ - OpenMp:创建具有线程数大小的数组的最佳方法