Home > Mobile >  How to make different picture using carousel slider in flutter?
How to make different picture using carousel slider in flutter?

Time:12-20

        CarouselSlider(
          items: [0, 1, 2, 3].map((e) {
            return Image.asset('assets/images/onboarding6.png');
          }).toList(),

this is my code

how to make different pictures using the carousel slider?

pic below is my UI Program

UI

CodePudding user response:

    CarouselSlider(
              items: [
                      'assets/images/onboarding1.png', 
                      'assets/images/onboarding2.png', 
                      'assets/images/onboarding3.png', 
                      'assets/images/onboarding4.png',
                     ].map((e) {
                return Image.asset(e);
              }).toList(),

CodePudding user response:

List _images=['assets/images/one.png','assets/images/two.png','assets/images/three.png','assets/images/four.png',];

CarouselSlider(items:_images.map((e)=>return Image.asset(e)).toList(),

  • Related