before_after
3.2.0, released 2 years ago by xdsahil.dev
A Flutter widget that makes it easier to display the difference between two images using a slider.
What it does
The before_after package provides a single-purpose BeforeAfter widget that allows users to compare two images or widgets using a draggable slider. It supports horizontal and vertical sliding, custom track and thumb dimensions, decorations, and callback handlers for value changes.
AI-written summary of version 3.2.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You want to compare 'before' and 'after' states of images in your Flutter application.
- You need a customizable image slider with support for horizontal and vertical directions.
Skip it when
- You only need to display single standard images without comparison sliders.
- You require complex image manipulation or editing capabilities beyond simple side-by-side comparison.
Strengths
- Supports both horizontal and vertical drag directions.
- Provides extensive customization options for track, thumb, height, width, and mouse cursors.
- Built entirely in Dart.
Weaknesses
- Limited to image comparison use cases.
- Requires a minimum Flutter version of 3.22.0.
Setup
- Kind
- Flutter widgets
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 0
BeforeAfter(
value: value,
before: Image.asset('assets/after.png'),
after: Image.asset('assets/before.png'),
onValueChanged: (value) {
setState(() => this.value = value);
},
)Alternatives
Packages that do the same job and could replace before_after.
- image_compare_slider
Compare two images with a slider, handle, zoom, pan, and rotation.
66Compare - intro_slider
A Flutter plugin that helps you create introductory slides and walkthroughs for apps.
59Compare - widget_tooltip
A customizable tooltip widget for Flutter with multiple trigger modes and smart positioning
48Compare - circular_widgets
Display widgets in a circle with customizable radius and spacing.
45Compare