el_flutter
library
Classes
AnsiColor
This class handles colorizing of terminal output.
B
BackgroundTransformer
The default Transformer for Dio .
BaseOptions
A set of base settings for each Dio().
BaseOptions and Options will be merged into one RequestOptions before
sending the requests. See Options.compose .
BoolObs
CancelToken
Controls cancellation of Dio 's requests.
DefaultRetryEvaluator
Del
Dio
Dio enables you to make HTTP requests easily.
DioMixin
El
ElAnchor
ElAnimatedColoredBox
动画颜色盒子
ElAnimatedDecoratedBox
动画装饰器盒子
ElAnimatedDefaultColor
ElAnimatedGrid
动画版本 Grid 小部件
ElAnimatedIconTheme
ElAnimatedInk
动画版本 Ink 小部件
ElAnimatedMaterial
动画版本 Material 小部件
ElAnimatedOffset
动画 Offset 偏移
ElAnimatedOverlayService
全局 overlay 基类,统一提供四个核心 API:
ElAnimatedOverlayWidget
动画 overlay 组件基类。
ElAnimatedOverlayWidgetState <T extends ElAnimatedOverlayWidget >
ElAnimatedRefreshProgressIndicator
动画刷新指示器
ElApp
Element 顶级小部件,它只构建组件库自身所必要的内容,你可以搭配任意顶级 App 构建应用:WidgetsApp 、MaterialApp 、CupertinoApp
ElAssert
ElBadge
ElBody
Element UI 主窗口
ElBox
盒子小部件
ElBoxStyle
ElBrightness
ElBrightnessSerialize
请求缓存额外配置数据
ElCacheImage
网络图片缓存类,此类相当于 NetworkImage ,你需要使用 Image 小部件加载它,
代码示例:
ElCacheInterceptor
ElChildIndex
一个功能小部件,让迭代的列表子元素确认自身所在的位置
ElChildSizeBuilder
ElCloseButton
ElCollapseAnimation
折叠动画
ElColorSerialize
ElColorTransition
ElConfigData
ElContainer
ElContainerState
ElCursorUtil
ElCustomMultiChildLayoutWidget
ElDateTimeSerialize
ElDebugWidget
调试小部件
ElDefaultColor
ElDialog2Service
ElDisposeNotify
当一个组件被 dispose 时,会通知侦听它的所有监听器
ElDivider
ElDividerTheme
ElDividerThemeData
ElDoubleQuit
ElDrag
监听拖拽事件小部件,对于嵌套拖拽引起的事件冒泡,需要分多种情况进行处理:
ElDraggable <T extends Object >
在长按拖拽的基础上新增一个 triggerOffset 属性,支持根据拖拽偏移来触发拖拽
ElDragPointerManager
ElDragStartDetails
ElDragStartListener
ElDragStyle
ElDurationSerialize
ElEditor
ElEditorState
ElEmptyWidget
不渲染任何内容的小部件,它的作用仅充当占位符
ElErrorInterceptor
错误拦截器,通常情况下此拦截器应当放在最后
ElEvent
构建通用的事件小部件,在 ElTap 的基础上加入 MouseRegion 、Focus 、Actions 组成完整的事件,
后代小部件可以通过 context 访问 hover、tap、focus 状态,例如:
ElEventStyle
ElFadeAnimation
ElFadeTap
ElFieldGenerator
ElFileUtil
ElFirstPaintCallback
ElFlutterUtil
Element UI 底部区域栏
ElForm
表单小部件,此组件拥有表单校验、数据重置功能,但不包含任何 UI 外观,
创建 model 时必须明确指定 Map<String, dynamic> 类型,否则无法通过 dart 类型校验:
ElFormController
ElFormModelValue <D >
ElFormRule
规则校验对象
ElFps
显示当前帧率小部件
ElGrid
网格布局容器,允许指定 width 、crossAxisCount 来确定网格布局,
如果都不指定,则取第一条数据的布局尺寸为基准,自动应用每个网格布局约束。
ElHookState
将 Hook 状态抽离到独立的 class 类中
ElHookWidget
ElHttp
对 Dio 进行一层简单包装,统一处理请求、响应拦截
ElHttpModel
默认的 Http 响应模型
ElIcons
Element UI 字体图标集合,总计 280 个图标,图标库的尺寸约为 55 kb,打包时会剔除未使用的图标
ElIconThemeTween
ElImageStorage
ElImplicitlyAnimatedWidget
Hook 版本的隐式动画小部件,它类似于官方提供的 ImplicitlyAnimatedWidget 小部件,
其子类需要实现 effects 、forEachTween 、buildAnimatedWidget 三个抽象方法
ElInputModelValue <D >
ElInputNumModelValue
ElJsonUtil
此工具类用于代码生成(fromJson),直接访问 Map 对象很容易出现低级类型转换错误,
例如:int is not String.
ElKeepAlive
切换多个子组件时会缓存旧的实例
ElKeepAliveElement
ElLabelModel <T >
ElLayoutData
ElLink
ElListenableBuilder <L extends Listenable , D >
ElListener
对原始指针进行一层浅封装,使其支持事件冒泡
ElListenerPointerManager
ElListenerStyle
ElLoading
Element 加载小部件,允许将任意小部件进行旋转处理
ElLoadingCloseModel
关闭 loading 文本描述对象
ElLoadingService
ElLocaleSerialize
ElLocalResampling
对局部组件应用触控重采样,此组件可以解决高刷安卓触控抖动问题(仅限安卓)
ElLogConfig
日志配置对象
ElLogInterceptor
日志拦截器
ElMaterialElColorSerialize
Material 颜色对象序列化。
菜单模型类
ElMessageService
Element UI 消息服务,它会在屏幕中上方显示一连串的消息,并支持合并相同类型的消息
ElModal
ElModalTransition
模态框动画
ElModalTransition2
ElModelGenerator
ElModelValue <D >
ElMultiDragGestureRecognizer
扩展延迟触发拖拽,新增拖拽触发偏移,此属性对桌面端更加友好
ElMultiElement
ElMultiWidget
布局、渲染多个子节点的小部件,该小部件是 MultiChildRenderObjectWidget 的简化版本,
它只使用 Key 来放置 children 插槽,在 ElRenderMultiBox 中,允许用户使用 key
来访问 children 实例化的 RenderObject 对象。
ElNestModel <T extends ElNestModel <T > >
嵌套数据模型
ElNestScrollWrapper
ElNotify
使用 Set 集合实现最简单的 Listenable 侦听器
ElNullElement
空 Element 实例,通常用于初始化 Element 数组
ElNullWidget
空 Widget 实例,通常用于在 build 条件分之中返回不可到达代码
ElOffsetSerialize
ElOffsetTransition
ElOffsetTween
ElOverlayHandle
与单次 createOverlayHandle / insertOverlay 一一对应。
通过 remove / hide / show 操作该层,无需暴露整型 id。
ElPaint
是否允许绘制子元素
ElPlatform
ElPointerFollower
将事件命中测试转移至 ElPointerTarget ,应用场景:
ElPointerTarget
创建一个代理命中测试小部件,它会收集后代 ElPointerFollower 的 RenderObject 对象,
然后在 hitTestChildren 方法中调用它们的命中测试,用于解决 hitTestSelf 被剔除的事件命中问题:
https://github.com/flutter/flutter/issues/75747
ElPopScope <T >
原生 PopScope 的变体,该小部件只执行最后一个拦截返回事件
ElPositioned
对 Positioned 进行增强,4 个方向值支持百分比字符串
ElProgress
ElPromptService
ElRangFormRule
范围区间规则
ElRebuildWidget <W extends Widget >
ElReg
常用的正则表达式
ElRenderKeepAlive
ElRenderMultiBox
多节点渲染对象,children 实例化的 RenderObject 对象会存放在 renderBoxMap 集合,
你可以通过 Key 访问目标渲染对象,然后需要自行实现 performLayout 、paint 、hitTestChildren 方法
ElRenderSecondChildBox
ElRenderStack
ElRenderVirtualScroll
请求携带的配置数据
ElRequiredFormRule
必填规则
ElResponsive
ElResponsiveData
响应式断点配置
ElRichText
Element 富文本小部件
ElRing
ElRouterService
ElSafeArea
使用 ElApp 所在的 context 访问 MediaQuery 对象填充安全边距,它与原生 SafeArea 的区别在于,
祖先使用 SafeArea 添加安全内边距会删除使用的内边距,这会导致后代组件可能无法正确添加安全边距。
ElScaleAnimation
ElScaleTap
ElScaleTransition
ElScroll
滚动小部件,它会一次性布局所有子项,但不会渲染可视窗口外的元素
ElScrollbar
ElScrollBehavior
Element 默认滚动配置
ElScrollControllerAttrModel
创建默认的滚动控制器所支持的参数模型
ElSecondChildElement
ElSecondChildWidget
ElSelectionArea
ElSelectionListener
ElSerialize <T >
对象序列化接口
ElSerializeModel <T >
数据模型序列化接口
ElSerialTaskQueue
串行任务队列
ElShortcut
Element UI 侧边栏
ElSingleAnimatedOverlayService
单实例:toast、loading、prompt 等,页面同时只保留一个 overlay。
ElSizeSerialize
ElSlideAnimation
ElSlideTransition
ElSmoothScrollController
ElSplitPane
Element UI 分割面板,划分的区域是以等比例进行的,同时分割面板支持无限嵌套
ElSplitPaneTheme
ElSplitPaneThemeData
ElSplitResizer
Element UI 拖拽分割器,该小部件通常用于分割页面布局,它内部会通过 Overlay 创建可交互的拖拽器,
所以当你创建拖拽页面尺寸的小部件时,你需要在外部嵌套一个局部 Overlay ,否则分割器所在的层级可能很高。
ElSplitResizerTheme
ElSplitResizerThemeData
ElStack
Stack 的变体,允许通过 index 来调整堆叠小部件的显示层级
ElStackParentData
ElPositioned 传递给 ElStack 的数据,它所定义的 4 个方向值,不仅支持传统的 num 类型,
还支持百分比字符串,例如 top: '100%' 表示浮动元素位于子元素的底部。
ElStopPropagation
ElStorage
一个简单的 key - value 本地存储类,在 web 端,它使用 localStorage 进行存储,在客户端则将其保存到文件
ElSwitcherAnimation
开关动画
ElTable
ElTableColumn
ElTap
在原始指针事件的基础上进行扩展,使其支持单击、双击、三击、右键、长按等功能
ElTapOutSide
ElTapStyle
ElThemeData
ElThemeGenerator
ElToastService
Toast 服务:
ElToolbar
工具栏,它位于布局中的最左侧或最右侧,
ElTree
ElTreeModel
ElTreeProps
自定义 Map 数据结构 key 关键字
ElTreeTheme
ElTreeThemeData
ElTriangle
ElVirtualScroll <D >
虚拟滚动小部件,该小部件可以高效地渲染大量数据
ElVirtualScrollController
ElVirtualScrollElement <D >
ElZoomAnimation
ElZoomTransition
ErrorInterceptorHandler
The handler for interceptors to handle error occurred during the request.
FontModel
FormData
A class to create readable "multipart/form-data" streams.
It can be used to submit forms and file uploads to http server.
FusedTransformer
A Transformer that has a fast path for decoding UTF8-encoded JSON.
If the response is utf8-encoded JSON and no custom decoder is specified in the RequestOptions , this transformer
is significantly faster than the default SyncTransformer and the BackgroundTransformer .
This improvement is achieved by using a fused Utf8Decoder and JsonDecoder to decode the response,
which is faster than decoding the utf8-encoded JSON in two separate steps, since
Dart uses a special fast decoder for this case.
See https://github.com/dart-lang/sdk/blob/5b2ea0c7a227d91c691d2ff8cbbeb5f7f86afdb9/sdk/lib/_internal/vm/lib/convert_patch.dart#L40
GlobalFontPreset
assets资产包提供的预设字体
GlobalFontUtil
Flutter字体工具类
H1
H2
H3
H4
H5
H6
The headers class for requests and responses.
HttpClientAdapter
HttpAdapter is a bridge between Dio and HttpClient .
I
Interceptor
Interceptor helps to deal with RequestOptions , Response ,
and DioException during the lifecycle of a request
before it reaches users.
Interceptors
A Queue-Model list for Interceptor s.
InterceptorsWrapper
A helper class to create interceptors in ease.
ListObs <E >
ListParam <T >
Indicates a param being used as queries or form data,
and how does it gets formatted.
LogInterceptor
LogInterceptor is used to print logs during network requests.
It should be the last interceptor added,
otherwise modifications by following interceptors will not be logged.
This is because the execution of interceptors is in the order of addition.
MapObs <K , V >
MultipartFile
An upload content that is a part of MultipartRequest.
This doesn't need to correspond to a physical file.
Obs <T >
响应式变量对象,在 ObsBuilder 中使用会自动建立依赖,当变量更新时会自动重建 UI:
ObsBuilder
Options
The configuration for a single request.
BaseOptions and Options will be merged into one RequestOptions before
sending the requests. See Options.compose .
P
QueuedInterceptor
Interceptor in queue.
QueuedInterceptorsWrapper
A helper class to create QueuedInterceptor in ease.
RedirectRecord
A record that records the redirection happens during requests,
including status code, request method, and the location.
RequestInterceptorHandler
The handler for interceptors to handle before the request has been sent.
RequestOptions
The internal request option class that is the eventual result after
BaseOptions and Options are composed.
Response <T >
The Response class contains the payload (could be transformed)
that respond from the request, and other information of the response.
ResponseBody
The response wrapper class for adapters.
ResponseInterceptorHandler
The handler for interceptors to handle after respond.
RetryInterceptor
An interceptor that will try to send failed request again
SetObs <E >
ShortcutUtil
SyncTransformer
If you want to custom the transformation of request/response data,
you can provide a Transformer by your self, and replace
the transformer by setting the Dio.transformer .
Transformer
Transformer allows changes to the request/response data before
it is sent/received to/from the server.
Properties
atDrawFrame
→ bool
当框架正在处理下一帧持久回调时(build/layout),它将返回 true,当你在此阶段调用 setState 时,
Flutter 框架将会抛出异常:setState() or markNeedsBuild() called during build.
no setter
faker
→ Faker
final
localStorage
→ ElStorage
默认的本地存储对象
no setter
Functions
defaultDioExceptionReadableStringBuilder (DioException e )
→ String
The default implementation of building a readable string of DioException .
elCompareMatch (ElCompareType compareType , num result )
→ bool
将 a - b 的差值与 compareType 对应关系匹配。
isRetryable (int statusCode )
→ bool
Be careful: this method do not
take into account RetryInterceptor.retryableExtraStatuses
nextFrame (VoidCallback fun )
→ void
注册下一帧回调函数,此函数会主动请求下一帧
nextTick (VoidCallback fun )
→ void
将回调函数添加到下一帧执行,注意:如果框架没有触发帧重建,那么注册的回调将不会执行
safeCallback (VoidCallback fun )
→ void
安全地执行回调函数,在框架 build 期间,你不可以调用 setState、markNeedsBuild 之类重建方法,
此函数会判断当前 Flutter 框架是否正在执行重建,若为 true 则会将回调安排到帧后运行
useAddListener (ValueListenable listenable , VoidCallback callback )
→ void
给响应式变量添加监听函数
useAnimationStatusListener (AnimationController controller , AnimationStatusListener callback )
→ void
给动画控制器添加状态监听
useCurvedAnimation ({required Animation <double > parent , required Curve curve , Curve ? reverseCurve })
→ CurvedAnimation
创建 CurvedAnimation 动画 Hook
useDidUpdate <W extends Widget > (void fun (W oldWidget ), W widget )
→ void
当 Widget 发生更新时执行,此 hook 会传递旧 Widget 实例
useGlobalScrollController ({ScrollController ? controller , String ? cacheKey })
→ ScrollController
访问全局默认的滚动控制器,由 El 全局服务提供
useHookState <T extends ElHookState > (T builder (), {bool ignoreListener = false })
→ T
页面局部状态 Hook,类似于 useState,只不过将状态抽离到独立的 class 中,示例:
useInterval (VoidCallback fun , int wait )
→ Timer
定时器钩子,当组件被卸载时会自动取消
useMounted (VoidCallback fun )
→ void
在 build 完成后执行(只触发一次)
useObs <T > (T value , {ValueChanged <T > ? onChanged , bool ? immediate , bool ? ignoreBuilder , String ? cacheKey , ElSerialize ? serialize , Duration ? expire })
→ Obs <T >
支持在 HookWidget 中使用 Obs 响应式变量
useUpdateEffect (VoidCallback ? effect (), [List <Object ? > ? keys ])
→ void
与 useEffect 完全一样,只不过此 hook 的回调函数不会在初始化时执行
useWatch <T > (ValueListenable <T > listenable , ElUpdateCallback <T > watchFun )
→ void
监听响应式变量发生变化:
Typedefs
DefaultTransformer
= SyncTransformer
DioError
= DioException
DioError describes the exception info when a request failed.
DioErrorType
= DioExceptionType
Deprecated in favor of DioExceptionType and will be removed in future major versions.
DioExceptionReadableStringBuilder
= String Function(DioException e )
The readable string builder's signature of
DioException.readableStringBuilder .
DioMediaType
= MediaType
The type (alias) for specifying the content-type of the MultipartFile.
ElAnimatedOverlayBuilder
= Widget Function(ElOverlayHandle handle )
ElColorBuilder
= Color Function(BuildContext context )
颜色构建
ElFontWeightBuilder
= FontWeight Function([FontWeight weight ])
默认的字重构建器
ElGestureDragStartCallback
= void Function(ElDragStartDetails details )
ElGlobalAnimation
= (Duration , Curve )
全局主题动画
ElLogFunction
= void Function(dynamic message , {ElLogConfig ? config , dynamic title })
ElMessageBuilder
= Widget Function(BuildContext context , dynamic content )
ElPromptAction
= FutureOr <bool > Function()
ElPromptInputAction
= FutureOr <bool > Function(String value )
ElScrollbarBuilder
= Widget Function(BuildContext context , ScrollController controller , Widget child )
默认的滚动条小部件构建器
ElScrollControllerBuilder
= ScrollController Function([ElScrollControllerAttrModel model ])
默认的滚动控制器构建器
ElShortcutHandler
= bool Function()
快捷键处理,如果返回 true,那么将阻止快捷键冒泡
ElTweenVisitor
= void Function(String key , dynamic targetValue , Tween <Object ? > tween )
ElUpdateCallback <T >
= bool ? Function(T newValue , T oldValue )
新、旧值回调
ElWidgetBuilder
= Widget Function(BuildContext context , Widget child )
小部件构建器
The signature that iterates header fields.
InterceptorErrorCallback
= void Function(DioException error , ErrorInterceptorHandler handler )
The signature of Interceptor.onError .
InterceptorSendCallback
= void Function(RequestOptions options , RequestInterceptorHandler handler )
The signature of Interceptor.onRequest .
InterceptorSuccessCallback
= void Function(Response response , ResponseInterceptorHandler handler )
The signature of Interceptor.onResponse .
JsonDecodeCallback
= FutureOr Function(String )
The callback definition for decoding a JSON string.
JsonEncodeCallback
= FutureOr <String > Function(Object )
The callback definition for encoding a JSON object.
ProgressCallback
= void Function(int count , int total )
The type of a progress listening callback when sending or receiving data.
RequestEncoder
= FutureOr <List <int > > Function(String request , RequestOptions options )
The type of a request encoding callback.
ResponseDecoder
= FutureOr <String ? > Function(List <int > responseBytes , RequestOptions options , ResponseBody responseBody )
The type of a response decoding callback.
RetryEvaluator
= FutureOr <bool > Function(DioException error , int attempt )
UpdateCustomLayoutSize
= void Function(Size size )
更新自定义布局尺寸回调函数
ValidateStatus
= bool Function(int ? status )
The type of a response status code validate callback.