lock and long press pop menu
This commit is contained in:
parent
8e529399c3
commit
8090726649
@ -9,6 +9,7 @@ import 'dart:math' as math;
|
||||
import 'package:tuple/tuple.dart';
|
||||
import 'common.dart';
|
||||
import 'model.dart';
|
||||
import 'package:wakelock/wakelock.dart';
|
||||
|
||||
class RemotePage extends StatefulWidget {
|
||||
RemotePage({Key key, this.id}) : super(key: key);
|
||||
@ -38,6 +39,7 @@ class _RemotePageState extends State<RemotePage> {
|
||||
_interval =
|
||||
Timer.periodic(Duration(milliseconds: 30), (timer) => interval());
|
||||
});
|
||||
Wakelock.enable();
|
||||
}
|
||||
|
||||
@override
|
||||
@ -48,6 +50,7 @@ class _RemotePageState extends State<RemotePage> {
|
||||
_interval.cancel();
|
||||
dismissLoading();
|
||||
SystemChrome.setEnabledSystemUIOverlays(SystemUiOverlay.values);
|
||||
Wakelock.disable();
|
||||
}
|
||||
|
||||
void interval() {
|
||||
@ -197,9 +200,29 @@ class _RemotePageState extends State<RemotePage> {
|
||||
LongPressGestureRecognizer>(
|
||||
() => LongPressGestureRecognizer(),
|
||||
(LongPressGestureRecognizer instance) {
|
||||
instance.onLongPress = () {
|
||||
print('long press');
|
||||
};
|
||||
var x = 0.0;
|
||||
var y = 0.0;
|
||||
instance
|
||||
..onLongPressStart = (details) {
|
||||
x = details.globalPosition.dx;
|
||||
y = details.globalPosition.dy;
|
||||
}
|
||||
..onLongPress = () {
|
||||
print('long press');
|
||||
() async {
|
||||
await showMenu(
|
||||
context: context,
|
||||
position: RelativeRect.fromLTRB(x, y, 0, 0),
|
||||
items: [
|
||||
PopupMenuItem<String>(
|
||||
child: const Text('Doge'), value: 'Doge'),
|
||||
PopupMenuItem<String>(
|
||||
child: const Text('Lion'), value: 'Lion'),
|
||||
],
|
||||
elevation: 8.0,
|
||||
);
|
||||
}();
|
||||
};
|
||||
},
|
||||
),
|
||||
PanGestureRecognizer:
|
||||
|
@ -43,6 +43,13 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.15.0-nullsafety.3"
|
||||
csslib:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: csslib
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.16.2"
|
||||
cupertino_icons:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@ -95,6 +102,25 @@ packages:
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
flutter_web_plugins:
|
||||
dependency: transitive
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
html:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: html
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.14.0+4"
|
||||
import_js_library:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: import_js_library
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.2"
|
||||
intl:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -102,6 +128,13 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.16.1"
|
||||
js:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: js
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.6.2"
|
||||
matcher:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -268,6 +301,27 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.0-nullsafety.3"
|
||||
wakelock:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: wakelock
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.2.1+1"
|
||||
wakelock_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: wakelock_platform_interface
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.1.0+1"
|
||||
wakelock_web:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: wakelock_web
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.1.0+3"
|
||||
win32:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -284,4 +338,4 @@ packages:
|
||||
version: "0.1.2"
|
||||
sdks:
|
||||
dart: ">=2.10.0-110 <2.11.0"
|
||||
flutter: ">=1.16.0 <2.0.0"
|
||||
flutter: ">=1.20.0 <2.0.0"
|
||||
|
@ -33,6 +33,7 @@ dependencies:
|
||||
provider: ^4.3.2+2
|
||||
flutter_easyloading: ^2.1.3
|
||||
tuple: ^1.0.1
|
||||
wakelock: ^0.2.1+1
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
Loading…
x
Reference in New Issue
Block a user