BaseListVM<T> class abstract

Inheritance
Implementers

Constructors

BaseListVM.new()

Properties

appbarController AppbarController
finalinherited
context BuildContext?
上下文
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
itemListController SimpleGetxController<List<T>>
no setter
onDismissLoading OnDismissLoading?
getter/setter pairinherited
onShowLoading OnShowLoading?
getter/setter pairinherited
pageLifecycle PageLifecycle
页面生命周期
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stateController ViewStateController
finalinherited
timers List<Timer>
finalinherited

Methods

cancelRequest(CancelToken cancelToken) → void
取消某个网络请求
inherited
checkHasPermissions(List<Permission> permissions) Future<bool>
检查是否有权限
inherited
createApi<API extends BaseApi>(API api) → API
创建api,这个方法主要是将api绑定到VM中,VM销毁时会去cancel其中的未完成请求
inherited
createLifecycleTimer(Duration duration, void callback()) Timer
创建具备ViewModel生周期自动销毁的Timer
inherited
dismissLoading() → void
隐藏loading弹框
inherited
download({required String urlPath, required dynamic filename, bool isNeedLoading = true, bool isLoadingCancelable = false, String? loadingTxt, Map<String, dynamic>? params, Map<String, dynamic>? body, Options? options, CancelToken? cancelToken, OnSuccess<File>? onSuccess, ProgressCallback? onProgress, OnFailed? onFailed}) → void
下载文件
inherited
getDelayCreateDuration() Duration
inherited
getString(MultiString multiString) String
根据MultiString获取字符串
inherited
gridBuilder({required int crossAxisCount, required ChildItemBuilder<T> childItemBuilder, OnItemClick<T>? onItemClick, OnItemDoubleClick<T>? onItemDoubleClick, OnItemLongClick<T>? onItemLongClick, ScrollController? scrollController, double mainAxisSpacing = 0.0, double crossAxisSpacing = 0.0, EdgeInsetsGeometry? padding, ScrollPhysics? physics, bool shrinkWrap = false}) Widget
快速构建GridView
hideKeyboard() → void
隐藏输入法
inherited
init(BuildContext context, PageLifecycle pageLifecycle) → void
inherited
isFinishing() bool
widget生命周期是否没开始或已经结束
inherited
listBuilder({required ChildItemBuilder<T> childItemBuilder, OnItemClick<T>? onItemClick, OnItemDoubleClick<T>? onItemDoubleClick, OnItemLongClick<T>? onItemLongClick, ScrollController? scrollController, EdgeInsetsGeometry? padding, ScrollPhysics? physics, bool shrinkWrap = false}) Widget
快速构建ListView
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyDataChanged() → void
通知列表数据变动
onBackPressed() Future<bool>
返回按钮点击 注意,如果是带有BasePage嵌套BasePage的情况,子BasePage需要override并不执行pop操作 以上提到的BasePage是指BasePageBasePage的子类
inherited
onCreate() → void
onCreate生命周期
inherited
onDelayCreate() → void
inherited
onDestroy() → void
onDestroy生命周期
inherited
onPause() → void
onPause生命周期
inherited
onResume() → void
onResume生命周期
inherited
onRetry() → void
重试按钮被点击
inherited
pop<T extends Object?>({T? result, bool cantPopExit = true}) → void
页面退出,dialog的dismiss cantPopExit 如果不可pop的时候是否退出当前APP,默认是true
inherited
push<T>(Widget page, {bool finishCurr = false}) Future<T?>
跳转页面 page 需要跳转的页面 finishCurr 是否需要结束当前页面,注意确认当前页面是否可退出
inherited
refreshData({bool isClear = true, List<T>? dataList}) → void
刷新列表数据
request<T>({required Future<BaseResp<T>> future, bool isNeedLoading = true, bool isLoadingCancelable = false, String? loadingTxt, bool isShowErrorToast = false, bool isShowErrorDetailToast = false, OnSuccess<T>? onSuccess, OnFailed? onFailed}) → void
同步回调的网络请求
inherited
requestPermission(PermissionReq permissionReq) → void
请求权限
inherited
requestWithState<T>({required Future<BaseResp<T>> future, String? loadingTxt, bool isShowErrorDetail = false, String? retryTxt, OnSuccess<T>? onSuccess, OnFailed? onFailed}) → void
结合多状态UI的网络请求
inherited
showContentState() → void
展示内容状态的UI
inherited
showEmptyState({String? emptyTxt, String? retryTxt}) → void
展示空状态的UI
inherited
showErrorState({String? errorTxt, String? retryTxt}) → void
展示错误状态的UI
inherited
showKeyboard(FocusNode focusNode) → void
展示输入法
inherited
showLoading({String? loadingTxt, Color? barrierColor, bool barrierDismissible = false, bool cancelable = false}) → void
展示loading弹框 barrierColor 蒙层颜色 barrierDismissible 点击蒙层是否可以消失,默认不行 cancelable 返回按钮或者手势是否可以dismiss,默认不行
inherited
showLoadingState({String? loadingTxt}) → void
展示loading状态的UI
inherited
showToast(String? msg) → void
展示toast
inherited
staggeredGridBuilder({required int crossAxisCount, required StaggeredGridTileBuilder<T> staggeredGridTileBuilder, required ChildItemBuilder<T> childItemBuilder, OnItemClick<T>? onItemClick, OnItemDoubleClick<T>? onItemDoubleClick, OnItemLongClick<T>? onItemLongClick, ScrollController? scrollController, double mainAxisSpacing = 0.0, double crossAxisSpacing = 0.0, EdgeInsetsGeometry? padding, ScrollPhysics? physics}) Widget
快速构建存在item占不同列数的GridView,注意该方法不使用数据量特别多的情况
toString() String
A string representation of this object.
inherited
waterfallBuilder({required SliverSimpleGridDelegate gridDelegate, required ChildItemBuilder<T> childItemBuilder, OnItemClick<T>? onItemClick, OnItemDoubleClick<T>? onItemDoubleClick, OnItemLongClick<T>? onItemLongClick, ScrollController? scrollController, double mainAxisSpacing = 0.0, double crossAxisSpacing = 0.0, EdgeInsetsGeometry? padding, ScrollPhysics? physics, bool shrinkWrap = false}) Widget
快速构建瀑布流

Operators

operator ==(Object other) bool
The equality operator.
inherited