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

responsive_ui 封面
插件详情v3.0.1

responsive_ui

responsive ui Flutter 包帮助您创建响应式和嵌套响应式小部件。适用于 Android、iOS 和 Web,支持竖屏和横屏模式。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
481
喜欢数
104
Pub 分数
160

安装插件

flutter pub add responsive_ui

插件介绍

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

responsive_ui 包简化了在 Flutter 中跨多个平台和屏幕方向创建自适应布局的过程。它使开发者能够构建响应式且可嵌套的响应式组件,这些组件能自动适应不同的设备尺寸,包括 Android、iOS、Web、macOS、Windows 和 Linux。该包内置对纵向和横向模式的支持,确保无需手动处理媒体查询即可实现一致的用户体验。此包非常适合需要灵活、可扩展设计的应用程序。

适合场景

  • 跨平台移动和网页应用
  • 自适应布局适用于平板电脑和桌面设备
  • 嵌套的响应式组件
  • 根据屏幕尺寸动态调整用户界面
  • 支持多种方向的应用程序
  • 响应式仪表板

主要特点

  • 支持所有主要平台
  • 自动方向适应
  • 嵌套的响应式小部件结构
  • 简化响应式设计逻辑
  • 与媒体查询兼容
  • 跨设备的一致性用户界面

适合对象

  • 开发跨平台应用的开发者
  • 需要响应式布局但无需复杂代码的团队
  • 针对多种屏幕尺寸的项目
  • UI密集型应用
  • 需要可扩展性的设计系统

使用建议

  • 可能需要学习新的小部件模式
  • 超出内置响应式逻辑的自定义功能有限
  • 深层嵌套结构可能带来的性能影响
  • 未针对高度动态的运行时布局更改进行优化
  • 最适合静态或可预测的响应式需求

原始 README

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

Responsive UI

Pub

responsive_ui package helps you to create a responsive widget and Nested responsive widgets. Works on all Platforms.

Getting Started

Live demo : https://bharathraj-e.github.io/responsive_ui/ Have a look!

It works as same as Bootstrap / Materialize Row Column method, Splitting screen into 12 columns and placing widget by combining column based on screen size.

    Responsive(
        children: <Widget>[
            Div(
                division:Division(
                    colS: 5,
                    offsetL: 2,
                ),
                child: Card(child: Icon(Icons.game))
            ),
            Div(
                division:Division(
                    colS: 12,
                    colM: 6,
                    colL: 4,
                ),  
                child: Text('responsive ui')
            )          
        ]
    )

Widgets

The Responsive UI Package contains two simple widgets.

  1. Div()
  2. Responsive()

1. Div()

Arguments inputs if null / default to
child Widget required
division Division if null defaluts to Division()

Divison() intakes column sizes and offSets.

Arguments inputs if null / default to
colXS (int) 0-12 12
colS (int) 0-12 colXS value
colM (int) 0-12 ColS value
colL (int) 0-12 ColM value
colXL (int) 0-12 ColL value
offsetXS (int) 0-12 0
offsetS (int) 0-12 0
offsetM (int) 0-12 0
offsetL (int) 0-12 0
offsetXL (int) 0-12 0
(XS = Extra Small, S = small, M = medium, L = large, XL = Extra Large)
  • 0 - 0.0 width (gone) (replaced with SizedBox.shrink())

  • 12 - full width (provided by parent widget not screen width)

  • Parent widget should not be a horizontal scroll type widget

  • To offset, simply add offsetS / offsetM / offsetL to the Div() widget with colS / colM / colL respectively.

  • Offset works for their respective column sizes.

2. Responsive()

Responsive intakes List<Widget> or List<Div> with default column/screen size for each widget can be declared.

Arguments inputs if null / default
children List / List
not null / required / empty[]
alignment WrapAlignment WrapAlignment.start
runAlignment WrapAlignment WrapAlignment.start
crossAxisAlignment WrapCrossAlignment WrapCrossAlignment.start
runSpacing double 0.0

Note

  • Responsive widget is a Wrap widget.

  • Responsive & Div() widget need Finite width to work.

  • Div() works with vertical scroll not in horizontal scroll, as it calculations are base on width only.

  • Div() works as expected when it placed as a direct child of Responsive() widget's children.

  • Sum of the offset and the respective col should be <= to 12

Nested Responsive

Place a Responsive() widget into a Div().

The nested Responsive() widget takes the width provided by parent Div() widget and not the screen width

sample

Screen Types

Type Default Size
Xtra small < 375.0
Small 375.0 - 596.0
Medium 596.0 - 897.0
Large 897.0 - 1232.0
Xtra Large >1232.0

Override / Set your default size

Yes, now you can set your own breakpoints, that applies to all the Responsive & Div widgets.

void main() {
  // sample 1
  Responsive.setGlobalBreakPoints(400.0, 600.0, 997.0, 1380.0);
  // Sample 2 
  Responsive.setGlobalBreakPoints(0, 596.0, 897.0, 1232.0);
  // Since the first value is 0 : colXS is always neglected
  runApp(const MyApp());
}

responsive_ui is made simply using Wrap() and LayoutBuilder() with a bits of logics.



Buy Me A Coffee

所属分类

源码仓库

使用此插件的项目

暂无相关数据。