美文网首页
flutter 手动触发RefreshIndicator刷新

flutter 手动触发RefreshIndicator刷新

作者: Yancy007 | 来源:发表于2020-11-19 13:49 被阅读0次
    GlobalKey<RefreshIndicatorState> _indicatorKey =
          GlobalKey<RefreshIndicatorState>();
    
    body: RefreshIndicator(
            key: _indicatorKey,
            onRefresh: () async {
              try {
                await _viewModel.loadNewData();
              } catch (e) {
                showErrorHint(context, e);
                throw (e);
              }
    },
    
    _refresh() {
        _indicatorKey.currentState.show();
    }
    

    相关文章

      网友评论

          本文标题:flutter 手动触发RefreshIndicator刷新

          本文链接:https://www.haomeiwen.com/subject/pfwgjktx.html