-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
Closed
Copy link
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listf: focusFocus traversal, gaining or losing focusFocus traversal, gaining or losing focusf: material designflutter/packages/flutter/material repository.flutter/packages/flutter/material repository.found in release: 3.33Found to occur in 3.33Found to occur in 3.33found in release: 3.35Found to occur in 3.35Found to occur in 3.35frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-designOwned by Design Languages teamOwned by Design Languages teamtriaged-designTriaged by Design Languages teamTriaged by Design Languages team
Description
Steps to reproduce
- Run the code sample
- Press tab two times to move the focus on the second TextButton which label is "TextButton.icon"
- Click on the button or press enter
Expected results
The icon appears and the focus stays on the button
Actual results
The icon appears and the focus move to the first button
(Also the Ink animation is interrupted)
Code sample
Code sample
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
/// Flutter code sample for [SegmentedButton].
void main() {
runApp(const SegmentedButtonApp());
}
class SegmentedButtonApp extends StatefulWidget {
const SegmentedButtonApp({super.key});
@override
State<SegmentedButtonApp> createState() => _SegmentedButtonAppState();
}
class _SegmentedButtonAppState extends State<SegmentedButtonApp> {
bool showIcon = false;
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: TextButtonTheme(
data: const TextButtonThemeData(
style: ButtonStyle(
backgroundColor: WidgetStateProperty.fromMap(<WidgetStatesConstraint, Color>{
WidgetState.focused: Colors.greenAccent,
WidgetState.any: Color(0xFFEEEEFF),
}),
),
),
child: Center(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
spacing: 16,
children: [
TextButton(onPressed: onPressed, child: const Text('TextButton')),
TextButton.icon(
onPressed: onPressed,
icon: showIcon ? const Icon(Icons.check) : null,
label: const Text('TextButton.icon'),
),
],
),
),
),
),
);
}
void onPressed() {
setState(() {
showIcon = !showIcon;
});
}
}
Screenshots or Video
Screenshots / Video demonstration
Screen.Recording.2025-08-18.at.09.47.33.mov
Logs
Flutter Doctor output
Doctor output
Flutter (Channel [user-branch], 3.33.0-1.0.pre.401, on macOS 15.5 24F74 darwin-arm64, locale en-FR)Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listf: focusFocus traversal, gaining or losing focusFocus traversal, gaining or losing focusf: material designflutter/packages/flutter/material repository.flutter/packages/flutter/material repository.found in release: 3.33Found to occur in 3.33Found to occur in 3.33found in release: 3.35Found to occur in 3.35Found to occur in 3.35frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-designOwned by Design Languages teamOwned by Design Languages teamtriaged-designTriaged by Design Languages teamTriaged by Design Languages team
Type
Projects
Status
Done (PR merged)