Photo_view: Proposal: PhotoViewController

Created on 7 Jan 2019  路  4Comments  路  Source: fireslime/photo_view

In the last months, more and more use cases of custom behavior appeared.
PhotoView as a generalist zoomable widget of zoomable must be more customizable, but in another way, cover a world of features is not our main objective here.

Customize PhotoView should be easy but use it without any config should be too.

After reading some issues, I think the best pattern to provide an optional, flexible and simple API would be a Controller.

Controller is a patter where a class define parameters of behavior and controlls state outside the widget, this would enable methods like reset (#67).

Due to the amount of issues, this is priority.

PhotoView Controller

Most helpful comment

After Some work, the controller is starting to take form. #89 will be the PR where the evolution of the controller will be placed at. Once all goals has been achieved, we will merge and release it as 0.2.0.


To summarize its goals:

  • [x] Be flexible and extensible: allow authors to customize it or even create their own controllers
  • [x] Control state: scale number, scale state (initial, covered or zooming), rotation factor and position (translate) of the image
  • [x] Provide a way to set the initial values for scale, rotation and position #79
  • [x] Expose the state values to be accessed and changed externally #49 #66
  • [x] Provide a reset method to make PhotoView go back to its initial values #67
  • [x] Be sensible to layout changes: if either PhotoView or the child size changes #70 #80
  • [x] Make the 'double tab' behavior customizable #69
  • [x] Keep the 'go back to initial scale' behavior implemented on #76
  • [x] Be externally listenable to value changes

All 4 comments

After Some work, the controller is starting to take form. #89 will be the PR where the evolution of the controller will be placed at. Once all goals has been achieved, we will merge and release it as 0.2.0.


To summarize its goals:

  • [x] Be flexible and extensible: allow authors to customize it or even create their own controllers
  • [x] Control state: scale number, scale state (initial, covered or zooming), rotation factor and position (translate) of the image
  • [x] Provide a way to set the initial values for scale, rotation and position #79
  • [x] Expose the state values to be accessed and changed externally #49 #66
  • [x] Provide a reset method to make PhotoView go back to its initial values #67
  • [x] Be sensible to layout changes: if either PhotoView or the child size changes #70 #80
  • [x] Make the 'double tab' behavior customizable #69
  • [x] Keep the 'go back to initial scale' behavior implemented on #76
  • [x] Be externally listenable to value changes

In order to set the next release small and let the controller with a specific concern (controlling state), we shall not include items "Customize the clamping position behavior #68" and "Customize the clamping scale behavior #85"

Merged, sorry for the absurd long time.

Just launched as 0.2.0

Was this page helpful?
0 / 5 - 0 ratings