-
-
Notifications
You must be signed in to change notification settings - Fork 860
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[v6] Major State Refactoring (#1551)
* Split FlutterMapState in to a stateful container widget (FlutterMapStateContainer) and an immutable representation of the state of the map (FlutterMapState) * Extract interactions to InteractionDetector * Move gesture initialisation out of builder and stop passing the whole FlutterMapStateContainer to InteractionDetector * Minor tidy-ups * Re-instate linking of MapController to map state * Trigger all FlutterMapState manipulations via FlutterMapStateController * Reduce MapController API size and simplify gesture code - Replaced mapState getter with the various getters which were just proxied to MapState. - Heavy refactoring (hopefully without changing behaviour) of gesture code. In passing I have simplified * Remove unnecessary getters now that InteractiveFlags defines convenience methods for checking single flags * Fix double tap zoom not working when drag was enabled and prevent pinch move when only pinch zoom is enabled * Use new InteractiveFlag convenience methods * Combine getBoundsCenterZoom and centerZoomFitBounds * Replace http stubbing with an in-memory TileProvider in tests This stops the following message from being spammed in tests which was caused by a problem with the http mocking: type 'Null' is not a subtype of type 'Future<HttpClientRequest>' * Separate MapOptions from FlutterMapState In doing so I noticed that the adaptive boundary options could use a refactor and so placed them in a dedicated class which led to a tidy up to the boundary code in FlutterMapState. * Combine adaptive bounds, max bounds and sw/ne pan bounds in to a single MapBounds class * Create FrameConstraint and FrameFit abstraction FrameConstraint unites the various methods of setting a maximum bounds for the map frame. Previously MapOptions had three different concepts for setting a max bounds: adaptive bounds, maxBounds and se/nw pan boundaries. Adaptive bounds and maxBounds are now FrameConstraint.contain whilst sw/ne pan boundaries is replaced by FrameConstraint.containCenter. FrameFit is a replacement for FitBoundsOptions, combinining the options with the bounds. This means bounds/boundsOptions now become initialFrameFit (since bounds/boundsOptions were actually initial bounds and the options for those initial bounds). Additionally this sets up an abstraction for different map fits since coordinate fit will be added next. * Add deprecations on MapControllerImpl * Add fitting by coordinates This commit incorporates @jjoelson's coordinate fit implementation in to the new FrameFit abstraction. Co-authored-by: Jonathan Joelson <[email protected]> * Rename FlutterMapState to FlutterMapFrame, add InteractionOptions collection to tidy up options and change how options are propagated in preparation for changing the inherited widget to an inherited model * Use InhertiedModel instead of InheritedWidget * Remove FitCoordinates' inside parameter because fitting inside a set of coordinates doesn't have an unambiguous meaning * Fix event names appearing minified when running web release build * Set constraints that match the old adaptive constraints These old adaptive constraints did not prevent the map from going outside of the specified bounds, they stopped the center of the map from going outside of those bounds. This commit sets the constraints appropriately. * Make documentation easier to read * Use flags/options from InteractionOptions not the old deprecated values, unless InteractiveOptions is not provided * Fix options propagation * Add tests to make sure the InheritedModel notifies if and only if the relevnat aspect changes * Rename FlutterMapFrame to MapFrame * Avoid an extra Stack * Assign AnimationControllers where they are declared * Rename from frame to camera * Remove flutter_map_ prefixes from files in lib/src/map/ * Move FlutterMapStateContainer in to FlutterMap's file since it is just the widget state * Rename mapCamera variables to camera for consistency with options for MapOptions * Documentation * Use standard deprecations format In passing re-ordered the methods in MapControllerImpl to match MapController. * Re-organized camera related source files Improved some documentation (part 1) Prevent public exposure of `FitCoordinates` and `FitBounds` constructors * Add FitInsideBounds * Move CameraFit attributes from the base class to the subclasses and tidy up documentation None of the fields which were on the CameraFit base class were conceptually essential for any imaginable camera fit. Moving them to the subclasses ensures that any future camera fits will not need to implement those options just because they already exist. It would also allow for individual camera fits to specify different default values if appropriate. * Re-order imports alphabetically * Add lint to enforce consistent import/export ordering * Reinstate maxBounds as a deprecated option * Remove duplicate exports and make imports consistent The plugin API no longer exports classes which flutter_map already exports. Imports within this package now import the actual classes they use rather than the whole flutter_map library. Internal code should not depend on the exported library definition. * Remove deprecated AnchorAlign * Add deprecation for nonrotatedSize * Fix deprecation * Set default CameraFit maxZoom values to null The other parameters for CameraFit all have default values which will not cause changes to the calculated CameraFit (i.e. padding is zero, forceIntegerZoomLevel is false). Setting maxZoom to null makes it consistent with the other parameters in that it will not affect the calculated CameraFit. I chose null over double.infinity as in my opinion the intent is clearer, no maximum. --------- Co-authored-by: Jonathan Joelson <[email protected]> Co-authored-by: JaffaKetchup <[email protected]>
- Loading branch information
1 parent
8ac3ebd
commit 2c60d63
Showing
86 changed files
with
4,910 additions
and
2,604 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.