flutter_google_cast_button 0.2.0
flutter_google_cast_button: ^0.2.0 copied to clipboard

A Flutter plugin provides cast button which sync cast state with it.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter_google_cast_button/bloc_media_route.dart';
import 'package:flutter_google_cast_button/cast_button_widget.dart';
import 'package:flutter_google_cast_button/flutter_google_cast_button.dart';

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

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {

  MediaRouteBloc mediaRouteBloc;

  @override
  void initState() {
    super.initState();
    mediaRouteBloc = MediaRouteBloc();
  }

  @override
  void dispose() {
    mediaRouteBloc.dispose();
    mediaRouteBloc = null;
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: Padding(
            padding: EdgeInsets.only(bottom: kToolbarHeight),
            child: Column(
              mainAxisAlignment: MainAxisAlignment.center,
              children: <Widget>[
                CastButtonWidget(
                  bloc: mediaRouteBloc,
                  tintColor: Colors.deepPurple,
                ),
                RaisedButton(
                  child: Text("Show cast dialog manually"),
                  onPressed: () => FlutterGoogleCastButton.showCastDialog(),
                )
              ],
            ),
          ),
        ),
      ),
    );
  }
}
2
likes
70
pub points
25%
popularity

A Flutter plugin provides cast button which sync cast state with it.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

bloc, equatable, flutter, flutter_bloc

More

Packages that depend on flutter_google_cast_button