Skip to content

Commit 2b8e1d1

Browse files
committed
Merge remote-tracking branch 'upstream/master' into feature/200
2 parents 5eacbf6 + 15afa53 commit 2b8e1d1

File tree

3 files changed

+7
-38
lines changed

3 files changed

+7
-38
lines changed

lib/src/css_parser.dart

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import 'dart:ui';
22

3+
import 'package:collection/collection.dart';
34
import 'package:csslib/visitor.dart' as css;
45
import 'package:csslib/parser.dart' as cssparser;
56
import 'package:flutter/cupertino.dart';
@@ -70,14 +71,8 @@ Style declarationsToStyle(Map<String?, List<css.Expression>> declarations) {
7071
&& element.text != "overline" && element.text != "underline" && element.text != "line-through");
7172
List<css.Expression?>? nullableList = value;
7273
css.Expression? textDecorationColor;
73-
/// orElse: will not allow me to return null (even if the compiler says its okay, it errors on runtime).
74-
/// try/catch is a workaround for this.
75-
try {
76-
textDecorationColor = nullableList.firstWhere(
77-
(css.Expression? element) => element is css.HexColorTerm || element is css.FunctionTerm);
78-
} catch (e) {
79-
textDecorationColor = null;
80-
}
74+
textDecorationColor = nullableList.firstWhereOrNull(
75+
(element) => element is css.HexColorTerm || element is css.FunctionTerm);
8176
List<css.LiteralTerm?>? potentialStyles = value.whereType<css.LiteralTerm>().toList();
8277
/// List<css.LiteralTerm> might include other values than the ones we want for [textDecorationStyle], so make sure to remove those before passing it to [ExpressionMapping]
8378
potentialStyles.removeWhere((element) => element != null && element.text != "solid"

lib/src/utils.dart

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -49,38 +49,9 @@ class Context<T> {
4949
// This class is a workaround so that both an image
5050
// and a link can detect taps at the same time.
5151
class MultipleTapGestureRecognizer extends TapGestureRecognizer {
52-
bool _ready = false;
53-
54-
@override
55-
void addAllowedPointer(PointerDownEvent event) {
56-
if (state == GestureRecognizerState.ready) {
57-
_ready = true;
58-
}
59-
super.addAllowedPointer(event);
60-
}
61-
62-
@override
63-
void handlePrimaryPointer(PointerEvent event) {
64-
if (event is PointerCancelEvent) {
65-
_ready = false;
66-
}
67-
super.handlePrimaryPointer(event);
68-
}
69-
70-
@override
71-
void resolve(GestureDisposition disposition) {
72-
if (_ready && disposition == GestureDisposition.rejected) {
73-
_ready = false;
74-
}
75-
super.resolve(disposition);
76-
}
77-
7852
@override
7953
void rejectGesture(int pointer) {
80-
if (_ready) {
81-
acceptGesture(pointer);
82-
_ready = false;
83-
}
54+
acceptGesture(pointer);
8455
}
8556
}
8657

pubspec.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ dependencies:
3434
# Plugin for rendering MathML
3535
flutter_math_fork: ^0.3.0+2
3636

37+
# plugin for firstWhereOrNull extension on lists
38+
collection: ^1.15.0
39+
3740
flutter:
3841
sdk: flutter
3942

0 commit comments

Comments
 (0)