flutterflutter-layout

Hide circle progress inside RefreshIndicator


I am trying to use RefreshIndicator in my flutter app so i use this builtin library:

 child: SafeArea(
    child: RefreshIndicator(
      onRefresh: () => _onRefreshData(),
      child: Column(
        children: <Widget>[
          Expanded(...

In my page i have 2 list.when this page appear I shows a dialog and I get data from server and show these data inside of lists:

  Future<void> _onRefreshData() async {
    getMyChan();
  }

  void getMyChan() async {
    Future.delayed(Duration.zero, () => _showProgressDialog());
    _myChannel = await MyToolsProvider().getMe(_testToken);
    getTools();
    setState(() {
      _closeDialog();
    });
  }

Now i want to use RefreshIndicator to refresh my lists but i have a question: I just want to use swap of RefreshIndicator and don't need circle progress because as you can see i am using progressDialog in getMyChan() method so i do not need circle progress.

How can i hide circle progress inside RefreshIndicator?


Solution

  • Unfortunately (or not), the RefreshIndicator indicator don't have an option to hide the RefreshProgressIndicator widget present inside.

    The only way is to copy the Widget in your project and replace the RefreshProgressIndicator with an empty Container here : https://github.com/flutter/flutter/blob/f3d95cd734ad23b7f9e15e7d0bc182d40965e05f/packages/flutter/lib/src/material/refresh_indicator.dart#L459