This file contains 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 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 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 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 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 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 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; |
This file contains 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 VideoControlOverlay extends ViewModelWidget<StackedVideoViewModel> { | |
@override | |
Widget build(BuildContext context, StackedVideoViewModel model) { | |
return Container( | |
height: model.thumbnailHeight, | |
width: model.thumbnailWidth, | |
child: Stack( | |
children: <Widget>[ | |
AnimatedSwitcher( | |
duration: Duration(milliseconds: 50), |
This file contains 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 VideoThumbnail extends ViewModelWidget<StackedVideoViewModel> { | |
@override | |
Widget build(BuildContext context, StackedVideoViewModel model) { | |
return Builder( | |
builder: (context) { | |
// If we want to show the full video, we need to scale it to fit the longest side | |
if (model.showFull) { | |
bool wideVideo = | |
model.videoPlayerController.value.size.width > |
This file contains 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 StackedVideoView extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return ViewModelBuilder<StackedVideoViewModel>.reactive( | |
viewModelBuilder: () => StackedVideoViewModel(), | |
onModelReady: (model) { | |
model.initialize( | |
'https://www.learningcontainer.com/wp-content/uploads/2020/05/sample-mp4-file.mp4'); | |
}, | |
builder: (context, model, child) { |