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

插件详情v1.0.4

constrained_scrollable_views

一组有用的可滚动视图包括 ConstrainedScrollView、ScrollableColumn 和 ScrollableRow。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
110
喜欢数
44
Pub 分数
160

安装插件

flutter pub add constrained_scrollable_views

插件介绍

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

一个 Flutter 包,提供专门的可滚动视图,如 ConstrainedScrollView、ScrollableColumn 和 ScrollableRow。这些组件在受限布局内提供了对滚动行为的增强控制,确保内容在定义的边界内显示,同时保持流畅滚动。非常适合需要响应式、灵活的滚动容器,并具有可预测的尺寸和对齐方式的 UI。

适合场景

  • 创建响应式可滚动布局
  • 构建受约束的垂直或水平列表
  • 在固定宽度容器中实现可滚动区域
  • 跨多个平台设计自适应UI
  • 管理嵌套滚动行为
  • 优化复杂控件中的布局性能

主要特点

  • 支持垂直和水平滚动
  • 在滚动时强制执行大小约束
  • 提供内置的对齐和填充选项
  • 与现有的 Flutter 布局无缝集成
  • 提供轻量级、专注的功能
  • 确保跨平台的一致性行为

适合对象

  • 开发响应式 UI 的开发者
  • 需要精确滚动控制的团队
  • 具有复杂嵌套滚动结构的项目
  • 跨平台应用程序,适用于多种设备
  • 寻求可预测滚动行为的UI设计师

使用建议

  • 仅限可滚动容器使用场景
  • 不替换完整的滚动视图自定义
  • 需要了解 Flutter 的布局系统
  • 最适合特定受限场景
  • 对于简单的可滚动需求,可能具有最小的开销

原始 README

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

Constrained Scrollable Views

Pub style: very good analysis License: MIT

Set of useful scrollable views includes ConstrainedScrollView, ScrollableColumn, and ScrollableRow.

  • ConstrainedScrollView is a combination of LayoutBuilder and SingleChildScrollView.
  • ScrollableColumn is Column wrapped by ConstrainedScrollView.
  • ScrollableRow is Row wrapped by ConstrainedScrollView.

Usage

Example of using ConstrainedScrollView:

ConstrainedScrollView(
  padding: const EdgeInsets.all(8),
  physics: const BouncingScrollPhysics(),
  constraintsBuilder: (constraints) => BoxConstraints(
    minWidth: constraints.maxWidth,
    minHeight: constraints.maxHeight,
  ),
  child: const Center(
    child: Text('ScrollView value'),
  ),
)

Example of using ScrollableColumn:

ScrollableColumn(
  padding: const EdgeInsets.all(8),
  physics: const BouncingScrollPhysics(),
  constraintsBuilder: (constraints) => BoxConstraints(
    minHeight: constraints.maxHeight,
  ),
  children: [
    for (var i = 0; i <= 100; i++)
      Padding(
        padding: const EdgeInsets.all(4),
        child: Text('Column value: $i'),
      ),
  ],
)

Example of using ScrollableRow:

ScrollableRow(
  padding: const EdgeInsets.all(8),
  physics: const BouncingScrollPhysics(),
  constraintsBuilder: (constraints) => BoxConstraints(
    minWidth: constraints.maxWidth,
  ),
  children: [
    for (var i = 0; i <= 100; i++)
      Padding(
        padding: const EdgeInsets.all(4),
        child: Text('Row value: $i'),
      ),
  ],
)

所属分类

源码仓库

使用此插件的项目

暂无相关数据。