BasePageListVM<T, E> class abstract

Inheritance

Constructors

BasePageListVM.new()

Properties

appbarController AppbarController
finalinherited
context BuildContext?
上下文
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
itemListController SimpleGetxController<List<T>>
no setterinherited
onDismissLoading OnDismissLoading?
getter/setter pairinherited
onShowLoading OnShowLoading?
getter/setter pairinherited
page int
no setter
pageLifecycle PageLifecycle
页面生命周期
no setterinherited
refreshController → EasyRefreshController
final
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
createPageResult(BaseResp<E> resp) PageResult<T>?
数据加载成功之后构建本次加载的列表数据,抽象方法,由子类具体实现
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
easyRefreshBuilder({required Widget child}) → EasyRefresh
快速构建下拉刷新控件
firstLoad({bool? multiStateLoading, bool? dialogLoading, String? loadingTxt}) → void
首次加载,主要用于进入页面时即触发数据加载,且不想要下拉刷新的动作
getDelayCreateDuration() Duration
inherited
getPageSize() int
每页数量,默认为0,子类可override重新定义
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
inherited
hideKeyboard() → void
隐藏输入法
inherited
init(BuildContext context, PageLifecycle pageLifecycle) → void
inherited
initPage() int
开始的页码,默认为0,子类可override重新定义
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
inherited
loadData(int page, int pageSize) Future<BaseResp<E>>
加载数据的具体过程,抽象方法,由子类具体实现
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyDataChanged() → void
通知列表数据变动
inherited
onBackPressed() Future<bool>
返回按钮点击 注意,如果是带有BasePage嵌套BasePage的情况,子BasePage需要override并不执行pop操作 以上提到的BasePage是指BasePageBasePage的子类
inherited
onCreate() → void
onCreate生命周期
inherited
onDelayCreate() → void
inherited
onDestroy() → void
onDestroy生命周期
inherited
onLoadMore() → void
加载更多操作,主要时给EasyRefresher绑定
onPause() → void
onPause生命周期
inherited
onRefresh() → void
刷新操作,主要时给EasyRefresher绑定
onResume() → void
onResume生命周期
inherited
onRetry() → void
重试按钮被点击
override
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
刷新列表数据
inherited
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,注意该方法不使用数据量特别多的情况
inherited
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
快速构建瀑布流
inherited

Operators

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