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

插件详情v1.0.0

flextras

一组带有额外功能的 Flex 小部件(Columns 和 Rows)。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
9130
喜欢数
143
Pub 分数
150

安装插件

flutter pub add flextras

插件介绍

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

Flextras 是一个 Flutter 包,通过添加额外功能扩展了标准 Column 和 Row 小部件的功能,以实现更灵活、更强大的布局管理。它提供了对对齐、间距和响应式行为的增强控制,使创建复杂且自适应的 UI 变得更加容易。专为寻求超越内置 Flex 小部件定制能力的开发者设计,Flextras 可无缝集成到现有的 Flutter 项目中。该包支持所有主要平台,包括移动设备、网页和桌面端,确保在各种设备上行为一致。

适合场景

  • 创建响应式布局
  • 使用动态间距构建复杂的用户界面
  • 提高对齐精度
  • 为多种屏幕尺寸设计可适应的界面
  • 简化重复的布局模式

主要特点

  • 扩展对齐选项
  • 动态间距控制
  • 响应式布局辅助工具
  • 跨平台一致性
  • 与现有 Flutter 代码的轻松集成

适合对象

  • Flutter 开发人员构建复杂布局
  • 优先考虑跨平台UI一致性
  • 需要对小部件排列进行细粒度控制的项目

使用建议

  • 需要熟悉 Flutter 的布局系统
  • 可能为简单布局增加开销
  • 最适合具有高级布局需求的项目

原始 README

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

tests

flextras

A collection of Columns and Rows with extra functionality:

  • PaddedColumn / PaddedRow - Wraps a column/row in padding
  • SeparatedColumn / SeparatedRow - Insert any widget between each child
  • ExpandedScrollingColumn / ExpandedScrollingRow - Allow a column to hold Expandable children, while still scrolling if it needs to.

🔨 Installation

dependencies:
  flextras: ^0.0.1
⚙ Import
import 'package:flextras/flextras.dart';

🕹️ Usage

PaddedContainer and PaddedRow

A simple combination of Padding and Column/Row, as is often needed. Very simple, but saves a few lines in your tree:

return PaddedColumn(
    padding: EdgeInsets.all(20),
    children: [ ... ]
)
SeparatedColumn and SeparatedRow

Often you want to place a divider between the elements of a Column or Row. Use the separatorBuilder method to do so easily:

return SeparatedColumn(
    // 10px gap between each element
    separatorBuilder: () => SizedBox(height: 10),
    children: [ ... ]
)
ExpandedScrollingColumn and ExpandedScrollingRow

Solves a common use case where you want to have some expanding content, that can also begin scrolling if it runs out of room.

Normally, if you do something like this it will throw a layout error:

SingleChildScrollView(
    child: Column(
        children: [
            Expanded(child: ...) // This tries to expand to infinity :(
        ]
    )
)

ExpandedScrollingColumn fixes this by using the content's natural height, or the height of the parent view, whichever is greater.

// This will expand vertically to fill the parent, but begin scrolling when it has to
ExpandedScrollingColumn(
    children: [
        Expanded(child: Container(height: 400)),
    ]
)

🐞 Bugs/Requests

If you encounter any problems please open an issue. If you feel the library is missing a feature, please raise a ticket on Github and we'll look into it. Pull request are welcome.

📃 License

MIT License

所属分类

源码仓库

使用此插件的项目