Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DON’T create a lambda when a tear-off will do #28

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ class _HomePageState extends State<HomePage> {
_image = geteditimage;
});
}
}).catchError((er) {
print(er);
});
}).catchError(print);

@override
Widget build(BuildContext context) {
Expand Down
32 changes: 18 additions & 14 deletions lib/image_editor_pro.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import 'package:firexcode/firexcode.dart';

TextEditingController heightcontroler = TextEditingController();
TextEditingController widthcontroler = TextEditingController();
var width = 300;
var height = 300;
var width;
var height;

List fontsize = [];
var howmuchwidgetis = 0;
Expand All @@ -35,7 +35,8 @@ SignatureController _controller =
class ImageEditorPro extends StatefulWidget {
final Color appBarColor;
final Color bottomBarColor;
ImageEditorPro({this.appBarColor, this.bottomBarColor});
final Image image;
ImageEditorPro({this.appBarColor, this.bottomBarColor, this.image});

@override
_ImageEditorProState createState() => _ImageEditorProState();
Expand Down Expand Up @@ -99,20 +100,23 @@ class _ImageEditorProState extends State<ImageEditorPro> {

@override
Widget build(BuildContext context) {
width = widget.image.width.toInt();
height = widget.image.height.toInt();
return Screenshot(
controller: screenshotController,
child: RepaintBoundary(
key: globalKey,
child: xStack.list(
[
_image != null
? Image.file(
_image,
height: height.toDouble(),
width: width.toDouble(),
fit: BoxFit.cover,
)
: Container(),
// _image != null
// ? Image.file(
// _image,
// height: height.toDouble(),
// width: width.toDouble(),
// fit: BoxFit.cover,
// )
widget.image,
// : Container(),
Signat().xGesture(
onPanUpdate: (DragUpdateDetails details) {
setState(() {
Expand Down Expand Up @@ -179,8 +183,8 @@ class _ImageEditorProState extends State<ImageEditorPro> {
)
],
)).xContainer(
margin: EdgeInsets.all(20),
color: Colors.white,
padding: EdgeInsets.all(0),
color: Colors.blue,
width: width.toDouble(),
height: height.toDouble(),
),
Expand Down Expand Up @@ -250,7 +254,7 @@ class _ImageEditorProState extends State<ImageEditorPro> {
.then((binaryIntList) async {
//print("Capture Done");

final paths = await getDownloadsDirectory();
final paths = await getTemporaryDirectory();

final file = await File('${paths.path}/' +
DateTime.now().toString() +
Expand Down