当前位置:网站首页>[shutter] banner carousel component (shutter_wiper plug-in | swiper component)
[shutter] banner carousel component (shutter_wiper plug-in | swiper component)
2022-07-03 02:28:00 【Programmer community】
List of articles
- One 、flutter_swiper plug-in unit
- Two 、Swiper Components use
- 3、 ... and 、 Complete code example
- Four 、 Related resources
One 、flutter_swiper plug-in unit
To https://pub.dev/packages Search for flutter_swiper Components https://pub.dev/packages/flutter_swiper ;
install flutter_swiper plug-in unit :
① To configure Flutter plug-in unit : stay pubspec.yaml Configuration in profile Flutter plug-in unit :
dependencies: flutter_swiper: ^1.1.6
② obtain Flutter plug-in unit : Click on the " Pub get " Button , Get plug-ins , Automatically from https://pub.dev/packages The platform downloads the plug-in and configures it to Flutter In the project ;
③ Introduce in the project : In need of use Banner Carousel plug in flutter_swiper Import the dart package ;
import 'package:flutter_swiper/flutter_swiper.dart';
Two 、Swiper Components use
install flutter_swiper After plug-in package , stay dart Import the plug-in package from the source code ,
import 'package:flutter_swiper/flutter_swiper.dart';
In the corresponding dart Use... In the document Swiper Components ;
Main setup Swiper The following four parameters :
① int itemCount : Number of carousels , There are a few pictures in the rotation status ;
② bool autoplay : Whether to automatically rotate pictures ;
③ IndexedWidgetBuilder itemBuilder : Set the rotation component , Be careful IndexedWidgetBuilder Type is a method , This method returns Widget Components ;
typedef IndexedWidgetBuilder = Widget Function(BuildContext context, int index);
④ SwiperPlugin pagination : Rotation indicator , Dot under the rotation component ;
Code example :
Swiper( /// Number of carousels itemCount: _imageUrls.length, /// Set the rotation chart to play automatically autoplay: true, /// Carousel entry component itemBuilder: (BuildContext context, int index) {
return Image.network( /// picture URL link _imageUrls[index], /// Zoom mode fit: BoxFit.fill, ); }, /// Carousel indicator pagination: SwiperPagination(),),
3、 ... and 、 Complete code example
Complete code example :
import 'package:flutter/material.dart';import 'package:flutter_swiper/flutter_swiper.dart';/// Application main interface class HomePage extends StatefulWidget {
@override _HomePageState createState() => _HomePageState();}class _HomePageState extends State<HomePage> {
List _imageUrls = [ "https://img-blog.csdnimg.cn/20210401205234582.png", "https://img-blog.csdnimg.cn/20210401205307863.png", "https://img-blog.csdnimg.cn/20210401205249606.png" ]; @override Widget build(BuildContext context) {
/// Interface framework return Scaffold( /// Centering component body: Center( child: Column( children: [ Container( /// Set up Banner Shuffling figure 160 Pixels height: 200, /// This is a flutter_swiper Rotation diagram of plug-in child: Swiper( /// Number of carousels itemCount: _imageUrls.length, /// Set the rotation chart to play automatically autoplay: true, /// Carousel entry component itemBuilder: (BuildContext context, int index) {
return Image.network( /// picture URL link _imageUrls[index], /// Zoom mode fit: BoxFit.fill, ); }, /// Carousel indicator pagination: SwiperPagination(), ), ), ], ), ), ); }}
Running effect :
Four 、 Related resources
Reference material :
- Flutter Official website : https://flutter.dev/
- Flutter Plug in download address : https://pub.dev/packages
- Flutter Developing documents : https://flutter.cn/docs ( Strongly recommend )
- official GitHub Address : https://github.com/flutter
- Flutter The Chinese community : https://flutter.cn/
- Flutter Practical tutorial : https://flutter.cn/docs/cookbook
- Flutter CodeLab : https://codelabs.flutter-io.cn/
- Dart Chinese document : https://dart.cn/
- Dart Developer website : https://api.dart.dev/
- Flutter Chinese net : https://flutterchina.club/ , http://flutter.axuer.com/docs/
- Flutter Related issues : https://flutterchina.club/faq/ ( It is recommended to watch it at the introductory stage )
- GitHub Upper Flutter Open source examples : https://download.csdn.net/download/han1202012/15989510
- Flutter Practical e-books : https://book.flutterchina.club/chapter1/
Important topics :
- Flutter Animation reference documentation : https://flutterchina.club/animations/
Blog source download :
GitHub Address : https://github.com/han1202012/flutter_app ( Keep updating with the progress of the blog , There may not be the source code of this blog )
Blog source snapshot : https://download.csdn.net/download/han1202012/16311756 ( The source code snapshot of this blog , You can find the source code of this blog )
边栏推荐
- 错误Invalid bound statement (not found): com.ruoyi.stock.mapper.StockDetailMapper.xxxx解决
- GBase 8c系统表-pg_amop
- [codeforces] cf1338a - Powered addition [binary]
- 通达OA 首页门户工作台
- GBase 8c触发器(三)
- [tutorial] chrome turns off cross domain policies CORS and samesite, and brings cookies across domains
- Awk from getting started to getting into the ground (3) the built-in functions printf and print of awk realize formatted printing
- awk从入门到入土(2)认识awk内置变量和变量的使用
- CFdiv2-Fixed Point Guessing-(区间答案二分)
- GBase 8c系统表-pg_am
猜你喜欢
udp接收队列以及多次初始化的测试
easyExcel
Tongda OA V12 process center
[Flutter] dart: class; abstract class; factory; Class, abstract class, factory constructor
4. 类和对象
Restcloud ETL cross database data aggregation operation
easyExcel
Use go language to realize try{}catch{}finally
错误Invalid bound statement (not found): com.ruoyi.stock.mapper.StockDetailMapper.xxxx解决
SPI mechanism
随机推荐
[codeforces] cf1338a - Powered addition [binary]
《MATLAB 神经网络43个案例分析》:第43章 神经网络高效编程技巧——基于MATLAB R2012b新版本特性的探讨
UDP receive queue and multiple initialization test
基于线程池的生产者消费者模型(含阻塞队列)
require. context
awk从入门到入土(2)认识awk内置变量和变量的使用
Cfdiv2 Fixed Point Guessing - (2 points for Interval answer)
Awk from entry to burial (1) awk first meeting
Servlet中数据传到JSP页面使用el表达式${}无法显示问题
Machine learning process and method
MUX VLAN Foundation
awk从入门到入土(1)awk初次会面
require.context
Awk from getting started to getting into the ground (3) the built-in functions printf and print of awk realize formatted printing
iptables 4层转发
Javescript 0.1 + 0.2 = = 0.3 problem
stm32F407-------DMA
通达OA v12流程中心
[advanced ROS] Lesson 6 recording and playback in ROS (rosbag)
Gbase 8C trigger (I)