Repository: flutter
Issue: Incorrect highlight color for hovered and focused InkResponse
Labels: framework,f: material design,P2,team-design,triaged-design,found in release: 3.24,found in release: 3.25

### Steps to reproduce

1. Create `InkResponse`, `InkWell`, or a material button with an `overlayColor` that resolves to colors with different opacities for hovered and focused states.
2. a. If the `overlayColor` resolves hovered and focused at the same time as hovered (1st `InkResponse` in the code sample), hover while unfocused, focus while hovered, and unhover while focused.
  b. If the `overlayColor` resolves hovered and focused at the same time as focused (2nd `InkResponse` in the code sample), focus while unhovered, hover while focused, and unfocus while hovered.
3. Compare the highlight color with the usual focused/hovered color and the color from the `overlayColor`.

### Expected results

The highlight color is correct and matches the color from the `overlayColor`.

### Actual results

The highlight color has the opacity of the other color from the `overlayColor`.

This is caused by 2 issues:
1. `_InkResponseState.updateHighlight` resolves the `overlayColor` using `statesController.value` that can have multiple states. As a result, the highlight for the focused state can get the color for the hovered state and vice versa.
2. `_InkResponseState.build` sets the correct color for the highlight, but `InkHighlight._alpha` isn't updated and the highlight is painted with the old opacity.

A possible workaround is to set the widget's `statesController` to a controller that stores only the last state. For example:
```dart
class SingleWidgetStateController extends WidgetStatesController {
  @override
  void update(WidgetState state, bool add) {
    if (add) value.retainAll([state]);
    super.update(state, add);
  }
}
```

### Code sample

<details open><summary>Code sample</summary>

```dart
import 'package:flutter/material.dart';

void main() {
  runApp(const MainApp());
}

class MainApp extends StatelessWidget {
  const MainApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: Center(
          child: Column(
            mainAxisSize: MainAxisSize.min,
            children: [
              SizedBox.square(
                dimension: 70,
                child: InkResponse(
                  onTap: () {},
                  overlayColor: WidgetStateProperty.resolveWith(
                    (Set<WidgetState> states) {
                      if (states.contains(WidgetState.hovered)) {
                        return Colors.amber.withOpacity(0.2);
                      }
                      if (states.contains(WidgetState.focused)) {
                        return Colors.blue.withOpacity(0.8);
                      }
                      return Colors.transparent;
                    },
                  ),
                  child: const Center(child: Text('1')),
                ),
              ),
              SizedBox.square(
                dimension: 70,
                child: InkResponse(
                  onTap: () {},
                  overlayColor: WidgetStateProperty.resolveWith(
                    (Set<WidgetState> states) {
                      if (states.contains(WidgetState.focused)) {
                        return Colors.blue.withOpacity(0.8);
                      }
                      if (states.contains(WidgetState.hovered)) {
                        return Colors.amber.withOpacity(0.2);
                      }
                      return Colors.transparent;
                    },
                  ),
                  child: const Center(child: Text('2')),
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
```

</details>


### Screenshots or Video

<details open>
<summary>Screenshots / Video demonstration</summary>
Expected:

https://github.com/user-attachments/assets/28afcfdb-03f7-4264-8fd2-4778e3c161f0

Actual:

https://github.com/user-attachments/assets/933a3129-a4ce-4c9b-855e-0a07ed3cd004

</details>


### Logs

<details open><summary>Logs</summary>

```console
[Paste your logs here]
```

</details>


### Flutter Doctor output

<details open><summary>Doctor output</summary>

```console
[✓] Flutter (Channel stable, 3.24.1, on macOS 14.6.1 23G93 darwin-arm64, locale en-UA)
    • Flutter version 3.24.1 on channel stable at /Users/andrew/Applications/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 5874a72aa4 (2 weeks ago), 2024-08-20 16:46:00 -0500
    • Engine revision c9b9d5780d
    • Dart version 3.5.1
    • DevTools version 2.37.2

[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
    • Android SDK at /Users/andrew/Library/Android/sdk
    • Platform android-34, build-tools 35.0.0
    • Java binary at: /Users/andrew/Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.11+0-17.0.11b1207.24-11852314)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.4)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15F31d
    • CocoaPods version 1.15.0

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2024.1)
    • Android Studio at /Users/andrew/Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.11+0-17.0.11b1207.24-11852314)

[✓] VS Code (version 1.92.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.96.0

[✓] Connected device (3 available)
    • macOS (desktop)                 • macos                     • darwin-arm64   • macOS 14.6.1 23G93 darwin-arm64
    • Mac Designed for iPad (desktop) • mac-designed-for-ipad     • darwin         • macOS 14.6.1 23G93 darwin-arm64
    • Chrome (web)                    • chrome                    • web-javascript • Google Chrome 128.0.6613.114

[✓] Network resources
    • All expected network resources are available.

• No issues found!
```

</details>