@@ -43,6 +43,10 @@ class WindowsSearchDelegate extends AbstractPlatformSearchDelegate {
4343
4444 @override
4545 Widget buildScaffold (Widget ? body, BuildContext context) {
46+ const BorderSide _kDefaultRoundedBorderSide = BorderSide (
47+ style: BorderStyle .solid,
48+ width: 0.8 ,
49+ );
4650 return fluent.Scaffold (
4751 left: NavigationPanel (
4852 currentIndex: 2 ,
@@ -53,65 +57,62 @@ class WindowsSearchDelegate extends AbstractPlatformSearchDelegate {
5357 ),
5458 ),
5559 items: [
56- NavigationPanelItem (
57- header: true ,
58- label: fluent.Container (
59- color: Colors .white,
60- child: fluent.AutoSuggestBox <PlatformItem >(
61- controller: queryTextController,
62- items: search (query),
63- onSelected: (text) {
64- print (text);
65- },
66- noResultsFound: (context) => ListTile (
67- title: DefaultTextStyle (
68- style: TextStyle (
69- fontWeight: FontWeight .normal, color: Colors .black),
70- child: Text ('No results found' ),
60+ NavigationPanelSectionHeader (
61+ header: fluent.AutoSuggestBox <PlatformItem >(
62+ onSelected: (PlatformItem item) => print (item.name),
63+ controller: queryTextController,
64+ sorter: (String text, List items) => search.call (text),
65+ items: platforms,
66+ noResultsFound: (context) => ListTile (
67+ title: DefaultTextStyle (
68+ style: TextStyle (
69+ fontWeight: FontWeight .normal, color: Colors .black),
70+ child: Text ('No results found' ),
71+ ),
72+ ),
73+ itemBuilder: (context, item) {
74+ return PlatformItemWidget (
75+ item,
76+ small: true ,
77+ );
78+ },
79+ textBoxBuilder: (context, controller, fn, key) => TextBox (
80+ key: key,
81+ controller: controller,
82+ focusNode: fn,
83+ suffixMode: OverlayVisibilityMode .always,
84+ suffix: fluent.Row (
85+ children: [
86+ controller.text.isNotEmpty
87+ ? IconButton (
88+ icon: fluent.Icon (Icons .close),
89+ onPressed: () {
90+ controller.clear ();
91+ fn.unfocus ();
92+ },
93+ )
94+ : fluent.SizedBox .shrink (),
95+ IconButton (
96+ icon: fluent.Icon (Icons .search),
97+ onPressed: () {},
7198 ),
99+ ],
100+ ),
101+ placeholder: searchFieldLabel,
102+ decoration: BoxDecoration (
103+ color: Colors .white,
104+ border: Border (
105+ top: _kDefaultRoundedBorderSide,
106+ bottom: _kDefaultRoundedBorderSide,
107+ left: _kDefaultRoundedBorderSide,
108+ right: _kDefaultRoundedBorderSide,
72109 ),
73- itemBuilder: (context, item) {
74- return PlatformItemWidget (
75- item,
76- small: true ,
77- );
78- },
79- textBoxBuilder: (context, controller, fN, key) {
80- const BorderSide _kDefaultRoundedBorderSide = BorderSide (
81- style: BorderStyle .solid,
82- width: 0.8 ,
83- );
84-
85- return TextBox (
86- key: key,
87- controller: controller,
88- focusNode: fN,
89- suffixMode: OverlayVisibilityMode .editing,
90- suffix: IconButton (
91- icon: fluent.Icon (Icons .close),
92- onPressed: () {
93- controller.clear ();
94- fN.unfocus ();
95- },
96- ),
97- placeholder: 'Type in a platform' ,
98- decoration: BoxDecoration (
99- border: Border (
100- top: _kDefaultRoundedBorderSide,
101- bottom: _kDefaultRoundedBorderSide,
102- left: _kDefaultRoundedBorderSide,
103- right: _kDefaultRoundedBorderSide,
104- ),
105- borderRadius: fN.hasFocus
106- ? BorderRadius .vertical (top: Radius .circular (3.0 ))
107- : BorderRadius .all (Radius .circular (3.0 )),
108- ),
109- );
110- },
110+ borderRadius: fn.hasFocus
111+ ? BorderRadius .vertical (top: Radius .circular (3.0 ))
112+ : BorderRadius .all (Radius .circular (3.0 )),
111113 ),
112114 ),
113- ),
114- NavigationPanelSectionHeader (header: Text ('' )),
115+ )),
115116 NavigationPanelItem (
116117 icon: fluent.Icon (Icons .input),
117118 label: Text ('Page 1' ),
0 commit comments