Skip to content

InputDecorationTheme.contentPadding not accepting EdgeInsetsDirectional #19305

@rocca23

Description

@rocca23

Flutter 0.5.1 • channel beta
Framework • revision c7ea3ca (6 weeks ago) • 2018-05-29 21:07:33 +0200
Engine • revision 1ed25ca
Tools • Dart 2.0.0-dev.58.0.flutter-f981f09760

══╡ EXCEPTION CAUGHT BY FLUTTER FRAMEWORK 
I/flutter (16423): The following assertion was thrown during a service extension callback for
I/flutter (16423): "ext.flutter.inspector.getRootWidgetSummaryTree":
I/flutter (16423): type 'EdgeInsetsDirectional' is not a subtype of type 'EdgeInsets'
When the exception was thrown, this was the stack:
Error -32000 received from application: Server error
I/flutter (16423): #0      InputDecorationTheme.debugFillProperties (package:flutter/src/material/input_decorator.dart:2411:74)
I/flutter (16423): #1      DiagnosticableNode._builder (package:flutter/src/foundation/diagnostics.dart:1974:14)
I/flutter (16423): #2      DiagnosticableNode.getProperties (package:flutter/src/foundation/diagnostics.dart:1987:44)
I/flutter (16423): #3      DiagnosticsNode.toStringDeep (package:flutter/src/foundation/diagnostics.dart:894:46)
I/flutter (16423): #4      DiagnosticsNode.toString (package:flutter/src/foundation/diagnostics.dart:790:14)
I/flutter (16423): #5      Diagnosticable.toString (package:flutter/src/foundation/diagnostics.dart:2121:70)
I/flutter (16423): #6      DiagnosticsProperty.valueToString (package:flutter/src/foundation/diagnostics.dart:1799:60)
I/flutter (16423): #7      DiagnosticsProperty.toDescription (package:flutter/src/foundation/diagnostics.dart:1813:21)

code:

ThemeData(
    inputDecorationTheme: InputDecorationTheme(
      contentPadding: EdgeInsetsDirectional.only(
        top: 16.0,
        bottom: 8.0,
      ),
    ),
 );

I noticed that inside InputDecoratorTheme.debugFillProperties(), contentPadding is checked to be EdgeInsetsinstead of EdgeInsetsGeometry:

  @override
  void debugFillProperties(DiagnosticPropertiesBuilder properties) {
    super.debugFillProperties(properties);
    const InputDecorationTheme defaultTheme = const InputDecorationTheme();
    // ...
    properties.add(new DiagnosticsProperty<EdgeInsets>('contentPadding', contentPadding, defaultValue: defaultTheme.contentPadding));
    // ...
  }

Quite obviously, replacing contentPadding: EdgeInsetsDirectional.only with contentPadding: EdgeInsets.only avoids the exception.

Metadata

Metadata

Assignees

No one assigned

    Labels

    frameworkflutter/packages/flutter repository. See also f: labels.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions