rail_navigator 1.0.0
rail_navigator: ^1.0.0 copied to clipboard
A customizable side navigation rail for Flutter apps, allowing developers to create dynamic and responsive navigation menus with configurable options.
Basic example #
import 'package:flutter/material.dart';
import 'package:rail_navigator/rail_navigator.dart';
/// The main entry point for the BasicExample application.
void main() {
runApp(const BasicExample());
}
/// A StatefulWidget that demonstrates the usage of RailNavigator.
class BasicExample extends StatefulWidget {
/// Creates a [BasicExample].
const BasicExample({super.key});
@override
BasicExampleState createState() => BasicExampleState();
}
/// The state for the [BasicExample] widget.
/// Manages the expanded/collapsed state of the RailNavigator.
class BasicExampleState extends State<BasicExample> {
/// Tracks whether the RailNavigator is expanded or collapsed.
bool isExpanded = false;
/// Toggles the expanded/collapsed state of the RailNavigator.
void toggleRail() {
setState(() {
isExpanded = !isExpanded;
});
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: Row(
children: [
// Basic RailNavigator with default settings
RailNavigator(
isExpanded: isExpanded,
onToggle: toggleRail,
railItems: [
RailItem(icon: Icons.dashboard, label: 'Dashboard'),
RailItem(icon: Icons.settings, label: 'Settings'),
RailItem(icon: Icons.info, label: 'About'),
],
),
const Expanded(
child: Center(child: Text('Main Content Area')),
),
],
),
),
);
}
}