main.dart 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. import 'package:fis_live/widgets/style.dart';
  2. import 'package:flutter/material.dart';
  3. import 'package:fis_live/fis_live.dart';
  4. void main() {
  5. runApp(const MyApp());
  6. }
  7. class MyApp extends StatelessWidget {
  8. const MyApp({super.key});
  9. // This widget is the root of your application.
  10. @override
  11. Widget build(BuildContext context) {
  12. return MaterialApp(
  13. title: 'Flutter Demo',
  14. theme: ThemeData(
  15. primarySwatch: Colors.blue,
  16. ),
  17. home: const MyHomePage(title: 'Flutter Demo Home Page'),
  18. );
  19. }
  20. }
  21. class MyHomePage extends StatefulWidget {
  22. const MyHomePage({super.key, required this.title});
  23. final String title;
  24. @override
  25. State<MyHomePage> createState() => _MyHomePageState();
  26. }
  27. class _MyHomePageState extends State<MyHomePage> {
  28. int _counter = 0;
  29. final controller = LiveController(
  30. source: LiveSource(
  31. "http://liveplay.fis.plus/live/71678_4c08d218d5ddb3f374c5af26c75392cd.flv",
  32. ),
  33. );
  34. void _incrementCounter() {
  35. setState(() {
  36. _counter++;
  37. });
  38. }
  39. @override
  40. Widget build(BuildContext context) {
  41. return Scaffold(
  42. appBar: AppBar(
  43. title: Text(widget.title),
  44. ),
  45. body: Center(
  46. child: Column(
  47. mainAxisAlignment: MainAxisAlignment.center,
  48. children: <Widget>[
  49. const Text(
  50. 'You have pushed the button this many times:',
  51. ),
  52. Text(
  53. '$_counter',
  54. style: Theme.of(context).textTheme.headlineMedium,
  55. ),
  56. SizedBox(height: _counter.toDouble()),
  57. SizedBox(
  58. width: 320,
  59. height: 240,
  60. child: FLivePlayer(controller: controller),
  61. ),
  62. ],
  63. ),
  64. ),
  65. floatingActionButton: FloatingActionButton(
  66. onPressed: _incrementCounter,
  67. tooltip: 'Increment',
  68. child: const Icon(Icons.add),
  69. ),
  70. );
  71. }
  72. }