Skip to content

Button behaves differently in Web/Desktop and Mobile #85729

@bernaferrari

Description

@bernaferrari

[Expected] Flutter Web (beta and dartpad):
image

[Weird] Android (tested on beta):

return Column(
          children: [
            for (int i = 0; i < 5; i++)
              ElevatedButton(
                style: ElevatedButton.styleFrom(
                  primary: Colors.red,
                  padding: EdgeInsets.zero,
                  minimumSize: Size.zero,
                  visualDensity: VisualDensity.standard,
                  fixedSize: const Size(100, 8),
                  shape: const RoundedRectangleBorder(),
                  elevation: 0,
                ),
                onPressed: () {},
                child: Container(),
              )
          ],
        );

Possible fix: wrap ElevatedButton in SizedBox. This, however, shouldn't be necessary with the fixedSize property.

[✓] Flutter (Channel beta, 2.3.0-24.1.pre, on macOS 11.4 20F71 darwin-x64,
    locale en-BR)
    • Flutter version 2.3.0-24.1.pre at /usr/local/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 615957513e (6 days ago), 2021-06-25 09:24:44 -0700
    • Engine revision 9d517f475b
    • Dart version 2.14.0 (build 2.14.0-188.5.beta)

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Issues that are less important to the Flutter projectd: api docsIssues with https://api.flutter.dev/f: material designflutter/packages/flutter/material repository.found in release: 2.2Found to occur in 2.2found in release: 2.3Found to occur in 2.3frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-androidAndroid applications specificallyplatform-iosiOS applications specificallyteam-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