Code Monkey home page Code Monkey logo

flutter_zoom_drawer's Introduction

Flutter Zoom Drawer

pub package License: MIT

A Flutter package with custom implementation of the Side Menu (Drawer)

๐ŸŒŸ Getting Started

To start using this package, add flutter_zoom_drawer dependency to your pubspec.yaml

dependencies:
  flutter_zoom_drawer: "<latest_release>"

โš  Version 3 Breaking Changes for Style

Old Style New Style
DrawerStyle.style1 DrawerStyle.defaultStyle
DrawerStyle.style2 DrawerStyle.defaultStyle
DrawerStyle.style3 DrawerStyle.defaultStyle
DrawerStyle.style4 DrawerStyle.style1
DrawerStyle.style5 DrawerStyle.style2
DrawerStyle.style6 DrawerStyle.style3
DrawerStyle.style7 DrawerStyle.style4

๐Ÿ’ช Features

  • Simple sliding drawer
  • Sliding drawer with shadows
  • Sliding drawer with rotation
  • Sliding drawer with rotation and shadows
  • Support for both LTR & RTL

๐Ÿ“Œ Simple Example (Thanks to @JesusHdezWaterloo)

import 'package:flutter/material.dart';
import 'package:flutter_zoom_drawer/flutter_zoom_drawer.dart';
import 'package:get/get.dart';

void main() {
  Get.put<MyDrawerController>(MyDrawerController());

  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Zoom Drawer Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends GetView<MyDrawerController> {
  @override
  Widget build(BuildContext context) {
    return GetBuilder<MyDrawerController>(
      builder: (_) => ZoomDrawer(
        controller: _.zoomDrawerController,
        menuScreen: MenuScreen(),
        mainScreen: MainScreen(),
        borderRadius: 24.0,
        showShadow: true,
        angle: -12.0,
        drawerShadowsBackgroundColor: Colors.grey,
        slideWidth: MediaQuery.of(context).size.width * 0.65,
      ),
    );
  }
}

class MenuScreen extends GetView<MyDrawerController> {
  const MenuScreen({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
      color: Colors.yellow,
    );
  }
}

class MainScreen extends GetView<MyDrawerController> {
  const MainScreen({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
      color: Colors.pink,
      child: Center(
        child: ElevatedButton(
          onPressed: controller.toggleDrawer,
          child: Text("Toggle Drawer"),
        ),
      ),
    );
  }
}

class MyDrawerController extends GetxController {
  final zoomDrawerController = ZoomDrawerController();

  void toggleDrawer() {
    print("Toggle drawer");
    zoomDrawerController.toggle?.call();
    update();
  }
}

๐Ÿ“ Documentation

    ZoomDrawer(
      controller: ZoomDrawerController,
      style: DrawerStyle.defaultStyle,
      menuScreen: MenuScreen(),
      mainScreen: MainScreen(),
      borderRadius: 24.0,
      showShadow: true,
      angle: -12.0,
      drawerShadowsBackgroundColor: Colors.grey[300],
      slideWidth: MediaQuery.of(context).size.width*.65,
      openCurve: Curves.fastOutSlowIn,
      closeCurve: Curves.bounceIn,
    )
Parameters Value Required Docs
controller ZoomDrawerController No Controller to have access to the open/close/toggle function of the drawer
style DrawerStyle No the drawer style to be displayed (check the DrawerStyle enum)
mainScreen Widget Yes Screen containing the main content to display
menuScreen Widget Yes Screen containing the menu/bottom screen
slideWidth double No Sliding width of the drawer - defaults to 275.0
slideHeight double No Sliding height of the drawer - defaults to 0.0
mainScreenScale double No MainScreen scale - defaults to 0.3
borderRadius double No Border radius of the slided content - defaults to 16.0
angle double No Rotation angle of the drawer - defaults to -12.0 - should be 0.0 to -30.0
disableGesture bool No Disable the home page swipe to open drawer gesture - defaults to false
drawerShadowsBackgroundColor Color No Background color of the drawer shadows - defaults to white
showShadow bool No Boolean, whether to show the drawer shadows - defaults to false
openCurve Curve No open animation curve - defaults to Curves.easeOut
closeCurve Curve No close animation curve - defaults to Curves.easeOut
mainScreenTapClose bool No Close drawer when tapping mainScreen
mainScreenOverlayColor Color No Color of the main screen's cover overlay
overlayBlend BlendMode No The BlendMode of the mainScreenOverlayColor filter (default BlendMode.screen)
boxShadow BoxShadow No The Shadow of the mainScreenContent
overlayBlur double No The Blur amount of the mainScreen option
shrinkMainScreen bool No Shrinks the mainScreen by [slideWidth], good on desktop with Style2
drawerStyleBuilder DrawerStyleBuilder No Build custom animated style to override [DrawerStyle]

๐Ÿ•น๏ธ Drawer Usage

To use the drawer, and be able to control it, there are 2 ways:

  • Using a ZoomDrawerController inside the main widget where you have the ZoomDrawer widget and providing it to the widget, which will allow you to trigger the open/close/toggle methods.
    final drawerController = ZoomDrawerController();

    drawerController.open();
    drawerController.close();
    drawerController.toggle();
    drawerController.isOpen();
    drawerController.stateNotifier;
  • Using the static method inside ancestor widgets to get access to the ZoomDrawer.
  ZoomDrawer.of(context).open();
  ZoomDrawer.of(context).close();
  ZoomDrawer.of(context).toggle();
  ZoomDrawer.of(context).isOpen();
  ZoomDrawer.of(context).stateNotifier;

Screens

Example app Demo

Example RTL Demo

  • Drawer Sliding
    ZoomDrawer(
      controller: ZoomDrawerController,
      menuScreen: MenuScreen(),
      mainScreen: MainScreen(),
      borderRadius: 24.0,
      showShadow: false,
      angle: 0.0,
      drawerShadowsBackgroundColor: Colors.grey[300],
      slideWidth: MediaQuery.of(context).size.width * 0.65,
    )

Drawer Sliding

  • Drawer Sliding with shadow
    ZoomDrawer(
      controller: ZoomDrawerController,
      menuScreen: MenuScreen(),
      mainScreen: MainScreen(),
      borderRadius: 24.0,
      showShadow: true,
      angle: 0.0,
      drawerShadowsBackgroundColor: Colors.grey[300],
      slideWidth: MediaQuery.of(context).size.width * 0.65,
    )

Drawer Sliding

  • Drawer Sliding with rotation
    ZoomDrawer(
      controller: ZoomDrawerController,
      menuScreen: MenuScreen(),
      mainScreen: MainScreen(),
      borderRadius: 24.0,
      showShadow: false,
      angle: -12.0,
      drawerShadowsBackgroundColor: Colors.grey[300],
      slideWidth: MediaQuery.of(context).size.width * 0.65,
    )

Drawer Sliding with rotation

  • Drawer Sliding with rotation and shadows
    ZoomDrawer(
      controller: ZoomDrawerController,
      menuScreen: MenuScreen(),
      mainScreen: MainScreen(),
      borderRadius: 24.0,
      showShadow: true,
      angle: -12.0,
      drawerShadowsBackgroundColor: Colors.grey[300],
      slideWidth: MediaQuery.of(context).size.width * 0.65,
    )

Drawer Sliding with rotation and shadows

Issues

Please file any issues, bugs or feature request as an issue on our GitHub page.

Want to contribute

If you would like to contribute to the plugin (e.g. by improving the documentation, solving a bug or adding a cool new feature), please carefully review our contribution guide and send us your pull request.

Credits

Credits goes to pedromassango as most of this package comes from his implementation.

flutter_zoom_drawer's People

Contributors

abdelazeem777 avatar dangtienngoc avatar fernan542 avatar hugo-sna avatar isaacadariku avatar marco4763 avatar medyas avatar melodysdreamj avatar mis1eader-dev avatar s7dhansh avatar skquark avatar vantoan08 avatar yda93 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  avatar  avatar  avatar  avatar

flutter_zoom_drawer's Issues

DrawerStyle.Style3 animation artifact

hi, I encountered next issue, using DrawerStyle.Style3.

on captured video there are two Style modes, but the problem is obvious with first one.

Tested on IOS(14+) Iphone 12 pro, and platform :ios, '12.0'

Screen.Recording.2021-09-13.at.22.57.45.mov

I can't use this pachage ...

sorry,
i'm new in flutter
but i will use this package
can you put full example to explain it
The design is awesome.
thank you for help

Language Change button

Can you kindly introduce one one of the pages a settings page with a language radio or pulldown list

Open with a swipe

Is it possible to open Drawer by swiping on the content page?
Currently, I've implemented Drawer based on your example and the only way to interact with it by swipe is closing.
Thanks for this awesome package!

Failed assertion: boolean expression must not be null [Flutter Web]

โ•โ•โ•โ•โ•โ•โ•โ• Exception caught by widgets library โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
The following assertion was thrown building MenuScreen(dirty, state: _MenuScreenState#2bbc9):
Failed assertion: boolean expression must not be null

The relevant error-causing widget was:
MenuScreen file:/drawer/home_page.dart:36:19
When the exception was thrown, this was the stack:
dart-sdk/lib/internal/js_dev_runtime/private/ddc_runtime/errors.dart 195:49 throw
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 419:40 _throwBooleanConversionError
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 410:50 test
packages/toffeecover/page/drawer/menu_page.dart 34:11 build
packages/flutter/src/widgets/framework.dart 4619:28 build
...
โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•

The Drawer work perfectly on the mobile, however when running the code in flutter web, a red screen shows up with following exception

Facing issue with RTL support

I had run the example code with only Arabic locale but the drawer menu doesn't toggle as expected
Please refer image for further clarification.

1606245173722

Add option to chance scale of main screen

At the moment the scale of the main screen (when drawer is open) is a fixed percentage that can't be changed.
For each style (with some exceptions) 0.3 is used as fixed scale percentage:

double scale = 1 - (_animationController.value * 0.3);

This fixed value could be replaced with a widget attribute to make it part of the public API:

double scale = 1 - (_animationController.value * widget.mainScreenScale);

Issue with the package?

Am I doing it correctly?

Screenshot 2021-08-31 at 10 15 21 PM

Main Screen is returning a scaffold with appbar and Menu Screen is also returning a scaffold with appbar.

P.S. I am using MacBook Air M1

Example using BloC pattern

Dear Sir,
Hello,
Thanks for this great flutter menu!

please how can i integrate this package with the BloC pattern

landscape mode have area error overflow

hi , i just implement this package on project everything works fine , but it has a small problem on landscape mode have area error overflow like picture below , i try to wrap it with SingleChildScrollView but it still doesn't work , how can i fix this problem ?
thank in advance
Simulator Screen Shot - iPhone 12 Pro Max - 2021-09-03 at 16 17 41

How to close the drawer after selecting the menu item?

Dear Sir,

I tried to call ZoomDrawer.of(context).close() under the function assigned to menuScreen's callback, but I got the error showing I am calling a null function.

I also tried to call by using _drawerController.close(), but also got the same result.

May I know the solution on this? Thank you.

RTL problem

Hi. When I set RTL to true then at the start of the screen the drawer is open for one second and then it close. This happens only in RTL mode.
My app Locale is "fa" and my device language is English.
It happens in your last update.

can't close drawer

Hi, a dear friend can you help me when I open a drawer from the menu icon on the home screen I can't close it from the home screen when press on the same button opens the drawer
after downloading the example and run it the is the same only close when drag to left.
how can I fix it?
I need to close the drawer from the same menu button I open it from?
Simulator Screen Shot - iPhone 11 Pro Max - 2020-09-14 at 10 01 44

Add ability to know if the drawer is opened or closed

I'm currently working with this plugin (pretty great, btw) but I see is lacking the ability to know if the drawer is opened or closed.
I think this is a very important feature to this plugin.
I guess this could be implemented in the ZoomDrawerController.

When I have a little more free time I can work on this if you can't

Null stateNotifier on ZoomController

Hi.

I was using this package and I was trying to use one of the latests features that its the stateNotifier in the ZoomController but I got the error The getter 'value' was called on null.

This is a sample class that should demonstrate the error

class MyDrawer extends StatelessWidget {
  final ZoomDrawerController _controller = ZoomDrawerController();
  final Widget content;

  MyDrawer({
    Key key,
    @required this.content,
  })  : assert(content != null),
        super(key: key);
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: ZoomDrawer(
        controller: _controller,
        angle: 0.0,
        showShadow: true,
        menuScreen: Container(),
        mainScreen: GestureDetector(
          onTap: () {
            print('test');
          },
          child: AbsorbPointer(

            /// Here the app crashes because stateNotifier is [null]. 
            /// I could wrap it in a null safety operator but I really need to access the notifier to get the value.
            absorbing: _controller.stateNotifier.value == DrawerState.closed,  
            child: content,
          ),
        ),
      ),
    );
  }
}

The question is:
Am I using wrong the ZoomController or its a package wide problem?

Style 1 drag menu jittering

Hello, in your example if i set style1 and try to just drag and hold the menu button to show the drawer, its jittering and all over the place.

Could you do something with that? and also on Flutter 2 it yells about the same thing still which is in issue #47

Both sides support

Amazing package, beautiful drawer!
I need this drawer on both sides, triggered from 2 different buttons, showing 2 different menus.
In scaffold terms - have both a drawer and endDrawer.
Do you think I can easily use your package and do this?

I can't scroll the screen

I'm trying to use a webview on the home screen, but when I want to scroll up, the menu opens. and I can't use webview. how can i fix this? thank you

[Bug] Drawer state is disposed before controller is disposed

Hi, thanks for making awesome library.

Issue

By the way, I am getting exceptions as below.
Screen Shot 2020-11-26 at 9 40 55 PM

Suggestion

animationController should be disposed before super.dispose. Otherwise, the state is disposed before the animation controller and ticker will leak

  @override
  void dispose() {
    _animationController.dispose();
    super.dispose();
  }

Tried to contribute, but creating a branch from my cloned repo is not working, so I am creating an issue instead.

Thanks

On a page the drawer open and close itself when moving finger up or down

This does not looks good.

child: ZoomDrawer(
                controller: _drawerController,
                style: DrawerStyle.Style1,
                menuScreen: MenuScreen(
                  Home.mainMenu,
                  callback: _updatePage,
                  current: _currentPage,
                ),
                disableGesture: true,
                mainScreen: MainScreen(store: store),
                borderRadius: 24.0,
                showShadow: true,
                angle: 0.0,
                backgroundColor: Colors.grey[300]!,
                slideWidth: MediaQuery.of(context).size.width *
                    (ZoomDrawer.isRTL() ? .45 : 0.65),
                // openCurve: Curves.fastOutSlowIn,
                // closeCurve: Curves.ease,
              ),
            ),
class _MainScreenState extends State<MainScreen> {
  @override
  Widget build(BuildContext context) {
    final rtl = ZoomDrawer.isRTL();
    return ValueListenableBuilder<DrawerState>(
      valueListenable: ZoomDrawer.of(context)!.stateNotifier!,
      builder: (context, state, child) {
        return child!;
//
        return AbsorbPointer(
          absorbing: state != DrawerState.closed,
          child: child,
        );
      },
      child: GestureDetector(
        child: PageStructure(store: widget.store),
        onPanUpdate: (details) {
          if (details.delta.dx < 6 && !rtl || details.delta.dx < -6 && rtl) {
            ZoomDrawer.of(context)!.toggle();
          }
        },
      ),
    );
  }
}

device-2021-04-28-203415.mp4

all is working fine. But i have this warning

/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_zoom_drawer-2.0.2+1/lib/flutter_zoom_drawer.dart:106:30: Warning: Operand of null-aware operation '!' has type 'Locale' which excludes null.

  • 'Locale' is from 'dart:ui'.
    final locale = ui.window.locale!.languageCode.toLowerCase();

Library can't build for web app

Hi Medyas, thanks for your library, i have problem when run web app, please help me have a look.

`๐Ÿ’ช Building with sound null safety ๐Ÿ’ช

Target dart2js failed: Exception: ../../FlutterSDK/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_zoom_drawer-2.0.2+3/lib/flutter_zoom_drawer.dart:117:31:
Error: Property 'languageCode' cannot be accessed on 'Locale?' because it is potentially null.

  • 'Locale' is from 'dart:ui'.
    return ui.window.locale.languageCode.toLowerCase();
    ^^^^^^^^^^^^
    Error: Compilation failed.
    `

flutter doctor.
`[โœ“] Flutter (Channel stable, 2.0.3, on macOS 11.0.1 20B50 darwin-x64, locale en-VN)
โ€ข Flutter version 2.0.3 at /Users/NguyenLinh/FlutterSDK/flutter
โ€ข Framework revision 4d7946a68d (3 months ago), 2021-03-18 17:24:33 -0700
โ€ข Engine revision 3459eb2436
โ€ข Dart version 2.12.2

[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
โ€ข Android SDK at /Users/NguyenLinh/Library/Android/sdk
โ€ข Platform android-30, build-tools 30.0.3
โ€ข ANDROID_HOME = /Users/NguyenLinh/Library/Android/sdk
โ€ข Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
โ€ข Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264)
โœ— Android license status unknown.
Run flutter doctor --android-licenses to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.

[โœ“] Xcode - develop for iOS and macOS
โ€ข Xcode at /Applications/Xcode.app/Contents/Developer
โ€ข Xcode 12.2, Build version 12B45b
โ€ข CocoaPods version 1.10.0

[โœ“] Chrome - develop for the web
โ€ข Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[โœ“] Android Studio (version 4.2)
โ€ข Android Studio at /Applications/Android Studio.app/Contents
โ€ข Flutter plugin can be installed from:
๐Ÿ”จ https://plugins.jetbrains.com/plugin/9212-flutter
โ€ข Dart plugin can be installed from:
๐Ÿ”จ https://plugins.jetbrains.com/plugin/6351-dart
โ€ข Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264)

[โœ“] Connected device (2 available)
โ€ข macOS (desktop) โ€ข macos โ€ข darwin-x64 โ€ข macOS 11.0.1 20B50 darwin-x64
โ€ข Chrome (web) โ€ข chrome โ€ข web-javascript โ€ข Google Chrome 90.0.4430.212

! Doctor found issues in 1 category.
Process finished with exit code 0`

String? locale = ui.window.locale?.languageCode?.toLowerCase();

You fixed the null-safety error for locale but another error created. Please fix this too.

flutter_zoom_drawer-2.0.2/lib/flutter_zoom_drawer.dart:106:32: Warning: Operand of null-aware operation '?.' has type 'Locale' which excludes null.

  • 'Locale' is from 'dart:ui'.
    String? locale = ui.window.locale?.languageCode?.toLowerCase();

I suggest use this:
String? locale = ui.window.locale.languageCode!.toLowerCase();
or this:
String? locale = ui.window.locale!.languageCode.toLowerCase();

Shadow suggestion

I suggest to provide ways to change Shadow, such as to change the opicity.

behavior at start up

Hi...thanks for your work on this package.

I'm noticing on startup of my app, the Drawer contents are being shown for a brief second before the actual main screen gets rendered, rather than drawing the main screen (and keeping drawer hidden)

I'm sure i'm just doing something wrong here in my implementation. Does anyone have any suggestion on where i may be going wrong that causes this behavior?

Thanks

Operand of null-aware operation '!' has type 'Locale' which excludes null.

[+2159 ms] /C:/src/Flutter/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_zoom_drawer-2.0.2+4/lib/flutter_zoom_drawer.dart:117:24:
Warning: Operand of null-aware operation '!' has type 'Locale' which excludes null.
[   +2 ms]  - 'Locale' is from 'dart:ui'.
[        ]       return ui.window.locale!.languageCode.toLowerCase();
[        ]                        ^

Why I have error with "isRTL()" in "slideWidth: MediaQuery.of(context).size.width * (ZoomDrawer.isRTL() ? .45 : 0.65),"

import 'package:flutter/material.dart';
import 'package:flutter_zoom_drawer/flutter_zoom_drawer.dart';
import 'package:my_app/screens/home%20screen/home_screen.dart';
import 'package:my_app/screens/menu%20profile/menu_profile.dart';

class HomeScreen extends StatefulWidget {
@OverRide
_HomeScreenState createState() => _HomeScreenState();
}

class _HomeScreenState extends State {
final _drawerController = ZoomDrawerController();

@OverRide
Widget build(BuildContext context) {
return Scaffold(
body: ZoomDrawer(
controller: _drawerController,
style: DrawerStyle.Style1,
menuScreen: MenuProfile(),
mainScreen: Home(_drawerController),
borderRadius: 24.0,
showShadow: true,
angle: 0.0,
backgroundColor: Colors.grey,
slideWidth:
MediaQuery.of(context).size.width * (ZoomDrawer.isRTL() ? .45 : 0.65),
openCurve: Curves.fastOutSlowIn,
closeCurve: Curves.bounceIn,
),
);
}
}

Improvement: Slide back menu when opened

Hi. Thanks for your package, really nice job.

However, I would like to know if it is possible to close the drawer when its opened, by swiping or clicking the view on the right.

Thanks in advance

'Locale' is from 'dart:ui'

Hi. I have this issue when running on the web with null-safety

flutter_zoom_drawer-2.0.1/lib/flutter_zoom_drawer.dart:106:38: Error: Property 'languageCode' cannot be accessed on 'Locale?' because it is potentially null.

  • 'Locale' is from 'dart:ui'.
    Try accessing using ?. instead.
    String locale = ui.window.locale.languageCode.toLowerCase();
    ^^^^^^^^^^^^

getting Unhandled Exception: Bad state: You cannot close the subject while items are being added from addStream

hi
i copied the example you provided , i am getting below error in logs while trying to press back button.

see below

image

  @override
  void dispose() {
    _locationStreamController.close();
    FlutterQiblah().dispose();
    super.dispose();
  }

Performing hot reload...
Syncing files to device HD1903...
Reloaded 3 of 1365 libraries in 529ms.
E/flutter ( 4181): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: Bad state: You cannot close the subject while items are being added from addStream
E/flutter ( 4181): #0 Subject.close (package:rxdart/src/subjects/subject.dart:152:7)
E/flutter ( 4181): #1 FlutterCompass.dispose (package:flutter_compass/flutter_compass.dart:35:21)
E/flutter ( 4181): #2 FlutterQiblah.dispose (package:flutter_qiblah/flutter_qiblah.dart:87:22)
E/flutter ( 4181): #3 _QiblahCompassState.dispose (package:salatkapp/ui/prayer/qibla/qiblah_compass.dart:89:21)
E/flutter ( 4181): #4 StatefulElement.unmount (package:flutter/src/widgets/framework.dart:4729:12)
E/flutter ( 4181): #5 _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1922:13)
E/flutter ( 4181): #6 _InactiveElements._unmount. (package:flutter/src/widgets/framework.dart:1920:7)
E/flutter ( 4181): #7 ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4556:14)
E/flutter ( 4181): #8 _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1918:13)
E/flutter ( 4181): #9 _InactiveElements._unmount. (package:flutter/src/widgets/framework.dart:1920:7)
E/flutter ( 4181): #10 ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4556:14)
E/flutter ( 4181): #11 _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1918:13)
E/flutter ( 4181): #12 _InactiveElements._unmount. (package:flutter/src/widgets/framework.dart:1920:7)
E/flutter ( 4181): #13 ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4556:14)
E/flutter ( 4181): #14 _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1918:13)
E/flutter ( 4181): #15 _InactiveElements._unmount. (package:flutter/src/widgets/framework.dart:1920:7)
E/flutter ( 4181): #16 ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4556:14)
E/flutter ( 4181): #17 _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1918:13)
E/flutter ( 4181): #18 _InactiveElements._unmount. (package:flutter/src/widgets/framework.dart:1920:7)
E/flutter ( 4181): #19 MultiChildRenderObjectElement.visitChildren (package:flutter/src/widgets/framework.dart:5929:16)
E/flutter ( 4181): #20 _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1918:13)
E/flutter ( 4181): #21 _InactiveElements._unmount. (package:flutter/src/widgets/framework.dart:1920:7)
E/flutter ( 4181): #22 ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4556:14)
E/flutter ( 4181): #23 _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1918:13)
E/flutter ( 4181): #24 _InactiveElements._unmount. (package:flutter/src/widgets/framework.dart:1920:7)
E/flutter ( 4181): #25 ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4556:14)
E/flutter ( 4181): #26 _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1918:13)
E/flutter ( 4181): #27 _InactiveElements._unmount. (package:flutter/src/widgets/framework.dart:1920:7)
E/flutter ( 4181): #28 ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4556:14)
E/flutter ( 4181): #29 _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1918:13)
E/flutter ( 4181): #30 _InactiveElements._unmount. (package:flutter/src/widgets/framework.dart:1920:7)
E/flutter ( 4181): #31 SingleChildRenderObjectElement.visitChildren (package:flutter/src/widgets/framework.dart:5817:14)
E/flutter ( 4181): #32 _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1918:13)
E/flutter ( 4181): #33 _InactiveElements._unmount. (package:flutter/src/widgets/framework.dart:1920:7)
E/flutter ( 4181): #34 ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4556:14)
E/flutter ( 4181): #35 _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1918:13)
E/flutter ( 4181): #36 _InactiveElements._unmount. (package:flutter/src/widgets/framework.dart:1920:7)
E/flutter ( 4181): #37 SingleChildRenderObjectElement.visitChildren (package:flutter/src/widgets/framework.dart:5817:14)
E/flutter ( 4181): #38 _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1918:13)
E/flutter ( 4181): #39 _InactiveElements._unmount. (package:flutter/src/widgets/framework.dart:1920:7)
E/flutter ( 4181): #40 ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4556:14)
E/flutter ( 4181): #41
W/IInputConnectionWrapper( 4181): getExtractedText on inactive InputConnection
W/IInputConnectionWrapper( 4181): getTextBeforeCursor on inactive InputConnection
D/OnePlusJankManager( 4181): Chor uploadMDM JANK_TYPE_ONCE mViewTitle = kw.ltd.salatkapp/kw.ltd.salatkapp.MainActivity--- jank level = 1

Disable taps on content elements

Thanks for this great flutter menu!
I'm wondering how you would disable taps on the content page while the menu is open. I experienced some problems with buttons on the content page being tappable while the menu is open and I would like to deactivate them if the drawer is visible.
Thanks!

Always open drawer

Hi thanks for the nice package I am using it in my app. However on tablets, desktop and web I want the drawer to always open. can you please guide what will be the best practice for it. also slideWidth not working. it always takes 80% of the screen if we don't give any style.

AnimationController disposed

How can I dispose AnimationController of _ZoomDrawerController?
Maybe you can expose it somehow?

I'm getting

The following assertion was thrown while finalizing the widget tree:
_ZoomDrawerState#722ca(ticker active) was disposed with an active Ticker.

_ZoomDrawerState created a Ticker via its SingleTickerProviderStateMixin, but at the time dispose() was called on the mixin, that Ticker was still active. The Ticker must be disposed before calling super.dispose().

Using with Scaffold ?

Hello,

The design is awesome.
Is it possible to use it with a scaffold ? I am newbie in Flutter.
Thanks for your help

Vincent

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.