Giter VIP home page Giter VIP logo

shiburagi / drawer-behavior-flutter Goto Github PK

View Code? Open in Web Editor NEW
207.0 1.0 34.0 8.02 MB

Drawer behavior is a library that provide an extra behavior on drawer, such as, move view or scaling view's height while drawer on slide.

License: MIT License

Kotlin 0.08% Swift 1.13% Objective-C 0.02% Dart 69.29% HTML 0.73% CMake 12.71% C++ 15.09% C 0.93%
flutter flutter-plugin flutter-package flutter-widget drawerlayout drawer-navigation drawer android ios drawer-layout

drawer-behavior-flutter's People

Contributors

kiplelive-zariman avatar shiburagi avatar trademunch avatar vladaman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

drawer-behavior-flutter's Issues

Can't change tabs using bottom navigation bar

Cant switch tabs when clicking on bottom navigation bar items.

@override Widget build(BuildContext context) { return Sizer(builder: (context, orientation, deviceType) { return WillPopScope( onWillPop: () async => false, child: Directionality( textDirection: TextDirection.rtl, child: DrawerScaffold( extendedBody: true, controller: drawerController, extendBodyBehindAppBar: true, appBar: AppHeader( drawerController: drawerController, ), drawers: [ SideDrawer( padding: EdgeInsets.fromLTRB(24, 16, 24, 16), menu: menu, direction: Direction.right, animation: true, selectorColor: Colors.white, background: DecorationImage( fit: BoxFit.fill, image: AssetImage('assets/images/generalBackground.png')), color: Color(0x00000000), selectedItemId: selectedMenuItemId, onMenuItemSelected: (itemId) { setState(() { selectedMenuItemId = itemId; }); }, ), ], builder: (context, id) { return SingleChildScrollView( physics: NeverScrollableScrollPhysics(), child: Container( width: double.infinity, decoration: BoxDecoration( image: DecorationImage( image: AssetImage('assets/images/generalBackground.png'), fit: BoxFit.cover, ), ), alignment: Alignment.center, child: Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ SizedBox( height: 12.h, ), Row( children: [ SizedBox( width: 3, ), Icon( Icons.my_location, color: Colors.white54, size: 20.0, ), SizedBox( width: 3, ), Text( 'داخل النطاق', style: TextStyle( color: Colors.white, fontFamily: demiFont), ), Spacer(), Directionality( textDirection: TextDirection.ltr, child: Text( date, style: TextStyle( fontFamily: demiFontEnglish, color: Colors.white), ), ), Spacer(), Icon( dayTime ? Icons.wb_sunny : Icons.nightlight_round, color: dayTime ? Colors.yellow : Colors.white), SizedBox( width: 3, ), Text( time, style: TextStyle( fontFamily: demiFontEnglish, color: Colors.white), ), SizedBox( width: 3, ) ], ), SizedBox(height: 10), tabScreens[navigationBarIndex] ], ), ), ); }, bottomNavigationBar: FFNavigationBar( theme: FFNavigationBarTheme( selectedItemLabelColor: taqahDefualtTextColor, selectedItemIconColor: Colors.white, selectedItemBackgroundColor: taqahGreen, unselectedItemIconColor: taqahBlue, showSelectedItemShadow: false), selectedIndex: navigationBarIndex, onSelectTab: (index) { setState(() { navigationBarIndex = index; }); }, items: [ FFNavigationBarItem( iconData: Icons.home_filled, label: "الرئيسية", ), FFNavigationBarItem(iconData: Icons.bookmark, label: "المفضلة"), FFNavigationBarItem( iconData: Icons.notifications, label: "التنبيهات", ), FFNavigationBarItem( iconData: Icons.help, label: "الدعم", ), ], ), ), ), ); }); }

Menu Controller import issue

I am getting this error message when trying to build for a iOS app. Any advice?

Error: 'MenuController' is imported from both 'package:drawerbehavior/src/drawer_scaffold.dart' and 'package:flutter/src/material/menu_anchor.dart'.

FloatingActionButton can't be used with drawerScaffold

I am trying to implement the library in my existing project and as soon as i try to replace scaffold with DrawerScaffold, my other properties gives error,
Including FloatingActionButton, Bottom navigation bar, ExtendedBody etc.

Please suggest

Missing kotlin-gradle-plugin

When I add this project to pubspec.yaml and try the demo, Flutter gives me:

Launching lib/main.dart on Android SDK built for x86 in debug mode...
Running Gradle task 'assembleDebug'...

FAILURE: Build failed with an exception.

* What went wrong:
The Android Gradle plugin supports only Kotlin Gradle plugin version 1.3.10 and higher.
The following dependencies do not satisfy the required version:
project ':drawerbehavior' -> org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.71

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 647ms
Finished with error: Gradle task assembleDebug failed with exit code 1
  • drawerbehavior: ^0.0.8
import 'package:flutter/material.dart';
import 'package:drawerbehavior/drawerbehavior.dart';

class Drawer4 extends StatefulWidget {
  @override
  _Drawer4State createState() => _Drawer4State();
}

class _Drawer4State extends State<Drawer4> {
  final menu = new Menu(
    items: [
      new MenuItem(
        id: 'restaurant',
        title: 'THE PADDOCK',
      ),
      new MenuItem(
        id: 'other1',
        title: 'THE HERO',
      ),
      new MenuItem(
        id: 'other2',
        title: 'HELP US GROW',
      ),
      new MenuItem(
        id: 'other3',
        title: 'SETTINGS',
      ),
    ],
  );

  var selectedMenuItemId = 'restaurant';
  var _widget = Text("1");

  Widget headerView(BuildContext context) {
    return Column(
      children: <Widget>[
        Container(
          padding: EdgeInsets.fromLTRB(16, 12, 16, 0),
          child: Row(
            children: <Widget>[
              new Container(
                  width: 48.0,
                  height: 48.0,
                  decoration: new BoxDecoration(
                      shape: BoxShape.circle,
                      image: new DecorationImage(
                          fit: BoxFit.fill,
                          image: AssetImage("assets/user1.jpg")))),
              Container(
                  margin: EdgeInsets.only(left: 16),
                  child: Column(
                    mainAxisAlignment: MainAxisAlignment.start,
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: <Widget>[
                      Text(
                        "John Witch",
                        style: Theme.of(context)
                            .textTheme
                            .subhead
                            .copyWith(color: Colors.white),
                      ),
                      Text(
                        "[email protected]",
                        style: Theme.of(context)
                            .textTheme
                            .subtitle
                            .copyWith(color: Colors.white.withAlpha(200)),
                      )
                    ],
                  ))
            ],
          ),
        ),
        Divider(
          color: Colors.white.withAlpha(200),
          height: 16,
        )
      ],
    );
  }

  @override
  Widget build(BuildContext context) {
    return new DrawerScaffold(
      percentage: 1,
      cornerRadius: 0,
      appBar: AppBarProps(
          title: Text("Drawer 4"),
          actions: [IconButton(icon: Icon(Icons.add), onPressed: () {})]),
      menuView: new MenuView(
        menu: menu,
        headerView: headerView(context),
        animation: false,
//        mainAxisAlignment: MainAxisAlignment.start,
        color: Theme.of(context).primaryColor,
        selectedItemId: selectedMenuItemId,
        onMenuItemSelected: (String itemId) {
          selectedMenuItemId = itemId;
          if (itemId == 'restaurant') {
            setState(() => _widget = Text("1"));
          } else {
            setState(() => _widget = Text("default"));
          }
        },
      ),
      contentView: Screen(
        contentBuilder: (context) => Center(child: _widget),
        color: Colors.white,
      ),
    );
  }
}

Add property to change Leading Icon in DrawerScaffold()

I want to change the Icon to my desired icon.
When I add my desired icon in the leading property in the AppBar, I am not able to figure out what should be in the onPressed to open the side drawer.

If you allow the option to change the icon or tell me what should I put in the onPressed, it would be very helpful.

type 'InkWell' is not a subtype of type '_MenuListItem?' in type cast

import 'dart:ui';

import 'package:brando_store/utils/app_utils.dart';
import 'package:drawerbehavior/drawer_scaffold.dart';
import 'package:drawerbehavior/menu_screen.dart';
import 'package:flutter/material.dart';

class HomeScreen extends StatefulWidget {
  const HomeScreen({Key? key}) : super(key: key);

  @override
  _HomeScreenState createState() => _HomeScreenState();
}

class _HomeScreenState extends State<HomeScreen> {
  int selectedItemId = 0;
  @override
  Widget build(BuildContext context) {
    return LayoutBuilder(
      builder: (BuildContext context, BoxConstraints constraints) {
        final height = getHeight(constraints);
        final width = getWidth(constraints);
        return DrawerScaffold(
          appBar: AppBar(),
          drawers: [
            SideDrawer(
              slide: true,
              animation: true,
              color: Theme.of(context).primaryColor,
              selectedItemId: selectedItemId,
              onMenuItemSelected: (itemId) {
                setState(() {
                  selectedItemId = itemId;
                });
              },
              background: DecorationImage(
                image: AssetImage('assets/gifs/logo.gif'),
                fit: BoxFit.cover,
                colorFilter: ColorFilter.mode(
                  Colors.white,
                  BlendMode.color,
                ),
                alignment: Alignment.topCenter,
              ),
              // percentage: 0.3,
              menu: Menu(items: [
                MenuItem(title: "Profile", icon: Icons.redeem),
                MenuItem(title: "Posts"),
              ]),

              itemBuilder: (_, item, __) {
                return InkWell(
                  child: Container(
                    height: height * 10,
                    width: width * 2,
                    child: Text(item.id.toString()),
                  ),
                );
                /* return Stack(
                  children: [Image.asset('assets/gifs/logo.gif'), item],
                ); */
              },
            )
          ],
        );
      },
    );
  }
}

MenuItem optimization

This is the best Drawer implementation so far. I've been comparing.
But for complete happiness, there is not enough opportunity to use the Widget instead of IconData as icons.
And if String is also used Widget will be even better.

NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE

I have a issue with menuView.

Error:

══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞════════════════════════════
The following assertion was thrown building DrawerScaffoldMenuController(dirty, state:
DrawerScaffoldMenuControllerState#989c4):
RenderBox was not laid out: RenderConstrainedBox#74325 NEEDS-LAYOUT NEEDS-PAINT
NEEDS-COMPOSITING-BITS-UPDATE
'package:flutter/src/rendering/box.dart':
Failed assertion: line 1702 pos 12: 'hasSize'

The relevant error-causing widget was:
MenuView-[GlobalKey#e9b13 MenuScreen]
-----/lib/ui/drawer/Home.dart:58:17

When the exception was thrown, this was the stack:
#2 RenderBox.size (package:flutter/src/rendering/box.dart:1702:12)
#3 _MenuViewState.build. (package:drawerbehavior/menu_screen.dart:254:56)
#4 DrawerScaffoldMenuControllerState.build (package:drawerbehavior/drawer_scaffold.dart:334:26)
#5 StatefulElement.build (package:flutter/src/widgets/framework.dart:4663:28)
#6 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4546:15)
#7 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4719:11)
#8 Element.rebuild (package:flutter/src/widgets/framework.dart:4262:5)
#9 StatefulElement.update (package:flutter/src/widgets/framework.dart:4751:5)
#10 Element.updateChild (package:flutter/src/widgets/framework.dart:3245:15)
#11 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4571:16)
#12 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4719:11)
#13 Element.rebuild (package:flutter/src/widgets/framework.dart:4262:5)
#14 StatefulElement.update (package:flutter/src/widgets/framework.dart:4751:5)
#15 Element.updateChild (package:flutter/src/widgets/framework.dart:3245:15)
#16 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3480:38)
#17 MultiChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5991:32)
... Normal element mounting (148 frames)
#165 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3490:14)
#166 Element.updateChild (package:flutter/src/widgets/framework.dart:3258:18)
#167 RenderObjectElement.updateChildren (package:flutter/src/widgets/framework.dart:5624:32)
#168 MultiChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:6001:17)
#169 Element.updateChild (package:flutter/src/widgets/framework.dart:3245:15)
#170 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4571:16)
#171 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4719:11)
#172 Element.rebuild (package:flutter/src/widgets/framework.dart:4262:5)
#173 StatefulElement.update (package:flutter/src/widgets/framework.dart:4751:5)
#174 Element.updateChild (package:flutter/src/widgets/framework.dart:3245:15)
#175 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4571:16)
#176 Element.rebuild (package:flutter/src/widgets/framework.dart:4262:5)
#177 ProxyElement.update (package:flutter/src/widgets/framework.dart:4906:5)
#178 _InheritedNotifierElement.update (package:flutter/src/widgets/inherited_notifier.dart:183:11)
#179 Element.updateChild (package:flutter/src/widgets/framework.dart:3245:15)
#180 SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:5881:14)
#181 Element.updateChild (package:flutter/src/widgets/framework.dart:3245:15)
#182 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4571:16)
#183 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4719:11)
#184 Element.rebuild (package:flutter/src/widgets/framework.dart:4262:5)
#185 StatefulElement.update (package:flutter/src/widgets/framework.dart:4751:5)
#186 Element.updateChild (package:flutter/src/widgets/framework.dart:3245:15)
#187 SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:5881:14)
#188 Element.updateChild (package:flutter/src/widgets/framework.dart:3245:15)
#189 SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:5881:14)
#190 Element.updateChild (package:flutter/src/widgets/framework.dart:3245:15)
#191 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4571:16)
#192 Element.rebuild (package:flutter/src/widgets/framework.dart:4262:5)
#193 StatelessElement.update (package:flutter/src/widgets/framework.dart:4627:5)
#194 Element.updateChild (package:flutter/src/widgets/framework.dart:3245:15)
#195 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4571:16)
#196 Element.rebuild (package:flutter/src/widgets/framework.dart:4262:5)
#197 ProxyElement.update (package:flutter/src/widgets/framework.dart:4906:5)
#198 Element.updateChild (package:flutter/src/widgets/framework.dart:3245:15)
#199 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4571:16)
#200 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4719:11)
#201 Element.rebuild (package:flutter/src/widgets/framework.dart:4262:5)
#202 BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2667:33)
#203 WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:866:20)
#204 RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:286:5)
#205 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1117:15)
#206 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1056:9)
#207 SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:972:5)
#211 _invoke (dart:ui/hooks.dart:253:10)
#212 _drawFrame (dart:ui/hooks.dart:211:3)
(elided 5 frames from class _AssertionError and dart:async)

═════════════════════════════════════════════

════════ Exception caught by widgets library ══════════════════════════
The following assertion was thrown building DrawerScaffoldMenuController(dirty, state: DrawerScaffoldMenuControllerState#989c4):
RenderBox was not laid out: RenderConstrainedBox#74325 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
'package:flutter/src/rendering/box.dart':
Failed assertion: line 1702 pos 12: 'hasSize'

The relevant error-causing widget was:
MenuView-[GlobalKey#e9b13 MenuScreen] ----/lib/ui/drawer/Home.dart:58:17
When the exception was thrown, this was the stack:
#2 RenderBox.size (package:flutter/src/rendering/box.dart:1702:12)
#3 _MenuViewState.build. (package:drawerbehavior/menu_screen.dart:254:56)
#4 DrawerScaffoldMenuControllerState.build (package:drawerbehavior/drawer_scaffold.dart:334:26)
#5 StatefulElement.build (package:flutter/src/widgets/framework.dart:4663:28)
#6 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4546:15)
...
══════════════════════════════════════════════════════════

My code is :

return new DrawerScaffold(
    percentage: 1,
    cornerRadius: 0,
    appBar: AppBarProps(
        backgroundColor: getAppBarBgColor("default"),
        title: Text(AppTranslations != null ? AppTranslations.of(context).text("home_appbar_text"):"", style: TextStyle(color: getAppBarTxtColor("default")),),
        centerTitle: true,
        actions: [
          //
          //IconButton(icon: Icon(Icons.add), onPressed: () {}),
          IconButton(icon: Icon(Icons.account_circle), onPressed: () {
            goToScreen(context, ProfileScreen());
         /*   showDialog(
              context: context,
              builder: (BuildContext context) => RechargeByPINScreen(
                title: "Recharge By PIN",
                description: "Hello, this is dummy description",
                okbuttontxt: "Okay",
                cancelbuttontxt: "Cancel",
                subsNo: 0,
              ),
            );*/
          }),
           IconButton(icon: Icon(Icons.language), onPressed: () {goToScreen(context, LanguageSelectorPage());}),

  ]),
    menuView: MenuView(
      selectorColor: drawerSelectedColor,
      menu: Menu(
        items: [
          new MenuItem(
            id: 'menuHome',
            icon: Icons.home,
            title: AppTranslations.of(context).text("menu_home"),
          ),
          new MenuItem(
            id: 'menuTransations',
            icon: Icons.transform,
            title: AppTranslations.of(context).text("menu_transaction"),
          ),
          new MenuItem(
            id: 'menuInvoice',
            icon: Icons.receipt,
            title: AppTranslations.of(context).text("menu_invoice"),
          ),
          new MenuItem(
            id: 'menuMySession',
            icon: Icons.timelapse,
            title: AppTranslations.of(context).text("menu_my_session"),
          ),
          /* new MenuItem(
      id: 'menuServices',
      icon: Icons.traffic,
      title: 'Services',
    ),*/
          new MenuItem(
            id: 'menuSubscriptions',
            icon: Icons.subscriptions,
            title: AppTranslations.of(context).text("menu_subscriptions"),
          ),
          new MenuItem(
            id: 'menuSessionHistory',
            icon: Icons.history,
            title: AppTranslations.of(context).text("menu_session_history"),
          ),
          new MenuItem(
            id: 'menuUsageSummary',
            icon: Icons.settings,
            title: AppTranslations.of(context).text("menu_usage_summary"),
          ),
          new MenuItem(
            id: 'menuRateUs',
            icon: Icons.question_answer,
            title: AppTranslations.of(context).text("menu_rate_us"),
          ),
          /*    new MenuItem(
      id: 'menuShare',
      icon: Icons.data_usage,
      title: 'Share',
    ),*/
          /*   new MenuItem(
      id: 'menuFeedback',
      icon: Icons.feedback,
      title: 'Feedback'
    ),*/
          new MenuItem(
            id: 'menuLogout',
            icon: Icons.all_out,
            title: AppTranslations.of(context).text("menu_logout"),
          ),
        ],
      ),
      animation: false,
      alignment: Alignment.topCenter,
      color: getThemeColor(),
      selectedItemId: selectedMenuItemId,
      onMenuItemSelected: (String itemId) {

        selectedMenuItemId = itemId;

        if (itemId == 'menuHome') {
          //setState(() => {});
          //Navigator.pushReplacementNamed(context, "/login");
        }
        else if(itemId == 'menuTransations'){
          goToScreen(context, Transactions(title: AppTranslations != null ?AppTranslations.of(context).text("transaction_appbar_text"):"",));
        }
        else if(itemId == 'menuInvoice'){
          goToScreen(context, InvoiceList(title: AppTranslations != null ?AppTranslations.of(context).text("invoice_appbar_text"):"",));
        }
        else if(itemId == 'menuMySession'){
          goToScreen(context, MySession(title: AppTranslations != null ?AppTranslations.of(context).text("mysession_appbar_text"):"",));
        }
        else if(itemId == 'menuSubscriptions'){
          goToScreen(context, Subscriptions(title: AppTranslations != null ?AppTranslations.of(context).text("subscriptions_appbar_text"):"",));
        }
        else if(itemId == 'menuSessionHistory'){
          goToScreen(context, SessionHistory(title: AppTranslations != null ?AppTranslations.of(context).text("session_history_appbar_text"):"",));
        }
        else if(itemId == 'menuUsageSummary'){
          goToScreen(context, UsageSummary(title: AppTranslations != null ?AppTranslations.of(context).text("usage_summary_appbar_text"):"",));
        }
        else if(itemId == 'menuRateUs'){
          //LaunchReview.launch(); use for current app open in play store
          LaunchReview.launch(androidAppId: "net.inventum.selfcare");
        }
        else{
          //menuLogout -- logout
          showDialog(
            context: context,
            builder: (BuildContext context) {
              // return object of type Dialog
              return AlertDialog(
                title: new Text(AppTranslations != null ?AppTranslations.of(context).text("dialog_alert_text"):""),
                content: new Text(AppTranslations != null ?AppTranslations.of(context).text("logout_text"):""),
                actions: <Widget>[
                  // usually buttons at the bottom of the dialog
                  new FlatButton(
                    child: new Text(AppTranslations != null ?AppTranslations.of(context).text("no_text"):""),
                    onPressed: () {
                      Navigator.of(context).pop();
                    },
                  ),
                  new FlatButton(
                    child: new Text(AppTranslations != null ?AppTranslations.of(context).text("yes_text"):""),
                    onPressed: () {
                      Navigator.of(context).pop();
                      clearSharedData();
                    },
                  ),
                ],
              );
            },
          );


        }

        // this used to always select home tag
        //start
        setState(() => {
          this.selectedMenuItemId = 'menuHome'
        });
        //end

      },
    ),
    contentView: Screen(
      contentBuilder: (context) => LayoutBuilder(
      builder: (context, constraint) =>  HomeView(),
  ),
  color: Colors.white,
  )

  );

Please suggest me for solving this issue ? I am using 'drawerbehavior: ^0.0.10'

itemBuilder Method always return isSelected "true" from first position.

I am using you this function:

itemBuilder:
(BuildContext context, MenuItem menuItem, bool isSelected) {
return Container(
color: isSelected
? Theme.of(context).accentColor.withOpacity(0.7)
: Colors.transparent,
padding: EdgeInsets.fromLTRB(24, 16, 24, 16),
child: Text(
menuItem.title,
style: Theme.of(context).textTheme.subhead.copyWith(
color: isSelected ? Colors.black87 : Colors.white70),
),
);
}

But isSelected is always return true for the only first position even I am updating the "selectedMenuItemId".

Here is the whole code for the menu:

menuView: MenuView(
menu: menu,
headerView: headerView(context),
animation: false,
alignment: Alignment.topLeft,
color: Theme.of(context).primaryColor,
selectedItemId: selectedMenuItemId,
onMenuItemSelected: (String itemId) {
selectedMenuItemId = itemId;
},
itemBuilder:
(BuildContext context, MenuItem menuItem, bool isSelected) {
return Container(
color: isSelected
? Theme.of(context).accentColor.withOpacity(0.7)
: Colors.transparent,
padding: EdgeInsets.fromLTRB(24, 16, 24, 16),
child: Text(
menuItem.title,
style: Theme.of(context).textTheme.subhead.copyWith(
color: isSelected ? Colors.black87 : Colors.white70),
),
);
}),

Please let me know how fix it.

Error: No named parameter with the name 'resizeToAvoidBottomPadding' in latest flutter beta version

[+3056 ms] ../../../../../Android/flutter/.pub-cache/hosted/pub.dartlang.org/drawerbehavior-1.2.2/lib/drawer_scaffold.dart:276:7: Error: No named parameter with the name 'resizeToAvoidBottomPadding'.
[ ] resizeToAvoidBottomPadding: widget.resizeToAvoidBottomPadding,

Details of flutter and SDK:
Flutter is already up to date on channel beta
Flutter 1.26.0-17.5.pre • channel beta • https://github.com/flutter/flutter.git
Framework • revision 1fe38dcb5f (5 days ago) • 2021-02-10 16:25:47 -0800
Engine • revision d4453f6018
Tools • Dart 2.12.0 (build 2.12.0-259.9.beta)

reference for latest drawerbehavior
https://pub.dev/packages/drawerbehavior/install

please fixed asap.

iOS build failing

/ios/Pods/Headers/Public/drawerbehavior/DrawerbehaviorPlugin.h:1:9: error: 'Flutter/Flutter.h' file not found #import <Flutter/Flutter.h> ^ <unknown>:0: error: could not build Objective-C module 'drawerbehavior'

Exception caught by rendering library

═══════════ Exception caught by rendering library ═════════════════════════════════
RenderBox was not laid out: RenderPadding#a8d01 relayoutBoundary=up12 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
'package:flutter/src/rendering/box.dart':
Failed assertion: line 1930 pos 12: 'hasSize'

The relevant error-causing widget was
Container
lib\drawers_constants\admin_drawer.dart:93
  • I went through the code it is correct I think this is some issue with the package itself.
    1

[GlobalKey#ead10 MenuScreen] error

The following GlobalKey was specified multiple times in the widget tree. This will lead to parts of the widget tree being truncated unexpectedly, because the second time a key is seen, the previous instance is moved to the new location. The key was:

  • [GlobalKey#ead10 MenuScreen]

drawerbehavior: ^1.1.4

Initial page with menu and page sharing the screen

Hello, i am trying to use this beautiful layout, but when i open the app, it comes with the drawer opened can u please help me

Here is the code

class _DrawerScaleIconState extends State {
int selectedMenuItemId;
final GlobalKey _scaffoldKey = new GlobalKey();
DrawerScaffoldController controller =
DrawerScaffoldController(open: Direction.left);

@OverRide
void initState() {
selectedMenuItemId = menuWithIcon.items[0].id;
// controller.toggle();
super.initState();
}

@OverRide
Widget build(BuildContext context) {
Home homeScreen = Home(context);
Profile profileScreen = Profile(context);
Help helpScreen = Help(context);

List<Widget> widgets = [
  homeScreen,
  profileScreen,
  Container(color: Colors.blue),
  Container(color: Colors.yellow),
  helpScreen
];

DrawerScaffoldController controller =
    DrawerScaffoldController(open: Direction.left);
return DrawerScaffold(
  controller: controller,
  appBar: AppBar(
    centerTitle: true,
    title: Column(
      children: <Widget>[
        SizedBox(
          height: 12,
        ),
        Container(
          width: 150.0,
          height: 150.0,
          decoration: BoxDecoration(
            shape: BoxShape.rectangle,
            image: DecorationImage(
                fit: BoxFit.contain,
                image:
                    CachedNetworkImageProvider(Singleton().teamImageURL)),
          ),
        ),
        SizedBox(
          height: 8,
        )
      ],
    ),
    elevation: 0,
    automaticallyImplyLeading: false,
    leading: IconButton(
      icon: SizedBox(
        height: 24,
        width: 24,
        child: Image.asset(
          'assets/icon_menu.png',
          fit: BoxFit.fill,
        ),
      ), // set your color here
      onPressed: () {
        controller.openDrawer();
      },
    ),
    backgroundColor: Colors.white,
    actions: null,
  ),
  drawers: [
    SideDrawer(
      percentage: 0.9,
      degree: 0.8,
      selectorColor: Colors.white,
      padding: EdgeInsets.fromLTRB(24, 15, 12, 15),
      textStyle: TextStyle(
          color: Colors.white70, fontWeight: FontWeight.bold, fontSize: 16),
      menu: menuWithIcon,
      animation: true,
      color: Singleton().secondaryColor,
      selectedItemId: selectedMenuItemId,
      onMenuItemSelected: (itemId) {
        setState(() {
          selectedMenuItemId = itemId;
        });
      },
    )
  ],
  key: _scaffoldKey,
  builder: (context, id) => IndexedStack(
    index: id,
    children: menu.items.map((e) => widgets[selectedMenuItemId]).toList(),
  ),
);

I cannot define body in Drawer Scaffold. So I can't use bottom navigation bar.

Codes;

@OverRide
Widget build(BuildContext context) {
return
DrawerScaffold(
appBar: AppBar(
backgroundColor: Colors.transparent,
elevation: 0,
centerTitle: true,
iconTheme: IconThemeData(color: Colors.grey.shade900),
title: Text(
"TEST",
style: TextStyle(color: Colors.grey.shade900),
),
),
drawers: [
SideDrawer(
percentage: 0.9,
menu: menu,
direction: Direction.left,
animation: true,

          //alignment: Alignment.topLeft,
          color: Theme.of(context).primaryColor,
          selectedItemId: selectedMenuItemId,
          onMenuItemSelected: (itemId) {
            setState(() {
              selectedMenuItemId = itemId;
            });
            if (itemId == 0) {
              Navigator.push(context,
                  MaterialPageRoute(builder: (context) => HomePage()));
            } else if (itemId == 1) {
            } else if (itemId == 2) {
              //signOut();
            } else if (itemId == 3) {
              signOut();
            }
          },
        ),
      ],
    
    bottomNavigationBar: CurvedNavigationBar(
      key: _bottomNavigationKey,
      index: 1,
      height: 50.0,
      items: <Widget>[
        Icon(
          Icons.search,
          size: 30,
          color: Colors.white,
        ),
        IconButton(
          icon: Image.asset(
            "assets/twitter.png",
            height: 50,
            width: 50,
            color: Colors.white,
          ),
          onPressed: () {},
        ),

        Icon(
          Icons.shopping_bag_outlined,
          size: 30,
          color: Colors.white,
        ),
        //Icon(Icons.call_split, size: 30),
        //Icon(Icons.perm_identity, size: 30),
      ],
      color: purplebackground,
      buttonBackgroundColor: purplebackground,
      backgroundColor: Colors.transparent,
      animationCurve: Curves.easeInOut,
      animationDuration: Duration(milliseconds: 300),
      onTap: (index) {
        setState(() {
          _page = index;
        });
      },
      letIndexChange: (index) => true,
    ),
    body: Stack(children: [
      Container(color: kPrimaryColor, child: sayfaGoster(_page))
    ]));

}

Active animation ticker and Lifecycle assertion failure.

Hello,

When I am trying to pop away from an open drawer (when user signs out), I am presented with the following errors.
Is this a bug, or something I have incorrectly done on my side?

======== Exception caught by widgets library =======================================================
The following assertion was thrown while finalizing the widget tree:
_DrawerScaffoldState#4c862(tickers: tracking 1 ticker) was disposed with an active Ticker.

_DrawerScaffoldState created a Ticker via its TickerProviderStateMixin, but at the time dispose() was called on the mixin, that Ticker was still active. All Tickers must be disposed before calling super.dispose().

Tickers used by AnimationControllers should be disposed by calling dispose() on the AnimationController itself. Otherwise, the ticker will leak.

The offending ticker was: _WidgetTicker(created by _DrawerScaffoldState#4c862(lifecycle state: created, tickers: tracking 0 tickers))
The stack trace when the _WidgetTicker was actually created was:
#0 new Ticker. (package:flutter/src/scheduler/ticker.dart:67:40)
#1 new Ticker (package:flutter/src/scheduler/ticker.dart:69:6)
#2 new _WidgetTicker (package:flutter/src/widgets/ticker_provider.dart:271:81)
#3 TickerProviderStateMixin.createTicker (package:flutter/src/widgets/ticker_provider.dart:202:34)
#4 new AnimationController (package:flutter/src/animation/animation_controller.dart:247:21)
#5 new MenuController (package:drawerbehavior/drawer_scaffold.dart:566:36)
#6 _DrawerScaffoldState.dcreateController (package:drawerbehavior/drawer_scaffold.dart:165:33)
#7 _DrawerScaffoldState.createController (package:drawerbehavior/drawer_scaffold.dart:150:33)
#8 MappedListIterable.elementAt (dart:_internal/iterable.dart:412:31)
#9 ListIterator.moveNext (dart:_internal/iterable.dart:341:26)
#10 new _GrowableList._ofEfficientLengthIterable (dart:core-patch/growable_array.dart:188:27)
#11 new _GrowableList.of (dart:core-patch/growable_array.dart:150:28)
#12 new List.of (dart:core-patch/array_patch.dart:50:28)
#13 ListIterable.toList (dart:_internal/iterable.dart:212:44)
#14 _DrawerScaffoldState.assignContoller (package:drawerbehavior/drawer_scaffold.dart:177:65)
#15 _DrawerScaffoldState.initState (package:drawerbehavior/drawer_scaffold.dart:128:5)
#16 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4711:57)
#17 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4548:5)
... Normal element mounting (9 frames)
#26 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3611:14)
#27 Element.updateChild (package:flutter/src/widgets/framework.dart:3360:20)
#28 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4599:16)
#29 Element.rebuild (package:flutter/src/widgets/framework.dart:4267:5)
#30 BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2582:33)
#31 WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:875:21)
#32 RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:328:5)
#33 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1144:15)
#34 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1082:9)
#35 SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:998:5)
#39 _invoke (dart:ui/hooks.dart:163:10)
#40 PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:259:5)
#41 _drawFrame (dart:ui/hooks.dart:126:31)
(elided 3 frames from dart:async)

When the exception was thrown, this was the stack:
#0 TickerProviderStateMixin.dispose. (package:flutter/src/widgets/ticker_provider.dart:219:13)
#1 TickerProviderStateMixin.dispose (package:flutter/src/widgets/ticker_provider.dart:237:6)
#2 _DrawerScaffoldState.dispose (package:drawerbehavior/drawer_scaffold.dart:140:11)
#3 StatefulElement.unmount (package:flutter/src/widgets/framework.dart:4800:11)
#4 _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1847:13)
...

======== Exception caught by foundation library ====================================================
The following assertion was thrown while dispatching notifications for MenuController:
'package:flutter/src/widgets/framework.dart': Failed assertion: line 4188 pos 12: '_lifecycleState != _ElementLifecycle.defunct': is not true.

Either the assertion indicates an error in the framework itself, or we should provide substantially more information in this error message to help you determine and fix the underlying cause.
In either case, please report this assertion by filing a bug on GitHub:
https://github.com/flutter/flutter/issues/new?template=2_bug.md

When the exception was thrown, this was the stack:
#2 Element.markNeedsBuild (package:flutter/src/widgets/framework.dart:4188:12)
#3 State.setState (package:flutter/src/widgets/framework.dart:1108:15)
#4 _DrawerScaffoldState.createController. (package:drawerbehavior/drawer_scaffold.dart:159:26)
#5 ChangeNotifier.notifyListeners (package:flutter/src/foundation/change_notifier.dart:243:25)
#6 new MenuController. (package:drawerbehavior/drawer_scaffold.dart:574:9)
...
The MenuController sending notification was: Instance of 'MenuController'

======== Exception caught by foundation library ====================================================
The following assertion was thrown while dispatching notifications for MenuController:
'package:flutter/src/widgets/framework.dart': Failed assertion: line 4188 pos 12: '_lifecycleState != _ElementLifecycle.defunct': is not true.

Either the assertion indicates an error in the framework itself, or we should provide substantially more information in this error message to help you determine and fix the underlying cause.
In either case, please report this assertion by filing a bug on GitHub:
https://github.com/flutter/flutter/issues/new?template=2_bug.md

When the exception was thrown, this was the stack:
#2 Element.markNeedsBuild (package:flutter/src/widgets/framework.dart:4188:12)
#3 State.setState (package:flutter/src/widgets/framework.dart:1108:15)
#4 _DrawerScaffoldState.createController. (package:drawerbehavior/drawer_scaffold.dart:159:26)
#5 ChangeNotifier.notifyListeners (package:flutter/src/foundation/change_notifier.dart:243:25)
#6 new MenuController. (package:drawerbehavior/drawer_scaffold.dart:592:9)
...
The MenuController sending notification was: Instance of 'MenuController'

Unable to determine Swift version

Helo, the following error appears

Launching lib/main.dart on iPhone Xʀ in debug mode... CocoaPods' output: ↳ Preparing Analyzing dependencies Inspecting targets to integrate UsingARCHSsetting to build architectures of targetPods-Runner: (``) Fetching external sources -> Fetching podspec for Flutterfrom.symlinks/flutter/ios-> Fetching podspec fordrawerbehaviorfrom.symlinks/plugins/drawerbehavior/iosResolving dependencies ofPodfileComparing resolved specification to the sandbox manifest A Flutter A drawerbehavior Downloading dependencies -> Installing Flutter (1.0.0) -> Installing drawerbehavior (0.0.1) - Running pre install hooks [!] Unable to determine Swift version for the following pods: -drawerbehavior does not specify a Swift version and none of the targets (Runner) integrating it have the SWIFT_VERSIONattribute set. Please contact the author or set theSWIFT_VERSIONattribute in at least one of the targets that integrate this pod. /usr/local/Cellar/cocoapods/1.7.4/libexec/gems/cocoapods-1.7.4/lib/cocoapods/installer/xcode/target_validator.rb:122:inverify_swift_pods_swift_version'
/usr/local/Cellar/cocoapods/1.7.4/libexec/gems/cocoapods-1.7.4/lib/cocoapods/installer/xcode/target_validator.rb:37:in validate!' /usr/local/Cellar/cocoapods/1.7.4/libexec/gems/cocoapods-1.7.4/lib/cocoapods/installer.rb:578:in validate_targets'
/usr/local/Cellar/cocoapods/1.7.4/libexec/gems/cocoapods-1.7.4/lib/cocoapods/installer.rb:158:in install!' /usr/local/Cellar/cocoapods/1.7.4/libexec/gems/cocoapods-1.7.4/lib/cocoapods/command/install.rb:51:in run'
/usr/local/Cellar/cocoapods/1.7.4/libexec/gems/claide-1.0.2/lib/claide/command.rb:334:in run' /usr/local/Cellar/cocoapods/1.7.4/libexec/gems/cocoapods-1.7.4/lib/cocoapods/command.rb:52:in run'
/usr/local/Cellar/cocoapods/1.7.4/libexec/gems/cocoapods-1.7.4/bin/pod:55:in <top (required)>' /usr/local/Cellar/cocoapods/1.7.4/libexec/bin/pod:22:in load'
/usr/local/Cellar/cocoapods/1.7.4/libexec/bin/pod:22:in `

'
Error output from CocoaPods:

WARNING: CocoaPods requires your terminal to be using UTF-8 encoding.
Consider adding the following to ~/.profile:
export LANG=en_US.UTF-8

[!] `<PBXGroup UUID=`97C146E51CF9000F007C117D`>` attempted to initialize an object with an unknown UUID. `CF3B75C9A7D2FA2A4C99F110` for attribute: `children`. This can be the result of a merge and  the unknown UUID is being discarded.
[!] Automatically assigning platform `ios` with version `8.0` on target `Runner` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.

Error running pod install
Error launching application on iPhone Xʀ.
Exited (sigterm)
`

AppBar as PrefferedSizeWidget

Hi, I'm using your package (so thanks first of all for your work!).

I'm currently working on the responsiveness of my application and I noticed that the appBar attribute in DrawerScaffold is of the type AppBar differently from the material Scaffold that is PrefferedSizeWidget and allow to resize the height of the app bar for different device. Do you think is it possible to fix it?

Dynamic List not working in builder

Hi, Thank you for this package.
I added this package my project, it works perfectly but I have a big problem. :)

As I scrolled down the page, I was pulling data again and showing them in the list.
Now I am drawing data again, but my list in builder is not refreshed. Can I use something different instead of the builder? how can i solve this.

Does not work

It throws the following error

FAILURE: Build failed with an exception.

  • What went wrong:
    The Android Gradle plugin supports only Kotlin Gradle plugin version 1.3.10 and higher.
    The following dependencies do not satisfy the required version:
    project ':drawerbehavior' -> org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.71

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.