Skip to content

Floating action button has inconsistent reacting regions #42693

@dkwingsmt

Description

@dkwingsmt

Problem

1

FAB has 2 different regions, the outer region (rectangle) and the inner region (circular), and they react to different events:

  • Hover of the tooltip reacts to the outer region, because Tooltip wraps the entire widget
  • Hover of the inkwell reacts to the inner region, as shown by hover color
  • Tap gestures react to the outer region, thanks to _InputPadding

This brings inconsistency: The gap between the 2 regions reacts to tooltips, but not the hover color (as well as the upcoming mouse cursor feature), but again, reacts to mouse clicks. Ideally we would like the region that hover events react to match that of the tap events; at least we would like only one hovering region, instead of 2 regions for different changes.

If we must use _InputPadding, I suggest we find a way to make it also proxy the mouse events of the InkWell, so that all events react to the outer region.

Flutter: dd43da7

Sample code:

import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);

  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {

  @override
  Widget build(BuildContext context) {
    return DefaultTabController(
      length: 2,
      child: Scaffold(
          body: Center(
            child: FloatingActionButton(
              onPressed: () {},
              tooltip: 'floating',
              hoverColor: Colors.deepOrange,
            ),
          )),
    );
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: desktopRunning on desktopf: material designflutter/packages/flutter/material repository.found in release: 3.3Found to occur in 3.3found in release: 3.7Found to occur in 3.7frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onteam-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