thresh library

MIT License

Copyright (c) 2020 ManBang Group Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Classes

ChannelMethod
DFStopAlwaysRenderController
DynamicAppRoot
App根节点
DynamicChannel
LayoutInfo
LifeCycleStep
生命周期类型
NoSplash
NoSplashFactory
组件点击后的纹理类型 用于关闭默认的水纹效果
Position
具有上下左右四个属性的位置类型
Range
数字范围类型 闭区间 Range(min: 0, max: 1) 表示 0, 1
RouteInfo
路由信息
StackList<T>
模拟栈列表并提供一些特殊的方法
TimerForJs
为 js 提供的定时器类型

Properties

dynamicApp ↔ _DynamicApp
read / write
dynamicChannel DynamicChannel
read / write

Functions

eventGlobalHandlerWithParam<T>({String pageName, String widgetId, String eventId, String type}) ParamGlobalHandler<T>
带参数的全局事件回调生成器
eventGlobalVoidHandler({String pageName, String widgetId, String eventId, String type}) VoidGlobalHandler
无返回值的全局事件回调生成器
initThreshApp({bool runApp = true, bool debugMode = false, String appName, Widget mainApp, String jsBundlePath, RouteInfo defaultRoute, NotFoundPageBuilder notFoundPage, OnWhiteScreen onWhiteScreen, PlaceholderBuilder placeholderPageBuilder, ErrorHandler errorHandler, int showWhiteScreenWhenWaitingForMillionSeconds = 3000}) Widget
初始化DynamicApp appName 应用名称 mainApp 作为Thresh App入口的flutter app,如果不存在则会直接调出Thresh App defaultRoute Thresh App的默认路由,会注入到js中 notFoundPage 404 页面 onWhiteScreen Thresh 中发生白屏时显示的页面 errorHandler Thresh 中发生异常时的处理方法 runApp 是否直接运行app,默认true,如果为false则需要手动调用runApp showWhiteScreenWhenWaitingForMillionSeconds 当 Thresh 初始页面等待时间超过该时间时会显示白屏页面,默认 3000ms,设为 null 或 0 时不会主动显示白屏页面,仅在非 debugMode 有效 debugMode 开发配置,线上环境不要使用
initThreshChannel() → void

Enums

CallType
DynamicFlutterErrorType
df 异常
TimerType

Typedefs

DynamicChannelFn = void Function(dynamic params)
ErrorHandler = void Function(DynamicFlutterError error)
异常处理
ModelBuilder = Widget Function(DynamicModel model, BuildContext context)
拦截器的构建方法类型
NotFoundPageBuilder = Widget Function(BuildContext context, Map<String, String> pathInfo)
404页面
OnWhiteScreen = Widget Function(dynamic reason)
白屏处理
ParamGlobalHandler<T> = void Function(T param)
带参数全局事件回调类型
PlaceholderBuilder = Widget Function(BuildContext context)
占位屏构造器
VoidGlobalHandler = void Function()
无返回值全局事件回调类型

Exceptions / Errors

DynamicFlutterError