|
1 | 1 | import 'package:flutter/material.dart';
|
2 | 2 | import 'package:flutter_unity_widget/flutter_unity_widget.dart';
|
| 3 | +import 'package:pointer_interceptor/pointer_interceptor.dart'; |
3 | 4 |
|
4 | 5 | class ApiScreen extends StatefulWidget {
|
5 | 6 | ApiScreen({Key key}) : super(key: key);
|
@@ -47,88 +48,90 @@ class _ApiScreenState extends State<ApiScreen> {
|
47 | 48 | webUrl: 'http://localhost:6080',
|
48 | 49 | ),
|
49 | 50 | ),
|
50 |
| - Positioned( |
51 |
| - bottom: 20, |
52 |
| - left: 20, |
53 |
| - right: 20, |
54 |
| - child: Card( |
55 |
| - elevation: 10, |
56 |
| - child: Column( |
57 |
| - mainAxisSize: MainAxisSize.min, |
58 |
| - children: <Widget>[ |
59 |
| - Padding( |
60 |
| - padding: const EdgeInsets.only(top: 20), |
61 |
| - child: Text("Rotation speed:"), |
62 |
| - ), |
63 |
| - Slider( |
64 |
| - onChanged: (value) { |
65 |
| - setState(() { |
66 |
| - _sliderValue = value; |
67 |
| - }); |
68 |
| - setRotationSpeed(value.toString()); |
69 |
| - }, |
70 |
| - value: _sliderValue, |
71 |
| - min: 0, |
72 |
| - max: 20, |
73 |
| - ), |
74 |
| - FittedBox( |
75 |
| - child: Row( |
76 |
| - mainAxisAlignment: MainAxisAlignment.spaceBetween, |
77 |
| - children: [ |
78 |
| - MaterialButton( |
79 |
| - onPressed: () { |
80 |
| - _unityWidgetController.quit(); |
81 |
| - }, |
82 |
| - child: Text("Quit"), |
83 |
| - ), |
84 |
| - MaterialButton( |
85 |
| - onPressed: () { |
86 |
| - _unityWidgetController.create(); |
87 |
| - }, |
88 |
| - child: Text("Create"), |
89 |
| - ), |
90 |
| - MaterialButton( |
91 |
| - onPressed: () { |
92 |
| - _unityWidgetController.pause(); |
93 |
| - }, |
94 |
| - child: Text("Pause"), |
95 |
| - ), |
96 |
| - MaterialButton( |
97 |
| - onPressed: () { |
98 |
| - _unityWidgetController.resume(); |
99 |
| - }, |
100 |
| - child: Text("Resume"), |
101 |
| - ), |
102 |
| - ], |
| 51 | + PointerInterceptor( |
| 52 | + child: Positioned( |
| 53 | + bottom: 20, |
| 54 | + left: 20, |
| 55 | + right: 20, |
| 56 | + child: Card( |
| 57 | + elevation: 10, |
| 58 | + child: Column( |
| 59 | + mainAxisSize: MainAxisSize.min, |
| 60 | + children: <Widget>[ |
| 61 | + Padding( |
| 62 | + padding: const EdgeInsets.only(top: 20), |
| 63 | + child: Text("Rotation speed:"), |
103 | 64 | ),
|
104 |
| - ), |
105 |
| - FittedBox( |
106 |
| - child: Row( |
107 |
| - mainAxisAlignment: MainAxisAlignment.spaceBetween, |
108 |
| - children: [ |
109 |
| - MaterialButton( |
110 |
| - onPressed: () async { |
111 |
| - await _unityWidgetController |
112 |
| - .openInNativeProcess(); |
113 |
| - }, |
114 |
| - child: Text("Open Native"), |
115 |
| - ), |
116 |
| - MaterialButton( |
117 |
| - onPressed: () { |
118 |
| - _unityWidgetController.unload(); |
119 |
| - }, |
120 |
| - child: Text("Unload"), |
121 |
| - ), |
122 |
| - MaterialButton( |
123 |
| - onPressed: () { |
124 |
| - _unityWidgetController.quit(); |
125 |
| - }, |
126 |
| - child: Text("Silent Quit"), |
127 |
| - ), |
128 |
| - ], |
| 65 | + Slider( |
| 66 | + onChanged: (value) { |
| 67 | + setState(() { |
| 68 | + _sliderValue = value; |
| 69 | + }); |
| 70 | + setRotationSpeed(value.toString()); |
| 71 | + }, |
| 72 | + value: _sliderValue, |
| 73 | + min: 0, |
| 74 | + max: 20, |
129 | 75 | ),
|
130 |
| - ), |
131 |
| - ], |
| 76 | + FittedBox( |
| 77 | + child: Row( |
| 78 | + mainAxisAlignment: MainAxisAlignment.spaceBetween, |
| 79 | + children: [ |
| 80 | + MaterialButton( |
| 81 | + onPressed: () { |
| 82 | + _unityWidgetController.quit(); |
| 83 | + }, |
| 84 | + child: Text("Quit"), |
| 85 | + ), |
| 86 | + MaterialButton( |
| 87 | + onPressed: () { |
| 88 | + _unityWidgetController.create(); |
| 89 | + }, |
| 90 | + child: Text("Create"), |
| 91 | + ), |
| 92 | + MaterialButton( |
| 93 | + onPressed: () { |
| 94 | + _unityWidgetController.pause(); |
| 95 | + }, |
| 96 | + child: Text("Pause"), |
| 97 | + ), |
| 98 | + MaterialButton( |
| 99 | + onPressed: () { |
| 100 | + _unityWidgetController.resume(); |
| 101 | + }, |
| 102 | + child: Text("Resume"), |
| 103 | + ), |
| 104 | + ], |
| 105 | + ), |
| 106 | + ), |
| 107 | + FittedBox( |
| 108 | + child: Row( |
| 109 | + mainAxisAlignment: MainAxisAlignment.spaceBetween, |
| 110 | + children: [ |
| 111 | + MaterialButton( |
| 112 | + onPressed: () async { |
| 113 | + await _unityWidgetController |
| 114 | + .openInNativeProcess(); |
| 115 | + }, |
| 116 | + child: Text("Open Native"), |
| 117 | + ), |
| 118 | + MaterialButton( |
| 119 | + onPressed: () { |
| 120 | + _unityWidgetController.unload(); |
| 121 | + }, |
| 122 | + child: Text("Unload"), |
| 123 | + ), |
| 124 | + MaterialButton( |
| 125 | + onPressed: () { |
| 126 | + _unityWidgetController.quit(); |
| 127 | + }, |
| 128 | + child: Text("Silent Quit"), |
| 129 | + ), |
| 130 | + ], |
| 131 | + ), |
| 132 | + ), |
| 133 | + ], |
| 134 | + ), |
132 | 135 | ),
|
133 | 136 | ),
|
134 | 137 | ),
|
|
0 commit comments