rolling_bottom_bar 1.1.0
rolling_bottom_bar: ^1.1.0 copied to clipboard
Package to show a dynamic bottom bar with a ball as indicator.
import 'package:flutter/material.dart';
import 'package:rolling_bottom_bar/rolling_bottom_bar.dart';
import 'package:rolling_bottom_bar/rolling_bottom_bar_item.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
debugShowCheckedModeBanner: false,
theme: ThemeData(
primarySwatch: Colors.blue,
visualDensity: VisualDensity.adaptivePlatformDensity,
),
home: const MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key});
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
final _controller = PageController();
@override
void dispose() {
_controller.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Rolling Bottom Bar'),
),
body: PageView(
controller: _controller,
children: <Widget>[
ColoredBox(color: Colors.blueGrey.shade100),
ColoredBox(color: Colors.redAccent),
ColoredBox(color: Colors.greenAccent),
ColoredBox(color: Colors.yellowAccent),
],
),
extendBody: true,
bottomNavigationBar: RollingBottomBar(
controller: _controller,
flat: true,
useActiveColorByDefault: false,
topRadius: 10,
bottomRadius: 28,
elevation: 5,
itemSize: RollingItemSize.lg,
items: [
RollingBottomBarItem(Icons.home,
label: 'Page 1', activeColor: Colors.redAccent),
RollingBottomBarItem(Icons.star,
label: 'Page 2', activeColor: Colors.blueAccent),
RollingBottomBarItem(Icons.person,
label: 'Page 3', activeColor: Colors.yellowAccent),
RollingBottomBarItem(Icons.access_alarm,
label: 'Page 4', activeColor: Colors.orangeAccent),
],
enableIconRotation: true,
onTap: (index) {
_controller.animateToPage(
index,
duration: const Duration(milliseconds: 400),
curve: Curves.easeOut,
);
},
),
);
}
}