circle_bottom_navigation 2.0.0 circle_bottom_navigation: ^2.0.0 copied to clipboard
An animated, beauty and functional Bottom Navigation Bar you app.
import 'package:circle_bottom_navigation/circle_bottom_navigation.dart';
import 'package:circle_bottom_navigation/widgets/tab_data.dart';
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Flutter Demo',
theme: ThemeData(
colorSchemeSeed: Colors.purple,
),
home: MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key});
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
int currentPage = 0;
final List<Widget> _pages = [
_Home(),
_History(),
_Search(),
_Alarm(),
];
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Center(
child: Text(
'Circle Bottom Navigation Example',
),
),
),
body: _pages[currentPage],
bottomNavigationBar: CircleBottomNavigation(
barHeight: 70,
circleSize: 65,
initialSelection: currentPage,
inactiveIconColor: Colors.grey,
textColor: Colors.black,
hasElevationShadows: false,
tabs: [
TabData(
icon: Icons.home,
iconSize: 35,
title: 'Home',
fontSize: 19,
fontWeight: FontWeight.bold,
),
TabData(
icon: Icons.history,
iconSize: 35,
title: 'History',
fontSize: 19,
fontWeight: FontWeight.bold,
),
TabData(
icon: Icons.search,
iconSize: 35,
title: 'Search',
fontSize: 19,
fontWeight: FontWeight.bold,
),
TabData(
icon: Icons.alarm,
iconSize: 35,
title: 'Alarm',
fontSize: 19,
fontWeight: FontWeight.bold,
),
],
onTabChangedListener: (index) => setState(() => currentPage = index),
),
);
}
}
class _Home extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
body: const Center(
child: Text(
'Home',
style: TextStyle(
fontSize: 20.0,
fontWeight: FontWeight.bold,
),
),
),
);
}
}
class _History extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
body: const Center(
child: Text(
'History',
style: TextStyle(
fontSize: 20.0,
fontWeight: FontWeight.bold,
),
),
),
);
}
}
class _Search extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
body: const Center(
child: Text(
'Search',
style: TextStyle(
fontSize: 20.0,
fontWeight: FontWeight.bold,
),
),
),
);
}
}
class _Alarm extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
body: const Center(
child: Text(
'Alarm ',
style: TextStyle(
fontSize: 20.0,
fontWeight: FontWeight.bold,
),
),
),
);
}
}