Skip to content

Commit

Permalink
Replace evolve.gif with Animation.
Browse files Browse the repository at this point in the history
  • Loading branch information
agent515 committed Oct 17, 2021
1 parent 5167bb1 commit eb1becd
Show file tree
Hide file tree
Showing 8 changed files with 162 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/
.vscode/

# Flutter/Dart/Pub related
**/doc/api/
Expand Down
28 changes: 28 additions & 0 deletions android/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>android</name>
<comment>Project android created by Buildship.</comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
</natures>
<filteredResources>
<filter>
<id>1633174926637</id>
<name></name>
<type>30</type>
<matcher>
<id>org.eclipse.core.resources.regexFilterMatcher</id>
<arguments>node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
</matcher>
</filter>
</filteredResources>
</projectDescription>
13 changes: 13 additions & 0 deletions android/.settings/org.eclipse.buildship.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
arguments=
auto.sync=false
build.scans.enabled=false
connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER)
connection.project.dir=
eclipse.preferences.version=1
gradle.user.home=
java.home=C\:/Program Files/Java/jdk-11.0.2
jvm.arguments=
offline.mode=false
override.workspace.settings=true
show.console.view=true
show.executions.view=true
6 changes: 6 additions & 0 deletions android/app/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11/"/>
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
<classpathentry kind="output" path="bin/default"/>
</classpath>
34 changes: 34 additions & 0 deletions android/app/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>app</name>
<comment>Project app created by Buildship.</comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
</natures>
<filteredResources>
<filter>
<id>1633174926653</id>
<name></name>
<type>30</type>
<matcher>
<id>org.eclipse.core.resources.regexFilterMatcher</id>
<arguments>node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
</matcher>
</filter>
</filteredResources>
</projectDescription>
2 changes: 2 additions & 0 deletions android/app/.settings/org.eclipse.buildship.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
connection.project.dir=..
eclipse.preferences.version=1
2 changes: 1 addition & 1 deletion assets/zanie.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
89 changes: 77 additions & 12 deletions lib/start.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import 'dart:async' show Future;
import 'dart:math';
// import 'package:external_app_launcher/external_app_launcher. dart';
import 'package:external_app_launcher/external_app_launcher.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:flutter_tts/flutter_tts.dart';
import 'package:speech_to_text_plugins/speech_to_text_plugins.dart';
import 'dart:io' show Platform;
Expand All @@ -18,7 +20,7 @@ class Start extends StatefulWidget {

enum TtsState { playing, stopped, paused, continued }

class _StartState extends State<Start> {
class _StartState extends State<Start> with TickerProviderStateMixin {
FlutterTts flutterTts = FlutterTts();

String language;
Expand All @@ -40,9 +42,28 @@ class _StartState extends State<Start> {
bool get isAndroid => !kIsWeb && Platform.isAndroid;
bool get isWeb => kIsWeb;

AnimationController _primaryAnimationController;
AnimationController _secondAnimationController;

@override
initState() {
super.initState();
_primaryAnimationController = AnimationController(
duration: const Duration(milliseconds: 1500),
vsync: this,
);
_secondAnimationController =
AnimationController(duration: const Duration(seconds: 2), vsync: this);
_primaryAnimationController.addStatusListener((status) {
if (_primaryAnimationController.isCompleted) {
_secondAnimationController.repeat(reverse: true);
} else if (_primaryAnimationController.isAnimating) {
_secondAnimationController.reset();
} else if (_primaryAnimationController.isDismissed) {
_secondAnimationController.reset();
}
});

initTts();
}

Expand Down Expand Up @@ -135,6 +156,8 @@ class _StartState extends State<Start> {
@override
void dispose() {
super.dispose();
_primaryAnimationController.dispose();
_secondAnimationController.dispose();
flutterTts.stop();
}

Expand Down Expand Up @@ -292,19 +315,61 @@ class _StartState extends State<Start> {
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Image.asset("$img", height: 200),
// Image.asset("$img", height: 200),
Container(
height: 200,
child: Align(
alignment: Alignment.bottomCenter,
child: AnimatedBuilder(
animation: _secondAnimationController,
builder: (context, child) {
return Transform.translate(
offset: Offset(
0,
_secondAnimationController.value * 25 - 25,
),
child: child,
);
},
child: AnimatedBuilder(
animation: CurvedAnimation(
parent: _primaryAnimationController,
curve: Curves.easeInOut),
builder: (context, child) {
return Transform.translate(
offset: Offset(
0,
1 /
tan(sin(_primaryAnimationController
.value)) *
25 +
-50),
child: Transform.scale(
scale:
_primaryAnimationController.value * 1.75,
child: child,
),
);
},
child: SvgPicture.asset(
"assets/zanie.svg",
),
),
),
),
),
MaterialButton(
onPressed: () {
setState(() {
img = "assets/evolve.gif";
b = 3;
});
Future.delayed(const Duration(milliseconds: 1300),
() {
setState(() {
img = "assets/logo.gif";
});
});
if (_primaryAnimationController.isAnimating) {
_primaryAnimationController.reset();
_primaryAnimationController.forward();
} else if (_primaryAnimationController.isCompleted) {
_primaryAnimationController.reset();
_primaryAnimationController.forward();
} else if (_primaryAnimationController.isDismissed) {
_primaryAnimationController.forward();
}

speechToTextPlugins.activate().then((onValue) {
print(onValue);
});
Expand Down

0 comments on commit eb1becd

Please sign in to comment.