vdocipher_flutter 1.0.0-alpha.3 copy "vdocipher_flutter: ^1.0.0-alpha.3" to clipboard
vdocipher_flutter: ^1.0.0-alpha.3 copied to clipboard

outdated

VdoCipher plugin for flutter apps.

example/lib/main.dart

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

import 'package:flutter/services.dart';
import 'package:vdocipher_flutter/vdocipher_flutter.dart';
import 'package:vdocipher_flutter_example/vdoplayback_view.dart';

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'VdoCipher Sample Application',
      home: MyHome(),
      theme: ThemeData(
          primaryColor: Colors.white,
          textTheme: TextTheme(bodyText1: TextStyle(fontSize: 12.0))),
    );
  }
}

class MyHome extends StatefulWidget {
  @override
  _MyHomeState createState() => _MyHomeState();
}

class _MyHomeState extends State<MyHome> {
  String _nativeAndroidLibraryVersion = 'Unknown';

  @override
  void initState() {
    super.initState();
    getNativeAndroidLibraryVersion();
  }

  // Platform messages are asynchronous, so we initialize in an async method.
  Future<void> getNativeAndroidLibraryVersion() async {
    String version;
    // Platform messages may fail, so we use a try/catch PlatformException.
    try {
      version = await VdocipherMethodChannel.nativeAndroidLibraryVersion;
    } on PlatformException {
      version = 'Failed to get native android library version.';
    }

    // If the widget was removed from the tree while the asynchronous platform
    // message was in flight, we want to discard the reply rather than calling
    // setState to update our non-existent appearance.
    if (!mounted) return;

    setState(() {
      _nativeAndroidLibraryVersion = version;
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('VdoCipher Sample Application'),
        ),
          body: Center(child: Column(
            children: <Widget>[
              Expanded(child: Column(
                  crossAxisAlignment: CrossAxisAlignment.center,
                  children: <Widget>[
                    ElevatedButton(
                      onPressed: _goToVideoPlayback,
                      child: const Text('Online Playback',
                          style: TextStyle(fontSize: 20)),
                    ),
                    ElevatedButton(
                      onPressed: null,
                      child: const Text('Todo: video selection',
                          style: TextStyle(fontSize: 20)),
                    )
                  ])),
              Padding(padding: EdgeInsets.all(16.0),
                  child: Text('Native android library version: $_nativeAndroidLibraryVersion',
                      style: TextStyle(color: Colors.grey, fontSize: 16.0)))
            ],
          )))
    );
  }

  void _goToVideoPlayback() {
    Navigator.of(context).push(
      MaterialPageRoute<void>(
        builder: (BuildContext context) {
          return VdoPlaybackView();
        },
      ),
    );
  }
}
19
likes
0
pub points
88%
popularity

Publisher

verified publishervdocipher.com

VdoCipher plugin for flutter apps.

Homepage

License

unknown (LICENSE)

Dependencies

flutter, wakelock

More

Packages that depend on vdocipher_flutter