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

auto_size_widget 封面
插件详情v0.0.4

auto_size_widget

一个可以拖动控件角落来调整子控件大小的 Flutter 小部件。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
153
喜欢数
38
Pub 分数
130

安装插件

flutter pub add auto_size_widget

插件介绍

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

auto_size_widget 包提供了一个 Flutter 小部件,可通过拖动角落实现子组件的动态调整大小,从而实现直观的布局调整。该包专为需要在应用中手动调整元素的交互式 UI 设计。它支持 Android、iOS、Web、macOS、Windows 和 Linux 等多个平台,适用于跨平台开发。它可无缝集成到现有的 Flutter 布局中,并通过直接操作提升用户体验。

适合场景

  • 交互式用户界面设计
  • 动态布局调整
  • 用户驱动的控件调整大小
  • 跨平台响应式界面
  • 原型化交互式布局
  • 实时UI自定义

主要特点

  • 角落拖拽调整大小功能
  • 跨平台兼容性
  • 与 Flutter 小部件的轻松集成
  • 支持所有主要平台
  • 所需设置最少
  • 响应式布局行为

适合对象

  • UI设计师原型设计交互布局
  • 开发可自定义仪表板的开发者
  • 需要手动调整小部件大小的应用
  • 跨平台应用程序与动态 UI
  • 带有互动元素的教育或创意工具

使用建议

  • 可能与其他手势检测器冲突
  • 复杂子组件带来的性能影响
  • 在嵌套布局中需要谨慎处理
  • 不适用于静态或只读UI
  • 仅限单子节点调整大小,无需额外逻辑
  • 触摸手势可能存在的可访问性挑战

原始 README

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

Auto Size Widget

A Flutter widget that can resize the child widget by dragging the widget corner.

Installation

  1. Add the latest version of the package to your pubspec.yaml (and run 'dart pub get'):
dependencies:
    auto_size_widget: ^0.0.3
  1. Import the package and use it in your Flutter app.
import 'package:auto_size_widget/auto_size_widget.dart';

Example

  1. To resize both the height and the width of the widget

initialWidth and initialHeight should be different from maxWidth and maxHeight respectively.

AutoSizeWidget(
  initialWidth: 120,
  initialHeight: 120,
  maxWidth: 320,
  maxHeight: 320,
  boxDecoration: BoxDecoration(
    border: Border.all(width: 1, color: Colors.grey),
    borderRadius: BorderRadius.circular(5)),
  child: Image.network(
    'https://docs.flutter.dev/assets/images/dash/early-dash-sketches2.jpg',
    fit: BoxFit.fill,
  ),
),
  1. To resize the height of the widget

initialWidth and maxWidth should be same to ensure that the width does not change on resize.

AutoSizeWidget(
  initialWidth: 250,
  initialHeight: 120,
  maxWidth: 250,
  maxHeight: 280,
  boxDecoration: BoxDecoration(
    border: Border.all(width: 1, color: Colors.grey),
    borderRadius: BorderRadius.circular(5),
  ),
  child: const SelectableText(
    "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum."
  ),
),           
  1. To resize the width of the widget

initialHeight and maxHeight should be same to ensure that the height does not change on resize.

AutoSizeWidget(
  initialWidth: 150,
  initialHeight: 200,
  maxWidth: 300,
  maxHeight: 200,
  boxDecoration: BoxDecoration(
    border: Border.all(width: 1, color: Colors.grey),
    borderRadius: BorderRadius.circular(5)),
  child: TextFormField(
    keyboardType: TextInputType.multiline,
    maxLines: 3 * 120,
    textAlign: TextAlign.start,
    decoration: const InputDecoration(
      focusedBorder: InputBorder.none,
      contentPadding:
        EdgeInsets.symmetric(vertical: 11, horizontal: 15),
      hintText: "Enter text here"
    ),
  ),
),                  

所属分类

源码仓库

使用此插件的项目

暂无相关数据。