This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "version": 8, | |
| "sprite": "https://www.arcgis.com/sharing/rest/content/items/2979525c704b4900811fb29822e0f27c/resources/sprites/sprite-1650359779877", | |
| "glyphs": "https://basemaps.arcgis.com/arcgis/rest/services/World_Basemap_v2/VectorTileServer/resources/fonts/{fontstack}/{range}.pbf", | |
| "sources": { | |
| "esri": { | |
| "type": "vector", | |
| "url": "https://basemaps.arcgis.com/arcgis/rest/services/World_Basemap_v2/VectorTileServer", | |
| "tiles": [ | |
| "https://basemaps.arcgis.com/arcgis/rest/services/World_Basemap_v2/VectorTileServer/tile/{z}/{y}/{x}.pbf" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @override | |
| Widget build(BuildContext context) { | |
| return PullToReachScope( | |
| child: Scaffold( | |
| appBar: AppBar( | |
| actions: [ | |
| ReachableIcon( | |
| child: Icon(Icons.search), | |
| index: 2, | |
| onSelect: () => _routeToPage("search!"), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class ReachableIcon extends StatefulWidget { | |
| final Widget child; | |
| final int index; | |
| final VoidCallback onSelect; | |
| ReachableIcon({ | |
| @required this.child, | |
| @required this.index, | |
| @required this.onSelect, | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @immutable | |
| class Reachable extends StatefulWidget { | |
| final Widget child; | |
| final int index; | |
| final ValueChanged<bool> onFocusChanged; | |
| final VoidCallback onSelect; | |
| Reachable({ | |
| @required this.child, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| bool _didDragEnd(ScrollNotification notification) { | |
| // Whenever dragDetails are null the scrolling happends without the users input | |
| // meaning that the user release the finger --> drag has ended. | |
| // For Cupertino Scrollables the ScrollEndNotification can not be used | |
| // since it will be send after the list scroll has completely ended and | |
| // the list is in its initial state | |
| if (notification is ScrollUpdateNotification && | |
| notification.dragDetails == null) { | |
| return true; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| bool _handleScrollNotification(ScrollNotification notification) { | |
| if (_didDragStart(notification)) { | |
| _dragOffset = 0; | |
| _pullToReachStarted = true; | |
| } | |
| if (_didDragEnd(notification)) { | |
| _dragOffset = 0; | |
| _pullToReachStarted = false; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class ScrollToIndexConverter extends StatefulWidget { | |
| final Widget child; | |
| final int itemCount; | |
| final double dragExtentPercentage; | |
| ScrollToIndexConverter({ | |
| @required this.child, | |
| @required this.itemCount, | |
| this.dragExtentPercentage = 0.2, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:flutter/material.dart'; | |
| import 'package:flutter/widgets.dart'; | |
| import 'package:pull_down_to_reach/index_calculator/index_calculator.dart'; | |
| import 'package:pull_down_to_reach/widgets/pull_to_reach_scope.dart'; | |
| abstract class IndexCalculator { | |
| int getIndexForScrollPercent(double scrollPercent); | |
| } | |
| class ScrollToIndexConverter extends StatefulWidget { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| double _calculateScrollProgress(ScrollNotification notification) { | |
| var containerExtent = notification.metrics.viewportDimension; | |
| if (notification is ScrollUpdateNotification) { | |
| _dragOffset -= notification.scrollDelta; | |
| } | |
| if (notification is OverscrollNotification) { | |
| _dragOffset -= notification.overscroll; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| NotificationListener<ScrollNotification>( | |
| onNotification: (notification) { | |
| // return true if | |
| // the notification shouldn't be forwarded to any parent widgets | |
| // false otherwise | |
| _handleScrollNotification(notification); | |
| return false; | |
| }, | |
| child: child, |
NewerOlder