Android Zefyr在嵌入图像-颤振时获得了很大的空间
我正在构建一个使用Zefyr库的颤振应用程序 现在我发现了一个问题,当我在Zefyr中使用一些图像时,它给了我更多的内容下方的空间 如果我不使用任何图像,而只使用文本,那么它工作正常。我只是想知道为什么在Zefyr中添加一些图像时会出现这个问题 下面是一个问题,导致下面的空间与图像 当我不使用任何图像时,只使用文本。。。 下面是我用来显示这个Zefyr的代码。我使用Android Zefyr在嵌入图像-颤振时获得了很大的空间,android,ios,flutter,flutter-layout,flutter-dependencies,Android,Ios,Flutter,Flutter Layout,Flutter Dependencies,我正在构建一个使用Zefyr库的颤振应用程序 现在我发现了一个问题,当我在Zefyr中使用一些图像时,它给了我更多的内容下方的空间 如果我不使用任何图像,而只使用文本,那么它工作正常。我只是想知道为什么在Zefyr中添加一些图像时会出现这个问题 下面是一个问题,导致下面的空间与图像 当我不使用任何图像时,只使用文本。。。 下面是我用来显示这个Zefyr的代码。我使用CustomScrollView作为父级 SliverFillRemaining( hasScrollBody: fals
CustomScrollView
作为父级
SliverFillRemaining(
hasScrollBody: false,
child: Padding(
padding: const EdgeInsets.fromLTRB(10, 0, 10, 50),
child: ZefyrScaffold(
child: ZefyrTheme(
data: theme,
child: ZefyrView(
document: document,
imageDelegate: MyAppZefyrImageViewDelegate(),
),
),
),
),
),
下面是MyAppZefyrImageViewDelegate()的
类MyAppZefyrImageViewDelegate实现ZefyrImageDelegate{
@凌驾
ImageSource get cameraSource=>ImageSource.camera;
@凌驾
ImageSource get gallerySource=>ImageSource.gallery;
@凌驾
小部件buildImage(BuildContext上下文,字符串键){
if(Uri.parse(key.isAbsolute){
返回手势检测器(
onTap:(){
导航器。推(
上下文
材料路线(
生成器:(BuildContext上下文)=>FullPhoto(url:key));
},
孩子:Image.network(
钥匙
frameBuilder:(BuildContext上下文、小部件子项、int-frame、,
布尔(已同步加载){
如果(已同步加载){
返回儿童;
}
返回能力(
不透明度:帧==null?0:1,
持续时间:常数持续时间(秒数:1),
曲线:Curves.easeOut,
孩子:孩子,
);
},
),
);
}
最终Uint8List字节=base64.解码(键);
返回手势检测器(
onTap:(){
导航器。推(
上下文
材料路线(
生成器:(BuildContext上下文)=>
FullBase64Photo(base64Str:key));
},
孩子:大小盒子(
宽度:MediaQuery.of(context).size.height/2,
高度:MediaQuery.of(context).size.height/2,
孩子:图像。记忆(
字节,
filterQuality:filterQuality.medium,
frameBuilder:(BuildContext上下文、小部件子项、int-frame、,
布尔(已同步加载){
如果(已同步加载){
返回儿童;
}
返回能力(
不透明度:帧==null?0:1,
持续时间:常数持续时间(秒数:1),
曲线:Curves.easeOut,
孩子:孩子,
);
},
),
),
);
}
}
class MyAppZefyrImageViewDelegate implements ZefyrImageDelegate<ImageSource> {
@override
ImageSource get cameraSource => ImageSource.camera;
@override
ImageSource get gallerySource => ImageSource.gallery;
@override
Widget buildImage(BuildContext context, String key) {
if (Uri.parse(key).isAbsolute) {
return GestureDetector(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (BuildContext context) => FullPhoto(url: key)));
},
child: Image.network(
key,
frameBuilder: (BuildContext context, Widget child, int frame,
bool wasSynchronouslyLoaded) {
if (wasSynchronouslyLoaded) {
return child;
}
return AnimatedOpacity(
opacity: frame == null ? 0 : 1,
duration: const Duration(seconds: 1),
curve: Curves.easeOut,
child: child,
);
},
),
);
}
final Uint8List bytes = base64.decode(key);
return GestureDetector(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (BuildContext context) =>
FullBase64Photo(base64Str: key)));
},
child: SizedBox(
width: MediaQuery.of(context).size.height / 2,
height: MediaQuery.of(context).size.height / 2,
child: Image.memory(
bytes,
filterQuality: FilterQuality.medium,
frameBuilder: (BuildContext context, Widget child, int frame,
bool wasSynchronouslyLoaded) {
if (wasSynchronouslyLoaded) {
return child;
}
return AnimatedOpacity(
opacity: frame == null ? 0 : 1,
duration: const Duration(seconds: 1),
curve: Curves.easeOut,
child: child,
);
},
),
),
);