flutter_sidenav 1.1.0 copy "flutter_sidenav: ^1.1.0" to clipboard
flutter_sidenav: ^1.1.0 copied to clipboard

Simple side-nav widget for Flutter

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:flutter_sidenav/flutter_sidenav.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      locale: Locale("en"),
      supportedLocales: [
        Locale("en", "")
      ],
      localizationsDelegates: [
        // AppLocalizationsDelegate(),
        GlobalMaterialLocalizations.delegate,
        GlobalWidgetsLocalizations.delegate,
        // const FallbackCupertinoLocalisationsDelegate(),
      ],
      home: SideBarScaffold(
        selectedColor: Colors.blueGrey,
        sideBarWidth: 250,
        backgroundColor: Colors.grey[100],
        // alwaysOpened: true,    // default is false
        items: [
          SideNavItem(
            name: "Tab 1",
            page: ExamplePage1(),
            iconData: Icons.person,
          ),
          SideNavItem(
            name: "Tab 2",
            page: ExamplePage2(),
            iconData: Icons.info,
          ),
          SideNavItem(
            name: "Tab 3",
            page: ExamplePage3(),
            iconData: Icons.favorite,
          ),
        ],
      ),
    );
  }
}

class ExamplePage1 extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Colors.red,
        title: Text("ExamplePage1"),
      ),
      body: Center(
        child: Text("This is the content for page 1"),
      ),
    );
  }
}

class ExamplePage2 extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Colors.blue,
        title: Text("ExamplePage2"),
      ),
      body: Center(
        child: Text("This is the content for page 2"),
      ),
    );
  }
}

class ExamplePage3 extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Colors.green,
        title: Text("ExamplePage3"),
      ),
      body: Center(
        child: Text("This is the content for page 3"),
      ),
    );
  }
}
2
likes
130
pub points
0%
popularity

Publisher

unverified uploader

Simple side-nav widget for Flutter

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on flutter_sidenav