-
Notifications
You must be signed in to change notification settings - Fork 42
Open
Description
the example app is crashed when building.
Flutter SDK version 3.22.2
custom_image_crop: ^0.0.13
the entire code:
import 'dart:math';
import 'package:custom_image_crop/custom_image_crop.dart';
import 'package:flutter/material.dart';
void main() => runApp(MyHomePage(
title: 'test',
));
class MyHomePage extends StatefulWidget {
final String title;
MyHomePage({
required this.title,
Key? key,
}) : super(key: key);
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
late CustomImageCropController controller;
@override
void initState() {
super.initState();
controller = CustomImageCropController();
}
@override
void dispose() {
controller.dispose();
super.dispose();
}
@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(widget.title),
),
body: Column(
children: [
Expanded(
child: CustomImageCrop(
cropController: controller,
image: const AssetImage(
'assets/test.png'), // Any Imageprovider will work, try with a NetworkImage for example...
),
),
Row(
children: [
IconButton(
icon: const Icon(Icons.refresh),
onPressed: controller.reset),
IconButton(
icon: const Icon(Icons.zoom_in),
onPressed: () =>
controller.addTransition(CropImageData(scale: 1.33))),
IconButton(
icon: const Icon(Icons.zoom_out),
onPressed: () =>
controller.addTransition(CropImageData(scale: 0.75))),
IconButton(
icon: const Icon(Icons.rotate_left),
onPressed: () => controller
.addTransition(CropImageData(angle: -pi / 4))),
IconButton(
icon: const Icon(Icons.rotate_right),
onPressed: () =>
controller.addTransition(CropImageData(angle: pi / 4))),
IconButton(
icon: const Icon(Icons.crop),
onPressed: () async {
final image = await controller.onCropImage();
if (image != null) {
showDialog(
context: context,
builder: (_) => Image(image: image));
}
},
),
],
),
SizedBox(height: MediaQuery.of(context).padding.bottom),
],
),
),
);
}
}
Metadata
Metadata
Assignees
Labels
No labels