Update TextStyle.hashCode to handle list fields (#50520)
This commit is contained in:
parent
48d5fcabbd
commit
324e20de09
@ -1177,7 +1177,6 @@ class TextStyle extends Diagnosticable {
|
||||
color,
|
||||
backgroundColor,
|
||||
fontFamily,
|
||||
fontFamilyFallback,
|
||||
fontSize,
|
||||
fontWeight,
|
||||
fontStyle,
|
||||
@ -1191,8 +1190,9 @@ class TextStyle extends Diagnosticable {
|
||||
decoration,
|
||||
decorationColor,
|
||||
decorationStyle,
|
||||
shadows,
|
||||
fontFeatures,
|
||||
hashList(shadows),
|
||||
hashList(fontFeatures),
|
||||
hashList(fontFamilyFallback),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -2,8 +2,9 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'dart:ui' as ui show TextStyle, ParagraphStyle;
|
||||
import 'dart:ui' as ui show TextStyle, ParagraphStyle, FontFeature, Shadow;
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/painting.dart';
|
||||
import '../flutter_test_alternative.dart';
|
||||
|
||||
@ -256,6 +257,13 @@ void main() {
|
||||
expect(TextStyle.lerp(foo.merge(bar), baz, 0.51).copyWith().debugLabel, '(lerp((foo).merge(bar) ⎯0.5→ baz)).copyWith');
|
||||
});
|
||||
|
||||
test('TextStyle.hashCode', () {
|
||||
const TextStyle a = TextStyle(fontFamilyFallback: <String>['Roboto'], shadows: <ui.Shadow>[ui.Shadow()], fontFeatures: <ui.FontFeature>[ui.FontFeature('abcd')]);
|
||||
const TextStyle b = TextStyle(fontFamilyFallback: <String>['Noto'], shadows: <ui.Shadow>[ui.Shadow()], fontFeatures: <ui.FontFeature>[ui.FontFeature('abcd')]);
|
||||
expect(a.hashCode, a.hashCode);
|
||||
expect(a.hashCode, isNot(equals(b.hashCode)));
|
||||
}, skip: kIsWeb);
|
||||
|
||||
test('TextStyle foreground and color combos', () {
|
||||
const Color red = Color.fromARGB(255, 255, 0, 0);
|
||||
const Color blue = Color.fromARGB(255, 0, 0, 255);
|
||||
|
Loading…
x
Reference in New Issue
Block a user