Repository: flutter
Issue: ElevatedButton inside TabBarView has delay on pressed animation
Labels: framework,a: animation,f: material design,c: performance,perf: speed,has reproducible steps,found in release: 3.3,found in release: 3.7,team-design,triaged-design

I have customized an `ElevatedButton` to be similar to a `CupertinoButton` (but more customizable). It works fine generally, but when it's inside a `TabBarView`, the click animation has a delay.

If the user does a quick press on the button (which is what most people do), there's no feedback animation, the button color doesn't change. The color will only change if you press and hold for a bit.

The following code illustrates the issue. There's a `CupertinoButton` that works fine and an `ElevatedButton` with the problem reported. Clicking on the `FloatingActionButton` opens a new page, with the same buttons, but without a `TabBarView`, which illustrates that the `ElevatedButton` is working correctly.


<details>
<summary>code sample</summary>

```dart
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      home: MyHomePage(),
    );
 }
}

class MyHomePage extends StatefulWidget {
  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  final List<Tab> tabs = <Tab>[
    Tab(text: '1'),
    Tab(text: '2'),
    Tab(text: '3'),
  ];

  @override
  Widget build(BuildContext context) {
    return DefaultTabController(
      length: 3,
      child: Scaffold(
        appBar: AppBar(
          title: Text('Button bug'),
          bottom: TabBar(
            tabs: tabs,
          ),
        ),
        body: TabBarView(
          children: tabs.map((tab) {
            return Buttons();
          }).toList(),
        ),
        floatingActionButton: FloatingActionButton(
          onPressed: () {
            Navigator.of(context).push(MaterialPageRoute(builder: (_) {
              return Scaffold(body: Buttons(),);
            }));
          },
          tooltip: 'Increment',
          child: Icon(Icons.add),
        ), // This trailing comma makes auto-formatting nicer for build methods.
      ),
    );
  }
}

class Buttons extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Center(
      child: Column(
        mainAxisAlignment: MainAxisAlignment.center,
        children: <Widget>[
          CupertinoButton.filled(child: Text('hi'), onPressed: () => print('hi')),
          ElevatedButton(
            onPressed: () => print('hi'),
            child: Text('hi'),
            style: ButtonStyle(
              backgroundColor: MaterialStateProperty.resolveWith<Color>(
                      (Set<MaterialState> states) {
                    if (states.contains(MaterialState.pressed))
                      return Colors.red;
                    if (states.contains(MaterialState.disabled))
                      return Colors.blue;
                    return Colors.green; // Defer to the widget's default.
                  }),
              foregroundColor: MaterialStateProperty.resolveWith<Color>(
                      (Set<MaterialState> states) {
                    if (states.contains(MaterialState.pressed)) {
                      return Colors.brown;
                    }
                    if (states.contains(MaterialState.disabled)) {
                      return Colors.yellow;
                    }
                    return Colors.pink;
                  }),
              overlayColor: MaterialStateProperty.all<Color>(Colors.transparent),
              elevation: MaterialStateProperty.all<double>(0),
              animationDuration: Duration.zero,
            ),
          ),
        ],
      ),
    );
  }
}
```
</details>