Skip to content

gwhcn/flu_ext

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

flu_ext

Flutter控件的扩展函数 blog

使用方式

 dependencies:
    flu_ext:
        git: https://github.com/gwhcn/flu_ext.git

or

 dependencies:
    flu_ext: 0.0.1

已有函数

  1. BuildContext扩展
  • textTheme
  • accentTextTheme
  • primaryTextTheme
  • getArguments 是ModalRoute.of(this).settings?.arguments的缩写
  • getArgument 是ModalRoute.of(this).settings?.arguments[key]的缩写
  1. Widget扩展
  • Container
  • InkWell
  • Padding
  • Center
  • Align
  • Expanded
  • SafeArea
  • SliverToBoxAdapter
  • SliverPadding
  • SizedBox
  • GestureDetector
  • SingleChildScrollView
  • Flexible
  • DefaultTextStyle
  • intoRow 比较特殊,配合addWidget使用
  • intoColumn 比较特殊,配合addWidget使用
  • intoStack 比较特殊,配合addWidget使用
  1. TextSpan扩展
  • RichText
  1. String扩展
  • toInt() 为空或异常返回0
  • toIntOrNull() 为空或异常返回null
  • toDouble() 为空或异常返回0.0
  • toDoubleOrNull() 为空或异常返回null
  • isNull 为空返回true,对象为空,不会报空指针
  • isNotNull 为空返回false,对象为空,不会报空指针
  1. List扩展
  • isNull 对象为空,不会报空指针
  • isNotNull 对象为空,不会报空指针
  • get(index) list[index]会导致空指针, list?.get(index)避免空针
  1. Widgets类 使用方式 Widgets.addWidget(Text("A")) .addWidget(Text("B")) ....省略..... .intoRow()

Getting Started

This project is a starting point for a Dart package, a library module containing code that can be shared easily across multiple Flutter or Dart projects.

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

About

Flutter extension

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages