From 49d0ea72387f67fcc0005cb77aa56130366d4534 Mon Sep 17 00:00:00 2001
From: SachetVijay <81145614+SachetVijay@users.noreply.github.com>
Date: Fri, 24 Mar 2023 22:03:41 +0530
Subject: [PATCH 1/3] Update
---
ios/Flutter/AppFrameworkInfo.plist | 2 +-
ios/Flutter/Debug.xcconfig | 1 +
ios/Flutter/Release.xcconfig | 1 +
ios/Flutter/flutter_export_environment.sh | 9 ++++-----
ios/Runner.xcodeproj/project.pbxproj | 12 +++++++-----
.../xcshareddata/xcschemes/Runner.xcscheme | 2 +-
ios/Runner/Info.plist | 4 ++++
lib/main.dart | 5 ++++-
pubspec.yaml | 1 +
9 files changed, 24 insertions(+), 13 deletions(-)
diff --git a/ios/Flutter/AppFrameworkInfo.plist b/ios/Flutter/AppFrameworkInfo.plist
index 8d4492f9..9625e105 100644
--- a/ios/Flutter/AppFrameworkInfo.plist
+++ b/ios/Flutter/AppFrameworkInfo.plist
@@ -21,6 +21,6 @@
CFBundleVersion
1.0
MinimumOSVersion
- 9.0
+ 11.0
diff --git a/ios/Flutter/Debug.xcconfig b/ios/Flutter/Debug.xcconfig
index 592ceee8..ec97fc6f 100644
--- a/ios/Flutter/Debug.xcconfig
+++ b/ios/Flutter/Debug.xcconfig
@@ -1 +1,2 @@
+#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
#include "Generated.xcconfig"
diff --git a/ios/Flutter/Release.xcconfig b/ios/Flutter/Release.xcconfig
index 592ceee8..c4855bfe 100644
--- a/ios/Flutter/Release.xcconfig
+++ b/ios/Flutter/Release.xcconfig
@@ -1 +1,2 @@
+#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "Generated.xcconfig"
diff --git a/ios/Flutter/flutter_export_environment.sh b/ios/Flutter/flutter_export_environment.sh
index e6fed476..6f688900 100755
--- a/ios/Flutter/flutter_export_environment.sh
+++ b/ios/Flutter/flutter_export_environment.sh
@@ -1,14 +1,13 @@
#!/bin/sh
# This is a generated file; do not edit or check into version control.
-export "FLUTTER_ROOT=/Users/angelayu/Development/flutter"
-export "FLUTTER_APPLICATION_PATH=/Users/angelayu/AndroidStudioProjects/xylophone-flutter"
+export "FLUTTER_ROOT=/Users/sachet/flutter"
+export "FLUTTER_APPLICATION_PATH=/Users/sachet/AndroidStudioProjects/xylophone-flutter"
export "COCOAPODS_PARALLEL_CODE_SIGN=true"
-export "FLUTTER_TARGET=/Users/angelayu/AndroidStudioProjects/xylophone-flutter/lib/main.dart"
+export "FLUTTER_TARGET=lib/main.dart"
export "FLUTTER_BUILD_DIR=build"
export "FLUTTER_BUILD_NAME=1.0.0"
export "FLUTTER_BUILD_NUMBER=1"
-export "DART_DEFINES=Zmx1dHRlci5pbnNwZWN0b3Iuc3RydWN0dXJlZEVycm9ycz10cnVl,RkxVVFRFUl9XRUJfQVVUT19ERVRFQ1Q9dHJ1ZQ=="
export "DART_OBFUSCATION=false"
export "TRACK_WIDGET_CREATION=true"
export "TREE_SHAKE_ICONS=false"
-export "PACKAGE_CONFIG=/Users/angelayu/AndroidStudioProjects/xylophone-flutter/.dart_tool/package_config.json"
+export "PACKAGE_CONFIG=.dart_tool/package_config.json"
diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj
index 869f0c30..aef95578 100644
--- a/ios/Runner.xcodeproj/project.pbxproj
+++ b/ios/Runner.xcodeproj/project.pbxproj
@@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
- objectVersion = 46;
+ objectVersion = 54;
objects = {
/* Begin PBXBuildFile section */
@@ -144,7 +144,7 @@
97C146E61CF9000F007C117D /* Project object */ = {
isa = PBXProject;
attributes = {
- LastUpgradeCheck = 0910;
+ LastUpgradeCheck = 1300;
ORGANIZATIONNAME = "The Chromium Authors";
TargetAttributes = {
97C146ED1CF9000F007C117D = {
@@ -190,6 +190,7 @@
/* Begin PBXShellScriptBuildPhase section */
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
isa = PBXShellScriptBuildPhase;
+ alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
@@ -204,6 +205,7 @@
};
9740EEB61CF901F6004384FC /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
+ alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
@@ -291,7 +293,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 9.0;
+ IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
@@ -371,7 +373,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 9.0;
+ IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
@@ -418,7 +420,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 9.0;
+ IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
diff --git a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
index 786d6aad..f1560181 100644
--- a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
+++ b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
@@ -1,6 +1,6 @@
UIViewControllerBasedStatusBarAppearance
+ CADisableMinimumFrameDurationOnPhone
+
+ UIApplicationSupportsIndirectInputEvents
+
diff --git a/lib/main.dart b/lib/main.dart
index 28fea9ce..f92fedc3 100644
--- a/lib/main.dart
+++ b/lib/main.dart
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
+import 'package:audioplayers/src/audio_cache.dart';
void main() => runApp(XylophoneApp());
@@ -8,7 +9,9 @@ class XylophoneApp extends StatelessWidget {
return MaterialApp(
home: Scaffold(
body: SafeArea(
- child: Container(),
+ child: Center(
+ child: TextButton(onPressed: () {}, child: Text('Click Me')),
+ ),
),
),
);
diff --git a/pubspec.yaml b/pubspec.yaml
index 9e2eb33c..62767ae5 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -11,6 +11,7 @@ dependencies:
sdk: flutter
cupertino_icons: ^0.1.2
+ audioplayers: ^3.0.1
# Use Audioplayers dependency version 0.17.4
dev_dependencies:
From e4f6ddc34d4a545be9bf9393fb0bbb4e7a8ea90e Mon Sep 17 00:00:00 2001
From: SachetVijay <81145614+SachetVijay@users.noreply.github.com>
Date: Sat, 25 Mar 2023 23:42:04 +0530
Subject: [PATCH 2/3] Audio added
---
ios/Flutter/flutter_export_environment.sh | 5 +-
ios/Runner.xcodeproj/project.pbxproj | 84 ++++++++++++++++++-
.../contents.xcworkspacedata | 3 +
lib/main.dart | 56 ++++++++++++-
pubspec.yaml | 3 +-
5 files changed, 142 insertions(+), 9 deletions(-)
diff --git a/ios/Flutter/flutter_export_environment.sh b/ios/Flutter/flutter_export_environment.sh
index 6f688900..bcb9a5d5 100755
--- a/ios/Flutter/flutter_export_environment.sh
+++ b/ios/Flutter/flutter_export_environment.sh
@@ -3,11 +3,12 @@
export "FLUTTER_ROOT=/Users/sachet/flutter"
export "FLUTTER_APPLICATION_PATH=/Users/sachet/AndroidStudioProjects/xylophone-flutter"
export "COCOAPODS_PARALLEL_CODE_SIGN=true"
-export "FLUTTER_TARGET=lib/main.dart"
+export "FLUTTER_TARGET=/Users/sachet/AndroidStudioProjects/xylophone-flutter/lib/main.dart"
export "FLUTTER_BUILD_DIR=build"
export "FLUTTER_BUILD_NAME=1.0.0"
export "FLUTTER_BUILD_NUMBER=1"
+export "DART_DEFINES=Zmx1dHRlci5pbnNwZWN0b3Iuc3RydWN0dXJlZEVycm9ycz10cnVl,RkxVVFRFUl9XRUJfQVVUT19ERVRFQ1Q9dHJ1ZQ=="
export "DART_OBFUSCATION=false"
export "TRACK_WIDGET_CREATION=true"
export "TREE_SHAKE_ICONS=false"
-export "PACKAGE_CONFIG=.dart_tool/package_config.json"
+export "PACKAGE_CONFIG=/Users/sachet/AndroidStudioProjects/xylophone-flutter/.dart_tool/package_config.json"
diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj
index aef95578..8e3aaec5 100644
--- a/ios/Runner.xcodeproj/project.pbxproj
+++ b/ios/Runner.xcodeproj/project.pbxproj
@@ -7,6 +7,7 @@
objects = {
/* Begin PBXBuildFile section */
+ 130E4C4EF69CB713720EBF40 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AA5F5A7C5775934A08356F17 /* Pods_Runner.framework */; };
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; };
@@ -34,7 +35,9 @@
/* Begin PBXFileReference section */
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; };
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; };
+ 32CBB9A7104103CBEDAD6D53 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; };
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; };
+ 6300D96B20B29946AF693501 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; };
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; };
7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; };
7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; };
@@ -46,8 +49,10 @@
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; };
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
+ AA5F5A7C5775934A08356F17 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
ADBA6C9B2746BFEF00436332 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; };
ADBA6C9C2746BFEF00436332 /* something.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = something.swift; sourceTree = ""; };
+ B502E3C2C13EF298ACCC176B /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -55,12 +60,24 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
+ 130E4C4EF69CB713720EBF40 /* Pods_Runner.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
+ 839D5C7CB3E4F62650CFAF4A /* Pods */ = {
+ isa = PBXGroup;
+ children = (
+ 32CBB9A7104103CBEDAD6D53 /* Pods-Runner.debug.xcconfig */,
+ 6300D96B20B29946AF693501 /* Pods-Runner.release.xcconfig */,
+ B502E3C2C13EF298ACCC176B /* Pods-Runner.profile.xcconfig */,
+ );
+ name = Pods;
+ path = Pods;
+ sourceTree = "";
+ };
9740EEB11CF90186004384FC /* Flutter */ = {
isa = PBXGroup;
children = (
@@ -78,6 +95,8 @@
9740EEB11CF90186004384FC /* Flutter */,
97C146F01CF9000F007C117D /* Runner */,
97C146EF1CF9000F007C117D /* Products */,
+ 839D5C7CB3E4F62650CFAF4A /* Pods */,
+ BDE2FC1E1E2E6D63467CFC2B /* Frameworks */,
);
sourceTree = "";
};
@@ -115,6 +134,14 @@
name = "Supporting Files";
sourceTree = "";
};
+ BDE2FC1E1E2E6D63467CFC2B /* Frameworks */ = {
+ isa = PBXGroup;
+ children = (
+ AA5F5A7C5775934A08356F17 /* Pods_Runner.framework */,
+ );
+ name = Frameworks;
+ sourceTree = "";
+ };
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
@@ -122,12 +149,14 @@
isa = PBXNativeTarget;
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
buildPhases = (
+ B37E8D68E932393911ADEA95 /* [CP] Check Pods Manifest.lock */,
9740EEB61CF901F6004384FC /* Run Script */,
97C146EA1CF9000F007C117D /* Sources */,
97C146EB1CF9000F007C117D /* Frameworks */,
97C146EC1CF9000F007C117D /* Resources */,
9705A1C41CF9048500538489 /* Embed Frameworks */,
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
+ 46EE830BC64776EE43A29FAE /* [CP] Embed Pods Frameworks */,
);
buildRules = (
);
@@ -203,6 +232,24 @@
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
};
+ 46EE830BC64776EE43A29FAE /* [CP] Embed Pods Frameworks */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputPaths = (
+ "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh",
+ "${BUILT_PRODUCTS_DIR}/audiofileplayer/audiofileplayer.framework",
+ );
+ name = "[CP] Embed Pods Frameworks";
+ outputPaths = (
+ "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/audiofileplayer.framework",
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
+ showEnvVarsInLog = 0;
+ };
9740EEB61CF901F6004384FC /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
@@ -218,6 +265,28 @@
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
};
+ B37E8D68E932393911ADEA95 /* [CP] Check Pods Manifest.lock */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputFileListPaths = (
+ );
+ inputPaths = (
+ "${PODS_PODFILE_DIR_PATH}/Podfile.lock",
+ "${PODS_ROOT}/Manifest.lock",
+ );
+ name = "[CP] Check Pods Manifest.lock";
+ outputFileListPaths = (
+ );
+ outputPaths = (
+ "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt",
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
+ showEnvVarsInLog = 0;
+ };
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
@@ -315,7 +384,10 @@
"$(PROJECT_DIR)/Flutter",
);
INFOPLIST_FILE = Runner/Info.plist;
- LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
+ LD_RUNPATH_SEARCH_PATHS = (
+ "$(inherited)",
+ "@executable_path/Frameworks",
+ );
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
@@ -441,7 +513,10 @@
"$(PROJECT_DIR)/Flutter",
);
INFOPLIST_FILE = Runner/Info.plist;
- LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
+ LD_RUNPATH_SEARCH_PATHS = (
+ "$(inherited)",
+ "@executable_path/Frameworks",
+ );
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
@@ -468,7 +543,10 @@
"$(PROJECT_DIR)/Flutter",
);
INFOPLIST_FILE = Runner/Info.plist;
- LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
+ LD_RUNPATH_SEARCH_PATHS = (
+ "$(inherited)",
+ "@executable_path/Frameworks",
+ );
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
diff --git a/ios/Runner.xcworkspace/contents.xcworkspacedata b/ios/Runner.xcworkspace/contents.xcworkspacedata
index 1d526a16..21a3cc14 100644
--- a/ios/Runner.xcworkspace/contents.xcworkspacedata
+++ b/ios/Runner.xcworkspace/contents.xcworkspacedata
@@ -4,4 +4,7 @@
+
+
diff --git a/lib/main.dart b/lib/main.dart
index f92fedc3..a2995b66 100644
--- a/lib/main.dart
+++ b/lib/main.dart
@@ -1,5 +1,5 @@
import 'package:flutter/material.dart';
-import 'package:audioplayers/src/audio_cache.dart';
+import 'package:audiofileplayer/audiofileplayer.dart';
void main() => runApp(XylophoneApp());
@@ -9,8 +9,58 @@ class XylophoneApp extends StatelessWidget {
return MaterialApp(
home: Scaffold(
body: SafeArea(
- child: Center(
- child: TextButton(onPressed: () {}, child: Text('Click Me')),
+ child: Column(
+ children: [
+ TextButton(
+ onPressed: () {
+ Audio audio = Audio.load('assets/note1.wav');
+ audio.play();
+ },
+ child: Text('Click Me'),
+ ),
+ TextButton(
+ onPressed: () {
+ Audio audio = Audio.load('assets/note2.wav');
+ audio.play();
+ },
+ child: Text('Click Me'),
+ ),
+ TextButton(
+ onPressed: () {
+ Audio audio = Audio.load('assets/note3.wav');
+ audio.play();
+ },
+ child: Text('Click Me'),
+ ),
+ TextButton(
+ onPressed: () {
+ Audio audio = Audio.load('assets/note4.wav');
+ audio.play();
+ },
+ child: Text('Click Me'),
+ ),
+ TextButton(
+ onPressed: () {
+ Audio audio = Audio.load('assets/note5.wav');
+ audio.play();
+ },
+ child: Text('Click Me'),
+ ),
+ TextButton(
+ onPressed: () {
+ Audio audio = Audio.load('assets/note6.wav');
+ audio.play();
+ },
+ child: Text('Click Me'),
+ ),
+ TextButton(
+ onPressed: () {
+ Audio audio = Audio.load('assets/note7.wav');
+ audio.play();
+ },
+ child: Text('Click Me'),
+ ),
+ ],
),
),
),
diff --git a/pubspec.yaml b/pubspec.yaml
index 62767ae5..173093f8 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -11,7 +11,8 @@ dependencies:
sdk: flutter
cupertino_icons: ^0.1.2
- audioplayers: ^3.0.1
+
+ audiofileplayer: ^2.1.1
# Use Audioplayers dependency version 0.17.4
dev_dependencies:
From 8afdb1938cbf9a251ec9336ac9ae0517693c3a8d Mon Sep 17 00:00:00 2001
From: SachetVijay <81145614+SachetVijay@users.noreply.github.com>
Date: Sun, 26 Mar 2023 00:39:27 +0530
Subject: [PATCH 3/3] App Finished!!
---
lib/main.dart | 75 ++++++++++++++++++---------------------------------
1 file changed, 26 insertions(+), 49 deletions(-)
diff --git a/lib/main.dart b/lib/main.dart
index a2995b66..7a013aad 100644
--- a/lib/main.dart
+++ b/lib/main.dart
@@ -4,62 +4,39 @@ import 'package:audiofileplayer/audiofileplayer.dart';
void main() => runApp(XylophoneApp());
class XylophoneApp extends StatelessWidget {
+ void playmusic1(int fileno) {
+ Audio audio = Audio.load('assets/note$fileno.wav');
+ audio.play();
+ }
+
+ Expanded builtKey(Color color, int keyNo) {
+ return Expanded(
+ child: TextButton(
+ onPressed: () {
+ playmusic1(keyNo);
+ },
+ child: Container(
+ color: color,
+ ),
+ ),
+ );
+ }
+
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: SafeArea(
child: Column(
+ crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
- TextButton(
- onPressed: () {
- Audio audio = Audio.load('assets/note1.wav');
- audio.play();
- },
- child: Text('Click Me'),
- ),
- TextButton(
- onPressed: () {
- Audio audio = Audio.load('assets/note2.wav');
- audio.play();
- },
- child: Text('Click Me'),
- ),
- TextButton(
- onPressed: () {
- Audio audio = Audio.load('assets/note3.wav');
- audio.play();
- },
- child: Text('Click Me'),
- ),
- TextButton(
- onPressed: () {
- Audio audio = Audio.load('assets/note4.wav');
- audio.play();
- },
- child: Text('Click Me'),
- ),
- TextButton(
- onPressed: () {
- Audio audio = Audio.load('assets/note5.wav');
- audio.play();
- },
- child: Text('Click Me'),
- ),
- TextButton(
- onPressed: () {
- Audio audio = Audio.load('assets/note6.wav');
- audio.play();
- },
- child: Text('Click Me'),
- ),
- TextButton(
- onPressed: () {
- Audio audio = Audio.load('assets/note7.wav');
- audio.play();
- },
- child: Text('Click Me'),
- ),
+ builtKey(Colors.red, 1),
+ builtKey(Colors.orange, 2),
+ builtKey(Colors.yellow, 3),
+ builtKey(Colors.green, 4),
+ builtKey(Colors.teal, 5),
+ builtKey(Colors.cyan, 6),
+ builtKey(Colors.blue, 7),
],
),
),