Flutter Image carousel slider With Text | Flutter Slider Tutorial



Flutter Slider

How to make an effective flutter slider for your app?

In this tutorial, you learn how to Create an effective flutter slider.

How to set Flutter Slider Image, Text?

You Can set your flutter slider any kind of image JPEG, PNG, GIF & also Text.

Open Your Android Studio/Code Editor add Dependencies.

Dependencies:

carousel_slider: ^4.0.0

Carousel Slider Widget Flutter:

CarouselOptions(height:  300),
            items: ['assets/fruit_ (1).png','assets/fruit_ (2).png','assets/fruit_ (3).png','assets/fruit_ (4).png','assets/fruit_ (5).png'].map((i) {
              return Builder(
              builder : (BuildContext context) {
                return Container(
                width: MediaQuery.of(context).size.width,
                margin : EdgeInsets.symmetric(horizontal: 5.0),

                  child: Column(
                    children: [
                      Image.asset(i),
                      SizedBox( height:  10,),
                      if(i == 'assets/fruit_ (1).png')
                        Text(""${FruitList[0]}"", style:  TextStyle( fontSize: 25, fontWeight: FontWeight.w800),),
                      if(i == 'assets/fruit_ (2).png')
                        Text(""${FruitList[1]}"", style:  TextStyle( fontSize: 25, fontWeight: FontWeight.w800),),
                      if(i == 'assets/fruit_ (3).png')
                        Text(""${FruitList[2]}"", style:  TextStyle( fontSize: 25, fontWeight: FontWeight.w800),),
                      if(i == 'assets/fruit_ (4).png')
                        Text(""${FruitList[3]}"", style:  TextStyle( fontSize: 25, fontWeight: FontWeight.w800),),
                      if(i == 'assets/fruit_ (5).png')
                        Text(""${FruitList[4]}"", style:  TextStyle( fontSize: 25, fontWeight: FontWeight.w800),),
                    ],
                  ),

                );
          }
              );
          }).toList(),

          ),
Flutter Slider

Flutter Carousel slider full example dart code. You can use these codes in your Flutter app project.

import 'package:carousel_slider/carousel_slider.dart';
import 'package:flutter/material.dart';

void main() {
  runApp(MaterialApp(
    debugShowCheckedModeBanner: false,
    home: MyApp(),
  ));
}

class MyApp extends StatefulWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State {

  var FruitList = ['Coconut','Grapes','Apple','Banana','Cherry'];

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Slider App'),
      ),
      body: Center(
        child: Padding(
          padding: const EdgeInsets.all(10.0),
          child: CarouselSlider(
            options: CarouselOptions(height:  300),
            items: ['assets/fruit_ (1).png','assets/fruit_ (2).png','assets/fruit_ (3).png','assets/fruit_ (4).png','assets/fruit_ (5).png'].map((i) {
              return Builder(
              builder : (BuildContext context) {
                return Container(
                width: MediaQuery.of(context).size.width,
                margin : EdgeInsets.symmetric(horizontal: 5.0),

                  child: Column(
                    children: [
                      Image.asset(i),
                      SizedBox( height:  10,),
                      if(i == 'assets/fruit_ (1).png')
                        Text(""${FruitList[0]}"", style:  TextStyle( fontSize: 25, fontWeight: FontWeight.w800),),
                      if(i == 'assets/fruit_ (2).png')
                        Text(""${FruitList[1]}"", style:  TextStyle( fontSize: 25, fontWeight: FontWeight.w800),),
                      if(i == 'assets/fruit_ (3).png')
                        Text(""${FruitList[2]}"", style:  TextStyle( fontSize: 25, fontWeight: FontWeight.w800),),
                      if(i == 'assets/fruit_ (4).png')
                        Text(""${FruitList[3]}"", style:  TextStyle( fontSize: 25, fontWeight: FontWeight.w800),),
                      if(i == 'assets/fruit_ (5).png')
                        Text(""${FruitList[4]}"", style:  TextStyle( fontSize: 25, fontWeight: FontWeight.w800),),
                    ],
                  ),

                );
          }
              );
          }).toList(),

          ),
        ),
      ),
    );
  }
}
  • How to Conduct YouTube Keyword Research Easily?
    Introduction YouTube is the second largest search engine in the world, making it a valuable platform for content creators and businesses alike. To maximize your visibility and reach on YouTube, it is crucial to conduct proper keyword research. By identifying the right keywords, you can optimize your videos for search and increase your chances of …

    Read more …

  • How to upgrade the Dart SDK version in flutter
    If you’re a Flutter developer, you know how important it is to stay up-to-date with the latest version of the Dart SDK. Upgrading the Dart SDK ensures that you have access to the latest features, bug fixes, and performance improvements. Step 1: Check Your Current Dart SDK Version Before you begin the upgrade process, it’s …

    Read more …

  • Why Do Advertisers Use Testimonials?
    In the ever-competitive business landscape, nurturing strong connections with your customers remains paramount for enhancing your credibility and positioning yourself as an industry authority. Establishing credibility is the bedrock upon which trust is built, ultimately translating into increased sales. To bolster your company’s credibility, integrating testimonial advertising into your marketing strategy is essential. So, what …

    Read more …

  • How To Earn $5 Fast Method!
    Looking to boost your income by $25 in less than an hour? This isn’t the start of a clichéd sales pitch; it’s about discovering several quick and simple ways to earn $5 online within minutes. For instance, you can make five bucks by completing tasks such as taking brief surveys, participating in short website usability …

    Read more …

  • What Does BMF Mean On TikTok? Latest Social Media Acronyms
    In the fast-paced world of social media, acronyms are the language of choice, enabling users to communicate swiftly without the need for lengthy phrases. While classics like LOL and OMG are still in use, the younger generation on TikTok has introduced a new acronym into the mix: BMF. So, what exactly does BMF mean, and …

    Read more …

Leave a Comment