[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-9313":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":16,"stars7d":17,"stars30d":18,"stars90d":16,"forks30d":16,"starsTrendScore":19,"compositeScore":20,"rankGlobal":10,"rankLanguage":10,"license":21,"archived":22,"fork":22,"defaultBranch":23,"hasWiki":24,"hasPages":24,"topics":25,"createdAt":10,"pushedAt":10,"updatedAt":31,"readmeContent":32,"aiSummary":33,"trendingCount":16,"starSnapshotCount":16,"syncStatus":17,"lastSyncTime":34,"discoverSource":35},9313,"flutter_carousel_slider","serenader2014\u002Fflutter_carousel_slider","serenader2014","A flutter carousel widget, support infinite scroll, and custom child widget.","https:\u002F\u002Fpub.dev\u002Fpackages\u002Fcarousel_slider",null,"Dart",1688,604,22,207,0,2,4,1,57.75,"MIT License",false,"master",true,[26,27,28,29,30],"autoplay","carousel-slider","flutter","infinite-scroll","widget","2026-06-12 04:00:44","# carousel_slider\n\nA carousel slider widget.\n\n## Features \n\n* Infinite scroll \n* Custom child widgets\n* Auto play\n\n## Supported platforms\n\n* Flutter Android\n* Flutter iOS\n* Flutter web\n* Flutter desktop\n\n## Live preview\n\nhttps:\u002F\u002Fserenader2014.github.io\u002Fflutter_carousel_slider\u002F#\u002F\n\nNote: this page is built with flutter-web. For a better user experience, please use a mobile device to open this link.\n\n## Installation\n\nAdd `carousel_slider: ^5.1.2` to your `pubspec.yaml` dependencies. And import it:\n\n```dart\nimport 'package:carousel_slider\u002Fcarousel_slider.dart';\n```\n\n## How to use\n\nSimply create a `CarouselSlider` widget, and pass the required params:\n\n```dart\nCarouselSlider(\n  options: CarouselOptions(height: 400.0),\n  items: [1,2,3,4,5].map((i) {\n    return Builder(\n      builder: (BuildContext context) {\n        return Container(\n          width: MediaQuery.of(context).size.width,\n          margin: EdgeInsets.symmetric(horizontal: 5.0),\n          decoration: BoxDecoration(\n            color: Colors.amber\n          ),\n          child: Text('text $i', style: TextStyle(fontSize: 16.0),)\n        );\n      },\n    );\n  }).toList(),\n)\n```\n\n## Params\n\n```dart\n\nCarouselSlider(\n   items: items,\n   options: CarouselOptions(\n      height: 400,\n      aspectRatio: 16\u002F9,\n      viewportFraction: 0.8,\n      initialPage: 0,\n      enableInfiniteScroll: true,\n      reverse: false,\n      autoPlay: true,\n      autoPlayInterval: Duration(seconds: 3),\n      autoPlayAnimationDuration: Duration(milliseconds: 800),\n      autoPlayCurve: Curves.fastOutSlowIn,\n      enlargeCenterPage: true,\n      enlargeFactor: 0.3,\n      onPageChanged: callbackFunction,\n      scrollDirection: Axis.horizontal,\n   )\n )\n```\n\nSince `v2.0.0`, you'll need to pass the options to `CarouselOptions`. For each option's usage you can refer to [carousel_options.dart](.\u002Flib\u002Fcarousel_options.dart).\n\n**If you pass the `height` parameter, the `aspectRatio` parameter will be ignored.**\n\n## Build item widgets on demand\n\nThis method will save memory by building items once it becomes necessary. This way they won't be built if they're not currently meant to be visible on screen.\nIt can be used to build different child item widgets related to content or by item index.\n\n```dart\n\nCarouselSlider.builder(\n  itemCount: 15,\n  itemBuilder: (BuildContext context, int itemIndex, int pageViewIndex) =>\n    Container(\n      child: Text(itemIndex.toString()),\n    ),\n)\n```\n\n## Carousel controller\n\nIn order to manually control the pageview's position, you can create your own `CarouselSliderController`, and pass it to `CarouselSlider`. Then you can use the `CarouselSliderController` instance to manipulate the position.\n\n```dart \nclass CarouselDemo extends StatelessWidget {\n  CarouselSliderController buttonCarouselController = CarouselSliderController();\n\n @override\n  Widget build(BuildContext context) => Column(\n    children: \u003CWidget>[\n      CarouselSlider(\n        items: child,\n        carouselController: buttonCarouselController,\n        options: CarouselOptions(\n          autoPlay: false,\n          enlargeCenterPage: true,\n          viewportFraction: 0.9,\n          aspectRatio: 2.0,\n          initialPage: 2,\n        ),\n      ),\n      RaisedButton(\n        onPressed: () => buttonCarouselController.nextPage(\n            duration: Duration(milliseconds: 300), curve: Curves.linear),\n        child: Text('→'),\n      )\n    ]\n  );\n}\n```\n\n### `CarouselSliderController` methods\n\n#### `.nextPage({Duration duration, Curve curve})`\n\nAnimate to the next page\n\n#### `.previousPage({Duration duration, Curve curve})`\n\nAnimate to the previous page\n\n#### `.jumpToPage(int page)`\n\nJump to the given page.\n\n#### `.animateToPage(int page, {Duration duration, Curve curve})`\n\nAnimate to the given page.\n\n## Screenshot\n\nBasic text carousel demo:\n\n![simple](screenshot\u002Fbasic.gif)\n\nBasic image carousel demo:\n\n![image](screenshot\u002Fimage.gif)\n\nA more complicated image carousel slider demo:\n\n![complicated image](screenshot\u002Fcomplicated-image.gif)\n\nFullscreen image carousel slider demo:\n\n![fullscreen](screenshot\u002Ffullscreen.gif)\n\nImage carousel slider with custom indicator demo:\n\n![indicator](screenshot\u002Findicator.gif)\n\nCustom `CarouselSliderController` and manually control the pageview position demo:\n\n![manual](screenshot\u002Fmanually.gif)\n\nVertical carousel slider demo:\n\n![vertical](screenshot\u002Fvertical.gif)\n\nSimple on-demand image carousel slider, with image auto prefetch demo:\n\n![prefetch](screenshot\u002Fpreload.gif)\n\nNo infinite scroll demo:\n\n![noloop](screenshot\u002Fnoloop.gif)\n\nAll screenshots above can be found at the example project.\n\n## License\n\nMIT\n","这是一个基于 Flutter 的轮播组件，支持无限滚动和自定义子组件。其核心功能包括无限滚动、自定义子组件以及自动播放。技术上，该项目使用 Dart 语言开发，并且兼容 Android、iOS、Web 和桌面平台的 Flutter 应用。适用于需要在应用中展示图片、文本或其他内容轮播的场景，如产品展示、广告推广等。项目遵循 MIT 许可证，在 GitHub 上获得了 1685 颗星标和 606 次分叉，表明了其在开发者社区中的受欢迎程度。","2026-06-11 03:22:07","top_language"]