use hidden textfield to capture input
This commit is contained in:
parent
25b2f52462
commit
f6f7e1ead1
@ -138,8 +138,8 @@ class ImageModel with ChangeNotifier {
|
|||||||
class CursorModel with ChangeNotifier {
|
class CursorModel with ChangeNotifier {
|
||||||
ui.Image _image;
|
ui.Image _image;
|
||||||
final _images = Map<int, ui.Image>();
|
final _images = Map<int, ui.Image>();
|
||||||
double _x = 0;
|
double _x = -10000;
|
||||||
double _y = 0;
|
double _y = -10000;
|
||||||
double _hotx = 0;
|
double _hotx = 0;
|
||||||
double _hoty = 0;
|
double _hoty = 0;
|
||||||
double _displayOriginX = 0;
|
double _displayOriginX = 0;
|
||||||
@ -189,6 +189,8 @@ class CursorModel with ChangeNotifier {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void clear() {
|
void clear() {
|
||||||
|
_x = -10000;
|
||||||
|
_x = -10000;
|
||||||
_image = null;
|
_image = null;
|
||||||
_images.clear();
|
_images.clear();
|
||||||
}
|
}
|
||||||
|
@ -85,132 +85,144 @@ class _RemotePageState extends State<RemotePage> {
|
|||||||
// Size size = MediaQueryData.fromWindow(ui.window).size;
|
// Size size = MediaQueryData.fromWindow(ui.window).size;
|
||||||
// MediaQuery.of(context).size.height;
|
// MediaQuery.of(context).size.height;
|
||||||
EasyLoading.instance.loadingStyle = EasyLoadingStyle.light;
|
EasyLoading.instance.loadingStyle = EasyLoadingStyle.light;
|
||||||
return RawKeyboardListener(
|
return WillPopScope(
|
||||||
focusNode: _focusNode,
|
onWillPop: () async {
|
||||||
onKey: _handleKeyEvent,
|
close();
|
||||||
child: WillPopScope(
|
return false;
|
||||||
onWillPop: () async {
|
},
|
||||||
close();
|
child: Scaffold(
|
||||||
return false;
|
floatingActionButton: _showBar
|
||||||
},
|
? null
|
||||||
child: Scaffold(
|
: FloatingActionButton(
|
||||||
floatingActionButton: _showBar
|
mini: true,
|
||||||
? null
|
child: Icon(Icons.expand_less),
|
||||||
: FloatingActionButton(
|
backgroundColor: MyTheme.accent50,
|
||||||
mini: true,
|
onPressed: () {
|
||||||
child: Icon(Icons.expand_less),
|
setState(() => _showBar = !_showBar);
|
||||||
backgroundColor: MyTheme.accent50,
|
}),
|
||||||
onPressed: () {
|
bottomNavigationBar: _showBar
|
||||||
setState(() => _showBar = !_showBar);
|
? BottomAppBar(
|
||||||
}),
|
elevation: 10,
|
||||||
bottomNavigationBar: _showBar
|
color: MyTheme.accent,
|
||||||
? BottomAppBar(
|
child: Row(
|
||||||
elevation: 10,
|
mainAxisSize: MainAxisSize.max,
|
||||||
color: MyTheme.accent,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
child: Row(
|
children: <Widget>[
|
||||||
mainAxisSize: MainAxisSize.max,
|
Row(children: [
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
IconButton(
|
||||||
children: <Widget>[
|
color: Colors.white,
|
||||||
Row(children: [
|
icon: Icon(Icons.clear),
|
||||||
IconButton(
|
onPressed: () {
|
||||||
|
close();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
IconButton(
|
||||||
|
color: Colors.white,
|
||||||
|
icon: Icon(Icons.keyboard),
|
||||||
|
onPressed: () {
|
||||||
|
SystemChrome.setEnabledSystemUIOverlays(
|
||||||
|
SystemUiOverlay.values);
|
||||||
|
_focusNode.requestFocus();
|
||||||
|
SystemChannels.textInput
|
||||||
|
.invokeMethod('TextInput.show');
|
||||||
|
}),
|
||||||
|
Transform.rotate(
|
||||||
|
angle: 15 * math.pi / 180,
|
||||||
|
child: IconButton(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
icon: Icon(Icons.clear),
|
icon: Icon(Icons.flash_on),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
close();
|
showActions(context);
|
||||||
},
|
},
|
||||||
),
|
)),
|
||||||
IconButton(
|
IconButton(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
icon: Icon(Icons.keyboard),
|
icon: Icon(Icons.tv),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
SystemChrome.setEnabledSystemUIOverlays(
|
showOptions(context);
|
||||||
SystemUiOverlay.values);
|
},
|
||||||
SystemChannels.textInput
|
),
|
||||||
.invokeMethod('TextInput.show');
|
Container(
|
||||||
_focusNode.requestFocus();
|
color: _pan ? Colors.blue[500] : null,
|
||||||
}),
|
child: IconButton(
|
||||||
Transform.rotate(
|
|
||||||
angle: 15 * math.pi / 180,
|
|
||||||
child: IconButton(
|
|
||||||
color: Colors.white,
|
|
||||||
icon: Icon(Icons.flash_on),
|
|
||||||
onPressed: () {
|
|
||||||
showActions(context);
|
|
||||||
},
|
|
||||||
)),
|
|
||||||
IconButton(
|
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
icon: Icon(Icons.tv),
|
icon: Icon(Icons.pan_tool),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
showOptions(context);
|
setState(() => _pan = !_pan);
|
||||||
},
|
},
|
||||||
),
|
))
|
||||||
Container(
|
]),
|
||||||
color: _pan ? Colors.blue[500] : null,
|
IconButton(
|
||||||
child: IconButton(
|
color: Colors.white,
|
||||||
color: Colors.white,
|
icon: Icon(Icons.expand_more),
|
||||||
icon: Icon(Icons.pan_tool),
|
onPressed: () {
|
||||||
onPressed: () {
|
setState(() => _showBar = !_showBar);
|
||||||
setState(() => _pan = !_pan);
|
}),
|
||||||
},
|
],
|
||||||
))
|
),
|
||||||
]),
|
)
|
||||||
IconButton(
|
: null,
|
||||||
color: Colors.white,
|
body: FlutterEasyLoading(
|
||||||
icon: Icon(Icons.expand_more),
|
child: Container(
|
||||||
onPressed: () {
|
color: MyTheme.canvasColor,
|
||||||
setState(() => _showBar = !_showBar);
|
child: RawGestureDetector(
|
||||||
}),
|
gestures: {
|
||||||
],
|
MultiTouchGestureRecognizer:
|
||||||
),
|
GestureRecognizerFactoryWithHandlers<
|
||||||
)
|
MultiTouchGestureRecognizer>(
|
||||||
: null,
|
() => MultiTouchGestureRecognizer(),
|
||||||
body: FlutterEasyLoading(
|
(MultiTouchGestureRecognizer instance) {
|
||||||
child: Container(
|
instance.onMultiTap = (
|
||||||
color: MyTheme.canvasColor,
|
touchCount,
|
||||||
child: RawGestureDetector(
|
addOrRemove,
|
||||||
gestures: {
|
) =>
|
||||||
MultiTouchGestureRecognizer:
|
print('$touchCount, $addOrRemove');
|
||||||
GestureRecognizerFactoryWithHandlers<
|
|
||||||
MultiTouchGestureRecognizer>(
|
|
||||||
() => MultiTouchGestureRecognizer(),
|
|
||||||
(MultiTouchGestureRecognizer instance) {
|
|
||||||
instance.onMultiTap = (
|
|
||||||
touchCount,
|
|
||||||
addOrRemove,
|
|
||||||
) =>
|
|
||||||
print('$touchCount, $addOrRemove');
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
child: GestureDetector(
|
),
|
||||||
onTap: () {
|
},
|
||||||
if (_pan) return;
|
child: GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
if (_pan) return;
|
||||||
|
},
|
||||||
|
onDoubleTap: () {
|
||||||
|
if (_pan) return;
|
||||||
|
},
|
||||||
|
onLongPress: () {
|
||||||
|
if (_pan) return;
|
||||||
|
},
|
||||||
|
child: InteractiveViewer(
|
||||||
|
constrained: false,
|
||||||
|
panEnabled: _pan,
|
||||||
|
onInteractionUpdate: (details) {
|
||||||
|
// print('$details');
|
||||||
},
|
},
|
||||||
onDoubleTap: () {
|
onInteractionStart: (s) {
|
||||||
if (_pan) return;
|
print('$s');
|
||||||
},
|
},
|
||||||
onLongPress: () {
|
onInteractionEnd: (x) {
|
||||||
if (_pan) return;
|
print('$x');
|
||||||
},
|
},
|
||||||
child: InteractiveViewer(
|
child: Stack(children: [
|
||||||
constrained: false,
|
ImagePaint(),
|
||||||
panEnabled: _pan,
|
CursorPaint(),
|
||||||
onInteractionUpdate: (details) {
|
SizedBox(
|
||||||
// print('$details');
|
width: 0,
|
||||||
},
|
height: 0,
|
||||||
onInteractionStart: (s) {
|
child: _bottom < 100
|
||||||
print('$s');
|
? Container()
|
||||||
},
|
: TextFormField(
|
||||||
onInteractionEnd: (x) {
|
textInputAction: TextInputAction.newline,
|
||||||
print('$x');
|
autocorrect: false,
|
||||||
},
|
enableSuggestions: false,
|
||||||
child: Stack(children: [
|
focusNode: _focusNode,
|
||||||
ImagePaint(),
|
maxLines: null,
|
||||||
CursorPaint(),
|
keyboardType: TextInputType.multiline,
|
||||||
])),
|
onChanged: (x) => print('$x'),
|
||||||
)),
|
),
|
||||||
)))));
|
),
|
||||||
|
])),
|
||||||
|
)),
|
||||||
|
))));
|
||||||
}
|
}
|
||||||
|
|
||||||
void close() {
|
void close() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user