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(),

          ),
        ),
      ),
    );
  }
}
  • Boost WooCommerce Security: Set Up OTP Login in WordPress
    Passwords, while essential for security, can be vulnerable to hacking and breaches. To add an extra layer of protection for your WooCommerce store, consider implementing an OTP (One-Time Password) login. This guide walks you through the process of setting up an OTP login in WordPress for enhanced security. Why Use OTP Login? Enhanced Security: OTPs …

    Read more …

  • How to Create Woocommerce Flutter App for WordPress free
    Absolutely! Let’s break down how to create a WooCommerce Flutter app for your WordPress store. Here’s a comprehensive outline of the process and essential considerations: 1. Setup Your Development Environment 2. Project Structure 3. Dependencies 4. Core Functionality 5. User Interface (UI) and User Experience 6. Additional Features (Optional) Example Code Snippet (Fetching Products) Important …

    Read more …

  • How to Add a Link to Your Facebook Story in 2024
    Facebook Stories have become an integral part of our social media experience, allowing us to share moments and updates with our friends and followers. But did you know that you can also add links to your Facebook Stories? Adding a link to your story can be a powerful way to drive traffic to your website, …

    Read more …

  • Troubleshooting “Failed to download Laravel from dist” Error
    If you encounter the “Failed to download Laravel from dist” error while working with Laravel 10, it is likely due to the absence of the zip extension and unzip/7z commands on your system. This error prevents the successful download of Laravel from the distribution (dist) repository. What causes this error? The error occurs when the …

    Read more …

  • Solutions for “The file is too large for the destination file system” Error on Pendrive
    If you have ever encountered the frustrating error message “The file is too large for the destination file system” when trying to transfer files to your pendrive, don’t worry! There are a few solutions you can try to resolve this issue. 1. Format the Pendrive: One of the easiest ways to fix this error is …

    Read more …

Leave a Comment