compare_image_slider 1.0.2 copy "compare_image_slider: ^1.0.2" to clipboard
compare_image_slider: ^1.0.2 copied to clipboard

The CompareImageSlider package is a Flutter widget that provides an interactive image comparison slider. It allows users to compare two images by dragging a slider horizontally, revealing portions of [...]

example/lib/main.dart

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

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: Scaffold(
        appBar: AppBar(title: Text("Compare Image Slider"),),
        body: SingleChildScrollView(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              SizedBox(
                  height: 400,
                  child: CompareImageSlider(
                    beforeImage: AssetImage('assets/images/image1.png'),
                    afterImage: AssetImage('assets/images/image2.png'),
                    initialPosition: 0.5, // Start in the middle
                    sliderColor: Colors.white,
                    sliderThickness: 2.0,
                  ),
              ),

              SizedBox(height: 50,),

              SizedBox(
                height: 400,
                child: CompareImageSlider(
                  beforeImage: AssetImage('assets/images/image3.png'),
                  afterImage: AssetImage('assets/images/image4.png'),
                  initialPosition: 0.5, // Start in the middle
                  sliderColor: Colors.black,
                  sliderThickness: 2.0,
                ),
              ),

              SizedBox(height: 50,),
            ],
          ),
        ),
      ),
    );
  }
}
17
likes
140
points
20
downloads

Publisher

unverified uploader

Weekly Downloads

The CompareImageSlider package is a Flutter widget that provides an interactive image comparison slider. It allows users to compare two images by dragging a slider horizontally, revealing portions of the before and after images seamlessly.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on compare_image_slider