Skip to content

DropdownButtonFormField's hintText is not vertically centered if items is null or empty #111958

@pongloongyeat

Description

@pongloongyeat

Steps to Reproduce

  1. Execute flutter run on the code sample
  2. Observe that the hintText is off-centered (pushed down vertically).

Expected results: hintText should be vertically centered

Actual results: hintText is not vertically centered

Code sample
// Copyright (c) 2019, the Dart project authors.  Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: Scaffold(
        appBar: AppBar(
          title: Text("Dropdown test"),
        ),
        body: Center(
          child: DropdownButtonFormField<String>(
            decoration: InputDecoration(
              border: OutlineInputBorder(),
              hintText: 'This hint text should be vertically centred',
            ),
            items: [],
            onChanged: (val) {},
          ),
        ),
      ),
    );
  }
}

Remarks

This seems to only be true for when items == null/empty

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listf: material designflutter/packages/flutter/material repository.found in release: 3.3Found to occur in 3.3found in release: 3.4Found to occur in 3.4frameworkflutter/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

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions