glass_nav_bar 0.0.5 copy "glass_nav_bar: ^0.0.5" to clipboard
glass_nav_bar: ^0.0.5 copied to clipboard

A customizable navigation bar for Flutter apps with a frosted glass effect. The navigation bar allows you to set custom icons, labels, and colors for both selected and unselected states. It uses the ` [...]

example/lib/glass_nav_bar.dart

import 'package:flutter/material.dart';
import 'package:glass_nav_bar/glass_nav_bar.dart';
import 'package:glass_nav_bar/nav_bar_item.dart';

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

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'Glass Nav Bar',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const MyHomePage(title: 'Glass Nav Bar'),
    );
  }
}

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

  final String title;

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

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

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

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            const Text(
              'You have pushed the button this many times:',
            ),
            Text(
              '$_counter',
              style: Theme.of(context).textTheme.headlineMedium,
            ),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        child: const Icon(Icons.add),
      ),
      bottomNavigationBar: GlassNavBar(
          selectedIndex: _selectedIndex,
          onItemTapped: (newIndex) {
            setState(() {
              _selectedIndex = newIndex;
            });
          },
          textColor: Colors.black,
          iconColor: Colors.black54,
          activeTextColor: Colors.pink,
          activeIconColor: Colors.pink,
          items: [
            NavBarItem(icon: Icons.home, label: "Home"),
            NavBarItem(icon: Icons.notifications, label: "Notifications"),
            NavBarItem(icon: Icons.settings, label: "Settings"),
            NavBarItem(icon: Icons.person, label: "Profile"),
          ]),
    );
  }

  int _selectedIndex = 0;
}
3
likes
140
points
60
downloads

Publisher

unverified uploader

Weekly Downloads

A customizable navigation bar for Flutter apps with a frosted glass effect. The navigation bar allows you to set custom icons, labels, and colors for both selected and unselected states. It uses the `BackdropFilter` widget to create the glass effect with a blur.

Repository (GitHub)
View/report issues

Documentation

Documentation
API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on glass_nav_bar