adaptive_navbar 0.0.3 adaptive_navbar: ^0.0.3 copied to clipboard
An Adaptive Navigation Bar in flutter. Depending on the screen width, this navbar changes itself into a menu icon in mobile view and navbar in web view.
import 'package:adaptive_navbar/adaptive_navbar.dart';
import 'package:flutter/material.dart';
/// Entry point of the application
void main() {
runApp(const MyApp());
}
/// Base structure of the app.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return const MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Adaptive NavBar',
home: HomePage(),
);
}
}
/// HomePage of the app.
class HomePage extends StatelessWidget {
const HomePage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
/// Screen Width of the device.
final sw = MediaQuery.of(context).size.width;
return Scaffold(
appBar: AdaptiveNavBar(
screenWidth: sw,
title: const Text("Adaptive NavBar"),
navBarItems: [
NavBarItem(
text: "Home",
onTap: () {
Navigator.pushNamed(context, "routeName");
},
),
NavBarItem(
text: "About Us",
onTap: () {
Navigator.pushNamed(context, "routeName");
},
),
NavBarItem(
text: "About Us",
onTap: () {
Navigator.pushNamed(context, "routeName");
},
),
NavBarItem(
text: "About Us",
onTap: () {
Navigator.pushNamed(context, "routeName");
},
),
],
),
body: const Center(
child: Text(
'This package, "ADAPTIVE NAVBAR", was developed by Mouli Bheemaneti.',
),
),
);
}
}