sinew_camouflage
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)andtoCamoOf(context), with everyPagingStatemapped 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.
Related packages
Sinew is one architecture for Flutter and Kotlin, released as a set of packages at one version.
Documentation
- Usage docs: sinew.srctool.com
- API reference: pub.dev/documentation/sinew_camouflage
- Source and issues: srctool/sinew-dart
- Design and decisions: the Guide
License
Apache 2.0, see LICENSE.
Libraries
- sinew_camouflage
- PagingState.toCamo() for Camouflage's CamoPagedList.