Skip to content

Instantly share code, notes, and snippets.

@suragch
Last active April 22, 2021 10:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save suragch/558e7a24d7432a5a9d396bcda48693e5 to your computer and use it in GitHub Desktop.
Save suragch/558e7a24d7432a5a9d396bcda48693e5 to your computer and use it in GitHub Desktop.
Playing short audio clips in Flutter with Just Audio (setup)
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: Center(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
ElevatedButton(
onPressed: () {
// TODO: cow button
},
child: Text('Cow'),
),
SizedBox(width: 10),
ElevatedButton(
onPressed: () {
// TODO: horse button
},
child: Text('Horse'),
),
],
),
),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment