Inspiration
MLH - LHD
What it does
Its a simple xylophone app it has 7 buttons of different color , just like rainbow and each produces different sound when pressed.
How we built it
We made this app using Flutter.
import 'package:flutter/material.dart';
import 'package:audioplayers/audio_cache.dart';
void main() {
runApp(testing());
}
class testing extends StatelessWidget {
void playSound(int soundNum)
{
final player = AudioCache();
player.play('note$soundNum.wav');
}
Expanded buildKey({Color color, int soundNum})
{
return Expanded(
child: FlatButton(
color : color,
onPressed: () {
playSound(soundNum);
},
),
);
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
backgroundColor: Colors.black,
body : SafeArea(
child : Column( mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
buildKey(color:Colors.red , soundNum:1),
buildKey(color:Colors.orange , soundNum:2),
buildKey(color:Colors.yellow , soundNum:3),
buildKey(color:Colors.lightGreen , soundNum:4),
buildKey(color:Colors.green , soundNum:5),
buildKey(color:Colors.blue , soundNum:6),
buildKey(color:Colors.purple , soundNum:7),
],
)
)
)
);
}
}
Basically , when we are pressing our flat button its calling a playsound function and we passing soundNum variable in it and it performing these two functions
final player = AudioCache();
player.play('note$soundNum.wav');
Also we are creating expanded type function and passing two arguements ```Expanded buildKey({Color color, int soundNum}) { return Expanded( child: FlatButton( color : color, onPressed: () { playSound(soundNum); }, ), ); }
## Challenges we ran into
Fun to make
## What we learned
About Flutter and Dart
## What's next for Create a Mobile App
Add more Functionalities to our App
Log in or sign up for Devpost to join the conversation.