From 698bda6ada1bbb339b522b48f60f8fca7cd7bab6 Mon Sep 17 00:00:00 2001 From: Hans Muller Date: Fri, 13 Jul 2018 10:37:55 -0700 Subject: [PATCH] Correct contentPadding type in InputDecoration.debugFillProperties (#19318) --- .../lib/src/material/input_decorator.dart | 2 +- .../test/material/input_decorator_test.dart | 21 ++++++++++++++----- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/packages/flutter/lib/src/material/input_decorator.dart b/packages/flutter/lib/src/material/input_decorator.dart index 4faea3dc90..fa8fe77374 100644 --- a/packages/flutter/lib/src/material/input_decorator.dart +++ b/packages/flutter/lib/src/material/input_decorator.dart @@ -2507,7 +2507,7 @@ class InputDecorationTheme extends Diagnosticable { properties.add(new DiagnosticsProperty('errorStyle', errorStyle, defaultValue: defaultTheme.errorStyle)); properties.add(new DiagnosticsProperty('errorMaxLines', errorMaxLines, defaultValue: defaultTheme.errorMaxLines)); properties.add(new DiagnosticsProperty('isDense', isDense, defaultValue: defaultTheme.isDense)); - properties.add(new DiagnosticsProperty('contentPadding', contentPadding, defaultValue: defaultTheme.contentPadding)); + properties.add(new DiagnosticsProperty('contentPadding', contentPadding, defaultValue: defaultTheme.contentPadding)); properties.add(new DiagnosticsProperty('isCollapsed', isCollapsed, defaultValue: defaultTheme.isCollapsed)); properties.add(new DiagnosticsProperty('prefixStyle', prefixStyle, defaultValue: defaultTheme.prefixStyle)); properties.add(new DiagnosticsProperty('suffixStyle', suffixStyle, defaultValue: defaultTheme.suffixStyle)); diff --git a/packages/flutter/test/material/input_decorator_test.dart b/packages/flutter/test/material/input_decorator_test.dart index b082442ce5..bc382c756d 100644 --- a/packages/flutter/test/material/input_decorator_test.dart +++ b/packages/flutter/test/material/input_decorator_test.dart @@ -763,7 +763,7 @@ void main() { ), ); - // Overall height for this InputDecorator is 48dps because the prefix icon's minimum size + // Overall height for this InputDecorator is 48dps because the prefix icon's minimum size // is 48x48 and the rest of the elements only require 40dps: // 12 - top padding // 16 - input text (ahem font size 16dps) @@ -799,7 +799,7 @@ void main() { ), ); - // Overall height for this InputDecorator is 48dps because the prefix icon's minimum size + // Overall height for this InputDecorator is 48dps because the prefix icon's minimum size // is 48x48 and the rest of the elements only require 40dps: // 12 - top padding // 16 - input text (ahem font size 16dps) @@ -821,7 +821,7 @@ void main() { ), ); - // Overall height for this InputDecorator is 100dps because the prefix icon's size + // Overall height for this InputDecorator is 100dps because the prefix icon's size // is 100x100 and the rest of the elements only require 40dps: // 12 - top padding // 16 - input text (ahem font size 16dps) @@ -864,7 +864,7 @@ void main() { ), ), ); - + // Margin for text decoration is 12 when filled and top left offset is (0, 0) // 0 + 12 = 12. expect(tester.getSize(find.byType(InputDecorator)), const Size(800.0, 60.0)); @@ -904,7 +904,7 @@ void main() { ), ), ); - + // Margin for text decoration is 12 when filled and top left offset is (0, 0) // 0 + 12 = 12. expect(tester.getSize(find.byType(InputDecorator)), const Size(800.0, 52.0)); @@ -1639,4 +1639,15 @@ void main() { }, skip: !Platform.isLinux, ); + + testWidgets('InputDecorationTheme.toString()', (WidgetTester tester) async { + // Regression test for https://github.com/flutter/flutter/issues/19305 + + expect( + const InputDecorationTheme( + contentPadding: const EdgeInsetsDirectional.only(start: 5.0), + ).toString(), + contains('contentPadding: EdgeInsetsDirectional(5.0, 0.0, 0.0, 0.0)'), + ); + }); }