make all possible fields private
update dependencies try to infer the prefix of the server url display display size dependent amount on shuffle page
This commit is contained in:
		| @@ -17,18 +17,14 @@ class DrawerPage extends StatefulWidget { | |||||||
| enum Section { HOME, SHUFFLE, LOGOUT } | enum Section { HOME, SHUFFLE, LOGOUT } | ||||||
|  |  | ||||||
| class _DrawerPageState extends State<DrawerPage> { | class _DrawerPageState extends State<DrawerPage> { | ||||||
|   Section sec = Section.HOME; |   Section _sec = Section.HOME; | ||||||
|  |  | ||||||
|   @override |   @override | ||||||
|   Widget build(BuildContext context) { |   Widget build(BuildContext context) { | ||||||
|     Widget body; |     Widget body; | ||||||
|     String title; |     String title; | ||||||
|  |  | ||||||
|     /// You can easily control the section for example inside the initState where you check |     switch (_sec) { | ||||||
|     /// if the user logged in, or other related logic |  | ||||||
|     switch (sec) { |  | ||||||
|  |  | ||||||
|     /// Display the home section, simply by |  | ||||||
|       case Section.HOME: |       case Section.HOME: | ||||||
|         body = const VideoFeed(); |         body = const VideoFeed(); | ||||||
|         title = widget.title; |         title = widget.title; | ||||||
| @@ -45,13 +41,13 @@ class _DrawerPageState extends State<DrawerPage> { | |||||||
|         break; |         break; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     var loginctx = LoginContext.of(context); |     final loginCtx = LoginContext.of(context); | ||||||
|  |  | ||||||
|     return Scaffold( |     return Scaffold( | ||||||
|       appBar: AppBar(title: Text(title), actions: [ |       appBar: AppBar(title: Text(title), actions: [ | ||||||
|         IconButton( |         IconButton( | ||||||
|             onPressed: () { |             onPressed: () { | ||||||
|               loginctx.onLoggin(false); |               loginCtx.onLoggin(false); | ||||||
|               Token.getInstance().setToken("", ""); |               Token.getInstance().setToken("", ""); | ||||||
|             }, |             }, | ||||||
|             icon: const Icon(Icons.logout)) |             icon: const Icon(Icons.logout)) | ||||||
| @@ -64,7 +60,7 @@ class _DrawerPageState extends State<DrawerPage> { | |||||||
|             leading: const Icon(Icons.home), |             leading: const Icon(Icons.home), | ||||||
|             onTap: () { |             onTap: () { | ||||||
|               setState(() { |               setState(() { | ||||||
|                 sec = Section.HOME; |                 _sec = Section.HOME; | ||||||
|               }); |               }); | ||||||
|               Navigator.pop(context); |               Navigator.pop(context); | ||||||
|             }, |             }, | ||||||
| @@ -74,7 +70,7 @@ class _DrawerPageState extends State<DrawerPage> { | |||||||
|             leading: const Icon(Icons.update), |             leading: const Icon(Icons.update), | ||||||
|             onTap: () { |             onTap: () { | ||||||
|               setState(() { |               setState(() { | ||||||
|                 sec = Section.SHUFFLE; |                 _sec = Section.SHUFFLE; | ||||||
|               }); |               }); | ||||||
|               Navigator.pop(context); |               Navigator.pop(context); | ||||||
|             }, |             }, | ||||||
| @@ -84,7 +80,7 @@ class _DrawerPageState extends State<DrawerPage> { | |||||||
|             leading: const Icon(Icons.settings), |             leading: const Icon(Icons.settings), | ||||||
|             onTap: () { |             onTap: () { | ||||||
|               setState(() { |               setState(() { | ||||||
|                 sec = Section.LOGOUT; |                 _sec = Section.LOGOUT; | ||||||
|               }); |               }); | ||||||
|               Navigator.pop(context); |               Navigator.pop(context); | ||||||
|             }, |             }, | ||||||
|   | |||||||
							
								
								
									
										14
									
								
								lib/app.dart
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								lib/app.dart
									
									
									
									
									
								
							| @@ -3,26 +3,18 @@ import 'package:openmediacentermobile/log/log.dart'; | |||||||
| import 'package:openmediacentermobile/login/login_screen.dart'; | import 'package:openmediacentermobile/login/login_screen.dart'; | ||||||
|  |  | ||||||
| import 'DrawerPage.dart'; | import 'DrawerPage.dart'; | ||||||
| import 'api/token.dart'; |  | ||||||
| import 'login/logincontext.dart'; | import 'login/logincontext.dart'; | ||||||
| import 'video_feed.dart'; |  | ||||||
|  |  | ||||||
| // class App extends StatefulWidget { |  | ||||||
| //   const App({Key? key}) : super(key: key); |  | ||||||
| //   @override |  | ||||||
| //   State<StatefulWidget> createState() => AppState(); |  | ||||||
| // } |  | ||||||
|  |  | ||||||
| class App extends StatelessWidget { | class App extends StatelessWidget { | ||||||
|   const App({Key? key}) : super(key: key); |   const App({Key? key}) : super(key: key); | ||||||
|  |  | ||||||
|   @override |   @override | ||||||
|   Widget build(BuildContext context) { |   Widget build(BuildContext context) { | ||||||
|     var loginctx = LoginContext.of(context); |     var loginCtx = LoginContext.of(context); | ||||||
|  |  | ||||||
|     Log.d("We are logged in: ${loginctx.LoggedIn}"); |     Log.d("We are logged in: ${loginCtx.loggedIn}"); | ||||||
|  |  | ||||||
|     if (!loginctx.LoggedIn) { |     if (!loginCtx.loggedIn) { | ||||||
|       return const MaterialApp(home: LoginScreen()); |       return const MaterialApp(home: LoginScreen()); | ||||||
|     } else { |     } else { | ||||||
|       return const MaterialApp( |       return const MaterialApp( | ||||||
|   | |||||||
| @@ -18,22 +18,28 @@ class _LoginScreenState extends State<LoginScreen> { | |||||||
|   final TextEditingController _domainTextController = TextEditingController(); |   final TextEditingController _domainTextController = TextEditingController(); | ||||||
|   final TextEditingController _passwordTextController = TextEditingController(); |   final TextEditingController _passwordTextController = TextEditingController(); | ||||||
|   String error = ""; |   String error = ""; | ||||||
|  |   bool _loginActive = false; | ||||||
|  |  | ||||||
|   Future<String> login(String password, String domain) async { |   Future<String> login(String password, String domain) async { | ||||||
|     Log.i("logging in..."); |     Log.i("logging in..."); | ||||||
|     // final compl = Completer<String>(); |  | ||||||
|     final resp = await http.post( |     http.Response resp; | ||||||
|       Uri.parse(domain + '/api/login/login'), |     try { | ||||||
|       headers: <String, String>{ |       resp = await http.post( | ||||||
|         'Content-Type': 'application/json; charset=UTF-8', |         Uri.parse(domain + '/api/login/login'), | ||||||
|       }, |         headers: <String, String>{ | ||||||
|       body: jsonEncode(<String, String>{ |           'Content-Type': 'application/json; charset=UTF-8', | ||||||
|         'Password': password, |         }, | ||||||
|       }), |         body: jsonEncode(<String, String>{ | ||||||
|     ); |           'Password': password, | ||||||
|  |         }), | ||||||
|  |       ); | ||||||
|  |     } catch (e) { | ||||||
|  |       return "error" + e.toString(); | ||||||
|  |     } | ||||||
|  |  | ||||||
|     if (resp.statusCode != 200) { |     if (resp.statusCode != 200) { | ||||||
|       return resp.body; |       return "error" + resp.body; | ||||||
|  |  | ||||||
|       // compl.complete(resp.body); |       // compl.complete(resp.body); | ||||||
|     } else { |     } else { | ||||||
| @@ -44,13 +50,7 @@ class _LoginScreenState extends State<LoginScreen> { | |||||||
|       LoginContext.of(context).onLoggin(true); |       LoginContext.of(context).onLoggin(true); | ||||||
|  |  | ||||||
|       return ""; |       return ""; | ||||||
|  |  | ||||||
|       // compl.complete(""); |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     // LoginContext.of(context).onLoggin(true); |  | ||||||
|  |  | ||||||
|     // return compl.future; |  | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   @override |   @override | ||||||
| @@ -130,16 +130,26 @@ class _LoginScreenState extends State<LoginScreen> { | |||||||
|                                 backgroundColor: const Color(0xff4c505b), |                                 backgroundColor: const Color(0xff4c505b), | ||||||
|                                 child: IconButton( |                                 child: IconButton( | ||||||
|                                     color: Colors.white, |                                     color: Colors.white, | ||||||
|                                     onPressed: () { |                                     onPressed: () async { | ||||||
|                                       Log.d("clickkked"); |                                       Log.d("clickkked"); | ||||||
|                                       final pwd = _passwordTextController.value.text; |                                       final pwd = _passwordTextController.value.text; | ||||||
|                                       final domain = _domainTextController.value.text; |                                       final domain = _domainTextController.value.text; | ||||||
|                                       login(pwd, domain).then((value) { |  | ||||||
|                                         if (value != "") { |                                       var err = ""; | ||||||
|                                           setState(() { |                                       if (domain.startsWith("https://") || domain.startsWith("http://")) { | ||||||
|                                             error = value; |                                         err = await login(pwd, domain); | ||||||
|                                           }); |                                         if (err.isEmpty) return; | ||||||
|                                         } |                                       } else { | ||||||
|  |                                         // try to auto infering domain prefix | ||||||
|  |                                         err = await login(pwd, "https://" + domain); | ||||||
|  |                                         if (err.isEmpty) return; | ||||||
|  |                                         err = await login(pwd, "http://" + domain); | ||||||
|  |                                         if (err.isEmpty) return; | ||||||
|  |                                       } | ||||||
|  |  | ||||||
|  |                                       Log.i(err); | ||||||
|  |                                       setState(() { | ||||||
|  |                                         error = err; | ||||||
|                                       }); |                                       }); | ||||||
|                                     }, |                                     }, | ||||||
|                                     icon: const Icon( |                                     icon: const Icon( | ||||||
|   | |||||||
| @@ -12,8 +12,8 @@ class LoginContainer extends StatefulWidget { | |||||||
| } | } | ||||||
|  |  | ||||||
| class _LoginContainerState extends State<LoginContainer> { | class _LoginContainerState extends State<LoginContainer> { | ||||||
|   bool loggedIn = false; |   bool _loggedIn = false; | ||||||
|   bool loading = true; |   bool _loading = true; | ||||||
|  |  | ||||||
|   @override |   @override | ||||||
|   void initState() { |   void initState() { | ||||||
| @@ -24,13 +24,13 @@ class _LoginContainerState extends State<LoginContainer> { | |||||||
|       Log.i("The token value is $value"); |       Log.i("The token value is $value"); | ||||||
|       if (value != null) { |       if (value != null) { | ||||||
|         setState(() { |         setState(() { | ||||||
|           loggedIn = true; |           _loggedIn = true; | ||||||
|           loading = false; |           _loading = false; | ||||||
|         }); |         }); | ||||||
|       } else { |       } else { | ||||||
|         setState(() { |         setState(() { | ||||||
|           loggedIn = false; |           _loggedIn = false; | ||||||
|           loading = false; |           _loading = false; | ||||||
|         }); |         }); | ||||||
|       } |       } | ||||||
|     }); |     }); | ||||||
| @@ -39,8 +39,8 @@ class _LoginContainerState extends State<LoginContainer> { | |||||||
|   @override |   @override | ||||||
|   Widget build(BuildContext context) { |   Widget build(BuildContext context) { | ||||||
|     return LoginContext( |     return LoginContext( | ||||||
|       LoggedIn: loggedIn, |       loggedIn: _loggedIn, | ||||||
|       child: loading |       child: _loading | ||||||
|           ? MaterialApp( |           ? MaterialApp( | ||||||
|               home: Container( |               home: Container( | ||||||
|                 color: Colors.white, |                 color: Colors.white, | ||||||
| @@ -49,9 +49,9 @@ class _LoginContainerState extends State<LoginContainer> { | |||||||
|             ) |             ) | ||||||
|           : widget.child, |           : widget.child, | ||||||
|       onLoggin: (bool login) { |       onLoggin: (bool login) { | ||||||
|         if (loggedIn != login) { |         if (_loggedIn != login) { | ||||||
|           setState(() { |           setState(() { | ||||||
|             loggedIn = login; |             _loggedIn = login; | ||||||
|           }); |           }); | ||||||
|         } |         } | ||||||
|       }, |       }, | ||||||
| @@ -63,11 +63,11 @@ class LoginContext extends InheritedWidget { | |||||||
|   const LoginContext( |   const LoginContext( | ||||||
|       {Key? key, |       {Key? key, | ||||||
|       required Widget child, |       required Widget child, | ||||||
|       required this.LoggedIn, |       required this.loggedIn, | ||||||
|       required this.onLoggin}) |       required this.onLoggin}) | ||||||
|       : super(key: key, child: child); |       : super(key: key, child: child); | ||||||
|  |  | ||||||
|   final bool LoggedIn; |   final bool loggedIn; | ||||||
|   final void Function(bool) onLoggin; |   final void Function(bool) onLoggin; | ||||||
|  |  | ||||||
|   static LoginContext of(BuildContext context) { |   static LoginContext of(BuildContext context) { | ||||||
| @@ -79,6 +79,6 @@ class LoginContext extends InheritedWidget { | |||||||
|  |  | ||||||
|   @override |   @override | ||||||
|   bool updateShouldNotify(LoginContext old) { |   bool updateShouldNotify(LoginContext old) { | ||||||
|     return LoggedIn != old.LoggedIn; |     return loggedIn != old.loggedIn; | ||||||
|   } |   } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -7,7 +7,6 @@ import 'log/log.dart'; | |||||||
| import 'login/logincontext.dart'; | import 'login/logincontext.dart'; | ||||||
| import 'platform.dart'; | import 'platform.dart'; | ||||||
|  |  | ||||||
| // main app entry point |  | ||||||
| void main() async { | void main() async { | ||||||
|   Log.i("App init!"); |   Log.i("App init!"); | ||||||
|   DartVLC.initialize(); |   DartVLC.initialize(); | ||||||
|   | |||||||
| @@ -16,10 +16,8 @@ class PreviewGrid extends StatefulWidget { | |||||||
|  |  | ||||||
| class _PreviewGridState extends State<PreviewGrid> { | class _PreviewGridState extends State<PreviewGrid> { | ||||||
|   late Future<List<VideoT>> _data; |   late Future<List<VideoT>> _data; | ||||||
|  |  | ||||||
|   Image? _previewImage; |   Image? _previewImage; | ||||||
|  |  | ||||||
|  |  | ||||||
|   @override |   @override | ||||||
|   void initState() { |   void initState() { | ||||||
|     super.initState(); |     super.initState(); | ||||||
| @@ -28,7 +26,7 @@ class _PreviewGridState extends State<PreviewGrid> { | |||||||
|  |  | ||||||
|   @override |   @override | ||||||
|   Widget build(BuildContext context) { |   Widget build(BuildContext context) { | ||||||
|     double width = MediaQuery.of(context).size.width; |     final double width = MediaQuery.of(context).size.width; | ||||||
|  |  | ||||||
|     return FutureBuilder<List<VideoT>>( |     return FutureBuilder<List<VideoT>>( | ||||||
|       future: _data, // a previously-obtained Future<String> or null |       future: _data, // a previously-obtained Future<String> or null | ||||||
|   | |||||||
| @@ -12,9 +12,9 @@ import 'platform.dart'; | |||||||
| class VideoT { | class VideoT { | ||||||
|   int id; |   int id; | ||||||
|   String title; |   String title; | ||||||
|   double Ratio; |   double ratio; | ||||||
|  |  | ||||||
|   VideoT(this.title, this.id, this.Ratio); |   VideoT(this.title, this.id, this.ratio); | ||||||
|  |  | ||||||
|   factory VideoT.fromJson(dynamic json) { |   factory VideoT.fromJson(dynamic json) { | ||||||
|     return VideoT(json['MovieName'] as String, json['MovieId'] as int, (json['Ratio'] as num).toDouble()); |     return VideoT(json['MovieName'] as String, json['MovieId'] as int, (json['Ratio'] as num).toDouble()); | ||||||
| @@ -109,7 +109,7 @@ class _PreviewTileState extends State<PreviewTile> { | |||||||
|                           Navigator.push( |                           Navigator.push( | ||||||
|                             context, |                             context, | ||||||
|                             MaterialPageRoute( |                             MaterialPageRoute( | ||||||
|                               builder: (context) => VideoScreen(MetaData: widget.dta), |                               builder: (context) => VideoScreen(metaData: widget.dta), | ||||||
|                             ), |                             ), | ||||||
|                           ); |                           ); | ||||||
|                         }, |                         }, | ||||||
|   | |||||||
| @@ -3,7 +3,7 @@ import 'dart:math'; | |||||||
|  |  | ||||||
| import 'package:flutter/material.dart'; | import 'package:flutter/material.dart'; | ||||||
| import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart'; | import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart'; | ||||||
| import 'package:openmediacentermobile/preview_tile.dart'; | import 'preview_tile.dart'; | ||||||
|  |  | ||||||
| import 'api/api.dart'; | import 'api/api.dart'; | ||||||
| import 'platform.dart'; | import 'platform.dart'; | ||||||
| @@ -18,8 +18,8 @@ class ShuffleScreen extends StatefulWidget { | |||||||
| class _ShuffleScreenState extends State<ShuffleScreen> { | class _ShuffleScreenState extends State<ShuffleScreen> { | ||||||
|   late Future<List<VideoT>> _data; |   late Future<List<VideoT>> _data; | ||||||
|  |  | ||||||
|   Future<List<VideoT>> loadData() async { |   Future<List<VideoT>> loadData(int nr) async { | ||||||
|     final data = await API.query("video", "getRandomMovies", {'Number': 4, 'Seed': Random().nextInt(0x7fffffff)}); |     final data = await API.query("video", "getRandomMovies", {'Number': nr, 'Seed': Random().nextInt(0x7fffffff)}); | ||||||
|  |  | ||||||
|     final d = jsonDecode(data); |     final d = jsonDecode(data); | ||||||
|  |  | ||||||
| @@ -32,7 +32,11 @@ class _ShuffleScreenState extends State<ShuffleScreen> { | |||||||
|   void initState() { |   void initState() { | ||||||
|     super.initState(); |     super.initState(); | ||||||
|  |  | ||||||
|     _data = loadData(); |     _data = Future.delayed(Duration.zero).then((_) { | ||||||
|  |       double width = MediaQuery.of(context).size.width; | ||||||
|  |       return loadData((isTV() ? width ~/ 200 : width ~/ 330) * 2); | ||||||
|  |     }); | ||||||
|  |  | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   @override |   @override | ||||||
| @@ -52,7 +56,7 @@ class _ShuffleScreenState extends State<ShuffleScreen> { | |||||||
|               mainAxisSpacing: 4, |               mainAxisSpacing: 4, | ||||||
|               crossAxisSpacing: 4, |               crossAxisSpacing: 4, | ||||||
|               padding: EdgeInsets.all(5), |               padding: EdgeInsets.all(5), | ||||||
|               itemCount: 4, |               itemCount: snapshot.data!.length, | ||||||
|               itemBuilder: (context, index) { |               itemBuilder: (context, index) { | ||||||
|                 return PreviewTile(dta: snapshot.data![index]); |                 return PreviewTile(dta: snapshot.data![index]); | ||||||
|               }, |               }, | ||||||
| @@ -63,7 +67,7 @@ class _ShuffleScreenState extends State<ShuffleScreen> { | |||||||
|             TextButton.icon( |             TextButton.icon( | ||||||
|                 onPressed: () { |                 onPressed: () { | ||||||
|                   setState(() { |                   setState(() { | ||||||
|                     _data = loadData(); |                     _data = loadData((isTV() ? width ~/ 200 : width ~/ 330) * 2); | ||||||
|                   }); |                   }); | ||||||
|                 }, |                 }, | ||||||
|                 icon: const Icon(Icons.update), |                 icon: const Icon(Icons.update), | ||||||
|   | |||||||
| @@ -14,19 +14,19 @@ import 'log/log.dart'; | |||||||
| import 'platform.dart'; | import 'platform.dart'; | ||||||
|  |  | ||||||
| class VideoScreen extends StatefulWidget { | class VideoScreen extends StatefulWidget { | ||||||
|   const VideoScreen({Key? key, required this.MetaData}) : super(key: key); |   const VideoScreen({Key? key, required this.metaData}) : super(key: key); | ||||||
|   final VideoT MetaData; |   final VideoT metaData; | ||||||
|  |  | ||||||
|   @override |   @override | ||||||
|   State<VideoScreen> createState() => _VideoScreenState(); |   State<VideoScreen> createState() => _VideoScreenState(); | ||||||
| } | } | ||||||
|  |  | ||||||
| class _VideoScreenState extends State<VideoScreen> { | class _VideoScreenState extends State<VideoScreen> { | ||||||
|   Player? player = isDesktop() ? Player(id: Random().nextInt(0x7fffffff)) : null; |   Player? _player = isDesktop() ? Player(id: Random().nextInt(0x7fffffff)) : null; | ||||||
|   ChewieController? _chewieController; |   ChewieController? _chewieController; | ||||||
|  |  | ||||||
|   void loadData() async { |   void loadData() async { | ||||||
|     final data = await API.query("video", "loadVideo", {'MovieId': widget.MetaData.id}); |     final data = await API.query("video", "loadVideo", {'MovieId': widget.metaData.id}); | ||||||
|  |  | ||||||
|     final d = jsonDecode(data); |     final d = jsonDecode(data); | ||||||
|  |  | ||||||
| @@ -41,7 +41,7 @@ class _VideoScreenState extends State<VideoScreen> { | |||||||
|     if (isDesktop()) { |     if (isDesktop()) { | ||||||
|       final media2 = Media.network(path); |       final media2 = Media.network(path); | ||||||
|  |  | ||||||
|       player?.open( |       _player?.open( | ||||||
|         media2, |         media2, | ||||||
|         autoStart: true, // default |         autoStart: true, // default | ||||||
|       ); |       ); | ||||||
| @@ -70,9 +70,9 @@ class _VideoScreenState extends State<VideoScreen> { | |||||||
|     if(isDesktop()){ |     if(isDesktop()){ | ||||||
|       RawKeyboard.instance.addListener((value) { |       RawKeyboard.instance.addListener((value) { | ||||||
|         if (value.logicalKey == LogicalKeyboardKey.arrowRight) { |         if (value.logicalKey == LogicalKeyboardKey.arrowRight) { | ||||||
|           player?.seek(player!.position.position! + const Duration(seconds: 5)); |           _player?.seek(_player!.position.position! + const Duration(seconds: 5)); | ||||||
|         } else if (value.logicalKey == LogicalKeyboardKey.arrowLeft) { |         } else if (value.logicalKey == LogicalKeyboardKey.arrowLeft) { | ||||||
|           player?.seek(player!.position.position! + const Duration(seconds: -5)); |           _player?.seek(_player!.position.position! + const Duration(seconds: -5)); | ||||||
|         } |         } | ||||||
|       }); |       }); | ||||||
|     } |     } | ||||||
| @@ -87,7 +87,7 @@ class _VideoScreenState extends State<VideoScreen> { | |||||||
|   void dispose() { |   void dispose() { | ||||||
|     super.dispose(); |     super.dispose(); | ||||||
|     if (isDesktop()) { |     if (isDesktop()) { | ||||||
|       player?.dispose(); |       _player?.dispose(); | ||||||
|     } else { |     } else { | ||||||
|       _chewieController?.videoPlayerController.dispose(); |       _chewieController?.videoPlayerController.dispose(); | ||||||
|       _chewieController?.dispose(); |       _chewieController?.dispose(); | ||||||
| @@ -98,7 +98,7 @@ class _VideoScreenState extends State<VideoScreen> { | |||||||
|   Widget build(BuildContext context) { |   Widget build(BuildContext context) { | ||||||
|     return Scaffold( |     return Scaffold( | ||||||
|       appBar: AppBar( |       appBar: AppBar( | ||||||
|         title: Text(widget.MetaData.title), |         title: Text(widget.metaData.title), | ||||||
|       ), |       ), | ||||||
|       body: Center(child: isDesktop() ? videoDesktop() : videoNotDesktop()), |       body: Center(child: isDesktop() ? videoDesktop() : videoNotDesktop()), | ||||||
|     ); |     ); | ||||||
| @@ -106,10 +106,9 @@ class _VideoScreenState extends State<VideoScreen> { | |||||||
|  |  | ||||||
|   Widget videoDesktop() { |   Widget videoDesktop() { | ||||||
|     return Video( |     return Video( | ||||||
|       player: player, |       player: _player, | ||||||
|       scale: 1.0, // default |       scale: 1.0, // default | ||||||
|       showControls: true, |       showControls: true | ||||||
|       playlistLength: 1, // default |  | ||||||
|     ); |     ); | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -8,6 +8,8 @@ | |||||||
|  |  | ||||||
| #include <dart_vlc/dart_vlc_plugin.h> | #include <dart_vlc/dart_vlc_plugin.h> | ||||||
| #include <flutter_secure_storage_linux/flutter_secure_storage_linux_plugin.h> | #include <flutter_secure_storage_linux/flutter_secure_storage_linux_plugin.h> | ||||||
|  | #include <screen_retriever/screen_retriever_plugin.h> | ||||||
|  | #include <window_manager/window_manager_plugin.h> | ||||||
|  |  | ||||||
| void fl_register_plugins(FlPluginRegistry* registry) { | void fl_register_plugins(FlPluginRegistry* registry) { | ||||||
|   g_autoptr(FlPluginRegistrar) dart_vlc_registrar = |   g_autoptr(FlPluginRegistrar) dart_vlc_registrar = | ||||||
| @@ -16,4 +18,10 @@ void fl_register_plugins(FlPluginRegistry* registry) { | |||||||
|   g_autoptr(FlPluginRegistrar) flutter_secure_storage_linux_registrar = |   g_autoptr(FlPluginRegistrar) flutter_secure_storage_linux_registrar = | ||||||
|       fl_plugin_registry_get_registrar_for_plugin(registry, "FlutterSecureStorageLinuxPlugin"); |       fl_plugin_registry_get_registrar_for_plugin(registry, "FlutterSecureStorageLinuxPlugin"); | ||||||
|   flutter_secure_storage_linux_plugin_register_with_registrar(flutter_secure_storage_linux_registrar); |   flutter_secure_storage_linux_plugin_register_with_registrar(flutter_secure_storage_linux_registrar); | ||||||
|  |   g_autoptr(FlPluginRegistrar) screen_retriever_registrar = | ||||||
|  |       fl_plugin_registry_get_registrar_for_plugin(registry, "ScreenRetrieverPlugin"); | ||||||
|  |   screen_retriever_plugin_register_with_registrar(screen_retriever_registrar); | ||||||
|  |   g_autoptr(FlPluginRegistrar) window_manager_registrar = | ||||||
|  |       fl_plugin_registry_get_registrar_for_plugin(registry, "WindowManagerPlugin"); | ||||||
|  |   window_manager_plugin_register_with_registrar(window_manager_registrar); | ||||||
| } | } | ||||||
|   | |||||||
| @@ -5,6 +5,8 @@ | |||||||
| list(APPEND FLUTTER_PLUGIN_LIST | list(APPEND FLUTTER_PLUGIN_LIST | ||||||
|   dart_vlc |   dart_vlc | ||||||
|   flutter_secure_storage_linux |   flutter_secure_storage_linux | ||||||
|  |   screen_retriever | ||||||
|  |   window_manager | ||||||
| ) | ) | ||||||
|  |  | ||||||
| list(APPEND FLUTTER_FFI_PLUGIN_LIST | list(APPEND FLUTTER_FFI_PLUGIN_LIST | ||||||
|   | |||||||
							
								
								
									
										100
									
								
								pubspec.lock
									
									
									
									
									
								
							
							
						
						
									
										100
									
								
								pubspec.lock
									
									
									
									
									
								
							| @@ -42,7 +42,7 @@ packages: | |||||||
|       name: chewie |       name: chewie | ||||||
|       url: "https://pub.dartlang.org" |       url: "https://pub.dartlang.org" | ||||||
|     source: hosted |     source: hosted | ||||||
|     version: "1.3.2" |     version: "1.3.4" | ||||||
|   clock: |   clock: | ||||||
|     dependency: transitive |     dependency: transitive | ||||||
|     description: |     description: | ||||||
| @@ -63,35 +63,35 @@ packages: | |||||||
|       name: csslib |       name: csslib | ||||||
|       url: "https://pub.dartlang.org" |       url: "https://pub.dartlang.org" | ||||||
|     source: hosted |     source: hosted | ||||||
|     version: "0.17.1" |     version: "0.17.2" | ||||||
|   cupertino_icons: |   cupertino_icons: | ||||||
|     dependency: "direct main" |     dependency: "direct main" | ||||||
|     description: |     description: | ||||||
|       name: cupertino_icons |       name: cupertino_icons | ||||||
|       url: "https://pub.dartlang.org" |       url: "https://pub.dartlang.org" | ||||||
|     source: hosted |     source: hosted | ||||||
|     version: "1.0.4" |     version: "1.0.5" | ||||||
|   dart_vlc: |   dart_vlc: | ||||||
|     dependency: "direct main" |     dependency: "direct main" | ||||||
|     description: |     description: | ||||||
|       name: dart_vlc |       name: dart_vlc | ||||||
|       url: "https://pub.dartlang.org" |       url: "https://pub.dartlang.org" | ||||||
|     source: hosted |     source: hosted | ||||||
|     version: "0.1.9" |     version: "0.3.0" | ||||||
|   dart_vlc_ffi: |   dart_vlc_ffi: | ||||||
|     dependency: transitive |     dependency: transitive | ||||||
|     description: |     description: | ||||||
|       name: dart_vlc_ffi |       name: dart_vlc_ffi | ||||||
|       url: "https://pub.dartlang.org" |       url: "https://pub.dartlang.org" | ||||||
|     source: hosted |     source: hosted | ||||||
|     version: "0.1.5+1" |     version: "0.1.8" | ||||||
|   device_info_plus: |   device_info_plus: | ||||||
|     dependency: "direct main" |     dependency: "direct main" | ||||||
|     description: |     description: | ||||||
|       name: device_info_plus |       name: device_info_plus | ||||||
|       url: "https://pub.dartlang.org" |       url: "https://pub.dartlang.org" | ||||||
|     source: hosted |     source: hosted | ||||||
|     version: "3.2.3" |     version: "4.0.0" | ||||||
|   device_info_plus_linux: |   device_info_plus_linux: | ||||||
|     dependency: transitive |     dependency: transitive | ||||||
|     description: |     description: | ||||||
| @@ -112,7 +112,7 @@ packages: | |||||||
|       name: device_info_plus_platform_interface |       name: device_info_plus_platform_interface | ||||||
|       url: "https://pub.dartlang.org" |       url: "https://pub.dartlang.org" | ||||||
|     source: hosted |     source: hosted | ||||||
|     version: "2.3.0+1" |     version: "2.6.1" | ||||||
|   device_info_plus_web: |   device_info_plus_web: | ||||||
|     dependency: transitive |     dependency: transitive | ||||||
|     description: |     description: | ||||||
| @@ -140,14 +140,14 @@ packages: | |||||||
|       name: ffi |       name: ffi | ||||||
|       url: "https://pub.dartlang.org" |       url: "https://pub.dartlang.org" | ||||||
|     source: hosted |     source: hosted | ||||||
|     version: "1.1.2" |     version: "1.2.1" | ||||||
|   file: |   file: | ||||||
|     dependency: transitive |     dependency: transitive | ||||||
|     description: |     description: | ||||||
|       name: file |       name: file | ||||||
|       url: "https://pub.dartlang.org" |       url: "https://pub.dartlang.org" | ||||||
|     source: hosted |     source: hosted | ||||||
|     version: "6.1.2" |     version: "6.1.4" | ||||||
|   flutter: |   flutter: | ||||||
|     dependency: "direct main" |     dependency: "direct main" | ||||||
|     description: flutter |     description: flutter | ||||||
| @@ -159,28 +159,35 @@ packages: | |||||||
|       name: flutter_lints |       name: flutter_lints | ||||||
|       url: "https://pub.dartlang.org" |       url: "https://pub.dartlang.org" | ||||||
|     source: hosted |     source: hosted | ||||||
|     version: "1.0.4" |     version: "2.0.1" | ||||||
|  |   flutter_native_view: | ||||||
|  |     dependency: transitive | ||||||
|  |     description: | ||||||
|  |       name: flutter_native_view | ||||||
|  |       url: "https://pub.dartlang.org" | ||||||
|  |     source: hosted | ||||||
|  |     version: "0.0.2" | ||||||
|   flutter_secure_storage: |   flutter_secure_storage: | ||||||
|     dependency: "direct main" |     dependency: "direct main" | ||||||
|     description: |     description: | ||||||
|       name: flutter_secure_storage |       name: flutter_secure_storage | ||||||
|       url: "https://pub.dartlang.org" |       url: "https://pub.dartlang.org" | ||||||
|     source: hosted |     source: hosted | ||||||
|     version: "5.0.2" |     version: "6.0.0" | ||||||
|   flutter_secure_storage_linux: |   flutter_secure_storage_linux: | ||||||
|     dependency: transitive |     dependency: transitive | ||||||
|     description: |     description: | ||||||
|       name: flutter_secure_storage_linux |       name: flutter_secure_storage_linux | ||||||
|       url: "https://pub.dartlang.org" |       url: "https://pub.dartlang.org" | ||||||
|     source: hosted |     source: hosted | ||||||
|     version: "1.1.0" |     version: "1.1.1" | ||||||
|   flutter_secure_storage_macos: |   flutter_secure_storage_macos: | ||||||
|     dependency: transitive |     dependency: transitive | ||||||
|     description: |     description: | ||||||
|       name: flutter_secure_storage_macos |       name: flutter_secure_storage_macos | ||||||
|       url: "https://pub.dartlang.org" |       url: "https://pub.dartlang.org" | ||||||
|     source: hosted |     source: hosted | ||||||
|     version: "1.1.0" |     version: "1.1.1" | ||||||
|   flutter_secure_storage_platform_interface: |   flutter_secure_storage_platform_interface: | ||||||
|     dependency: transitive |     dependency: transitive | ||||||
|     description: |     description: | ||||||
| @@ -208,7 +215,7 @@ packages: | |||||||
|       name: flutter_staggered_grid_view |       name: flutter_staggered_grid_view | ||||||
|       url: "https://pub.dartlang.org" |       url: "https://pub.dartlang.org" | ||||||
|     source: hosted |     source: hosted | ||||||
|     version: "0.6.1" |     version: "0.6.2" | ||||||
|   flutter_test: |   flutter_test: | ||||||
|     dependency: "direct dev" |     dependency: "direct dev" | ||||||
|     description: flutter |     description: flutter | ||||||
| @@ -232,14 +239,14 @@ packages: | |||||||
|       name: http |       name: http | ||||||
|       url: "https://pub.dartlang.org" |       url: "https://pub.dartlang.org" | ||||||
|     source: hosted |     source: hosted | ||||||
|     version: "0.13.4" |     version: "0.13.5" | ||||||
|   http_parser: |   http_parser: | ||||||
|     dependency: transitive |     dependency: transitive | ||||||
|     description: |     description: | ||||||
|       name: http_parser |       name: http_parser | ||||||
|       url: "https://pub.dartlang.org" |       url: "https://pub.dartlang.org" | ||||||
|     source: hosted |     source: hosted | ||||||
|     version: "4.0.0" |     version: "4.0.1" | ||||||
|   js: |   js: | ||||||
|     dependency: transitive |     dependency: transitive | ||||||
|     description: |     description: | ||||||
| @@ -253,7 +260,7 @@ packages: | |||||||
|       name: lints |       name: lints | ||||||
|       url: "https://pub.dartlang.org" |       url: "https://pub.dartlang.org" | ||||||
|     source: hosted |     source: hosted | ||||||
|     version: "1.0.1" |     version: "2.0.0" | ||||||
|   logger: |   logger: | ||||||
|     dependency: "direct main" |     dependency: "direct main" | ||||||
|     description: |     description: | ||||||
| @@ -302,49 +309,49 @@ packages: | |||||||
|       name: path_provider |       name: path_provider | ||||||
|       url: "https://pub.dartlang.org" |       url: "https://pub.dartlang.org" | ||||||
|     source: hosted |     source: hosted | ||||||
|     version: "2.0.9" |     version: "2.0.11" | ||||||
|   path_provider_android: |   path_provider_android: | ||||||
|     dependency: transitive |     dependency: transitive | ||||||
|     description: |     description: | ||||||
|       name: path_provider_android |       name: path_provider_android | ||||||
|       url: "https://pub.dartlang.org" |       url: "https://pub.dartlang.org" | ||||||
|     source: hosted |     source: hosted | ||||||
|     version: "2.0.12" |     version: "2.0.19" | ||||||
|   path_provider_ios: |   path_provider_ios: | ||||||
|     dependency: transitive |     dependency: transitive | ||||||
|     description: |     description: | ||||||
|       name: path_provider_ios |       name: path_provider_ios | ||||||
|       url: "https://pub.dartlang.org" |       url: "https://pub.dartlang.org" | ||||||
|     source: hosted |     source: hosted | ||||||
|     version: "2.0.8" |     version: "2.0.11" | ||||||
|   path_provider_linux: |   path_provider_linux: | ||||||
|     dependency: transitive |     dependency: transitive | ||||||
|     description: |     description: | ||||||
|       name: path_provider_linux |       name: path_provider_linux | ||||||
|       url: "https://pub.dartlang.org" |       url: "https://pub.dartlang.org" | ||||||
|     source: hosted |     source: hosted | ||||||
|     version: "2.1.5" |     version: "2.1.7" | ||||||
|   path_provider_macos: |   path_provider_macos: | ||||||
|     dependency: transitive |     dependency: transitive | ||||||
|     description: |     description: | ||||||
|       name: path_provider_macos |       name: path_provider_macos | ||||||
|       url: "https://pub.dartlang.org" |       url: "https://pub.dartlang.org" | ||||||
|     source: hosted |     source: hosted | ||||||
|     version: "2.0.5" |     version: "2.0.6" | ||||||
|   path_provider_platform_interface: |   path_provider_platform_interface: | ||||||
|     dependency: transitive |     dependency: transitive | ||||||
|     description: |     description: | ||||||
|       name: path_provider_platform_interface |       name: path_provider_platform_interface | ||||||
|       url: "https://pub.dartlang.org" |       url: "https://pub.dartlang.org" | ||||||
|     source: hosted |     source: hosted | ||||||
|     version: "2.0.1" |     version: "2.0.4" | ||||||
|   path_provider_windows: |   path_provider_windows: | ||||||
|     dependency: transitive |     dependency: transitive | ||||||
|     description: |     description: | ||||||
|       name: path_provider_windows |       name: path_provider_windows | ||||||
|       url: "https://pub.dartlang.org" |       url: "https://pub.dartlang.org" | ||||||
|     source: hosted |     source: hosted | ||||||
|     version: "2.0.5" |     version: "2.0.7" | ||||||
|   platform: |   platform: | ||||||
|     dependency: transitive |     dependency: transitive | ||||||
|     description: |     description: | ||||||
| @@ -372,7 +379,14 @@ packages: | |||||||
|       name: provider |       name: provider | ||||||
|       url: "https://pub.dartlang.org" |       url: "https://pub.dartlang.org" | ||||||
|     source: hosted |     source: hosted | ||||||
|     version: "6.0.2" |     version: "6.0.3" | ||||||
|  |   screen_retriever: | ||||||
|  |     dependency: transitive | ||||||
|  |     description: | ||||||
|  |       name: screen_retriever | ||||||
|  |       url: "https://pub.dartlang.org" | ||||||
|  |     source: hosted | ||||||
|  |     version: "0.1.2" | ||||||
|   sky_engine: |   sky_engine: | ||||||
|     dependency: transitive |     dependency: transitive | ||||||
|     description: flutter |     description: flutter | ||||||
| @@ -426,7 +440,7 @@ packages: | |||||||
|       name: typed_data |       name: typed_data | ||||||
|       url: "https://pub.dartlang.org" |       url: "https://pub.dartlang.org" | ||||||
|     source: hosted |     source: hosted | ||||||
|     version: "1.3.0" |     version: "1.3.1" | ||||||
|   vector_math: |   vector_math: | ||||||
|     dependency: transitive |     dependency: transitive | ||||||
|     description: |     description: | ||||||
| @@ -434,55 +448,48 @@ packages: | |||||||
|       url: "https://pub.dartlang.org" |       url: "https://pub.dartlang.org" | ||||||
|     source: hosted |     source: hosted | ||||||
|     version: "2.1.2" |     version: "2.1.2" | ||||||
|   very_good_analysis: |  | ||||||
|     dependency: transitive |  | ||||||
|     description: |  | ||||||
|       name: very_good_analysis |  | ||||||
|       url: "https://pub.dartlang.org" |  | ||||||
|     source: hosted |  | ||||||
|     version: "2.4.0" |  | ||||||
|   video_player: |   video_player: | ||||||
|     dependency: "direct main" |     dependency: "direct main" | ||||||
|     description: |     description: | ||||||
|       name: video_player |       name: video_player | ||||||
|       url: "https://pub.dartlang.org" |       url: "https://pub.dartlang.org" | ||||||
|     source: hosted |     source: hosted | ||||||
|     version: "2.3.0" |     version: "2.4.7" | ||||||
|   video_player_android: |   video_player_android: | ||||||
|     dependency: transitive |     dependency: transitive | ||||||
|     description: |     description: | ||||||
|       name: video_player_android |       name: video_player_android | ||||||
|       url: "https://pub.dartlang.org" |       url: "https://pub.dartlang.org" | ||||||
|     source: hosted |     source: hosted | ||||||
|     version: "2.3.2" |     version: "2.3.9" | ||||||
|   video_player_avfoundation: |   video_player_avfoundation: | ||||||
|     dependency: transitive |     dependency: transitive | ||||||
|     description: |     description: | ||||||
|       name: video_player_avfoundation |       name: video_player_avfoundation | ||||||
|       url: "https://pub.dartlang.org" |       url: "https://pub.dartlang.org" | ||||||
|     source: hosted |     source: hosted | ||||||
|     version: "2.3.1" |     version: "2.3.5" | ||||||
|   video_player_platform_interface: |   video_player_platform_interface: | ||||||
|     dependency: transitive |     dependency: transitive | ||||||
|     description: |     description: | ||||||
|       name: video_player_platform_interface |       name: video_player_platform_interface | ||||||
|       url: "https://pub.dartlang.org" |       url: "https://pub.dartlang.org" | ||||||
|     source: hosted |     source: hosted | ||||||
|     version: "5.1.1" |     version: "5.1.4" | ||||||
|   video_player_web: |   video_player_web: | ||||||
|     dependency: transitive |     dependency: transitive | ||||||
|     description: |     description: | ||||||
|       name: video_player_web |       name: video_player_web | ||||||
|       url: "https://pub.dartlang.org" |       url: "https://pub.dartlang.org" | ||||||
|     source: hosted |     source: hosted | ||||||
|     version: "2.0.7" |     version: "2.0.12" | ||||||
|   wakelock: |   wakelock: | ||||||
|     dependency: transitive |     dependency: transitive | ||||||
|     description: |     description: | ||||||
|       name: wakelock |       name: wakelock | ||||||
|       url: "https://pub.dartlang.org" |       url: "https://pub.dartlang.org" | ||||||
|     source: hosted |     source: hosted | ||||||
|     version: "0.6.1+2" |     version: "0.6.2" | ||||||
|   wakelock_macos: |   wakelock_macos: | ||||||
|     dependency: transitive |     dependency: transitive | ||||||
|     description: |     description: | ||||||
| @@ -517,14 +524,21 @@ packages: | |||||||
|       name: win32 |       name: win32 | ||||||
|       url: "https://pub.dartlang.org" |       url: "https://pub.dartlang.org" | ||||||
|     source: hosted |     source: hosted | ||||||
|     version: "2.5.1" |     version: "2.6.1" | ||||||
|  |   window_manager: | ||||||
|  |     dependency: transitive | ||||||
|  |     description: | ||||||
|  |       name: window_manager | ||||||
|  |       url: "https://pub.dartlang.org" | ||||||
|  |     source: hosted | ||||||
|  |     version: "0.2.6" | ||||||
|   xdg_directories: |   xdg_directories: | ||||||
|     dependency: transitive |     dependency: transitive | ||||||
|     description: |     description: | ||||||
|       name: xdg_directories |       name: xdg_directories | ||||||
|       url: "https://pub.dartlang.org" |       url: "https://pub.dartlang.org" | ||||||
|     source: hosted |     source: hosted | ||||||
|     version: "0.2.0+1" |     version: "0.2.0+2" | ||||||
| sdks: | sdks: | ||||||
|   dart: ">=2.17.0-0 <3.0.0" |   dart: ">=2.17.0 <3.0.0" | ||||||
|   flutter: ">=2.8.0" |   flutter: ">=2.10.0" | ||||||
|   | |||||||
| @@ -34,12 +34,12 @@ dependencies: | |||||||
|   # The following adds the Cupertino Icons font to your application. |   # The following adds the Cupertino Icons font to your application. | ||||||
|   # Use with the CupertinoIcons class for iOS style icons. |   # Use with the CupertinoIcons class for iOS style icons. | ||||||
|   cupertino_icons: ^1.0.2 |   cupertino_icons: ^1.0.2 | ||||||
|   flutter_secure_storage: ^5.0.2 |   flutter_secure_storage: ^6.0.0 | ||||||
|   logger: ^1.1.0 |   logger: ^1.1.0 | ||||||
|   http: ^0.13.4 |   http: ^0.13.4 | ||||||
|   flutter_staggered_grid_view: ^0.6.1 |   flutter_staggered_grid_view: ^0.6.1 | ||||||
|   dart_vlc: ^0.1.9 |   dart_vlc: ^0.3.0 | ||||||
|   device_info_plus: ^3.2.3 |   device_info_plus: ^4.0.0 | ||||||
|   video_player: ^2.3.0 |   video_player: ^2.3.0 | ||||||
|   chewie: ^1.3.2 |   chewie: ^1.3.2 | ||||||
|  |  | ||||||
| @@ -52,7 +52,7 @@ dev_dependencies: | |||||||
|   # activated in the `analysis_options.yaml` file located at the root of your |   # activated in the `analysis_options.yaml` file located at the root of your | ||||||
|   # package. See that file for information about deactivating specific lint |   # package. See that file for information about deactivating specific lint | ||||||
|   # rules and activating additional ones. |   # rules and activating additional ones. | ||||||
|   flutter_lints: ^1.0.0 |   flutter_lints: ^2.0.1 | ||||||
|  |  | ||||||
| # For information on the generic Dart part of this file, see the | # For information on the generic Dart part of this file, see the | ||||||
| # following page: https://dart.dev/tools/pub/pubspec | # following page: https://dart.dev/tools/pub/pubspec | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user