Repository navigation
Search View doesn't update size on navigator resize #186154
Copy link
Copy link
Closed
flutter/packages
#12466Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listp: material_uimaterial_ui package in flutter/packagesmaterial_ui package in flutter/packagespackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.platform-androidAndroid applications specificallyAndroid applications specificallyplatform-iosiOS applications specificallyiOS applications specificallyplatform-macosBuilding on or for macOS specificallyBuilding on or for macOS specificallyplatform-webWeb applications specificallyWeb applications specificallyteam-designOwned by Design Languages teamOwned by Design Languages teamtriaged-designTriaged by Design Languages teamTriaged by Design Languages team
Description
Steps to reproduce
- Use full screen search view (SearchAnchor).
- Rotate phone/expand window.
- Search view has outdated forced constraints.
Alternatively if navigator is resized to not be covered by keyboard:
- Open keyboard (for example long press to search bar inside of search anchor).
- Open search view.
- Close keyboard.
- View is clipped at the bottom because navigator was initially small.
Expected results
View should update viewMaxWidth to match new constraints.
_SearchViewRoute should call updateTweens when Navigator.size changes.
It seems that _viewRect is provided from evaluated tween (animation) and also updated in _ViewContentState.didChangeDependencies using media query (which is incorrect and should actually use Navigator.size, because navigator can be resized in response to opened/closed keyboard)
Actual results
View is stuck with old size constraints.
Code sample
Code sample
import 'package:flutter/material.dart';
/// Flutter code sample for [SearchAnchor].
void main() => runApp(const SearchBarApp());
class SearchBarApp extends StatefulWidget {
const SearchBarApp({super.key});
@override
State<SearchBarApp> createState() => _SearchBarAppState();
}
class _SearchBarAppState extends State<SearchBarApp> {
final SearchController controller = SearchController();
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(title: const Text('Search Anchor Sample')),
body: Column(
children: <Widget>[
SearchAnchor(
searchController: controller,
isFullScreen: true,
builder: (BuildContext context, SearchController controller) {
return IconButton(
icon: const Icon(Icons.search),
onPressed: () {
controller.openView();
},
);
},
suggestionsBuilder:
(BuildContext context, SearchController controller) {
return List<ListTile>.generate(5, (int index) {
final String item = 'item $index';
return ListTile(
title: Text(item),
onTap: () {
setState(() {
controller.closeView(item);
});
},
);
});
},
),
Center(
child: controller.text.isEmpty
? const Text('No item selected')
: Text('Selected item: ${controller.value.text}'),
),
],
),
),
);
}
}Screenshots or Video
No response
Logs
No response
Flutter Doctor output
Doctor output
[√] Flutter (Channel stable, 3.41.9, on Microsoft Windows [Version 10.0.19044.4529], locale en-US) [599ms]
• Flutter version 3.41.9 on channel stable at D:\Android\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 00b0c91f06 (7 days ago), 2026-04-29 10:03:19 -0700
• Engine revision 42d3d75a56
• Dart version 3.11.5
• DevTools version 2.54.2
• Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop, enable-android,
enable-ios, cli-animations, enable-native-assets, enable-swift-package-manager, omit-legacy-version-file,
enable-lldb-debugging, enable-uiscene-migration
[√] Windows Version (10 Enterprise 64-bit, 21H2, 2009) [4.5s]
[√] Android toolchain - develop for Android devices (Android SDK version 36.0.0) [6.1s]
• Android SDK at D:\Android\sdk
• Emulator version 36.5.10.0 (build_id 15081367) (CL:N/A)
• Platform android-36, build-tools 36.0.0
• ANDROID_HOME = D:\Android\sdk
• Java binary at: d:\Program Files\Android Studio Beta\jbr\bin\java
This is the JDK bundled with the latest Android Studio installation on this machine.
To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
• Java version OpenJDK Runtime Environment (build 21.0.10+-14961533-b1163.108)
• All Android licenses accepted.
[√] Chrome - develop for the web [137ms]
• CHROME_EXECUTABLE = C:\Program Files\Google\Chrome Beta\Application\chrome.exe
[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.14.31 (April 2026)) [134ms]
• Visual Studio at D:\Program Files\Microsoft Visual Studio\2022\Community
• Visual Studio Community 2022 version 17.14.37216.2
• Windows 10 SDK version 10.0.26100.0
[√] Connected device (3 available) [334ms]
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19044.4529]
• Chrome (web) • chrome • web-javascript • Google Chrome 147.0.7727.138
• Edge (web) • edge • web-javascript • Microsoft Edge 147.0.3912.98
[√] Network resources [446ms]
• All expected network resources are available.
• No issues found!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 listp: material_uimaterial_ui package in flutter/packagesmaterial_ui package in flutter/packagespackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.platform-androidAndroid applications specificallyAndroid applications specificallyplatform-iosiOS applications specificallyiOS applications specificallyplatform-macosBuilding on or for macOS specificallyBuilding on or for macOS specificallyplatform-webWeb applications specificallyWeb applications specificallyteam-designOwned by Design Languages teamOwned by Design Languages teamtriaged-designTriaged by Design Languages teamTriaged by Design Languages team
Activity
saurabh-mirajkar commentedon May 7, 2026
@Zekfad Thanks for the detailed report. I’m able to reproduce the issue on multiple platforms using the provided code sample.
After opening the fullscreen
SearchAnchor, resizing the window or rotating the device causes the search view to retain stale size constraints instead of adapting to the updated navigator dimensions.Routing this to
team-designfor further investigation.[material_ui] SearchAnchor overlay expands to full screen when viewpo…
github-actions commentedon Sep 3, 2026
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.