We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
1.25.0
iOS
15pm
Image.network 设置其他的fit,视差效果会失效
Widget _buildPageItemBgPicView(int index) { return ValueListenableBuilder( valueListenable: picAlignmentX, builder: (BuildContext context, double alignmentX, Widget? child) { return Image.network( widget.imgUrl, //fit: BoxFit.cover, alignment: Alignment(111, 0), ); }, ); }
No response
The text was updated successfully, but these errors were encountered:
这不是这个库的问题,alignment 是否生效与 fit 有关,你不设置 fit,它会根据其它参数给出一个默认值,这里相当于 .contain,会对图片进行缩放直到完全展示,而示例中的图片宽度比高度大,所以在这种情况下,你设置 alignment.x 是无效的,只能调整 alignment.y,否则这将与 fit 相违背。
alignment
fit
.contain
alignment.x
alignment.y
如果你就是想不设置 fit 还有视差效果,那可以改用 Transform
Transform
return Transform.translate( offset: Offset(alignmentX * 100, 0), child: Image.network( widget.imgUrl, ), );
Sorry, something went wrong.
LinXunFeng
No branches or pull requests
Version
1.25.0
Platforms
iOS
Device Model
15pm
flutter info
How to reproduce?
Image.network 设置其他的fit,视差效果会失效
Logs
Example code (optional)
Contact
No response
The text was updated successfully, but these errors were encountered: