{"id":17720590,"url":"https://github.com/kavantix/sliver_tools","last_synced_at":"2025-04-08T12:07:05.545Z","repository":{"id":38041161,"uuid":"292603430","full_name":"Kavantix/sliver_tools","owner":"Kavantix","description":"A set of useful sliver tools that are missing from the flutter framework","archived":false,"fork":false,"pushed_at":"2024-06-01T18:22:17.000Z","size":6436,"stargazers_count":627,"open_issues_count":12,"forks_count":63,"subscribers_count":10,"default_branch":"master","last_synced_at":"2024-08-01T12:25:45.568Z","etag":null,"topics":["flutter","sliver","slivers","widgets"],"latest_commit_sha":null,"homepage":null,"language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Kavantix.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-09-03T15:07:15.000Z","updated_at":"2024-08-01T06:02:14.000Z","dependencies_parsed_at":"2024-06-01T20:37:15.025Z","dependency_job_id":"20c42c9e-f8f4-4f2a-ab9b-f7d98d6d7000","html_url":"https://github.com/Kavantix/sliver_tools","commit_stats":{"total_commits":106,"total_committers":10,"mean_commits":10.6,"dds":"0.49056603773584906","last_synced_commit":"e52731670ec027f027af7f98f33f56d05fbbc02c"},"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kavantix%2Fsliver_tools","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kavantix%2Fsliver_tools/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kavantix%2Fsliver_tools/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kavantix%2Fsliver_tools/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Kavantix","download_url":"https://codeload.github.com/Kavantix/sliver_tools/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247838443,"owners_count":21004580,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["flutter","sliver","slivers","widgets"],"created_at":"2024-10-25T15:28:20.464Z","updated_at":"2025-04-08T12:07:05.523Z","avatar_url":"https://github.com/Kavantix.png","language":"Dart","funding_links":["https://www.buymeacoffee.com/kavantix"],"categories":[],"sub_categories":[],"readme":"# sliver_tools\n[![pub package](https://img.shields.io/pub/v/sliver_tools.svg)](https://pub.dartlang.org/packages/sliver_tools)\n\nA set of useful sliver tools that are missing from the flutter framework.\n\n\nHere is a taste what you can make using this package\n\n![Demo](https://raw.githubusercontent.com/Kavantix/sliver_tools/master/gifs/demo2.gif)\n\nThe structure of this app:\n```dart\nclass Section extends State {\n  @override\n  Widget build(BuildContext context) {\n    return MultiSliver(\n      pushPinnedChildren: true,\n      children: \u003cWidget\u003e[\n        SliverPersistentHeader(\n          pinned: true,\n          ...\n        ),\n        if (!infinite)\n          SliverAnimatedPaintExtent(\n            child: SliverList(...),\n          )\n        else\n          SliverList(...),\n      ],\n    );\n  }\n}\n\nclass NewsPage extends StatelessWidget {\n  @override\n  Widget build(BuildContext context) {\n    return CustomScrollView(\n      slivers: \u003cWidget\u003e[\n        Section(infinite: false),\n        Section(infinite: true),\n      ],\n    );\n  }\n}\n```\n\n## [MultiSliver]\n\nThe [MultiSliver] widget allows for grouping of multiple slivers together such that they can be returned as a single widget.\nFor instance when one wants to wrap a few slivers with some padding or an inherited widget.\n\n\n### Example\n```dart\nclass WidgetThatReturnsASliver extends StatelessWidget {\n  @override\n  Widget build(BuildContext context) {\n    return MultiSliver(\n      pushPinnedChildren: false, // defaults to false\n      children: \u003cWidget\u003e[\n        SliverPersistentHeader(...),\n        SliverList(...),\n      ],\n    );\n  }\n}\n```\n\nThe `pushPinnedChildren` parameter allows for achieving a 'sticky header' effect by simply using pinned `SliverPersistentHeader` widgets (or any custom sliver that paints beyond its layoutExtent).\n\n## [SliverStack](https://github.com/Kavantix/sliver_tools/blob/master/lib/src/sliver_stack.dart)\n\nThe [SliverStack] widget allows for stacking of both slivers and box widgets.\nThis can be useful for adding some decoration to a sliver.\nWhich is what some of the other widgets in this package use to get their desired effects.\n\n### Example\n```dart\nclass WidgetThatReturnsASliver extends StatelessWidget {\n  @override\n  Widget build(BuildContext context) {\n    return SliverStack(\n      insetOnOverlap: false, // defaults to false\n      children: \u003cWidget\u003e[\n        SliverPositioned.fill(\n          child: Container(\n            decoration: BoxDecoration(\n              color: Colors.white,\n              boxShadow: const \u003cBoxShadow\u003e[\n                BoxShadow(\n                  offset: Offset(0, 4),\n                  blurRadius: 8,\n                  color: Colors.black26,\n                )\n              ],\n              borderRadius: BorderRadius.circular(8),\n            ),\n          ),\n        ),\n        SliverList(...),\n      ],\n    );\n  }\n}\n```\n\nThe `insetOnOverlap` handles whether the positioned children should be inset (made smaller) when the sliver has overlap from a previous sliver.\n\n## [SliverClip]\n\nThe [SliverClip] widget will add a clip around its child from the child's paintOrigin to its paintExtent.\nThis is very useful and most likely what you want when using a pinned SliverPersistentHeader as child of the stack.\n\n### Example\n```dart\nclass WidgetThatReturnsASliver extends StatelessWidget {\n  @override\n  Widget build(BuildContext context) {\n    return SliverClip(\n      clipOverlap: true, // defaults to true\n      child: SliverList(...),\n    );\n  }\n}\n```\n\nThe `clipOverlap` parameter allows for configuring whether any overlap with the previous child should be clipped.\nThis can be useful when one has a SliverPersitentHeader above a SliverList and does not want to give the header an opaque background but also prevent the list from drawing underneath the header.\n\n\n## [SliverAnimatedPaintExtent]\n\nThe [SliverAnimatedPaintExtent] widget allows for having a smooth transition when a sliver changes the space it will occupy inside the viewport.\nFor instance when using a SliverList with a button below it that loads the next few items.\n\n\n### Example\n```dart\nclass WidgetThatReturnsASliver extends StatelessWidget {\n  @override\n  Widget build(BuildContext context) {\n    return SliverAnimatedPaintExtent(\n      duration: const Duration(milliseconds: 150),\n      child: SliverList(...),\n    );\n  }\n}\n```\n\n## [SliverAnimatedSwitcher]\n\nThe [SliverAnimatedSwitcher] widget is simply a pre-configured `AnimatedSwitcher` widget.\nIf one needs more options than supplied by this widget a regular `AnimatedSwitcher` can be used by giving it the `defaultLayoutBuilder` and `defaultTransitionBuilder` of [SliverAnimatedSwitcher].\n\n\n## [SliverCrossAxisConstrained]\n\nThe [SliverCrossAxisConstrained] widget allows for limiting the cross axis extent of a sliver to a maximum value given by the `maxCrossAxisExtent`.\nFor instance a long list of text items on an iPad would be too wide to read so one can wrap the SliverList in a [SliverCrossAxisConstrained] and limit its width to something more reasonable.\n\n\n### Example\n```dart\nclass WidgetThatReturnsASliver extends StatelessWidget {\n  @override\n  Widget build(BuildContext context) {\n    return SliverCrossAxisConstrained(\n      maxCrossAxisExtent: 700,\n      alignment: 0, // between -1.0 (left) and 1.0 (right)\n      child: SliverList(...),\n    );\n  }\n}\n```\n\n## [SliverCrossAxisPadded]\n\nThe [SliverCrossAxisPadded] widget allows for adding padding to the cross axis of a sliver.\nThis can be done either by passing a `paddingStart` and/or `paddingEnd` or by using the `symmetric` constructor which takes a single padding value.\nWhen using `paddingStart` and `paddingEnd` in a vertical sliver it will depend on the `TextDirection` whether start is left or right.\n\n### Example\n```dart\nclass WidgetThatReturnsASliver extends StatelessWidget {\n  @override\n  Widget build(BuildContext context) {\n    return SliverCrossAxisPadded(\n      paddingStart: 24,\n      paddingEnd: 48,\n      textDirection: TextDirection.ltr, // optional, defaults to the Directionality specified by the context\n      child: SliverList(...),\n    );\n  }\n}\n```\n\n\n## [SliverPinnedHeader]\n\nThe [SliverPinnedHeader] widget allows for easily making a pinned header.\nIt will size itself to the size of the child and when it reaches the leading edge of the viewport stay there instead of scrolling off the screen.\n\n\n\n\n\n[MultiSliver]: https://github.com/Kavantix/sliver_tools/blob/master/lib/src/multi_sliver.dart\n[SliverAnimatedPaintExtent]: https://github.com/Kavantix/sliver_tools/blob/master/lib/src/sliver_animated_paint_extent.dart\n[SliverStack]: https://github.com/Kavantix/sliver_tools/blob/master/lib/src/sliver_stack.dart\n[SliverClip]: https://github.com/Kavantix/sliver_tools/blob/master/lib/src/sliver_clip.dart\n[SliverAnimatedSwitcher]: https://github.com/Kavantix/sliver_tools/blob/master/lib/src/sliver_animated_switcher.dart\n[SliverCrossAxisConstrained]: https://github.com/Kavantix/sliver_tools/blob/master/lib/src/sliver_cross_axis_constrained.dart\n[SliverCrossAxisPadded]: https://github.com/Kavantix/sliver_tools/blob/master/lib/src/sliver_cross_axis_padded.dart\n[SliverPinnedHeader]: https://github.com/Kavantix/sliver_tools/blob/master/lib/src/sliver_pinned_header.dart\n\n\n## Buy me a coffee ☕️\n\n\u003ca href=\"https://www.buymeacoffee.com/kavantix\" target=\"_blank\"\u003e\u003cimg src=\"https://cdn.buymeacoffee.com/buttons/default-orange.png\" alt=\"Buy Me A Coffee\" height=\"41\" width=\"174\"\u003e\u003c/a\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkavantix%2Fsliver_tools","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkavantix%2Fsliver_tools","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkavantix%2Fsliver_tools/lists"}