@@ -43,10 +43,22 @@ class PassiveCanvasTransformer extends NodeWidgetTransformer<CanvasNode> {
43
43
settings: settings)
44
44
: null );
45
45
46
+ if (node.isScrollable) {
47
+ body = SingleChildScrollView (
48
+ scrollDirection: node.scrollDirection.flutterAxis,
49
+ reverse: node.reverse,
50
+ primary: node.primary,
51
+ physics: node.physics.flutterScrollPhysics,
52
+ keyboardDismissBehavior:
53
+ node.keyboardDismissBehavior.flutterKeyboardDismissBehavior,
54
+ child: body,
55
+ );
56
+ }
57
+
46
58
if (node.scaleMode == ScaleMode .autoScale) {
47
59
final double screenWidth = MediaQuery .of (context).size.width;
48
- final double screenHeight = MediaQuery .of (context).size.height;
49
60
final double canvasWidth = node.outerBoxLocal.width;
61
+ final double canvasHeight = node.outerBoxLocal.height;
50
62
final double viewRatio = screenWidth / canvasWidth;
51
63
52
64
// If the width of this canvas is smaller than the viewport's size,
@@ -57,24 +69,12 @@ class PassiveCanvasTransformer extends NodeWidgetTransformer<CanvasNode> {
57
69
alignment: Alignment .topCenter,
58
70
child: SizedBox (
59
71
width: viewRatio < 1 ? canvasWidth : screenWidth,
60
- height: screenHeight ,
72
+ height: canvasHeight ,
61
73
child: body,
62
74
),
63
75
);
64
76
}
65
77
66
- if (node.isScrollable) {
67
- body = SingleChildScrollView (
68
- scrollDirection: node.scrollDirection.flutterAxis,
69
- reverse: node.reverse,
70
- primary: node.primary,
71
- physics: node.physics.flutterScrollPhysics,
72
- keyboardDismissBehavior:
73
- node.keyboardDismissBehavior.flutterKeyboardDismissBehavior,
74
- child: body,
75
- );
76
- }
77
-
78
78
final bool needsAScaffold = appBar != null ||
79
79
floatingActionButton != null ||
80
80
bottomNavigationBar != null ;
0 commit comments