使用 FlutterIcons 而不是直接使用 SVG 是否有任何性能提升?
Is there any performance gain with FlutterIcons instead of using the SVG directly?
例如使用 fluttericon or fluttericon instead of just using each icon svg
directly with flutter_svg 是否有任何性能提升或任何其他优势?
这个问题有点老,所以您可能已经找到了答案,但这是我对这个主题的看法:
表演
Performance-wise,虽然包 flutter_svg 随着时间的推移有了很大改进,但它仍然是一个复杂的小部件,它将解析 SVG 文件并尝试使用其属性呈现它。每当您尝试显示大量 svg 小部件时,仍然存在一些与性能相关的问题:
- Performance to render many SVG in an animation
- SVG asset loading/rendering performance in PageView widget
fluttericon 等解决方案或任何其他通过字体提供更多图标的包将始终提供更好的渲染性能,因为它就像渲染文本一样简单。
现在 fluttericon 和 网站 fluttericon.com 生成的字体文件之间选择哪个?
Fluttericon(包)与 FlutterIcon(网络)
正如 Ravindra 和 ilikerobots 所说,直接导入包 fluttericon 会增加应用程序的大小,因为它将包含所有字体包。软件包的 README 文件中也提到了它:
Please note this package is not intended for production use, due to
the large size. Instead, it can be used as a development aid to help
identify/test icons.
For production use, it is highly recommended to use FlutterIcon to
customize your icon pack, limiting your icon font to needed icons and
building your own from custom SVG.
结论
因此,就性能和应用程序大小而言,最佳选择是使用 FlutterIcon,并且仅 select 您希望包含在应用程序中的图标。该包应该只用于在开发过程中试用哪个图标适合您的需求。
最后,如果您需要显示一些复杂的 SVG,而无法使用 FlutterIcon 准确导入,则应该主要使用包 flutter_svg。
例如使用 fluttericon or fluttericon instead of just using each icon svg
directly with flutter_svg 是否有任何性能提升或任何其他优势?
这个问题有点老,所以您可能已经找到了答案,但这是我对这个主题的看法:
表演
Performance-wise,虽然包 flutter_svg 随着时间的推移有了很大改进,但它仍然是一个复杂的小部件,它将解析 SVG 文件并尝试使用其属性呈现它。每当您尝试显示大量 svg 小部件时,仍然存在一些与性能相关的问题:
- Performance to render many SVG in an animation
- SVG asset loading/rendering performance in PageView widget
fluttericon 等解决方案或任何其他通过字体提供更多图标的包将始终提供更好的渲染性能,因为它就像渲染文本一样简单。
现在 fluttericon 和 网站 fluttericon.com 生成的字体文件之间选择哪个?
Fluttericon(包)与 FlutterIcon(网络)
正如 Ravindra 和 ilikerobots 所说,直接导入包 fluttericon 会增加应用程序的大小,因为它将包含所有字体包。软件包的 README 文件中也提到了它:
Please note this package is not intended for production use, due to the large size. Instead, it can be used as a development aid to help identify/test icons.
For production use, it is highly recommended to use FlutterIcon to customize your icon pack, limiting your icon font to needed icons and building your own from custom SVG.
结论
因此,就性能和应用程序大小而言,最佳选择是使用 FlutterIcon,并且仅 select 您希望包含在应用程序中的图标。该包应该只用于在开发过程中试用哪个图标适合您的需求。
最后,如果您需要显示一些复杂的 SVG,而无法使用 FlutterIcon 准确导入,则应该主要使用包 flutter_svg。