blur_bottom_bar 1.0.3 blur_bottom_bar: ^1.0.3 copied to clipboard
Flutter blur bottom bar is a recreation of the ios tab view with material desifn for android and ios
import 'package:blur_bottom_bar/blur_bottom_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(
title: 'Flutter example',
theme: ThemeData(
primarySwatch: Colors.blue,
visualDensity: VisualDensity.adaptivePlatformDensity,
),
home: MyHomePage(title: 'Flutter example Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key? key, required this.title}) : super(key: key);
final String title;
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
int _selectedIndex = 0;
static const TextStyle optionStyle =
TextStyle(fontSize: 30, fontWeight: FontWeight.bold);
static List<Widget> _widgetOptions = <Widget>[
ListView(
padding: const EdgeInsets.all(8),
children: <Widget>[
Container(
height: 200,
color: Colors.amber[600],
child: const Center(child: Text('Entry A')),
),
Container(
height: 200,
color: Colors.amber[500],
child: const Center(child: Text('Entry B')),
),
Container(
height: 200,
color: Colors.amber[800],
child: const Center(child: Text('Entry C')),
),
Container(
height: 300,
color: Colors.red[800],
child: const Center(child: Text('Entry C')),
),
],
),
Text(
'Index 1: Business',
style: optionStyle,
),
Text(
'Index 2: School',
style: optionStyle,
),
];
void _onItemTapped(int index) {
setState(() {
_selectedIndex = index;
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text("Blur bar example")),
body: Stack(
children: <Widget>[
_widgetOptions.elementAt(_selectedIndex),
BlurBottomView(
bottomNavigationBarItems: const <BottomNavigationBarItem>[
BottomNavigationBarItem(
icon: Icon(Icons.home),
label: 'Home',
),
BottomNavigationBarItem(
icon: Icon(Icons.business),
label: 'Business',
),
BottomNavigationBarItem(
icon: Icon(Icons.school),
label: 'School',
)
],
currentIndex: _selectedIndex,
onIndexChange: (val) {
_onItemTapped(val);
}),
],
),
);
}
}