Skip to content
This repository has been archived by the owner on Jul 6, 2020. It is now read-only.

Commit

Permalink
add initialScale
Browse files Browse the repository at this point in the history
  • Loading branch information
mchome committed Apr 13, 2019
1 parent 33ec21b commit 35524de
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/src/zoomable_widget.dart
Expand Up @@ -9,6 +9,7 @@ class ZoomableWidget extends StatefulWidget {
Key key,
this.minScale: 0.7,
this.maxScale: 1.4,
this.initialScale: 1.0,
this.enableZoom: true,
this.panLimit: 1.0,
this.singleFingerPan: true,
Expand All @@ -26,6 +27,7 @@ class ZoomableWidget extends StatefulWidget {
this.resetCurve: Curves.easeInOut,
}) : assert(minScale != null),
assert(maxScale != null),
assert(initialScale != null),
assert(enableZoom != null),
assert(panLimit != null),
assert(singleFingerPan != null),
Expand All @@ -43,6 +45,9 @@ class ZoomableWidget extends StatefulWidget {
/// The maximum size for scaling.
final double maxScale;

/// The initial scale.
final double initialScale;

/// Allow zooming the child widget.
final bool enableZoom;

Expand Down Expand Up @@ -109,6 +114,12 @@ class _ZoomableWidgetState extends State<ZoomableWidget> {
Duration _duration = const Duration(milliseconds: 100);
Curve _curve = Curves.easeOut;

@override
void initState() {
super.initState();
_zoom = widget.initialScale;
}

void _onScaleStart(ScaleStartDetails details) {
if (_childSize == Size.zero) {
final RenderBox renderbox = _key.currentContext.findRenderObject();
Expand Down

0 comments on commit 35524de

Please sign in to comment.