Skip to content

ClassicHeader & ClassicFooter

ClassicHeader and ClassicFooter are the default indicators bundled with smart_refresher. They combine an icon and a status text label, and automatically adapt their spinner to CircularProgressIndicator on Android and CupertinoActivityIndicator on iOS.


SmartRefresher(
controller: _controller,
enablePullDown: true,
enablePullUp: true,
header: const ClassicHeader(),
footer: const ClassicFooter(),
onRefresh: _onRefresh,
onLoading: _onLoading,
child: ListView.builder(...),
)

PropertyTypeDefaultDescription
idleTextString?"Pull down to refresh"Text shown when idle.
releaseTextString?"Release to refresh"Text shown when the threshold is crossed.
refreshingTextString?"Refreshing..."Text shown during the active refresh.
completeTextString?"Refresh Complete"Text shown on success.
failedTextString?"Refresh Failed"Text shown on failure.
idleIconWidget?↓ arrow iconIcon for the idle state.
releaseIconWidget?↺ refresh iconIcon when armed.
refreshingIconWidget?Platform spinnerIcon during refresh.
completeIconWidget?✓ check iconIcon on success.
failedIconWidget?⚠ error iconIcon on failure.
iconPosIconPosition.leftPosition of the icon relative to text.
spacingdouble16.0Gap between the icon and the label text.
colorColor?Theme primaryColor for the spinner and default icons.
arrowColorColor?Theme arrowColor for the directional arrow icons.
iconColorColor?Theme iconColor for complete/failed icons.
textStyleTextStyle?Theme textStyle for the status label.
outerBuilderOuterBuilder?nullWraps the entire indicator (e.g., for custom background).
heightdouble60.0Height reserved for the header.
completeDurationDuration600msHow long the complete/failed state is visible.
ValueBehaviour
.leftIcon to the left of the text (default).
.rightIcon to the right of the text.
.topIcon above the text.
.bottomIcon below the text.

PropertyTypeDefaultDescription
idleTextString?"Pull up to load"Text when the footer is visible but idle.
canLoadingTextString?"Release to load"Text when the user has pulled past the trigger.
loadingTextString?"Loading..."Text during active loading.
noDataTextString?"No more data"Text in the noData state.
failedTextString?"Load Failed"Text when loading fails.
idleIconWidget?↑ arrow iconIcon for the idle state.
canLoadingIconWidget?↺ autorenew iconIcon when armed to load.
loadingIconWidget?Platform spinnerIcon during loading.
noMoreIconWidget?nullOptional icon for the noData state.
failedIconWidget?⚠ error iconIcon on failure.
colorColor?Theme primaryColor for all default icons and the spinner.
textStyleTextStyle?Theme textStyle for the status text.
iconPosIconPosition.leftPosition of the icon relative to text.
spacingdouble16.0Gap between the icon and the label text.
outerBuilderOuterBuilder?nullWraps the entire footer indicator.
heightdouble60.0Height reserved for the footer.

ClassicHeader(
idleText: 'Swipe down to refresh',
releaseText: 'Let go!',
refreshingText: 'Hold on...',
completeText: 'Done ✓',
failedText: 'Something went wrong',
)
ClassicHeader(
color: Colors.deepPurple, // spinner color
arrowColor: Colors.purple, // arrow icon color
iconColor: Colors.green, // complete/fail icon color
)
ClassicHeader(
idleIcon: const Icon(Icons.south, color: Colors.blue),
releaseIcon: const Icon(Icons.north, color: Colors.orange),
completeIcon: const SizedBox.shrink(), // hide on complete
)
ClassicHeader(
outerBuilder: (child) => Container(
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Colors.deepPurple.shade900, Colors.black],
),
),
child: child,
),
)

ClassicHeader and ClassicFooter both support i18n via RefreshLocalizations. Wrap your app to provide localized strings:

MaterialApp(
localizationsDelegates: [
RefreshLocalizations.delegate,
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
],
supportedLocales: const [
Locale('en'),
Locale('zh'),
// ... other supported locales
],
...
)

ClassicHeader exposes additional properties for two-level refresh:

ClassicHeader(
canTwoLevelText: 'Pull further to open',
canTwoLevelIcon: const Icon(Icons.open_in_full),
twoLevelView: MySecondLevelWidget(), // full-screen widget shown on two-level open
)

See the Core Architecture page for a full explanation of the two-level refresh state machine.