Skip to content

Commit

Permalink
fix the type-mismatch
Browse files Browse the repository at this point in the history
  • Loading branch information
vintage committed Sep 7, 2023
1 parent 8f68c21 commit 3390675
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/widgets.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ import 'dart:typed_data';
import 'dart:ui' as ui;

import 'package:flutter/material.dart';
import 'package:scratcher/painter.dart';
import 'package:scratcher/utils.dart';

import 'painter.dart';

const _progressReportStep = 0.1;

/// How accurate should the progress be tracked.
Expand Down Expand Up @@ -199,7 +198,7 @@ class ScratcherState extends State<Scratcher> {
Future<ui.Image> _loadImage(Image image) async {
final completer = Completer<ui.Image>();
final imageProvider = image.image as dynamic;
final key = await imageProvider.obtainKey(const ImageConfiguration());
final key = await imageProvider.obtainKey(ImageConfiguration.empty);

imageProvider.load(key, (
Uint8List bytes, {
Expand Down Expand Up @@ -232,9 +231,10 @@ class ScratcherState extends State<Scratcher> {
_lastPosition = position;

ui.Offset? point = position;
final scratchPoint = ScratchPoint(point, widget.brushSize);

// Ignore when starting point of new line has been already scratched
if (points.isNotEmpty && points.contains(point)) {
if (points.isNotEmpty && points.contains(scratchPoint)) {
if (points.last == null) {
return;
} else {
Expand All @@ -243,7 +243,7 @@ class ScratcherState extends State<Scratcher> {
}

setState(() {
points.add(ScratchPoint(point, widget.brushSize));
points.add(scratchPoint);
});

if (point != null && !checked.contains(point)) {
Expand Down

0 comments on commit 3390675

Please sign in to comment.