medyas / flutter_zoom_drawer Goto Github PK
View Code? Open in Web Editor NEWA Flutter package with custom implementation of Drawer
License: MIT License
A Flutter package with custom implementation of Drawer
License: MIT License
How to use flutter_zoom_drawer with MaterialRoute for navigation to other screens? I tried but unsuccessfully :(
It's possible, can you guys provide an example? Thanks in advance!
Hi, thanks for making awesome library.
By the way, I am getting exceptions as below.
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
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?
Dear Sir,
Hello,
Thanks for this great flutter menu!
please how can i integrate this package with the BloC pattern
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
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!
When we swipe up or down the drawer opens automatically.pls help me
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.
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,
),
);
}
}
Hey, @medyas is it possible to control the animation duration. I would like to reduce the duration of the closeCurve
animation as it's too slow.
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?
Reproduced with different versions of module, flutter and dart but it doesn't work anymore in any way...
on Nov 27, 2020
https://github.com/medyas/flutter_zoom_drawer/blob/fc50763049bff751449c8225fef92d9286779c1b/lib/flutter_zoom_drawer.dart
this bug was not there.. please fix it
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.
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 you kindly introduce one one of the pages a settings page with a language radio or pulldown list
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
/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.
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
Hello,
The design is awesome.
Is it possible to use it with a scaffold ? I am newbie in Flutter.
Thanks for your help
Vincent
hi
i copied the example you provided , i am getting below error in logs while trying to press back button.
see below
@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
When closing drawer using Style1 it shows weird transition
Thank you very much for your best plugin, I tried to use it but I can't add the "bottom nav bar", could you please advise.
════════ 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
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
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?
I suggest to provide ways to change Shadow, such as to change the opicity.
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!
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.
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.
I suggest use this:
String? locale = ui.window.locale.languageCode!.toLowerCase();
or this:
String? locale = ui.window.locale!.languageCode.toLowerCase();
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);
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();
}
},
),
);
}
}
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.
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`
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
I will make a PR with null safety support implementation
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
[+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();
[ ] ^
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().
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'
Hi I tried to wrap it in Expanded widget but then menu does not shows. How can make menus scrollable in landscape mode
Hi. Please add the Persian ("fa") language to RTL languages list. Thanks
is it possible to integrate that plugin with Navigator?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.