Skip to content

TextField intrinsic width does not take label into account #178099

@bleroux

Description

@bleroux

Steps to reproduce

  1. Run the code sample
  2. Observe the TextField width

Expected results

The label is fully visible

Image

Actual results

The label is not fully visible because the width is not wide enough.

Image

Code sample

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

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

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData.dark(),
      title: 'InputDecorator with label intrinsic width',
      home: const HomePage(),
    );
  }
}

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

  @override
  Widget build(BuildContext context) {
    return const Material(
      child: Center(
        child: IntrinsicWidth(
          child: TextField(
            decoration: InputDecoration(
              labelText: 'labelText',
              hintText: 'hint',
              floatingLabelBehavior: FloatingLabelBehavior.never,
              border: OutlineInputBorder(),
            ),
          ),
        ),
      ),
    );
  }
}

Screenshots or Video

No response

Logs

Flutter Doctor output

Doctor output
Flutter (Channel [user-branch], 3.38.0-1.0.pre-429, on macOS 15.6.1 24G90 darwin-arm64, locale en-FR)

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.35Found to occur in 3.35found in release: 3.38Found to occur in 3.38frameworkflutter/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-text-inputOwned by Text Input team

Type

No type

Projects

Status

Done (PR merged)

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions