alarmplayer 1.0.1 copy "alarmplayer: ^1.0.1" to clipboard
alarmplayer: ^1.0.1 copied to clipboard

outdated

playing alarms

example/lib/main.dart

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

import 'package:flutter/services.dart';
import 'package:alarmplayer/alarmplayer.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {

  String _platformVersion = 'Unknown';
  Alarmplayer alarmplayer = Alarmplayer();


  // Platform messages are asynchronous, so we initialize in an async method.

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Container(
        alignment: Alignment.topCenter,
    // margin: const EdgeInsets.symmetric(horizontal: 30),
    child: SingleChildScrollView(
    child: Column(
    mainAxisAlignment: MainAxisAlignment.center,
    crossAxisAlignment: CrossAxisAlignment.center,
    children: <Widget>[
      Container(
        margin: EdgeInsets.all(25),
        child: FlatButton(
          child: Text('start alarm', style: TextStyle(fontSize: 20.0),),
          color: Colors.blueAccent,
          textColor: Colors.white,
          onPressed: () async {
            alarmplayer.Alarm(
              url: "assets/2.mp3",
              volume: 0.5,
            );

            },
        ),
      ),

      Container(
        margin: EdgeInsets.all(25),
        child: FlatButton(
          child: Text('stop alarm', style: TextStyle(fontSize: 20.0),),
          color: Colors.blueAccent,
          textColor: Colors.white,
          onPressed: () async {
            alarmplayer.StopAlarm();
            },
        ),
      ),


              ],
            ),
          ),
        ),
      ),
    );
  }
}
7
likes
0
points
113
downloads

Publisher

unverified uploader

Weekly Downloads

playing alarms

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, path_provider, plugin_platform_interface

More

Packages that depend on alarmplayer