before_after_image_slider_nullsafty 1.0.1
before_after_image_slider_nullsafty: ^1.0.1 copied to clipboard
A flutter package which makes it easier to display the difference between two images Side by Side With a before and after slideer.
import 'package:before_after/before_after.dart';
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.teal,
),
home: const MyHomePage(),
);
}
}
class MyHomePage extends StatelessWidget {
const MyHomePage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Before After'),
centerTitle: true,
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Expanded(
flex: 1,
child: BeforeAfter(
beforeImage: Image.asset('assets/after.jpg'),
afterImage: Image.asset('assets/before.jpg'),
),
),
Expanded(
flex: 1,
child: BeforeAfter(
beforeImage: Image.asset('assets/after.jpg'),
afterImage: Image.asset('assets/before.jpg'),
isVertical: true,
),
),
],
),
),
);
}
}