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

插件详情v2.4.3

niku

用于使用类似 SwiftUI 的模式来设置 Widget 样式属性构建器

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
535
喜欢数
69
Pub 分数
130

安装插件

flutter pub add niku

插件介绍

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

Niku 是一个 Flutter 包,提供类似 SwiftUI 的属性构建器模式来设置控件样式,使定义 UI 布局时语法更加简洁易读。它允许开发者流畅地链式调用样式属性,减少样板代码并提高代码可维护性。支持所有主要平台,Niku 通过提供类似于 SwiftUI 语法的声明式控件样式方法,提升了开发体验。该包可无缝集成到现有的 Flutter 项目中。

适合场景

  • 使用最少的代码构建响应式 UI
  • 简化复杂的 widget 样式
  • 创建可重用的 UI 组件
  • 在大型项目中提高代码可读性
  • UI 布局的快速原型设计

主要特点

  • 类似 SwiftUI 的流畅 API
  • 基于属性的样式构建器
  • 跨平台兼容性
  • 最小化样板代码
  • 可扩展且可组合

适合对象

  • 寻求 SwiftUI 风格语法的开发者
  • 注重简洁清晰的UI代码的团队
  • 需要快速UI开发的项目
  • 熟悉函数式 UI 模式的 Flutter 开发人员

使用建议

  • 新用户可能需要一定的学习曲线
  • 与核心 Flutter 相比,文档有限
  • 链式调用可能带来的性能开销
  • 不是标准 Flutter 小部件的替代品
  • 最适合优先考虑UI清晰度的项目

原始 README

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

Discord Shield

Niku

Create Flutter UI, easier, faster, smarter

Fluently developing without headache and Nested Hell.

korone-drake-format

Why

Recommended: See why people choose and how it get along with your codebase in the documentation

Styling in Flutter is complex and verbose.

Developers have to describe every styling detail to Widget. It’s like low-level programming UI, having to adapt between property is hard when some are more complex than others, for instance, MaterialStateProperty.

When the codebase gets more complex, the syntax of Flutter itself is too verbose, nested than it should be, result being hard to maintain mostly known as Nested Hell.

Niku helps to solve the problem by providing a cascade notation to style widget. Exposing the same naming convention, shorten property, parent builder and style extraction.

Providing a smoother, shorter yet, more straightforward and maintainable way to compose styling in Flutter.

Documentation

Documentation for v2 can be found on niku.saltyaom.com

License

Niku is MIT Licensed.

Maintainers

所属分类

依赖

依赖清单 1 项

源码仓库

使用此插件的项目