before_after 1.0.0 before_after: ^1.0.0 copied to clipboard
A flutter package which makes it easier to display the differences between two images.
import 'package:before_after/before_after.dart';
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.teal,
),
home: MyHomePage(),
);
}
}
class MyHomePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text('Before After'), centerTitle: true),
body: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
BeforeAfter(
beforeImage: Image.asset('assets/after.jpg'),
afterImage: Image.asset('assets/before.jpg'),
),
],
),
);
}
}