reveal_search_bar 0.3.0 copy "reveal_search_bar: ^0.3.0" to clipboard
reveal_search_bar: ^0.3.0 copied to clipboard

simple appbar transition to appbar with textField.

example/lib/main.dart

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

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

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

  @override
  Widget build(BuildContext context) {
    return Directionality(
      textDirection: TextDirection.ltr,
      child: MaterialApp(
        debugShowCheckedModeBanner: false,
        title: 'Flutter Search Bar Transition Example',
        theme: ThemeData(
          colorScheme: ColorScheme.fromSwatch(primarySwatch: Colors.blue)
              .copyWith(secondary: Colors.amber),
        ),
        home: MyHomePage(title: 'Flutter Search Bar Transition Example'),
      ),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  MyHomePageState createState() => MyHomePageState();
}

class MyHomePageState extends State<MyHomePage> {
  int _counter = 0;
  late TextEditingController controller;
  bool isRTL = false;

  @override
  void initState() {
    controller = TextEditingController();
    super.initState();
  }

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

  @override
  Widget build(BuildContext context) {
    return Directionality(
      textDirection: isRTL ? TextDirection.rtl : TextDirection.ltr,
      child: Scaffold(
        appBar: RevealAppBar(
          searchController: controller,
          title: Text(widget.title),
        ),
        body: Center(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
              Text(
                'You have pushed the button this many times:',
              ),
              Text(
                '$_counter',
                style: Theme.of(context).textTheme.headlineMedium,
              ),
              TextButton(
                child: Text(isRTL ? 'rtl' : 'ltr'),
                onPressed: () {
                  setState(() {
                    isRTL = !isRTL;
                  });
                },
              )
            ],
          ),
        ),
        floatingActionButton: FloatingActionButton(
          onPressed: _incrementCounter,
          tooltip: 'Increment',
          child: Icon(Icons.add),
        ),
      ),
    );
  }
}
7
likes
160
points
32
downloads

Publisher

unverified uploader

Weekly Downloads

simple appbar transition to appbar with textField.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on reveal_search_bar