parent
56c7262ba3
commit
fbbbffe7af
@ -0,0 +1,4 @@
|
||||
root = true
|
||||
|
||||
[*.dart]
|
||||
max_line_length = 120
|
@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
# Downloads WASM locally and use local fonts
|
||||
# Temporary solution until https://github.com/flutter/flutter/issues/70101 and 77580 provide a better way
|
||||
flutter clean
|
||||
flutter build web
|
||||
wasmLocation=$(grep canvaskit-wasm build/web/main.dart.js | sed -e 's/.*https/https/' -e 's/\/bin.*/\/bin/' | uniq)
|
||||
echo "Downloading WASM from $wasmLocation"
|
||||
curl -o build/web/canvaskit.js "$wasmLocation/canvaskit.js"
|
||||
curl -o build/web/canvaskit.wasm "$wasmLocation/canvaskit.wasm"
|
||||
sed -i -e "s!$wasmLocation!.!" \
|
||||
-e "s!https://fonts.gstatic.com/s/roboto/v20/KFOmCnqEu92Fr1Me5WZLCzYlKw.ttf!./assets/packages/amos_mobile_widgets/assets/google_fonts/Roboto-Regular.ttf!" \
|
||||
-e "s!https://fonts.googleapis.com/css2?family=Noto+Sans+Symbols!./assets/assets/css/Noto-Sans-Symbols.css!" \
|
||||
-e "s!https://fonts.googleapis.com/css2?family=Noto+Color+Emoji+Compat!./assets/assets/css/Noto-Color-Emoji-Compat.css!" \
|
||||
build/web/main.dart.js
|
@ -0,0 +1,90 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:dde_gesture_manager/builder/provider_annotation.dart';
|
||||
import 'package:dde_gesture_manager/utils/helper.dart';
|
||||
|
||||
@ProviderModel()
|
||||
class Solution {
|
||||
@ProviderModelProp()
|
||||
String? name;
|
||||
|
||||
@ProviderModelProp()
|
||||
String? description;
|
||||
|
||||
@ProviderModelProp()
|
||||
List<GestureProp>? gestures;
|
||||
|
||||
Solution.parse(solution) {
|
||||
if (solution is String) solution = json.decode(solution);
|
||||
assert(solution is Map);
|
||||
name = solution['name'];
|
||||
description = solution['desc'];
|
||||
gestures = (solution['gestures'] as List? ?? []).map<GestureProp>((ele) => GestureProp.parse(ele)).toList();
|
||||
}
|
||||
}
|
||||
|
||||
enum Gesture {
|
||||
swipe,
|
||||
tap,
|
||||
pinch,
|
||||
}
|
||||
|
||||
enum GestureDirection {
|
||||
up,
|
||||
down,
|
||||
left,
|
||||
right,
|
||||
pinch_in,
|
||||
pinch_out,
|
||||
none,
|
||||
}
|
||||
|
||||
enum GestureType {
|
||||
built_in,
|
||||
commandline,
|
||||
shortcut,
|
||||
}
|
||||
|
||||
@ProviderModel()
|
||||
class GestureProp {
|
||||
@ProviderModelProp()
|
||||
Gesture? gesture;
|
||||
|
||||
@ProviderModelProp()
|
||||
GestureDirection? direction;
|
||||
|
||||
@ProviderModelProp()
|
||||
int? fingers;
|
||||
|
||||
@ProviderModelProp()
|
||||
GestureType? type;
|
||||
|
||||
@ProviderModelProp()
|
||||
String? command;
|
||||
|
||||
@ProviderModelProp()
|
||||
String? remark;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
other is GestureProp &&
|
||||
other.gesture == this.gesture &&
|
||||
other.direction == this.direction &&
|
||||
other.fingers == this.fingers;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'GestureProp{gesture: $gesture, direction: $direction, fingers: $fingers, type: $type, command: $command, remark: $remark}';
|
||||
}
|
||||
|
||||
GestureProp.parse(props) {
|
||||
if (props is String) props = json.decode(props);
|
||||
assert(props is Map);
|
||||
gesture = H.getGestureByName(props['gesture']);
|
||||
direction = H.getGestureDirectionByName(props['direction']);
|
||||
fingers = props['fingers'];
|
||||
type = H.getGestureTypeByName(props['type']);
|
||||
command = props['command'];
|
||||
remark = props['remark'];
|
||||
}
|
||||
}
|
Loading…
Reference in new issue