Fix text direction logic for material icon variants (#71852)

This commit is contained in:
Pierre-Louis 2020-12-08 18:08:05 +01:00 committed by GitHub
parent 2cb652600c
commit a51b8e4309
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 225 additions and 214 deletions

View File

@ -383,8 +383,7 @@ class _Icon {
// e.g. e547
String hexCodepoint;
// TODO(guidezpl): will be fixed in a future PR to be shortId instead of id
String get mirroredInRTL => _iconsMirroredWhenRTL.contains(id) ? ', matchTextDirection: true' : '';
String get mirroredInRTL => _iconsMirroredWhenRTL.contains(shortId) ? ', matchTextDirection: true' : '';
String get name => id.replaceAll('_', ' ');

File diff suppressed because it is too large Load Diff

View File

@ -17,6 +17,18 @@ void main() {
expect(Icons.search.fontFamily, 'MaterialIcons');
});
testWidgets('Certain icons (and their variants) match text direction', (WidgetTester tester) async {
expect(Icons.arrow_back.matchTextDirection, true);
expect(Icons.arrow_back_rounded.matchTextDirection, true);
expect(Icons.arrow_back_outlined.matchTextDirection, true);
expect(Icons.arrow_back_sharp.matchTextDirection, true);
expect(Icons.access_time.matchTextDirection, false);
expect(Icons.access_time_rounded.matchTextDirection, false);
expect(Icons.access_time_outlined.matchTextDirection, false);
expect(Icons.access_time_sharp.matchTextDirection, false);
});
testWidgets('Adaptive icons are correct on cupertino platforms',
(WidgetTester tester) async {
expect(Icons.adaptive.arrow_back, Icons.arrow_back_ios);