This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class BodyPainter extends CustomPainter { | |
| final BuildContext context; | |
| final BodySelectorViewModel model; | |
| BodyPainter({ | |
| required this.context, | |
| required this.model, | |
| }); | |
| @override |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class BodyCanvas extends ViewModelWidget<BodySelectorViewModel> { | |
| @override | |
| Widget build(BuildContext context, BodySelectorViewModel model) { | |
| return CanvasTouchDetector( | |
| builder: (context) => CustomPaint( | |
| painter: BodyPainter( | |
| context: context, | |
| model: model, | |
| ), | |
| ), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Future<void> loadSvgImage({required bool back, required String svgImage}) async { | |
| String generalString = await rootBundle.loadString(svgImage); | |
| XmlDocument document = XmlDocument.parse(generalString); | |
| final paths = document.findAllElements('path'); | |
| paths.forEach((element) { | |
| String partName = element.getAttribute('id').toString(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:injectable/injectable.dart'; | |
| import 'package:porcupine/porcupine.dart'; | |
| import 'package:porcupine/porcupine_error.dart'; | |
| import 'package:porcupine/porcupine_manager.dart'; | |
| import 'package:speech_to_text/speech_recognition_result.dart'; | |
| import 'package:speech_to_text/speech_to_text.dart' as stt; | |
| import 'package:stacked/stacked.dart'; | |
| @singleton | |
| class SpeechService with ReactiveServiceMixin { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| PorcupineManager porcupineManager; | |
| /// Create an instance of your porcupineManager which will listen for the given wake words | |
| /// Must call start on the manager to actually start listening | |
| void createPorcupineManager() async { | |
| try{ | |
| porcupineManager = await PorcupineManager.fromKeywords( | |
| Porcupine.BUILT_IN_KEYWORDS, | |
| wakeWordCallback); | |
| } on PvError catch (err) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:desk_monkey/services/services.dart'; | |
| import 'package:stacked/stacked.dart'; | |
| class SingleCommandViewModel extends BaseViewModel{ | |
| String recognizedWords = ''; | |
| void initialize(){ | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:flutter/material.dart'; | |
| import 'package:stacked/stacked.dart'; | |
| import 'single_command_view_model.dart'; | |
| class SingleCommandView extends StatelessWidget { | |
| @override | |
| Widget build(BuildContext context) { | |
| return ViewModelBuilder<SingleCommandViewModel>.reactive( | |
| viewModelBuilder: () => SingleCommandViewModel(), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:injectable/injectable.dart'; | |
| import 'package:speech_to_text/speech_recognition_result.dart'; | |
| import 'package:speech_to_text/speech_to_text.dart' as stt; | |
| @singleton | |
| class SpeechService{ | |
| bool speechAvailable = false; | |
| stt.SpeechToText speech = stt.SpeechToText(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Uint8List pic; | |
| Future<void> readPic() async { | |
| AtKey atKey = AtKey(); | |
| atKey.key = 'pic'; | |
| // Get keys shared by the other sign | |
| if (!mine) { | |
| atKey.sharedBy = AtConstants().atMap[atProtocolService.currentAtSign]; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Future<void> sendImage() async { | |
| AtKey atKey = AtKey(); | |
| atKey.key = 'pic'; | |
| /// Share with the other sign | |
| if (shareWith) { | |
| atKey.sharedWith = AtConstants().atMap[atProtocolService.currentAtSign]; | |
| } | |
| String encodedImage = Base2e15.encode( |