ffWidget method

  1. @override
Widget ffWidget(
  1. BuildContext ctx,
  2. Widget child,
  3. FFPageStatus status
)
override

添加刷新组件

Implementation

@override
Widget ffWidget(BuildContext ctx, Widget child, FFPageStatus status) {

  refreshController = refreshMap[status]!;
  bool enablePullUp = ffCanRefreshFoot() ?? false;
  if (status == FFPageStatus.noData || status == FFPageStatus.netError) {
    enablePullUp = false;
  }
  return Container(
    child: SmartRefresher(
      enablePullDown: ffCanRefreshHead() ?? false,
      enablePullUp: enablePullUp,
      //header: ClassicHeader(),
      header: ClassicHeader(
        failedIcon: Icon(Icons.error, color: Colors.white),
        completeIcon: Icon(Icons.done, color: Colors.white),
        idleIcon: Icon(Icons.arrow_downward, color: Colors.white),
        releaseIcon: Icon(Icons.refresh, color: Colors.white),
        textStyle: TextStyle(color: Colors.white),
        refreshingIcon: SizedBox(
          width: 20.0,
          height: 20.0,
          child: FFPlatform.isIOS == true
              ? CupertinoActivityIndicator(color: Colors.white)
              : CircularProgressIndicator(
                  strokeWidth: 2.0, color: Colors.white),
        ),
        releaseText: DeaultPageConfig().releaseText != null
            ? DeaultPageConfig().releaseText!(ctx)
            : null,
        refreshingText: DeaultPageConfig().refreshingText != null
            ? DeaultPageConfig().refreshingText!(ctx)
            : null,
        canTwoLevelText: DeaultPageConfig().canTwoLevelText != null
            ? DeaultPageConfig().canTwoLevelText!(ctx)
            : null,
        completeText: DeaultPageConfig().completeText != null
            ? DeaultPageConfig().completeText!(ctx)
            : null,
        failedText: DeaultPageConfig().failedText != null
            ? DeaultPageConfig().failedText!(ctx)
            : null,
        idleText: DeaultPageConfig().idleText != null
            ? DeaultPageConfig().idleText!(ctx)
            : null,
      ),
      // footer: ClassicFooter(),
      footer: ClassicFooter(
        loadingIcon: SizedBox(
          width: 20.0,
          height: 20.0,
          child: FFPlatform.isIOS == true
              ? CupertinoActivityIndicator(color: Colors.white)
              : CircularProgressIndicator(
                  strokeWidth: 2.0, color: Colors.white),
        ),
        loadingText: DeaultPageConfig().loadingText != null
            ? DeaultPageConfig().loadingText!(ctx)
            : null,
        noDataText: DeaultPageConfig().noDataText != null
            ? DeaultPageConfig().noDataText!(ctx)
            : null,
        idleText: DeaultPageConfig().idleFootText != null
            ? DeaultPageConfig().idleFootText!(ctx)
            : null,
        failedText: DeaultPageConfig().failedFootText != null
            ? DeaultPageConfig().failedFootText!(ctx)
            : null,
        canLoadingText: DeaultPageConfig().canLoadingText != null
            ? DeaultPageConfig().canLoadingText!(ctx)
            : null,
      ),
      controller: refreshController,
      scrollController: scrollController,
      onRefresh: () {
        ffRefresh(true);
      },
      onLoading: () {
        ffRefresh(false);
      },
      child: child,
    ),
  );
}