context_app_bar 1.0.1 copy "context_app_bar: ^1.0.1" to clipboard
context_app_bar: ^1.0.1 copied to clipboard

A contextual app bar for flutter. This widget allows switching between standard app bar widgets triggered by a value notifier.

example/lib/main.dart

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

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

ValueNotifier<int> appbarSelector = ValueNotifier(0);

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Scaffold(
        appBar: ContextAppBar(
          appbarSelector: appbarSelector,
          children: [
            AppBar(
                key: UniqueKey(), // Any key that is unique to other app bars
                title: Text('The first appbar'),
                backgroundColor: Colors.green),
            AppBar(
                key: UniqueKey(),
                title: Text('The second appbar'),
                backgroundColor: Colors.red),
            AppBar(
                key: UniqueKey(),
                title: Text('The thrid appbar'),
                backgroundColor: Colors.blue),
            AppBar(
                key: UniqueKey(),
                title: Text('The fourth appbar'),
                backgroundColor: Colors.grey),
          ],
        ),
        floatingActionButton: FloatingActionButton(
          onPressed: () {
            appbarSelector.value = (appbarSelector.value + 1) % 4;
          },
          child: Icon(Icons.add),
        ),
      ),
    );
  }
}
1
likes
160
points
30
downloads
screenshot

Publisher

unverified uploader

Weekly Downloads

A contextual app bar for flutter. This widget allows switching between standard app bar widgets triggered by a value notifier.

Repository (GitHub)
View/report issues

Topics

#widget #appbar

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flutter

More

Packages that depend on context_app_bar