Skip to content

Commit

Permalink
add something
Browse files Browse the repository at this point in the history
  • Loading branch information
TravisRoad committed Jun 9, 2021
1 parent 21fbde9 commit d7ad05f
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 3 deletions.
1 change: 1 addition & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.chwazi">
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.INTERNET" />
<application
android:label="chwazi"
android:icon="@mipmap/ic_launcher">
Expand Down
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
buildscript {
ext.kotlin_version = '1.3.50'
ext.kotlin_version = '1.5.10'
repositories {
google()
jcenter()
Expand Down
11 changes: 11 additions & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'eventBus.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'util.dart';
import 'package:flutter/services.dart';
import 'package:audioplayers/audioplayers.dart';

void main() {
runApp(new MaterialApp(
Expand All @@ -28,6 +29,8 @@ class _MyAppstate extends State<MyApp> with WidgetsBindingObserver {
Status _status = Status.waiting;
Mode _mode = Mode.select;

late AudioCache audioPlayer;

@override
Widget build(BuildContext context) {
return new Scaffold(
Expand Down Expand Up @@ -117,6 +120,7 @@ class _MyAppstate extends State<MyApp> with WidgetsBindingObserver {
setState(() {
_getTargetNum();
});
audioPlayer = AudioCache();
super.initState();
}

Expand Down Expand Up @@ -273,6 +277,8 @@ class _MyAppstate extends State<MyApp> with WidgetsBindingObserver {
HapticFeedback.heavyImpact();
HapticFeedback.lightImpact();

playLocal();

switch (_status) {
case Status.waiting:
_addShape(event);
Expand Down Expand Up @@ -305,4 +311,9 @@ class _MyAppstate extends State<MyApp> with WidgetsBindingObserver {
break;
}
}

playLocal() async {
print("play");
await audioPlayer.play("user_1.mp3");
}
}
56 changes: 56 additions & 0 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.6.1"
audioplayers:
dependency: "direct main"
description:
name: audioplayers
url: "https://pub.dartlang.org"
source: hosted
version: "0.19.0"
boolean_selector:
dependency: transitive
description:
Expand Down Expand Up @@ -43,6 +50,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.15.0"
crypto:
dependency: transitive
description:
name: crypto
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.1"
cupertino_icons:
dependency: "direct main"
description:
Expand Down Expand Up @@ -86,6 +100,20 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
http:
dependency: transitive
description:
name: http
url: "https://pub.dartlang.org"
source: hosted
version: "0.13.3"
http_parser:
dependency: transitive
description:
name: http_parser
url: "https://pub.dartlang.org"
source: hosted
version: "4.0.0"
js:
dependency: transitive
description:
Expand Down Expand Up @@ -114,13 +142,27 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0"
path_provider:
dependency: transitive
description:
name: path_provider
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.2"
path_provider_linux:
dependency: transitive
description:
name: path_provider_linux
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
path_provider_macos:
dependency: transitive
description:
name: path_provider_macos
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
path_provider_platform_interface:
dependency: transitive
description:
Expand All @@ -135,6 +177,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
pedantic:
dependency: transitive
description:
name: pedantic
url: "https://pub.dartlang.org"
source: hosted
version: "1.11.0"
platform:
dependency: transitive
description:
Expand Down Expand Up @@ -252,6 +301,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
uuid:
dependency: transitive
description:
name: uuid
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.4"
vector_math:
dependency: transitive
description:
Expand Down
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ dependencies:
sdk: flutter
shared_preferences: ^2.0.6
vibration: ^1.7.4-nullsafety.0
# audioplayers: ^0.19.0
audioplayers: ^0.19.0
# audioplayer: 0.8.1
# audioplayer_web: 0.7.1

Expand All @@ -49,7 +49,7 @@ flutter:
# the material Icons class.
uses-material-design: true
assets:
- assets/raw/user_1.mp3
- assets/raw/

# To add assets to your application, add an assets section, like this:
# assets:
Expand Down

0 comments on commit d7ad05f

Please sign in to comment.