dot_navigation_bar 0.2.0
dot_navigation_bar: ^0.2.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(
body: Container(
color: Colors.grey,
),
bottomNavigationBar: DotNavigationBar(
currentIndex: _SelectedTab.values.indexOf(_selectedTab),
onTap: _handleIndexChanged,
items: [
/// Home
DotNavigationBarItem(
icon: Icon(Icons.home),
selectedColor: Colors.greenAccent[600],
),
/// Likes
DotNavigationBarItem(
icon: Icon(Icons.favorite_border),
selectedColor: Colors.pink[600],
),
/// Search
DotNavigationBarItem(
icon: Icon(Icons.search),
selectedColor: Colors.orange[600],
),
/// Profile
DotNavigationBarItem(
icon: Icon(Icons.person),
selectedColor: Colors.blue[600],
),
],
),
);
}
}
enum _SelectedTab { home, favorite, search, person }