App-Brewery-Flutter-Null-Safety icon indicating copy to clipboard operation
App-Brewery-Flutter-Null-Safety copied to clipboard

Lesson number 77

Open MiladZarour opened this issue 3 years ago • 0 comments

style: TextButton.styleFrom(backgroundColor: Colors.red),

Full Code :

import 'package:flutter/material.dart';
import 'package:audioplayers/audioplayers.dart';

void main() => runApp(XylophoneApp());

class XylophoneApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    final player = AudioPlayer();

    return MaterialApp(
      home: Scaffold(
        body: SafeArea(
          child: Column(
            children: [
              TextButton(
                style: TextButton.styleFrom(backgroundColor: Colors.red),
                onPressed: () async {
                  await player.play(AssetSource('note1.wav'));
                },
              ),
            ],
          ),
        ),
      ),
    );
  }
}

MiladZarour avatar Dec 11 '22 09:12 MiladZarour