搜索插件、代码仓与 APP 分类

插件详情v0.4.0+2

visibility_detector

一个检测其子部件可见性的控件,并通知回调。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
15.9万
喜欢数
1270
Pub 分数
140

安装插件

flutter pub add visibility_detector

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

visibility_detector 包提供了一个监视其子部件是否在屏幕上可见的部件。当子部件进入或退出视口时,它会触发回调,从而实现高效渲染和性能优化。非常适合用于延迟加载内容、动画或跟踪用户对特定 UI 元素的参与度。该包支持所有主要平台,包括 Android、iOS、Web、macOS、Windows 和 Linux,使其在跨平台应用中具有高度的通用性。

适合场景

  • 懒加载图像或列表
  • 跟踪用户对内容的参与度
  • 根据可见性优化动画
  • 减少离屏小部件的资源使用
  • 实现带有可见性检查的无限滚动

主要特点

  • 实时可见性检测
  • 跨平台兼容性
  • 可自定义的可见性阈值
  • 可见性更改回调
  • 轻量且高效

适合对象

  • 开发者优化应用性能
  • 包含大型可滚动列表的应用
  • 需要可见性反馈的交互式UI
  • 内容密集型应用,如新闻动态或图库
  • 需要对渲染时间进行精确控制的项目

使用建议

  • 如果在复杂树中过度使用,可能会影响性能
  • 需要仔细处理回调以避免内存泄漏
  • 可视性阈值设置可能需要针对不同用例进行调整
  • 在没有额外逻辑的情况下,不适合用于检测绝对屏幕位置
  • 限制在当前视口内的可见区域

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

Build

Flutter widgets

This repository contains the source code for various Flutter widgets that are developed by Google but not by the core Flutter team.

The product and source code here are neither endorsed by Google nor the Flutter team. They are mainly made available as a reference. Support is best-effort.

Packages

Package Description Version
flutter_simple_treeview A widget, that visualises a tree structure, where a node can be any widget. pub package
linked_scroll_controller A scroll controller that allows two or more scroll views to be in sync. pub package
scrollable_positioned_list A list with helper methods to programmatically scroll to an item. pub package
self_storing_input A set of input widgets that automatically save and load the entered value to a data store. pub package
visibility_detector A widget that detects the visibility of its child and notifies a callback. pub package

Issues

Please file any issues, bugs, or feature requests in the this repo.

Contributing

If you wish to contribute a change to any of the existing widgets in this repo, please review our contribution guide, and send a pull request.

所属分类

源码仓库

使用此插件的项目