-
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: material designflutter/packages/flutter/material repository.flutter/packages/flutter/material repository.found in release: 3.13Found to occur in 3.13Found to occur in 3.13found in release: 3.14Found to occur in 3.14Found to occur in 3.14frameworkflutter/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
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
- Run the provided sample code
- Start typing within the search bar
- Check your debug console for logs
Expected results
You should see debug logs of user input as you type within the search bar
Actual results
There is no debug log related to the search bar onChanged method as it seems not to be invoked at all.
Code sample
Code sample
import 'package:flutter/material.dart';
/// Flutter code sample for [SearchBar].
void main() => runApp(const SearchBarApp());
class SearchBarApp extends StatefulWidget {
const SearchBarApp({super.key});
@override
State<SearchBarApp> createState() => _SearchBarAppState();
}
class _SearchBarAppState extends State<SearchBarApp> {
bool isDark = false;
@override
Widget build(BuildContext context) {
final ThemeData themeData = ThemeData(
useMaterial3: true,
brightness: isDark ? Brightness.dark : Brightness.light);
return MaterialApp(
theme: themeData,
home: Scaffold(
appBar: AppBar(title: const Text('Search Bar Sample')),
body: Padding(
padding: const EdgeInsets.all(8.0),
child: SearchAnchor(
builder: (BuildContext context, SearchController controller) {
return SearchBar(
controller: controller,
padding: const MaterialStatePropertyAll<EdgeInsets>(
EdgeInsets.symmetric(horizontal: 16.0)),
onTap: () {
controller.openView();
},
onChanged: (value) {
debugPrint(value);
controller.openView();
},
leading: const Icon(Icons.search),
trailing: <Widget>[
Tooltip(
message: 'Change brightness mode',
child: IconButton(
isSelected: isDark,
onPressed: () {
setState(() {
isDark = !isDark;
});
},
icon: const Icon(Icons.wb_sunny_outlined),
selectedIcon: const Icon(Icons.brightness_2_outlined),
),
)
],
);
}, 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);
});
},
);
});
}),
),
),
);
}
}
Screenshots or Video
Logs
Logs
No logs!Flutter Doctor output
Doctor output
[√] Flutter (Channel stable, 3.10.6, on Microsoft Windows [Version 10.0.19045.3324], locale en-US)
• Flutter version 3.10.6 on channel stable at C:\Workspace\Development\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision f468f3366c (6 weeks ago), 2023-07-12 15:19:05 -0700
• Engine revision cdbeda788a
• Dart version 3.0.6
• DevTools version 2.23.1
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
• Android SDK at C:\Workspace\Development\AndroidSDK
• Platform android-33, build-tools 31.0.0
• ANDROID_SDK_ROOT = C:\Workspace\Development\AndroidSDK
• Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
• Java version OpenJDK Runtime Environment (build 17.0.6+0-b2043.56-9586694)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.11.2)
• Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
• Visual Studio Community 2019 version 16.11.31624.102
• Windows 10 SDK version 10.0.22000.0
[√] Android Studio (version 2022.2)
• Android Studio at C:\Program Files\Android\Android Studio
• 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.6+0-b2043.56-9586694)
[√] VS Code (version 1.81.1)
• VS Code at C:\Users\user\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.70.0
[√] Connected device (4 available)
• Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android 11 (API 30) (emulator)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19045.3324]
• Chrome (web) • chrome • web-javascript • Google Chrome 115.0.5790.173
• Edge (web) • edge • web-javascript • Microsoft Edge 115.0.1901.203cbenhagen, hbcraft, asdine, ips-jm, PackRuble and 5 more
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listf: material designflutter/packages/flutter/material repository.flutter/packages/flutter/material repository.found in release: 3.13Found to occur in 3.13Found to occur in 3.13found in release: 3.14Found to occur in 3.14Found to occur in 3.14frameworkflutter/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
