跳至主要內容
  • Hostloc 空間訪問刷分
  • 售賣場
  • 廣告位
  • 賣站?

4563博客

全新的繁體中文 WordPress 網站
  • 首頁
  • 发现了一个解决 Flutter 嵌套过深的包
未分類
19 4 月 2021

发现了一个解决 Flutter 嵌套过深的包

发现了一个解决 Flutter 嵌套过深的包

資深大佬 : hxse 11

https://pub.dev/packages/styled_widget

native flutter

Align(   alignment: Alignment.center,   child: DecoratedBox(     decoration: BoxDecoration(       color: Colors.amber,     ),     child: Padding(       padding: EdgeInsets.all(10),       child: Text('some text'),     ),   ), ); 

styled_widget

Text('some text')   .padding(all: 10)   .backgroundColor(Colors.amber)   .alignment(Alignment.center); 

看起来清爽多了, 大家觉得怎么样?

大佬有話說 (1)

  • 資深大佬 : AoEiuV020

    链式调用确实比较提倡,但对应层级太复杂的情况,做成链式调用会出现方法太多的问题,也很丑,

文章導覽

上一篇文章
下一篇文章

AD

其他操作

  • 登入
  • 訂閱網站內容的資訊提供
  • 訂閱留言的資訊提供
  • WordPress.org 台灣繁體中文

51la

4563博客

全新的繁體中文 WordPress 網站
返回頂端
本站採用 WordPress 建置 | 佈景主題採用 GretaThemes 所設計的 Memory
4563博客
  • Hostloc 空間訪問刷分
  • 售賣場
  • 廣告位
  • 賣站?
在這裡新增小工具