1. The package

Import the latest flutter_swiper package in pubspec.yaml, the latest version is 1.1.6.

Flutter_swiper: ^ 1.1.6Copy the code

2. Use

Prepare a few image paths in advance, this is using wan android’s round map API

List<Image> imgs = [
    Image.network(
      "https://wanandroid.com/blogimgs/8690f5f9-733a-476a-8ad2-2468d043c2d4.png",
      fit: BoxFit.cover,
    ),
    Image.network(
        "https://www.wanandroid.com/blogimgs/62c1bd68-b5f3-4a3c-a649-7ca8c7dfabe6.png",
        fit: BoxFit.cover),
    Image.network(
        "https://www.wanandroid.com/blogimgs/50c115c2-cf6c-4802-aa7b-a4334de444cd.png",
        fit: BoxFit.cover),
    Image.network(
        "https://www.wanandroid.com/blogimgs/90c6cc12-742e-4c9f-b318-b912f163b8d0.png",
        fit: BoxFit.cover)
  ];
Copy the code

The next step is to configure the rotograph with several core properties of Flutter_swiper

Child: Swiper(itemWidth: double. Infinity,// itemHeight: ItemWidth and itemHeight have no effect if Swiper is overshot by other containers and also has width and height set. (BuildContext context, int index) { return imgs[index]; }, autoplay: true,// Whether to autoplay pagination: new SwiperPagination(Builder: Control: new SwiperControl(),// arrows on both sides), swiperPagin.dots, swiperPagin.dotsCopy the code

Let’s see what happens