Skip to main content

sinew_camouflage 1.1.0 copy "sinew_camouflage: ^1.1.0" to clipboard
sinew_camouflage: ^1.1.0 copied to clipboard

PagingState.toCamo() for Camouflage's CamoPagedList.

sinew_camouflage #

pub package License Docs

PagingState.toCamo() for Camouflage's CamoPagedList.

The glue between Sinew's paging and Camouflage, the component library. One call turns a PagingState into what CamoPagedList shows: the skeleton, the items, load more, retry, refresh and the end of the list.

Features #

  • PagingState.toCamo(localizer) and toCamoOf(context), with every PagingState mapped by the rules in the Guide
  • Error text rendered at build time with Sinew's localizer, so it follows the current language
  • The only Sinew package that depends on Camouflage

Getting started #

flutter pub add sinew_camouflage

Usage #

CamoPagedList<Order>(
  state: state.orders.toCamoOf(context),
  itemKey: (order) => order.id,
  onLoadMore: () => onEvent(const OrderListEndReached()),
  onRetry: () => onEvent(const OrderListRetryTapped()),
  onRefresh: () async => onEvent(const OrderListRefreshed()),
  itemBuilder: (context, order, _) => CamoListItem(
    headline: order.title,
    supporting: order.status,
  ),
)

Only a next-page load or failure keeps the items: a refresh drops them, so the list shows its skeleton.

Sinew is one architecture for Flutter and Kotlin, released as a set of packages at one version.

Documentation #

License #

Apache 2.0, see LICENSE.