import_js_library 1.0.2 copy "import_js_library: ^1.0.2" to clipboard
import_js_library: ^1.0.2 copied to clipboard

Import & use javascript libraries in your flutter web projects

example/lib/main.dart

import 'package:audio_plugin_example/audio_plugin.dart';
import 'package:flutter/material.dart';

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: Row(
            children: [
              Expanded(flex: 1, child: AudioPage("./assets/test.mp3")),
              Expanded(flex: 1, child: AudioPage("./assets/astronomia.mp3")),
            ],
          ),
        ),
      ),
    );
  }
}

class AudioPage extends StatelessWidget {
  final String audioPath;

  AudioPage(this.audioPath);

  @override
  Widget build(BuildContext context) {
    return Column(
      children: <Widget>[
        Text(this.audioPath),
        RaisedButton(
          child: Text('Open'),
          onPressed: () {
            Audio.open(this.audioPath);
          },
        ),
        RaisedButton(
          child: Text('Play'),
          onPressed: () {
            Audio.play();
          },
        ),
        RaisedButton(
          child: Text('Pause'),
          onPressed: () {
            Audio.pause();
          },
        ),
      ],
    );
  }
}
55
likes
40
pub points
46%
popularity

Publisher

unverified uploader

Import & use javascript libraries in your flutter web projects

Repository (GitHub)
View/report issues

License

Apache-2.0 (license)

Dependencies

flutter, flutter_web_plugins, html, js

More

Packages that depend on import_js_library