jbh_bottom_nav_magnifier 1.0.0
jbh_bottom_nav_magnifier: ^1.0.0 copied to clipboard
Long-press lens and callout bubble for BottomNavigationBar with customizable shape, colors, and animations.
import 'package:flutter/material.dart';
import 'package:jbh_bottom_nav_magnifier/jbh_bottom_nav_magnifier.dart';
void main() {
runApp(const ExampleApp());
}
class ExampleApp extends StatelessWidget {
const ExampleApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'jbh_bottom_nav_magnifier Example',
theme: ThemeData(useMaterial3: true, colorSchemeSeed: Colors.blue),
home: const HomePage(),
);
}
}
class HomePage extends StatefulWidget {
const HomePage({super.key});
@override
State<HomePage> createState() => _HomePageState();
}
class _HomePageState extends State<HomePage> {
int _currentIndex = 0;
static const List<IconData> _icons = <IconData>[
Icons.home,
Icons.search,
Icons.person,
];
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('JBH Magnifier Example')),
body: Center(
child: Text(
'Tab: $_currentIndex',
style: Theme.of(context).textTheme.headlineMedium,
),
),
bottomNavigationBar: JbhBottomNavMagnifier(
currentIndex: _currentIndex,
child: BottomNavigationBar(
unselectedItemColor: Colors.red,
currentIndex: _currentIndex,
selectedItemColor: Colors.white,
onTap: (int i) => setState(() => _currentIndex = i),
items: List.generate(_icons.length, (int i) {
return BottomNavigationBarItem(
icon: Icon(_icons[i]),
label: ['Home', 'Search', 'Profile'][i],
);
}),
),
),
);
}
}