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
| @injectable | |
| class MediaService { | |
| final picker = ImagePicker(); | |
| /// Select an image from the user's device | |
| Future<File> selectImage({ImageSource source = ImageSource.gallery}) async { | |
| final pickedFile = await picker.getImage(source: source); | |
| if(pickedFile!= null) { | |
| return File(pickedFile.path); |
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> incrementCounter(String key) async { | |
| AtKey atKey = AtKey(); | |
| atKey.key = key; | |
| /// Share with the other sign | |
| if(shareWith) { | |
| atKey.sharedWith = AtConstants().atMap[atProtocolService.currentAtSign]; | |
| } | |
| counter++; |
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> initialize() async { | |
| String privateKey = await atProtocolService.getPrivateKey(atProtocolService.currentAtSign); | |
| try { | |
| atProtocolService.atClientImpl.startMonitor(privateKey, printResult); | |
| } on ConnectionInvalidException catch (e){ | |
| print('connection error: '+ e.toString()); | |
| } | |
| } | |
| Future<void> printResult(String val) async { |
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
| /// Create an AtClient (AtClientImpl) to communicate with the person's | |
| /// secondary server | |
| Future<bool> onboard({String atsign}) async { | |
| atClientImpl = null; | |
| atClientService = AtClientService(); | |
| Directory downloadDirectory; | |
| /// The directory where keys will be stored | |
| if (Platform.isIOS) { | |
| downloadDirectory = |
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 'dart:io'; | |
| import 'package:at_client_mobile/at_client_mobile.dart'; | |
| import 'package:at_commons/at_commons.dart'; | |
| import 'package:at_list/app/at_constants.dart'; | |
| import 'package:at_list/app/router.gr.dart'; | |
| import 'package:auto_route/auto_route.dart'; | |
| import 'package:flutter/cupertino.dart'; | |
| import 'package:injectable/injectable.dart'; | |
| import 'package:path_provider/path_provider.dart' as path_provider; |
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:image/image.dart'; | |
| import 'package:tflite_flutter/tflite_flutter.dart'; | |
| import 'package:tflite_flutter_helper/src/image/tensor_image.dart'; | |
| import 'package:tflite_flutter_helper/src/tensorbuffer/tensorbuffer.dart'; | |
| import 'dart:typed_data'; | |
| /// Implements some stateless image conversion methods. | |
| /// | |
| /// This class is an internal helper. | |
| class ImageConversion { |
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 VideoTimeElapsed extends ViewModelWidget<StackedVideoViewModel> { | |
| @override | |
| Widget build(BuildContext context, StackedVideoViewModel model) { | |
| return Container( | |
| padding: EdgeInsets.only(bottom: 8, left: 8), | |
| height: model.thumbnailHeight, | |
| width: model.thumbnailWidth, | |
| child: Align( | |
| alignment: Alignment.bottomLeft, | |
| child: Container( |
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 VideoTimeRemaining extends ViewModelWidget<StackedVideoViewModel> { | |
| @override | |
| Widget build(BuildContext context, StackedVideoViewModel model) { | |
| return Container( | |
| padding: EdgeInsets.only(bottom: 8, right: 8), | |
| height: model.thumbnailHeight, | |
| width: model.thumbnailWidth, | |
| child: Align( | |
| alignment: Alignment.bottomRight, | |
| child: Container( |
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
| /// (1) Use the WidgetsBindingObserver to get the VideoThumbnail's size | |
| /// after it is laid out | |
| class VideoThumbnail extends ViewModelWidget<StackedVideoViewModel> with WidgetsBindingObserver{ | |
| @override | |
| Widget build(BuildContext context, StackedVideoViewModel model) { | |
| /// (3) Get the size of the widget after it is rendered on screen | |
| WidgetsBinding.instance | |
| .addPostFrameCallback((_) { |
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 StackedVideoViewModel extends BaseViewModel { | |
| // Input Properties | |
| VideoPlayerController videoPlayerController; | |
| bool showFull; | |
| double x; // X alignment of FittedBox | |
| double y; // Y alignment of FittedBox | |
| // Local Properties | |
| bool gotThumbnailSize = false; |