@@ -90,12 +90,9 @@ class _MyHomePageState extends State<MyHomePage> {
90
90
child: CustomImageCrop (
91
91
cropController: controller,
92
92
// image: const AssetImage('assets/test.png'), // Any Imageprovider will work, try with a NetworkImage for example...
93
- image: const NetworkImage (
94
- 'https://upload.wikimedia.org/wikipedia/en/7/7d/Lenna_%28test_image%29.png' ),
93
+ image: const NetworkImage ('https://upload.wikimedia.org/wikipedia/en/7/7d/Lenna_%28test_image%29.png' ),
95
94
shape: _currentShape,
96
- ratio: _currentShape == CustomCropShape .Ratio
97
- ? Ratio (width: _width, height: _height)
98
- : null ,
95
+ ratio: _currentShape == CustomCropShape .Ratio ? Ratio (width: _width, height: _height) : null ,
99
96
canRotate: true ,
100
97
canMove: false ,
101
98
canScale: false ,
@@ -105,47 +102,34 @@ class _MyHomePageState extends State<MyHomePage> {
105
102
Row (
106
103
mainAxisAlignment: MainAxisAlignment .spaceAround,
107
104
children: [
108
- IconButton (
109
- icon: const Icon (Icons .refresh), onPressed: controller.reset),
110
- IconButton (
111
- icon: const Icon (Icons .zoom_in),
112
- onPressed: () =>
113
- controller.addTransition (CropImageData (scale: 1.33 ))),
114
- IconButton (
115
- icon: const Icon (Icons .zoom_out),
116
- onPressed: () =>
117
- controller.addTransition (CropImageData (scale: 0.75 ))),
118
- IconButton (
119
- icon: const Icon (Icons .rotate_left),
120
- onPressed: () =>
121
- controller.addTransition (CropImageData (angle: - pi / 4 ))),
122
- IconButton (
123
- icon: const Icon (Icons .rotate_right),
124
- onPressed: () =>
125
- controller.addTransition (CropImageData (angle: pi / 4 ))),
105
+ IconButton (icon: const Icon (Icons .refresh), onPressed: controller.reset),
106
+ IconButton (icon: const Icon (Icons .zoom_in), onPressed: () => controller.addTransition (CropImageData (scale: 1.33 ))),
107
+ IconButton (icon: const Icon (Icons .zoom_out), onPressed: () => controller.addTransition (CropImageData (scale: 0.75 ))),
108
+ IconButton (icon: const Icon (Icons .rotate_left), onPressed: () => controller.addTransition (CropImageData (angle: - pi / 4 ))),
109
+ IconButton (icon: const Icon (Icons .rotate_right), onPressed: () => controller.addTransition (CropImageData (angle: pi / 4 ))),
126
110
IconButton (
127
111
icon: const Icon (Icons .crop),
128
112
onPressed: () async {
129
113
final image = await controller.onCropImage ();
130
114
if (image != null ) {
131
- Navigator .of (context).push (MaterialPageRoute (
132
- builder: (BuildContext context) =>
133
- ResultScreen (image: image)));
115
+ Navigator .of (context).push (MaterialPageRoute (builder: (BuildContext context) => ResultScreen (image: image)));
134
116
}
135
117
},
136
118
),
137
119
PopupMenuButton <CustomCropShape >(
138
120
icon: const Icon (Icons .crop_original),
139
121
onSelected: _changeCropShape,
140
122
itemBuilder: (BuildContext context) {
141
- return CustomCropShape .values.map ((shape) {
142
- return PopupMenuItem <CustomCropShape >(
143
- value: shape,
144
- child: getShapeIcon (shape),
145
- );
146
- }).toList ();
123
+ return CustomCropShape .values.map (
124
+ (shape) {
125
+ return PopupMenuItem <CustomCropShape >(
126
+ value: shape,
127
+ child: getShapeIcon (shape),
128
+ );
129
+ },
130
+ ).toList ();
147
131
},
148
- )
132
+ ),
149
133
],
150
134
),
151
135
if (_currentShape == CustomCropShape .Ratio )
0 commit comments