Skip to content

InputDecorationTheme.isCollapsed doesn't seem to work #133144

@akshdeep-singh

Description

@akshdeep-singh

Is there an existing issue for this?

Steps to reproduce

I want to set TextField default collapsed in ThemeData. However, setting InputDecorationTheme.isCollapsed doesn't work. However, InputDecoration.isCollapsed is working.

Expected results

The TextField should be collapsed when InputDecorationTheme.isCollapsed is set to true.

Actual results

The TextField is not collapsed when InputDecorationTheme.isCollapsed is set to true.

Code sample

Code sample
import 'package:flutter/material.dart';

void main() {
  runApp(const MainApp());
}

class MainApp extends StatelessWidget {
  const MainApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData(
        inputDecorationTheme: const InputDecorationTheme(
          isCollapsed: true, // This doesn't work
          border: OutlineInputBorder(
            borderRadius: BorderRadius.all(Radius.circular(4)),
          ),
        ),
      ),
      home: const Scaffold(
        body: Center(
          child: SizedBox(
            width: 200,
            child: TextField(
              decoration: InputDecoration(
                // isCollapsed: true, // <-- This works
                hintText: 'Hello, Flutter!',
              ),
            ),
          ),
        ),
      ),
    );
  }
}

Screenshots or Video

No response

Logs

No response

Flutter Doctor output

Doctor output
[Paste your output here]

Metadata

Metadata

Assignees

Labels

a: text inputEntering text in a text field or keyboard related problemsf: material designflutter/packages/flutter/material repository.found in release: 3.13Found to occur in 3.13found in release: 3.14Found to occur in 3.14has reproducible stepsThe issue has been confirmed reproducible and is ready to work onteam-designOwned by Design Languages team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions