import 'package:flutter/material.dart'; import 'package:floating_search_bar/floating_search_bar.dart'; import 'dart:io' show Platform; import 'package:flutter/foundation.dart'; // The existing imports // !! Keep your existing impots here !! /// main is entry point of Flutter application void main() { // Desktop platforms aren't a valid platform. if (!kIsWeb) _setTargetPlatformForDesktop(); return runApp(MyApp()); } /// If the current platform is desktop, override the default platform to /// a supported platform (iOS for macOS, Android for Linux and Windows). /// Otherwise, do nothing. void _setTargetPlatformForDesktop() { TargetPlatform targetPlatform; if (Platform.isMacOS) { targetPlatform = TargetPlatform.iOS; } else if (Platform.isLinux || Platform.isWindows) { targetPlatform = TargetPlatform.android; } if (targetPlatform != null) { debugDefaultTargetPlatformOverride = targetPlatform; } } class MyApp extends StatefulWidget { @override _MyAppState createState() => _MyAppState(); } class _MyAppState extends State { @override Widget build(BuildContext context) { return MaterialApp( debugShowCheckedModeBanner: false, theme: ThemeData.light(), darkTheme: ThemeData.dark(), home: FloatingSearchBar.builder( pinned: true, itemCount: 100, padding: EdgeInsets.only(top: 10.0), itemBuilder: (BuildContext context, int index) { return ListTile( leading: Text(index.toString()), ); }, leading: CircleAvatar( child: Text("RD"), ), endDrawer: Drawer( child: Container(), ), onChanged: (String value) {}, onTap: () {}, decoration: InputDecoration.collapsed( hintText: "Search...", ), ), ); } }