Line data Source code
1 : import 'package:mvvm_builder/mvvm_builder.dart'; 2 : 3 : import 'user_fullscreen_helper.dart'; 4 : import 'user_fullscreen_helper_viewmodel.dart'; 5 : 6 : class UserFullScreenHelperPresenter extends Presenter<UserFullScreenHelperModel, UserFullScreenHelperView> { 7 : 8 1 : UserFullScreenHelperPresenter( 9 : UserFullScreenHelperView viewInterface, 10 2 : ) : super(UserFullScreenHelperModel(), viewInterface) { 11 2 : this.viewModel.helperOpacity = 0; 12 2 : this.viewModel.feedbackAnimation = false; 13 2 : this.viewModel.mediaAnimation = false; 14 2 : this.viewModel.titleAnimation = false; 15 2 : this.viewModel.isReversedAnimations = false; 16 : } 17 : 18 1 : @override 19 : void onInit() { 20 1 : startAnimations(); 21 : } 22 : 23 : 24 1 : startAnimations() async { 25 2 : this.viewModel.isReversedAnimations = false; 26 : // Fullscreen background opacity animation 27 4 : await Future.delayed(Duration(milliseconds: 1000), () { 28 2 : this.viewModel.helperOpacity = 1; 29 1 : this.refreshView(); 30 : }); 31 4 : await Future.delayed(Duration(milliseconds: 500), () { 32 2 : this.viewModel.mediaAnimation = true; 33 1 : this.refreshAnimations(); 34 : }); 35 4 : await Future.delayed(Duration(milliseconds: 200), () { 36 2 : this.viewModel.titleAnimation = true; 37 1 : this.refreshAnimations(); 38 : }); 39 4 : await Future.delayed(Duration(milliseconds: 100), () { 40 2 : this.viewModel.feedbackAnimation = true; 41 1 : this.refreshAnimations(); 42 : }); 43 : } 44 : 45 1 : reverseAnimations() async { 46 2 : this.viewModel.isReversedAnimations = true; 47 : 48 4 : await Future.delayed(Duration(milliseconds: 100), () { 49 2 : this.viewModel.feedbackAnimation = true; 50 1 : this.refreshAnimations(); 51 : }); 52 4 : await Future.delayed(Duration(milliseconds: 200), () { 53 2 : this.viewModel.titleAnimation = true; 54 2 : this.viewModel.mediaAnimation = true; 55 1 : this.refreshAnimations(); 56 : }); 57 4 : await Future.delayed(Duration(milliseconds: 1000), () { 58 2 : this.viewModel.helperOpacity = 0; 59 1 : this.refreshView(); 60 : }); 61 : 62 3 : await Future.delayed(Duration(milliseconds: 500)); 63 : } 64 : 65 1 : onTitleAnimationEnd() { 66 2 : this.viewModel.titleAnimation = false; 67 : } 68 : 69 1 : onMediaAnimationEnd() { 70 2 : this.viewModel.mediaAnimation = false; 71 : } 72 : 73 1 : onFeedbackAnimationEnd() { 74 2 : this.viewModel.feedbackAnimation = false; 75 : } 76 : 77 1 : onPositivButtonCallback() async { 78 2 : await this.reverseAnimations(); 79 2 : this.viewInterface.onPositivButtonCallback(); 80 : } 81 : 82 1 : onNegativButtonCallback() async { 83 2 : await this.reverseAnimations(); 84 2 : this.viewInterface.onNegativButtonCallback(); 85 : } 86 : }