feat: add gesture prop logic.

This commit is contained in:
2021-11-12 18:57:34 +08:00
parent 1c6d50a4b6
commit 07b9464496
8 changed files with 222 additions and 22 deletions
+20 -6
View File
@@ -1,9 +1,10 @@
import 'package:dde_gesture_manager/constants/constants.dart';
import 'package:dde_gesture_manager/extensions.dart';
import 'package:dde_gesture_manager/models/content_layout.provider.dart';
import 'package:dde_gesture_manager/models/scheme.dart';
import 'package:flutter/cupertino.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:dde_gesture_manager/constants/constants.dart';
import 'package:dde_gesture_manager/extensions.dart';
import 'package:uuid/uuid.dart';
class H {
H._();
@@ -85,10 +86,10 @@ class H {
GestureDirection.none;
static String? getGestureTypeName(GestureType? type) => const {
GestureType.built_in: 'built_in',
GestureType.shortcut: 'shortcut',
GestureType.commandline: 'commandline',
}[type];
GestureType.built_in: 'built_in',
GestureType.shortcut: 'shortcut',
GestureType.commandline: 'commandline',
}[type];
static GestureType getGestureTypeByName(String typeName) =>
const {
@@ -105,6 +106,19 @@ class H {
var rgba = list.map<int>((e) => int.parse(e) ~/ 257).toList();
return Color.fromARGB(rgba[3], rgba[0], rgba[1], rgba[2]);
}
static GestureProp? getNextAvailableGestureProp(SchemeTree tree) {
tree.sout();
var gestureProp = GestureProp.empty()
..id = Uuid().v1()
..type = GestureType.built_in
..command = builtInCommands.first;
if (tree.fullFiled) return null;
gestureProp.fingers = tree.availableNode.fingers;
gestureProp.gesture = tree.availableNode.availableNode.type;
gestureProp.direction = tree.availableNode.availableNode.availableNode.direction;
return gestureProp;
}
}
class PreferredPanelsStatus {