Skip to content

InputDecorationTheme and IconTheme isn't fully inherited  #71813

@xEyad

Description

@xEyad

Steps to Reproduce

  1. create new flutter app
  2. use this code (minimum reproduce-able)
void main()
{
  WidgetsFlutterBinding.ensureInitialized();
  runApp(test());
}
dynamic test()
{
  return MaterialApp(
        title: 'test',
        theme: AppThemeTest.theme,
        debugShowCheckedModeBanner: false,
        home: Scaffold(
          body: Column(
            mainAxisAlignment:MainAxisAlignment.center,
            children:[
            ///doesn't inherit iconTheme or floatingBehaviour from InputDecorationTheme
             TextFormField(decoration: InputDecoration(labelText: "password",prefixIcon: Icon(Icons.ac_unit)),),

            SizedBox(height: 15,),
            ///how the field should look like if InputDecorationTheme is inherited correctly
            TextFormField(
            decoration: InputDecoration(
                labelText: "Mobile number",
                floatingLabelBehavior: FloatingLabelBehavior.never,
                prefixIcon: Icon(
                  Icons.smartphone,
                  color: AppTheme.accentColor,
                ),
                focusedBorder: OutlineInputBorder(
                    borderSide: BorderSide(
                  color: AppTheme.accentColor,
                )),
                enabledBorder: OutlineInputBorder(
                    borderSide: BorderSide(
                  color: Color(0xffD4D4D4),
                )),
                filled: true,
                fillColor: Color(0xffF8F9FF),
                focusColor: AppTheme.accentColor,
                hoverColor: AppTheme.accentColor)),
              
          ],),)
        ); 
}


class AppThemeTest
{
  static final Color primaryColor = Color(0xff3C55F2);
  static final Color accentColor = Color(0xff3C55F2);
  static final Color disabledColor = Color(0xffC2C3C8);
  static final Color inputFieldFillColor = Color(0xffF8F9FF);
  static final double appBarHeight = Get.height*.15;
  static final ThemeData theme = ThemeData(
    primaryColor: primaryColor,
    scaffoldBackgroundColor: Colors.white,
    accentColor: Colors.white,
    disabledColor: disabledColor,
    canvasColor: Colors.white,
    
    inputDecorationTheme: InputDecorationTheme(
      floatingLabelBehavior: FloatingLabelBehavior.never,
      focusedBorder: OutlineInputBorder(borderSide: BorderSide(color: accentColor,)),
      enabledBorder: OutlineInputBorder(borderSide: BorderSide(color: Color(0xffD4D4D4),)),
      filled: true,
      fillColor: inputFieldFillColor,
      focusColor: accentColor,
      hoverColor: accentColor
    ),
    iconTheme: IconThemeData(color: accentColor),
    primaryIconTheme: IconThemeData(color: accentColor),
    textTheme: TextTheme(bodyText2: TextStyle(color: Colors.black),bodyText1: TextStyle(color: Colors.black))
  );
}

Expected results:
password TextFormField to look like the mobile TextFormField
Actual results:
they don't behave or look like each other because -i think- they didn't inherit InputDecorationTheme and iconTheme

Logs
[√] Flutter (Channel dev, 1.25.0-4.0.pre, on Microsoft Windows [Version 10.0.18363.1198], locale en-US)
    • Flutter version 1.25.0-4.0.pre at C:\flutter
    • Framework revision a7f5fd5360 (6 days ago), 2020-11-30 13:14:13 +0100
    • Engine revision 20caf54969
    • Dart version 2.12.0 (build 2.12.0-76.0.dev)

[√] Android toolchain - develop for Android devices (Android SDK version 30.0.0)
    • Android SDK at C:\Users\eyad\AppData\Local\Android\sdk
    • Platform android-30, build-tools 30.0.0
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe

[√] Android Studio (version 4.1.0)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)

[√] VS Code (version 1.51.1)
    • VS Code at C:\Users\eyad\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.17.0

[√] Connected device (4 available)
    • Android SDK built for x86 (mobile) • emulator-5554 • android-x86    • Android 9 (API 28) (emulator)
    • Web Server (web)                   • web-server    • web-javascript • Flutter Tools
    • Chrome (web)                       • chrome        • web-javascript • Google Chrome 86.0.4240.198
    • Edge (web)                         • edge          • web-javascript • Microsoft Edge 86.0.622.58

• No issues found!

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work lista: text inputEntering text in a text field or keyboard related problemsf: material designflutter/packages/flutter/material repository.f: themingStyling widgets with a themefound in release: 3.3Found to occur in 3.3found in release: 3.6Found to occur in 3.6frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer versionteam-designOwned by Design Languages teamtriaged-designTriaged by Design Languages team

Type

No type

Projects

Status

Done (PR merged)

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions