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 'package:tuple/tuple.dart';
|
||||||
import 'common.dart';
|
import 'common.dart';
|
||||||
import 'model.dart';
|
import 'model.dart';
|
||||||
|
import 'package:wakelock/wakelock.dart';
|
||||||
|
|
||||||
class RemotePage extends StatefulWidget {
|
class RemotePage extends StatefulWidget {
|
||||||
RemotePage({Key key, this.id}) : super(key: key);
|
RemotePage({Key key, this.id}) : super(key: key);
|
||||||
@ -38,6 +39,7 @@ class _RemotePageState extends State<RemotePage> {
|
|||||||
_interval =
|
_interval =
|
||||||
Timer.periodic(Duration(milliseconds: 30), (timer) => interval());
|
Timer.periodic(Duration(milliseconds: 30), (timer) => interval());
|
||||||
});
|
});
|
||||||
|
Wakelock.enable();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -48,6 +50,7 @@ class _RemotePageState extends State<RemotePage> {
|
|||||||
_interval.cancel();
|
_interval.cancel();
|
||||||
dismissLoading();
|
dismissLoading();
|
||||||
SystemChrome.setEnabledSystemUIOverlays(SystemUiOverlay.values);
|
SystemChrome.setEnabledSystemUIOverlays(SystemUiOverlay.values);
|
||||||
|
Wakelock.disable();
|
||||||
}
|
}
|
||||||
|
|
||||||
void interval() {
|
void interval() {
|
||||||
@ -197,9 +200,29 @@ class _RemotePageState extends State<RemotePage> {
|
|||||||
LongPressGestureRecognizer>(
|
LongPressGestureRecognizer>(
|
||||||
() => LongPressGestureRecognizer(),
|
() => LongPressGestureRecognizer(),
|
||||||
(LongPressGestureRecognizer instance) {
|
(LongPressGestureRecognizer instance) {
|
||||||
instance.onLongPress = () {
|
var x = 0.0;
|
||||||
print('long press');
|
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:
|
PanGestureRecognizer:
|
||||||
|
@ -43,6 +43,13 @@ packages:
|
|||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.15.0-nullsafety.3"
|
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:
|
cupertino_icons:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
@ -95,6 +102,25 @@ packages:
|
|||||||
description: flutter
|
description: flutter
|
||||||
source: sdk
|
source: sdk
|
||||||
version: "0.0.0"
|
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:
|
intl:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -102,6 +128,13 @@ packages:
|
|||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.16.1"
|
version: "0.16.1"
|
||||||
|
js:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: js
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "0.6.2"
|
||||||
matcher:
|
matcher:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -268,6 +301,27 @@ packages:
|
|||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.0-nullsafety.3"
|
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:
|
win32:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -284,4 +338,4 @@ packages:
|
|||||||
version: "0.1.2"
|
version: "0.1.2"
|
||||||
sdks:
|
sdks:
|
||||||
dart: ">=2.10.0-110 <2.11.0"
|
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
|
provider: ^4.3.2+2
|
||||||
flutter_easyloading: ^2.1.3
|
flutter_easyloading: ^2.1.3
|
||||||
tuple: ^1.0.1
|
tuple: ^1.0.1
|
||||||
|
wakelock: ^0.2.1+1
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user