app_bar_search 1.0.9 copy "app_bar_search: ^1.0.9" to clipboard
app_bar_search: ^1.0.9 copied to clipboard

A lightweight Flutter AppBar widget with integrated search and smooth animations.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:app_bar_search/app_bar_search.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'App Bar Search',
      theme: ThemeData(
        useMaterial3: true,
        colorSchemeSeed: Colors.blue,
      ),
      home: const MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key});

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  int _counter = 0;
  String _searchQuery = '';

  void _incrementCounter() {
    setState(() => _counter++);
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBarSearch(
        title: 'Home',
        hintText: 'Search...',
        onChanged: (value) {
          setState(() => _searchQuery = value);
        },
        animationStyle: SearchAnimationStyle.scale,
        onClear: () {
          setState(() => _searchQuery = '');
        },
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            Text(
              _searchQuery.isEmpty
                  ? 'You have pushed the button this many times:'
                  : 'Searching for: $_searchQuery',
            ),
            const SizedBox(height: 12),
            Text(
              '$_counter',
              style: Theme.of(context).textTheme.headlineMedium,
            ),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        child: const Icon(Icons.add),
      ),
    );
  }
}
4
likes
150
points
171
downloads

Publisher

unverified uploader

Weekly Downloads

A lightweight Flutter AppBar widget with integrated search and smooth animations.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on app_bar_search