Skip to content

Commit

Permalink
minor improvements and bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
lively-bigyan committed Dec 24, 2021
1 parent 8ebc2da commit 76cc17d
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 24 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# 0.4.5
- Added text delegates thanks to [avinath1998](https://github.com/avinath1998). Check example for implementation.
- Minor fixes.


# 0.4.4+1

- Fixed signature field initialization issue.
Expand Down
1 change: 0 additions & 1 deletion analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
include: package:effective_dart/analysis_options.1.3.0.yaml

analyzer:
strong-mode:
Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ packages:
path: ".."
relative: true
source: path
version: "0.4.4+1"
version: "0.4.5"
matcher:
dependency: transitive
description:
Expand Down
15 changes: 11 additions & 4 deletions lib/src/_paint_over_image.dart
Original file line number Diff line number Diff line change
Expand Up @@ -631,15 +631,15 @@ class ImagePainterState extends State<ImagePainter> {
});
}

void _addEndPoints() => _paintHistory.add(
void _addEndPoints() => _addPaintHistory(
PaintInfo(
offset: <Offset?>[_start, _end],
painter: _painter,
mode: _controller.value.mode,
),
);

void _addFreeStylePoints() => _paintHistory.add(
void _addFreeStylePoints() => _addPaintHistory(
PaintInfo(
offset: <Offset?>[..._points],
painter: _painter,
Expand Down Expand Up @@ -753,6 +753,12 @@ class ImagePainterState extends State<ImagePainter> {
return byteData?.buffer.asUint8List();
}

void _addPaintHistory(PaintInfo info) {
if (info.mode != PaintMode.none) {
_paintHistory.add(info);
}
}

void _openTextDialog() {
_controller.value = _controller.value.copyWith(mode: PaintMode.text);
final fontSize = 6 * _controller.value.strokeWidth;
Expand All @@ -761,7 +767,7 @@ class ImagePainterState extends State<ImagePainter> {
textDelegate, onFinished: () {
if (_textController.text != '') {
setState(() {
_paintHistory.add(
_addPaintHistory(
PaintInfo(
mode: PaintMode.text,
text: _textController.text,
Expand Down Expand Up @@ -835,12 +841,13 @@ class ImagePainterState extends State<ImagePainter> {
icon:
widget.undoIcon ?? Icon(Icons.reply, color: Colors.grey[700]),
onPressed: () {
print(_paintHistory.length);
if (_paintHistory.isNotEmpty) {
setState(_paintHistory.removeLast);
}
}),
IconButton(
tooltip: textDelegate.undo,
tooltip: textDelegate.clearAllProgress,
icon: widget.clearAllIcon ??
Icon(Icons.clear, color: Colors.grey[700]),
onPressed: () => setState(_paintHistory.clear),
Expand Down
9 changes: 5 additions & 4 deletions lib/src/widgets/_color_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ class ColorItem extends StatelessWidget {
child: Container(
padding: const EdgeInsets.all(2),
decoration: BoxDecoration(
color: isSelected! ? Colors.white70 : Colors.transparent,
shape: BoxShape.circle,
border: Border.all(
color: isSelected! ? Colors.black : Colors.grey[200]!)),
color: isSelected! ? Colors.white70 : Colors.transparent,
shape: BoxShape.circle,
border: Border.all(
color: isSelected! ? Colors.black : Colors.grey[200]!),
),
child: CircleAvatar(
radius: isSelected! ? 16 : 12, backgroundColor: color),
),
Expand Down
1 change: 0 additions & 1 deletion lib/src/widgets/_mode_widget.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'package:flutter/material.dart';
import 'package:image_painter/src/delegates/text_delegate.dart';

import '../../image_painter.dart';

Expand Down
27 changes: 17 additions & 10 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,33 @@ packages:
name: characters
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
version: "1.2.0"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.dartlang.org"
source: hosted
version: "1.15.0"
effective_dart:
dependency: "direct dev"
description:
name: effective_dart
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.2"
flutter:
dependency: "direct main"
description: flutter
source: sdk
version: "0.0.0"
flutter_lints:
dependency: "direct dev"
description:
name: flutter_lints
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.4"
lints:
dependency: transitive
description:
name: lints
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
meta:
dependency: transitive
description:
Expand All @@ -52,7 +59,7 @@ packages:
name: vector_math
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
version: "2.1.1"
sdks:
dart: ">=2.12.0 <3.0.0"
dart: ">=2.14.0 <3.0.0"
flutter: ">=1.17.0"
7 changes: 4 additions & 3 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: image_painter
description: A flutter package for drawing over images. Supports color,
strokeWidth, different paintModes and exporting image.
version: 0.4.4+1
version: 0.4.5
homepage: https://github.com/yellowQ-software/yellowQ-Flutter-Image-Painter

environment:
Expand All @@ -11,7 +11,8 @@ environment:
dependencies:
flutter:
sdk: flutter
vector_math: ^2.1.0
vector_math: ^2.1.1

dev_dependencies:
effective_dart: ^1.3.1
flutter_lints: ^1.0.4

0 comments on commit 76cc17d

Please sign in to comment.