-
Notifications
You must be signed in to change notification settings - Fork 30.1k
Closed
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work lista: devtoolsDevTools related - suite of performance and debugging toolsDevTools related - suite of performance and debugging toolsf: inspectorPart of widget inspector in framework.Part of widget inspector in framework.found in release: 2.8Found to occur in 2.8Found to occur in 2.8found in release: 2.9Found to occur in 2.9Found to occur in 2.9frameworkflutter/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 version
Description
This is because RenderIndexedStack does not override the debugDescribeChildren so the one from ContainerRenderObjectMixin is used that describes all the children instead of just the one that's actually displayed.
In this line, we can see as the Flutter Inspector hit tests using debugDescribeChildren: https://github.com/flutter/flutter/blob/master/packages/flutter/lib/src/widgets/widget_inspector.dart#L2275
[✓] Flutter (Channel stable, 2.8.1, on macOS 12.1 21C52 darwin-arm, locale
en-PL)
• Flutter version 2.8.1 at /Users/albert/fvm/versions/2.8.1
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 77d935af4d (4 weeks ago), 2021-12-16 08:37:33 -0800
• Engine revision 890a5fca2e
• Dart version 2.15.1
Reproduction
Steps: Run the code below, launch Flutter Inspector and click exactly at the center of the first tab contents text.
Expected: A text from tab 1 is selected.
Actual: A text from tab 2 is selected.
Code for reproduction
import 'package:flutter/material.dart';
void main() {
runApp(
const MaterialApp(
home: Screen(),
),
);
}
class Screen extends StatefulWidget {
const Screen({Key? key}) : super(key: key);
@override
_ScreenState createState() => _ScreenState();
}
class _ScreenState extends State<Screen> {
int tab = 0;
@override
Widget build(BuildContext context) {
return Scaffold(
bottomNavigationBar: BottomNavigationBar(
onTap: (index) => setState(() => tab = index),
currentIndex: tab,
items: const [
BottomNavigationBarItem(
icon: Icon(Icons.filter_1),
label: 'Tab 1',
),
BottomNavigationBarItem(
icon: Icon(Icons.filter_2),
label: 'Tab 2',
),
],
),
body: IndexedStack(
index: tab,
sizing: StackFit.expand,
children: const [
Center(child: Text('This is long text in tab 1')),
Center(child: Text('This is tab 2')),
],
),
);
}
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work lista: devtoolsDevTools related - suite of performance and debugging toolsDevTools related - suite of performance and debugging toolsf: inspectorPart of widget inspector in framework.Part of widget inspector in framework.found in release: 2.8Found to occur in 2.8Found to occur in 2.8found in release: 2.9Found to occur in 2.9Found to occur in 2.9frameworkflutter/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 version
