material-components-flutter-adaptive icon indicating copy to clipboard operation
material-components-flutter-adaptive copied to clipboard

Bottom Overflow in drawer

Open shobhitkrsingh opened this issue 4 years ago • 0 comments

// height scroll is not supported in drawer.....

import 'package:adaptive_navigation/adaptive_navigation.dart';
import 'package:erp/config/responsive.dart';
import 'package:erp/page/home/home.dart';
import 'package:flutter/material.dart';

class Dashboard extends StatefulWidget {
  @override
  _DashboardState createState() => _DashboardState();
}

class _DashboardState extends State<Dashboard> {
  int _selectedIndex = 0;

  List<Widget> _bodyWidget = [
    Home(),
    Text('data2'),
    Text('data3'),
    Text('data4'),
    Text('data5'),
    Text('data6'),
    Text('data7'),
    Text('data8'),
    Text('data9'),
    Text('data5'),
    Text('data6'),
    Text('data7'),
    Text('data8'),
    Text('data9'),
  ];

  @override
  Widget build(BuildContext context) {
    return AdaptiveNavigationScaffold(
      appBar: AdaptiveAppBar(
        title: Text('ErpLab'),
        actions: [
          ButtonBar(
            children: [
              IconButton(onPressed: () {}, icon: Icon(Icons.person)),
              IconButton(onPressed: () {}, icon: Icon(Icons.settings))
            ],
          )
        ],
      ),
      primary: true,
      fabInRail: true,
      onDestinationSelected: (int val) {
        setState(() {
          print(val);
          _selectedIndex = val;
          if (!Responsive.isDesktop(context)) Navigator.of(context).pop();
        });
      },
      selectedIndex: _selectedIndex,
      includeBaseDestinationsInMenu: true,
      destinations: [
        AdaptiveScaffoldDestination(title: 'Home', icon: Icons.home),
        AdaptiveScaffoldDestination(title: 'Book', icon: Icons.book),
        AdaptiveScaffoldDestination(title: 'Cake', icon: Icons.cake),
        AdaptiveScaffoldDestination(
            title: 'Directions', icon: Icons.directions),
        AdaptiveScaffoldDestination(title: 'Email', icon: Icons.email),
        AdaptiveScaffoldDestination(title: 'Favorite', icon: Icons.favorite),
        AdaptiveScaffoldDestination(title: 'Group', icon: Icons.group),
        AdaptiveScaffoldDestination(title: 'Headset', icon: Icons.headset),
        AdaptiveScaffoldDestination(title: 'Info', icon: Icons.info),
        AdaptiveScaffoldDestination(
            title: 'Directions', icon: Icons.directions),
        AdaptiveScaffoldDestination(title: 'Email', icon: Icons.email),
        AdaptiveScaffoldDestination(title: 'Favorite', icon: Icons.favorite),
        AdaptiveScaffoldDestination(title: 'Group', icon: Icons.group),
        AdaptiveScaffoldDestination(title: 'Headset', icon: Icons.headset),
        AdaptiveScaffoldDestination(title: 'Info', icon: Icons.info),
      ],
      navigationTypeResolver: (BuildContext context) {
        return Responsive.isDesktop(context)
            ? NavigationType.permanentDrawer
            : NavigationType.drawer;
      },
      body: _bodyWidget[_selectedIndex],
      floatingActionButton: FloatingActionButton(
        child: Icon(Icons.add),
        onPressed: () {},
      ),
      resizeToAvoidBottomInset: false,
      drawerHeader: UserAccountsDrawerHeader(
        accountName: Text('Shohit Singh'),
        accountEmail: Text('[email protected]'),
        currentAccountPicture: InkWell(
          onTap: () async {},
          child: CircleAvatar(
            child: ClipRRect(
              borderRadius: BorderRadius.circular(50),
              child: Image(
                image: AssetImage(
                  'images/logo.png',
                ),
              ),
            ),
          ),
        ),
        otherAccountsPictures: <Widget>[
          InkWell(
            child: CircleAvatar(
              child: Icon(Icons.settings),
            ),
            onTap: () {},
          ),
          InkWell(
            child: CircleAvatar(
              child: Icon(Icons.exit_to_app),
            ),
            onTap: () {
              Navigator.pushReplacementNamed(context, "/login");
            },
          )
        ],
      ),
    );
  }
}

shobhitkrsingh avatar Aug 19 '21 06:08 shobhitkrsingh