From 1d66a0e82a2641eeda8d799520c1bcb8a6252995 Mon Sep 17 00:00:00 2001 From: Miguel Beltran Date: Mon, 24 Jul 2023 20:50:26 +0200 Subject: [PATCH] Enable Material 3 on `background_isolate_channels` (#1946) --- background_isolate_channels/lib/main.dart | 35 +++++++++++------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/background_isolate_channels/lib/main.dart b/background_isolate_channels/lib/main.dart index 49f9c19e1..616770efb 100644 --- a/background_isolate_channels/lib/main.dart +++ b/background_isolate_channels/lib/main.dart @@ -31,6 +31,7 @@ class MyApp extends StatelessWidget { title: 'Background Isolate Channels', theme: ThemeData( primarySwatch: Colors.blue, + useMaterial3: true, ), home: const MyHomePage(title: 'Background Isolate Channels'), ); @@ -124,26 +125,24 @@ class _MyHomePageState extends State { return Scaffold( appBar: AppBar( title: Text(widget.title), - ), - body: Column( - children: [ - TextField( - onChanged: - _database == null ? null : (query) => _refresh(query: query), - decoration: const InputDecoration( - labelText: 'Search', - suffixIcon: Icon(Icons.search), - ), - ), - Expanded( - child: ListView.builder( - itemBuilder: (context, index) { - return ListTile(title: Text(_entries![index])); - }, - itemCount: _entries?.length ?? 0, + bottom: PreferredSize( + preferredSize: const Size.fromHeight(kToolbarHeight), + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 8.0), + child: SearchBar( + hintText: 'Search', + onChanged: + _database == null ? null : (query) => _refresh(query: query), + trailing: const [Icon(Icons.search), SizedBox(width: 8)], ), ), - ], + ), + ), + body: ListView.builder( + itemBuilder: (context, index) { + return ListTile(title: Text(_entries![index])); + }, + itemCount: _entries?.length ?? 0, ), floatingActionButton: FloatingActionButton( onPressed: _database == null ? null : _addDate,