rail_navigator 1.0.0 copy "rail_navigator: ^1.0.0" to clipboard
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.

example/example.md

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')),
            ),
          ],
        ),
      ),
    );
  }
}


5
likes
155
points
3
downloads

Publisher

unverified uploader

Weekly Downloads

A customizable side navigation rail for Flutter apps, allowing developers to create dynamic and responsive navigation menus with configurable options.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on rail_navigator