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

插件详情v1.0.0

storyboard

通过将小部件与您的应用隔离,加快 Flutter 用户界面的迭代开发。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
56
喜欢数
27
Pub 分数
120

安装插件

flutter pub add storyboard

插件介绍

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

Storyboard 是一个 Flutter 包,通过允许开发者将单个组件与主应用隔离并独立预览,从而加快用户界面的迭代开发。它支持以组件为中心的 UI 开发,使设计、测试和优化 UI 组件变得更加容易。Storyboard 支持所有主要平台——Android、iOS、Web、macOS、Windows 和 Linux,为注重一致性和快速原型设计的团队简化了 UI 工作流程。该包与 Flutter 的热重载无缝集成,提升了设计迭代过程中的生产力。

适合场景

  • UI 组件测试
  • 快速原型设计
  • 设计系统开发
  • 协作式UI评审
  • 孤立的 widget 调试

主要特点

  • 小部件隔离
  • 实时预览
  • 跨平台支持
  • 热重载集成
  • 可自定义的故事视图

适合对象

  • UI 设计师
  • 前端开发人员
  • 设计系统团队
  • Flutter 初学者
  • 敏捷开发团队

使用建议

  • 每个小部件都需要进行设置
  • 不适用于生产构建
  • 仅限用户界面相关的流程
  • 可能增加项目复杂性
  • 仅在开发中使用

原始 README

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

Storyboard

pub package

Faster iterative development of Flutter user interfaces by isolating widgets from your app, inspired by Storybook. Stage a collection of Widgets outside their normal app context. By repeating the same widget in various configurations or states in a single view, the effect of code changes to the Widget can quickly be assessed. This is especially useful for cosmetic changes, but also effective for behavior changes.

Adding Stories

The first step is to build a few stories, from which your Storyboard will be composed. Building stories is done by providing concrete children of the Story abstract class, e.g.

import 'package:mypackage/contacts.dart';
import 'package:storyboard/storyboard.dart';

class ContactsListStory extends Story {

  @override
  List<Widget> get storyContent {
    return [ContactsList()];
  }
}

At a minimum, the abstract storyContent getter, which provides the widgets to be observed, must be overridden. Overriding the title will alter the heading presented for the story. Overriding isFullScreen (or implementing FullScreenStory) will instruct the Widget to render itself within a new Navigator route without scaffolding.

The build method itself can also be overridden to completely customize the display of the Story.

Building a Storyboard

A storyboard is little more than a collection of stories.

import 'package:flutter/material.dart';
import 'package:storyboard/storyboard.dart';
import 'stories/contacts_story.dart';

void main() {
  runApp(MaterialApp(
      home: Storyboard([
        ContactsListStory(),
        ContactsCardStory(contact: Contact("alice")),
        ContactsCardStory(contact: Contact("bob")),
        ContactsCardStory(contact: Contact("charlie")),
  ])));
}

Or more simply, run the convenience StoryboardApp directly.

void main() {
  runApp(StoryboardApp([
    ContactsListStory(),
    ContactsCardStory(contact: Contact("alice")),
    ContactsCardStory(contact: Contact("bob")),
    ContactsCardStory(contact: Contact("charlie")),
  ]));
}

Further reading

See the article Storyboarding Widgets in Flutter.

所属分类

依赖

依赖清单 1 项

源码仓库

使用此插件的项目

暂无相关数据。