Coder Social home page Coder Social logo

rubber's People

Contributors

arinfaraj avatar aryzhov avatar felangel avatar mcrovero avatar micimize avatar muhmdhsn313 avatar nfsxreloader avatar paulcaroline avatar vardiak 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  avatar  avatar  avatar

rubber's Issues

Scrim with customizable color.

A nice addition would be scrim/overlay covering the widgets below the sheet. It helps to bring focus to the sheet. This would also be compliant with the material design guidelines.

Using ListView in upperLayer section cancel the drag up action

Describe the bug
I have a column with multiple rows in my upperLayer section. If I leave at it is, I get a "Bottom overflowed" error.

Column(
  children: <Widget>[
    Row(
      children: <Widget> [
      ...
      ]),
    Row(
      children: <Widget> [
      ...
      ]),
  ])

Putting the column within a ListView or similar widget remove the overflow, but now, when dragging up the section, it just scroll the ListView:

ListView(
  children: <Widget> [
    Column(
      children: <Widget>[
        Row(
          children: <Widget> [
          ...
          ]),
        Row(
          children: <Widget> [
          ...
        ]),
      ])
    ])
....

Smartphone (please complete the following information):

  • Device: Blackberry Motion
  • OS: Android 8.x
  • Flutter 1.0 and Rubber 0.2.1

Overflow when adding anything to Header

Describe the bug
Trying to have the RubberBottomSheet over GoogleMaps and allow the user to search. I can get the look needed, but everything seems to cause 'RenderFlex overflowed by 1.4 pixels on the bottom.' when moving Bottom sheet up and down...especially when using the header. I've tried using Stacks, ListViews, ClipRects, SingleChildScrollView, etc. However, always get an overflow.

To Reproduce

CameraPosition cam = _kInitialPos;
return Scaffold(
    appBar: AppBar(
      elevation: 0.0,
        title: Image.asset(
            "assets/Logo_white_med.png",
            fit: BoxFit.cover,
        ),
        backgroundColor: Theme.of(context).primaryColor,
    ),
    body: Container(
        child: RubberBottomSheet(
            scrollController: _scrollController,
            header: Container(
                width: MediaQuery.of(context).size.width,
                color: Theme.of(context).highlightColor,
                child: Icon(
                    FontAwesomeIcons.gripLines,
                    color: Theme.of(context).backgroundColor,
                ),
            ),
            lowerLayer: Container(
                child: GoogleMap(
                    mapType: MapType.normal,
                    initialCameraPosition: cam,
                    onMapCreated: (GoogleMapController controller) {
                        _mcontroller.complete(controller);
                    },
                    zoomGesturesEnabled: true,
                ),
            ),
            upperLayer: ListView(
                controller: _scrollController,
                children: <Widget>[
                    Text("Jimmy"),
                    Text("Ted"),
                    Text("Fred"),
                ],
            ),
            animationController: _controller,
        ),
    ),
);

Expected behavior
Not overflow

Screenshots
Example of what we are going for...
image

Smartphone (please complete the following information):

  • Device: iPhone Xr Simulator
  • OS: iOS
  • Browser stock browser, safari
  • Version 12.2

Additional context
Add any other context about the problem here.

dragFriction is reversed

Looking at the code, it seems like dragFriction is being treated as a multiplier, while I would expect more friction to dampen the velocity. I think this is what you want:

- controller.value -= details.primaryDelta / _screenHeight * friction;
+ controller.value -= details.primaryDelta / (_screenHeight * friction);

Future callback is not triggered with animation controller

Describe the bug
First of all, great work with the RubberBottomSheet ๐Ÿ‘
Now, I have a List much like in : https://github.com/mcrovero/rubber/blob/master/example/lib/scroll.dart
Upon onTap on the ListTile item I want to collapse the bottom sheet and then further do some update on the lowerLayer of the RubberBottomSheet. So I went for something like :

void _listItemTapped(index) {
    print('Collapsing');
    _controller.collapse().whenComplete(() {
      print('Collapsed');
      // Do something here
    });
  }

But I don't see Collapsed being printed at all. What am I missing here ?

** Gif **

bug

can On drag vertically full screen at upperLayer??

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

Failed assertion: line 110 pos 12: '_positions.isNotEmpty'

Failed assertion: line 110 pos 12: '_positions.isNotEmpty'
Either the assertion indicates an error in the framework itself, or we should provide substantially

When the exception was thrown, this was the stack:
#2 ScrollController.position (package:flutter/src/widgets/scroll_controller.dart:110:12)
#3 RubberBottomSheetState._handleDragStart (package:diabetist_pro/backend/componets/rubber/src/bottom_sheet.dart:246:33)

onTap event instead of defaulting to _onVerticalDragDown when tapping the RubberBottomSheet

Is your feature request related to a problem? Please describe.
When the RubberBottomSheet is tapped, we need it to have a different behaviour than the default one (in our case, expanding to be higher instead of collapsing to its smallest size), which is currently impossible because tapping is interpreted as a _onVerticalDragDown event by the plugin.

Describe the solution you'd like
Adding an Function _onTap property to the Widget, enabling executing a user-defined method when tapping instead of _onVerticalDragDown.
This onTap could be optional and call _onVerticalDragDown as a default behaviour, so that existing code relying on it would continue working as before.

Describe alternatives you've considered
Not many alternatives possible from outside the plugin.
We have tried wrapping the header and/or the content into a GestureDetector to handle the onTap event before it reaches the RubberBottomSheet. but that would also intercept any drag events, making it pointless to use a bottom sheet at all.
Similarly also considered putting it behind an transparent overlay (possibly using a Stack widget), but it would have the same effect.

ScrollController not attached to any scroll views

The following assertion was thrown while handling a gesture:

ScrollController not attached to any scroll views.
'package:flutter/src/widgets/scroll_controller.dart':
Failed assertion: line 110 pos 12: '_positions.isNotEmpty'

RubberBottomSheetState._onVerticalDragDown (package:diabetist_pro/backend/componets/rubber/src/bottom_sheet.dart:181:33)

Add RubberBottomSheet.of(context)

Is your feature request related to a problem? Please describe.
Currently you have to pass down the RubberAnimationController in order to show/control the BottomSheet from widgets down the tree.

Describe the solution you'd like
Like Scaffold.of(context).showModalBottomSheet it would be nice to have RubberBottomSheet.of(context), or something similar, in order to access the RubberAnimationController.

Describe alternatives you've considered
Like described, the alternative is to pass down the RubberAnimationController which isn't elegant.

Investigating access to upperBoundValue and lowerBoudnValue

Hey thank you for your awesome work
I want to change the upperBoundValue and lowerBoundValue in RubberAnimationControler when the device orientation changes, I couldn't change them using getters so I created two controllers each for a specific device orientation but it didn't seem to work. is there a better way to achieve this?
Thank you

Error with bare minimum layout: RenderBox was not laid out

Describe the bug
Implementing the bare minimum rubber bottomsheet in my page results in an exception. The exception does not terminate the bottomsheet though, it still works.

To Reproduce
Code:

class BrowserPage extends StatefulWidget {
  @override
  _BrowserPageState createState() => _BrowserPageState();
}

class _BrowserPageState extends State<BrowserPage> with SingleTickerProviderStateMixin {
  RubberAnimationController _controller;

  @override
  void initState() {
    _controller = RubberAnimationController(
      vsync: this,
      duration: Duration(milliseconds: 200)
    );
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
  return Scaffold(
      // drawer: AppDrawer(),
      // endDrawer: DebugDrawer(),
      body: Container(
        child: RubberBottomSheet(
          lowerLayer: Container(
            color: Colors.blueAccent
          ),
          upperLayer: Container(
            color: Colors.redAccent
          ),
          animationController: _controller,
        ),
      )
    );
  }
}

And error:

I/flutter (19728): โ•โ•โ•ก EXCEPTION CAUGHT BY SCHEDULER LIBRARY โ•žโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
I/flutter (19728): The following assertion was thrown during a scheduler callback:
I/flutter (19728): RenderBox was not laid out: RenderStack#abea0 NEEDS-LAYOUT NEEDS-PAINT
I/flutter (19728): 'package:flutter/src/rendering/box.dart': Failed assertion: line 1482 pos 12: 'hasSize'
I/flutter (19728): 
I/flutter (19728): Either the assertion indicates an error in the framework itself, or we should provide substantially
I/flutter (19728): more information in this error message to help you determine and fix the underlying cause.
I/flutter (19728): In either case, please report this assertion by filing a bug on GitHub:
I/flutter (19728):   https://github.com/flutter/flutter/issues/new?template=BUG.md
I/flutter (19728):
I/flutter (19728): When the exception was thrown, this was the stack:
I/flutter (19728): #2      RenderBox.size 
package:flutter/โ€ฆ/rendering/box.dart:1482
I/flutter (19728): #3      _RubberBottomSheetState._bottomSheetHeight 
package:rubber/src/bottom_sheet.dart:50
I/flutter (19728): #4      _RubberBottomSheetState.afterFirstLayout 
package:rubber/src/bottom_sheet.dart:296
I/flutter (19728): #5      __RubberBottomSheetState&State&TickerProviderStateMixin&AfterLayoutMixin.initState.<anonymous closure> 
package:after_layout/after_layout.dart:10
I/flutter (19728): #6      _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._invokeFrameCallback
I/flutter (19728): #7      _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding.handleDrawFrame 
package:flutter/โ€ฆ/scheduler/binding.dart:936
I/flutter (19728): #8      _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._handleDrawFrame 
package:flutter/โ€ฆ/scheduler/binding.dart:840
I/flutter (19728): #12     _invoke (dart:ui/hooks.dart:209:10)
I/flutter (19728): #13     _drawFrame (dart:ui/hooks.dart:168:3)
I/flutter (19728): (elided 5 frames from class _AssertionError and package dart:async)

Smartphone (please complete the following information):

  • Device: samsung galaxy s7
  • OS: not sure
  • Browser ??
  • Version Latest flutter and rubber

Extra:
As an aside, setting the lowerBoundValue to AnimationControllerValue(pixel: whatever) terminates the upperlayer, i.e. it doesnt show up at all. No error messages except for the one mentioned here.

launchTo value lower than lowerBoundValue causes jump

If you use launchTo to go to a value that is lower than the lowerBoundValue it goes to the value, then after a second it jumps back up to the lowerBoundValue on its own. This worked properly (without bouncing back up) in previous versions, but has since been broken.

This is the line that causes the issue (440 & 441 in animation_controller.dart):

if(_value < lowerBound && dismissable) 
        _value = lowerBound;

This should work like it did before, or there should be an option to allow not jump back up.

opening with animation

like with drag and drop animation how can i set them for expand and collapse methods?

RubberBottomSheet.onDragStart?

Is your feature request related to a problem? Please describe.
I need to listen when the drag starts so I can hide a FAB.

Describe the solution you'd like
Introduce RubberBottomSheet.onDragStart.

Bottom sheet is at wrong position after orientation change

Describe the bug
When using a RubberAnimationController like this one:
_controller = RubberAnimationController( vsync: this, halfBoundValue: AnimationControllerValue(percentage: 0.5), lowerBoundValue: AnimationControllerValue(pixel: 200), duration: Duration(milliseconds: 200) );
and an upper layer like this:

Widget _getUpperLayer() { return Container( height: 200.0, decoration: BoxDecoration( color: Colors.cyan ), ); }
then after starting the app everything looks fine, collapsed state:

image

Expanded state:

image

(note this is only for demonstration purposes, of course 200 pixel tall strip as a upper layer doesn't make a lot of sense)

Now I collapse the bottom sheet again and go into landscape mode:
image

The bottom sheet is not at the right position. A part of it is hidden below the screen.

Expanded in landscape:

image

To Reproduce
Steps to reproduce the behavior:

  1. open the default.dart file in the example app
  2. Write this on line 96:
    height: 200.0,
  3. Start the example App and open the default example. Rotate the screen.

Expected behavior
In the horizontal, as well as in the vertical position the full 200.0 pixel tall strip should be visible in the collapsed state.

Smartphone (please complete the following information):

  • Android Emulator Api 29

Add animate up/down threshold parameter

Could you implement a threshold parameter for when to animate up/down? Currently the threshold is extremely high. This feels extremely awkward if you want to dismiss the bottom sheet and you have to move your finger across more than a half of the screen.

RubberBottomSheet isn't working in release builds

Great library! For now, it's the only way to implement awesome persistent bottom sheet. But there is an annoying bug.

Source code of my application: https://github.com/alexandr2levin/my_mikhailovka

Description of the bug
RubberBottomSheet very often expands to full height and can't be collapsed in release builds. Sometimes it works as expected, but it happens very rare. Debug builds works as expected.

To Reproduce

  1. flutter run --release my project
  2. try to collapse the bottom sheet

Screenshots

Release build (incorrect behavior) Debug build (correct behavior)
telegram-cloud-file-2-257120505-20070-2437342557360051043 telegram-cloud-file-2-257033876-20696--9013455571151254205

Smartphone:

  • Device: iPhone 5S, Nokia 3.1
  • OS: latest iOS, Android 8.1
  • Version [e.g. 22]
  • Flutter

Flutter doctor

[โœ“] Flutter (Channel stable, v1.0.0, on Mac OS X 10.14.3 18D109, locale en-RU)

Disable drag event

Is it possible to disable the drag event? I need to toggle the bottom sheet via click of a button only

Variable to set an initial height value

It will be nice to get a variable to set the initial height value of the widget. Something like:

RubberBottomSheet(
  lowerLayer: _getLowerLayer(),
  upperLayer: _getUpperLayer(),
  animationController: _controller,
  height: 100.0
),

If there is another way, I would like to know. Thanks and nice widget!

Value of type 'dart.core::int' can't be assigned to a variable of type 'dart.core::double'

Please see the following error found in package:rubber/src/animation_controller.dart.

`'package:rubber/src/animation_controller.dart': error: line 355 pos 30:
file:///D:/Programing/FLUTTER/flutter/.pub-cache/hosted/pub.dartlang.org/rubber-0.2.5/lib/src/animation_controller.dart:355:30:

Error: A value of type 'dart.core::int' can't be assigned to a variable of type 'dart.core::double'.
Try changing the type of the left hand side, or casting the right hand side to 'dart.core::double'.
final double launchSpeed = 7;
^
final double launchSpeed = 7;
^`

When I try to slide down, it prompts me to overflow the title height

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context

image
image
When I try to slide down, it prompts me to overflow the title height

RubberBottomSheet crash when dragging bellow 0 height position

Describe the bug
Another exception was thrown: 'package:flutter/src/widgets/basic.dart': Failed assertion: line 2058 pos 15: 'heightFactor == null || heightFactor >= 0.0': is not true.

To Reproduce
Steps to reproduce the behavior:

  1. Open app that has a RubberBottomSheet
  2. Drag RubberBottomSheet bellow 0 height position.

Screenshots
Before error:
image

Start to drag the RubberBottomSheet at the bottom
image

  • start to drag from the small circle position

image

Dim lowerLayer when Rubber is active

I think it's common behavior that when your sheet slides up, the background dims to a certain degree. It would be nice if Rubber can handle this. I'm currently trying out ways to do it, via listening on AnimationStatus, or even using ValueBuilder to listen on animationState, but neither of this work nicely (I want the background to be dimmed the moment it starts sliding up, and automatically un-dim when it's dragged down, right now with my weird hack there are things like setting state to trigger a refresh, and even then it's pretty janky)

Ability to swipe down to bottom to close.

Can we have the ability to completely close the bottom sheet when we swipe all the way to the bottom? Or alternatively selecting the area of the screen where the bottom sheet is not showing.

GestureDetector in ListView is not working

Describe the bug
I have a ListView with items similar to the scroll example (which is now working really great by the way ๐Ÿ‘). Every item is wrapped in a GestureDetector that is listening for onTap.

There are currently three problems:

  • The taps are oftentimes not regognized.
  • If onTap is successfully called, the sheet jumps around.
  • There is also sometimes the following message appearing in the console
flutter: โ•โ•โ•ก EXCEPTION CAUGHT BY GESTURE โ•žโ•โ•โ•โ•โ•โ•โ•
flutter: The following assertion was thrown while handling a gesture:
flutter: 'package:rubber/src/bottom_sheet.dart': Failed assertion: line 149 pos 12: '_hold == null': is not
flutter: true.
flutter:
flutter: Either the assertion indicates an error in the framework itself, or we should provide substantially
flutter: more information in this error message to help you determine and fix the underlying cause.
flutter: In either case, please report this assertion by filing a bug on GitHub:
flutter:   https://github.com/flutter/flutter/issues/new?template=BUG.md
flutter:
flutter: When the exception was thrown, this was the stack:
flutter: #2      _RubberBottomSheetState._onVerticalDragDown (package:rubber/src/bottom_sheet.dart:149:12)
flutter: #3      DragGestureRecognizer.addPointer.<anonymous closure> (package:flutter/src/gestures/monodrag.dart:123:46)
flutter: #4      GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:102:24)
flutter: #5      DragGestureRecognizer.addPointer (package:flutter/src/gestures/monodrag.dart:123:9)
flutter: #6      RawGestureDetectorState._handlePointerDown (package:flutter/src/widgets/gesture_detector.dart:643:18)
flutter: #7      RenderPointerListener.handleEvent (package:flutter/src/rendering/proxy_box.dart:2500:14)
flutter: #8      _WidgetsFlutterBinding&BindingBase&GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:158:22)
flutter: #9      _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerEvent (package:flutter/src/gestures/binding.dart:138:7)
flutter: #10     _WidgetsFlutterBinding&BindingBase&GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:101:7)
flutter: #11     _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:85:7)
flutter: #12     _invoke1 (dart:ui/hooks.dart:168:13)
flutter: #13     _dispatchPointerDataPacket (dart:ui/hooks.dart:122:5)
flutter: (elided 2 frames from class _AssertionError)
flutter:
flutter: Handler: onDown
flutter: Recognizer:
flutter:   VerticalDragGestureRecognizer#d7641(debugOwner: GestureDetector)
flutter: โ•โ•โ•โ•โ•โ•โ•

Expected behavior
I expect that "normal" interactions like onTap are handled by the widgets inside of the modal.

Got Assertion Error when scrolling the Upper layer of bottom sheet

Describe the bug
When i was scrolling the bottom Sheet , i got the below exception

To Reproduce
Steps to reproduce the behavior:

  1. Random Error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots

I/flutter (22346): โ•โ•โ•ก EXCEPTION CAUGHT BY GESTURE โ•žโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
I/flutter (22346): The following assertion was thrown while handling a gesture:
I/flutter (22346): 'package:rubber/src/bottom_sheet.dart': Failed assertion: line 158 pos 14: '_drag == null': is not
I/flutter (22346): true.
I/flutter (22346):
I/flutter (22346): Either the assertion indicates an error in the framework itself, or we should provide substantially
I/flutter (22346): more information in this error message to help you determine and fix the underlying cause.
I/flutter (22346): In either case, please report this assertion by filing a bug on GitHub:
I/flutter (22346): https://github.com/flutter/flutter/issues/new?template=BUG.md
I/flutter (22346):
I/flutter (22346): When the exception was thrown, this was the stack:
I/flutter (22346): #2 _RubberBottomSheetState._onVerticalDragDown (package:rubber/src/bottom_sheet.dart:158:14)
I/flutter (22346): #3 DragGestureRecognizer.addPointer. (package:flutter/src/gestures/monodrag.dart:123:46)
I/flutter (22346): #4 GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:102:24)
I/flutter (22346): #5 DragGestureRecognizer.addPointer (package:flutter/src/gestures/monodrag.dart:123:9)
I/flutter (22346): #6 RawGestureDetectorState._handlePointerDown (package:flutter/src/widgets/gesture_detector.dart:698:18)
I/flutter (22346): #7 RenderPointerListener.handleEvent (package:flutter/src/rendering/proxy_box.dart:2519:14)
I/flutter (22346): #8 _WidgetsFlutterBinding&BindingBase&GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:158:22)
I/flutter (22346): #9 _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerEvent (package:flutter/src/gestures/binding.dart:138:7)
I/flutter (22346): #10 _WidgetsFlutterBinding&BindingBase&GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:101:7)
I/flutter (22346): #11 _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:85:7)
I/flutter (22346): #12 _invoke1 (dart:ui/hooks.dart:173:13)
I/flutter (22346): #13 _dispatchPointerDataPacket (dart:ui/hooks.dart:127:5)
I/flutter (22346): (elided 2 frames from class _AssertionError)
I/flutter (22346):
I/flutter (22346): Handler: onDown
I/flutter (22346): Recognizer:
I/flutter (22346): VerticalDragGestureRecognizer#30ccf(debugOwner: GestureDetector)
I/flutter (22346): โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
I/flutter (22346): Another exception was thrown: 'package:rubber/src/bottom_sheet.dart': Failed assertion: line 219 pos 14: '_drag == null': is not true.

Smartphone (please complete the following information):

  • Device: Pixel 2
  • OS: Android
  • Browser: NA
  • Version 0.2.6

Additional context
Add any other context about the problem here.

Got error when build the widget tree

Describe the bug
flutter: โ•โ•โ•ก EXCEPTION CAUGHT BY SCHEDULER LIBRARY โ•žโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
flutter: The following assertion was thrown during a scheduler callback:
flutter: AnimationController.animateTo() called with no explicit Duration and no default Duration.
flutter: Either the "duration" argument to the animateTo() method should be provided, or the "duration"
flutter: property should be set, either in the constructor or later, before calling the animateTo() function.
flutter:
flutter: When the exception was thrown, this was the stack:
flutter: #0 RubberAnimationController._animateToInternal. (package:rubber/src/animation_controller.dart:312:11)
flutter: #1 RubberAnimationController._animateToInternal (package:rubber/src/animation_controller.dart:320:8)
flutter: #2 RubberAnimationController.height= (package:rubber/src/animation_controller.dart:191:5)
flutter: #3 _RubberBottomSheetState.afterFirstLayout (package:rubber/src/bottom_sheet.dart:296:17)
flutter: #4 __RubberBottomSheetState&State&TickerProviderStateMixin&AfterLayoutMixin.initState. (package:after_layout/after_layout.dart:10:38)
flutter: #5 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:990:15)
flutter: #6 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:938:9)
flutter: #7 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:842:5)
flutter: #8 _invoke (dart:ui/hooks.dart:159:13)
flutter: #9 _drawFrame (dart:ui/hooks.dart:148:3)

To Reproduce
Steps to reproduce the behavior:

  void initState() {
    _controller = RubberAnimationController(
      halfBoundValue: AnimationControllerValue(percentage: 0.5),
      vsync: this,
    );
    super.initState();
}


**Smartphone (please complete the following information):**
 - Device: iPhoneXR Simulator

**Additional context**
Add any other context about the problem here.

Flag to make sheet to not overflow its lower and upper bounds (strictier controller values range)

I faced a need to keep sheet strictly in its bounds, so, when I didn't find any out-of-box solution, I decided to play with it by myself. And what I got:

In _onVerticalDragUpdate function from RubberBottomSheet I replaced one line like this

//_controller.value -= details.primaryDelta / screenHeight * friction;

var newValue = controller.value - (details.primaryDelta / _screenHeight * friction);
        if (_someFlagThatMakesControllerBeAwareAboutSheetBounds) {
          if (newValue > controller.upperBound)
            newValue = controller.upperBound;
          else if (newValue < controller.lowerBound)
            newValue = controller.lowerBound;
        }
        controller.value = newValue;

And after some gestures that caused fling of RubberAnimationController to be called, sheet comes collapsed or even disappears. But I played with it too and added these lines before simulation object creates (because it caused division by zero inside) [Not sure if it's necessary after update edits, couldn't catch it again]

if (value == to)
      return null;

Upd:
Also, controller should have added (_tick), right before notifyListeners():

// Strict boundaries enforced
    if(_someFlagThatMakesControllerBeAwareAboutSheetBounds && _value > upperBound)
      _value = upperBound;

So I hope it will appear in Rubber in a future.

Slow animation

Describe the bug
Hi McRovero, first i want to thank you for this great library, but i'm disappointed how the animation is too slow and luggy. is there something should i do to optimize the animation?

and thanks.

To Reproduce
Expand/Collapse the bottomsheet

Expected behavior
Smooth and not luggy animation

Smartphone:

  • Device: Lenovo k6 power and many...
  • OS: Android 8.1

How to ensure proper widget height when working with percentages?

When using a percentage to set the lowerBoundValue and the bottom sheet is collapsed, how can I make sure that the widget on the top of the bottom sheet expands the area properly? This is for example and issue when I switch to landscape mode, as the available size is much smaller then, which is causing overflow issues.

Thanks!!!

Exception if not using a ScrollController

I created a RubberBottomSheet without passing a ScrollController. It works for the most part, but an exception is thrown if I try to drag it down in order to dismiss. Below is the stack trace:

I/flutter (32146): โ•โ•โ•ก EXCEPTION CAUGHT BY GESTURE โ•žโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
I/flutter (32146): The following NoSuchMethodError was thrown while handling a gesture:
I/flutter (32146): The getter 'position' was called on null.
I/flutter (32146): Receiver: null
I/flutter (32146): Tried calling: position
I/flutter (32146): 
I/flutter (32146): When the exception was thrown, this was the stack:
I/flutter (32146): #0      Object.noSuchMethod (dart:core/runtime/libobject_patch.dart:50:5)
I/flutter (32146): #1      _RubberBottomSheetState._onVerticalDragDown (package:rubber/src/bottom_sheet.dart:159:31)
I/flutter (32146): #2      DragGestureRecognizer.addPointer.<anonymous closure> (package:flutter/src/gestures/monodrag.dart:123:46)
I/flutter (32146): #3      GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:102:24)
I/flutter (32146): #4      DragGestureRecognizer.addPointer (package:flutter/src/gestures/monodrag.dart:123:9)
I/flutter (32146): #5      RawGestureDetectorState._handlePointerDown (package:flutter/src/widgets/gesture_detector.dart:643:18)
I/flutter (32146): #6      RenderPointerListener.handleEvent (package:flutter/src/rendering/proxy_box.dart:2500:14)
I/flutter (32146): #7      _WidgetsFlutterBinding&BindingBase&GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:158:22)
I/flutter (32146): #8      _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerEvent (package:flutter/src/gestures/binding.dart:138:7)
I/flutter (32146): #9      _WidgetsFlutterBinding&BindingBase&GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:101:7)
I/flutter (32146): #10     _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:85:7)
I/flutter (32146): #11     _invoke1 (dart:ui/hooks.dart:168:13)
I/flutter (32146): #12     _dispatchPointerDataPacket (dart:ui/hooks.dart:122:5)
I/flutter (32146): 
I/flutter (32146): Handler: onDown
I/flutter (32146): Recognizer:
I/flutter (32146):   VerticalDragGestureRecognizer#b6362(debugOwner: GestureDetector)
I/flutter (32146): โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•

I am using rubber: 0.2.5

Support multiple ScrollControllers

Hello!
Thank you so much for this great library.
I'm using the bottom sheet in my new app where I have a Navigator with multiple scrolling screens in the bottom sheet:
image1
Scrolling is working fine for the first screen, but adding the ScrollController to the ListView of the second screen is throwing this exception:
ScrollController attached to multiple scroll views
Which makes sense I guess.... Can you think of a way to support multiple ListViews (on different pages, so only one shown at a time) inside a single bottom sheet?

Thanks!

height (depending on content)

Wow, this is a incredible good package - by far the smoothiest bottom-slider out there! ๐Ÿฅ‡

I am new to flutter, and i didn't found a way to:

  • set height of content to depending on content
  • set height for scrolling rubber via number (int/double?)

image

** not more than this height / space is wanted ... is just a placeholder for some real content, the content is not the text or a height of 10 ;)

Bottom sheet scroll position

Is there anything listener for listening to the bottomsheet position depending on peek mode and expanded mode?

Verbose mode

Is your feature request related to a problem? Please describe.
With the current version of this module, the debug console is spammed with useless informations for the end user.

Describe the solution you'd like
Hide those logs if a verbose mode is not activated.

Shape customization

It would be really nice if you were able to change the shape of the sheet, for example to create rounded corners at the top of the sheet, like many of Google's redesigned apps have.

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.