-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Closed
Labels
f: cupertinoflutter/packages/flutter/cupertino repositoryflutter/packages/flutter/cupertino repositoryf: material designflutter/packages/flutter/material repository.flutter/packages/flutter/material repository.frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.
Description
Is there an existing issue for this?
- I have searched the existing issues
- I have read the guide to filing a bug
Steps to reproduce
- Set the
TargetPlatform.macOSto eitherTargetPlatform.macOSorTargetPlatform.iOS - Use the
Switch.adaptivewidget in a Flutter app. - Navigate to the widget using the keyboard (e.g. press the tab key).
- Observe that it takes two tab presses to traverse over the
Switch.adaptivecomponent.
The _buildCupertinoSwitch function in switch.dart adds an additional focus node around the Cupertino switch, which means that the user has to press tab twice to traverse over the component. This is an unnecessary step and makes the widget less user-friendly.
Expected results
The component should only have one focus node for the upertinoSwitch
Actual results
The widget should only have one focus node.
Code sample
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(platform: TargetPlatform.iOS),
home: Scaffold(
body: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Text("Press tab, notice two presses are required to show the focus on the switch"),
Switch.adaptive(value: true, onChanged: (value) {}),
const Text("Pressing tab again should advance to the next switch but it takes two presses"),
Switch.adaptive(value: true, onChanged: (value) {}),
],
),
),
);
}
}Screenshots or Video
No response
Logs
No response
Flutter Doctor output
[✓] Flutter (Channel stable, 3.10.0, on macOS 12.6.5 21G531 darwin-arm64, locale en-DE)
• Flutter version 3.10.0 on channel stable at /Users/petri/.asdf/installs/flutter/3.10.0
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 84a1e904f4 (3 days ago), 2023-05-09 07:41:44 -0700
• Engine revision d44b5a94c9
• Dart version 3.0.0
• DevTools version 2.23.1
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
• Android SDK at /Users/petri/Library/Android/sdk
• Platform android-33, build-tools 33.0.0
• ANDROID_SDK_ROOT = /Users/petri/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 14.0)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 14A309
• CocoaPods version 1.11.3
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2021.2)
• Android Studio at /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 11.0.12+0-b1504.28-7817840)
[✓] VS Code (version 1.78.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.64.0
[✓] Connected device (3 available)
• iPhone 14 (mobile) • 76847016-235E-452D-A671-7217818DB072 • ios • com.apple.CoreSimulator.SimRuntime.iOS-16-0 (simulator)
• macOS (desktop) • macos • darwin-arm64 • macOS 12.6.5 21G531 darwin-arm64
• Chrome (web) • chrome • web-javascript • Google Chrome 113.0.5672.92
[✓] Network resources
• All expected network resources are available.
• No issues found!
Metadata
Metadata
Assignees
Labels
f: cupertinoflutter/packages/flutter/cupertino repositoryflutter/packages/flutter/cupertino repositoryf: material designflutter/packages/flutter/material repository.flutter/packages/flutter/material repository.frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.
Type
Projects
Status
Done (PR merged)