familyItem<T, Param> static method

Widget familyItem<T, Param>({
  1. required FutureProvider<T> provider(
    1. Param
    ),
  2. required Param param,
  3. required Widget builder(
    1. T item,
    2. WidgetRef ref
    ),
  4. Widget? loading,
  5. Widget error(
    1. Object error,
    2. StackTrace? stackTrace
    )?,
  6. EdgeInsets? padding,
  7. ScrollPhysics? physics,
  8. VoidCallback? onRetry,
  9. Future<void> onRefresh()?,
})

Creates a refreshable single item widget with family support

Implementation

static Widget familyItem<T, Param>({
  required FutureProvider<T> Function(Param) provider,
  required Param param,
  required Widget Function(T item, WidgetRef ref) builder,

  // Customization
  Widget? loading,
  Widget Function(Object error, StackTrace? stackTrace)? error,
  EdgeInsets? padding,
  ScrollPhysics? physics,

  // Callbacks
  VoidCallback? onRetry,
  Future<void> Function()? onRefresh,
}) {
  return _StateFamilyWidget<T, Param>(
    provider: provider,
    param: param,
    onRefresh: onRefresh,
    onRetry: onRetry,
    loading: loading,
    error: error,
    builder: (item, ref) {
      return SingleChildScrollView(
        padding: padding,
        physics: physics ?? const AlwaysScrollableScrollPhysics(),
        child: builder(item, ref),
      );
    },
  );
}