dot_navigation_bar 1.0.0 dot_navigation_bar: ^1.0.0 copied to clipboard
Simple smooth animations, providing a nice and cleanUI/UX Bottom Nav Bar.
import 'package:dot_navigation_bar/dot_navigation_bar.dart';
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
visualDensity: VisualDensity.adaptivePlatformDensity,
),
home: Home(),
);
}
}
class Home extends StatefulWidget {
@override
_HomeState createState() => _HomeState();
}
class _HomeState extends State<Home> {
var _selectedTab = _SelectedTab.home;
void _handleIndexChanged(int i) {
setState(() {
_selectedTab = _SelectedTab.values[i];
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
extendBody: true,
body: Container(
child: Image.asset("lib/img/1.png"),
),
bottomNavigationBar: DotNavigationBar(
currentIndex: _SelectedTab.values.indexOf(_selectedTab),
dotIndicatorColor: Colors.white,
unselectedItemColor: Colors.grey[300],
onTap: _handleIndexChanged,
items: [
/// Home
DotNavigationBarItem(
icon: Icon(Icons.home),
selectedColor: Color(0xff73544C),
),
/// Likes
DotNavigationBarItem(
icon: Icon(Icons.favorite),
selectedColor: Color(0xff73544C),
),
/// Search
DotNavigationBarItem(
icon: Icon(Icons.search),
selectedColor: Color(0xff73544C),
),
/// Profile
DotNavigationBarItem(
icon: Icon(Icons.person),
selectedColor: Color(0xff73544C),
),
],
),
);
}
}
enum _SelectedTab { home, favorite, search, person }