• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

icapps / flutter-custom-image-crop / 6545506866

17 Oct 2023 09:53AM CUT coverage: 0.0%. Remained the same
6545506866

Pull #45

github

web-flow
Merge bff8ba3a1 into 75def6bbd
Pull Request #45: optimize fillcropscpace imagefit

130 of 130 new or added lines in 3 files covered. (100.0%)

0 of 485 relevant lines covered (0.0%)

0.0 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/lib/src/controllers/controller.dart
1
import 'package:custom_image_crop/src/models/model.dart';
2
import 'package:flutter/material.dart';
3

4
/// The controller that handles the cropping and
5
/// changing of the cropping area
6
class CustomImageCropController {
7
  /// Listener for the cropping area changes
8
  final listeners = <CustomImageCropListener>[];
9

10
  /// Crop the image
11
  Future<MemoryImage?> onCropImage() =>
×
12
      listeners.map((e) => e.onCropImage()).first;
×
13

14
  /// The data that handles the transformation of the cropped image.
15
  CropImageData? get cropImageData => listeners.map((e) => e.data).first;
×
16

17
  /// Add a new listener for the cropping area changes
18
  void addListener(CustomImageCropListener listener) => listeners.add(listener);
×
19

20
  /// Remove a listener for the cropping area changes
21
  void removeListener(CustomImageCropListener listener) =>
×
22
      listeners.remove(listener);
×
23

24
  /// Notify all listeners for the cropping area changes
25
  void notifyListeners() => addTransition(CropImageData());
×
26

27
  void dispose() => listeners.clear();
×
28

29
  /// Move the cropping area using the given translation
30
  void addTransition(CropImageData transition) =>
×
31
      listeners.forEach((e) => e.addTransition(transition));
×
32

33
  /// Reset the cropping area
34
  void reset() => setData(CropImageData());
×
35

36
  /// Update the cropping area
37
  void setData(CropImageData data) => listeners.forEach((e) => e.setData(data));
×
38
}
39

40
mixin CustomImageCropListener {
41
  /// The data that handles the transformation of the cropped image.
42
  var data = CropImageData(scale: 1);
43

44
  /// Move the cropping area using the given translation
45
  void addTransition(CropImageData transition);
46

47
  /// Update the cropping area
48
  void setData(CropImageData transition);
49

50
  /// Crop the image
51
  Future<MemoryImage?> onCropImage();
52
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc