@@ -23,6 +23,7 @@ import 'dart:ui' as ui;
23
23
import 'package:flutter/material.dart' ;
24
24
import 'package:dart_vlc/dart_vlc.dart' ;
25
25
import 'package:dart_vlc/src/widgets/controls.dart' ;
26
+ import 'package:window_manager/window_manager.dart' ;
26
27
27
28
/// Internally used map to keep [GlobalKey] s for [Video] 's [ControlState] s.
28
29
Map <int , GlobalKey <ControlState >> controls = {};
@@ -100,6 +101,8 @@ class Video extends StatefulWidget {
100
101
this .showTimeLeft = false ,
101
102
this .progressBarTextStyle = const TextStyle (),
102
103
this .filterQuality = FilterQuality .low,
104
+ this .showFullscreenButton = false ,
105
+ this .fillColor: Colors .black,
103
106
}) : player = player ?? players[playerId]! as Player ,
104
107
super (key: key);
105
108
@@ -168,6 +171,12 @@ class Video extends StatefulWidget {
168
171
/// instead of the total time, set this to true
169
172
final bool showTimeLeft;
170
173
174
+ /// Whether to show the fullscreen button.
175
+ final bool showFullscreenButton;
176
+
177
+ /// Fill color.
178
+ final Color fillColor;
179
+
171
180
_VideoStateBase createState () => _VideoStateTexture ();
172
181
}
173
182
@@ -183,17 +192,67 @@ abstract class _VideoStateBase extends State<Video>
183
192
if (widget.showControls) controls[playerId] = controlKey;
184
193
}
185
194
195
+ void enterFullscreen () async {
196
+ await windowManager.ensureInitialized ();
197
+ await windowManager.setFullScreen (true );
198
+ Navigator .of (context, rootNavigator: true ).push (
199
+ PageRouteBuilder (
200
+ transitionDuration: Duration .zero,
201
+ reverseTransitionDuration: Duration .zero,
202
+ pageBuilder: (_, __, ___) => Scaffold (
203
+ body: Container (
204
+ height: double .infinity,
205
+ width: double .infinity,
206
+ color: widget.fillColor,
207
+ child: widget.showControls
208
+ ? Control (
209
+ player: widget.player,
210
+ enterFullscreen: enterFullscreen,
211
+ exitFullscreen: exitFullscreen,
212
+ isFullscreen: true ,
213
+ progressBarThumbRadius: widget.progressBarThumbRadius,
214
+ progressBarThumbGlowRadius:
215
+ widget.progressBarThumbGlowRadius,
216
+ progressBarActiveColor: widget.progressBarActiveColor,
217
+ progressBarInactiveColor: widget.progressBarInactiveColor,
218
+ progressBarThumbColor: widget.progressBarThumbColor,
219
+ progressBarThumbGlowColor: widget.progressBarThumbGlowColor,
220
+ volumeActiveColor: widget.volumeActiveColor,
221
+ volumeInactiveColor: widget.volumeInactiveColor,
222
+ volumeBackgroundColor: widget.volumeBackgroundColor,
223
+ volumeThumbColor: widget.volumeThumbColor,
224
+ showTimeLeft: widget.showTimeLeft,
225
+ progressBarTextStyle: widget.progressBarTextStyle,
226
+ child: present (),
227
+ )
228
+ : present (),
229
+ ),
230
+ ),
231
+ ),
232
+ );
233
+ }
234
+
235
+ void exitFullscreen () async {
236
+ await windowManager.ensureInitialized ();
237
+ await windowManager.setFullScreen (false );
238
+ Navigator .of (context, rootNavigator: false ).pop ();
239
+ }
240
+
186
241
@override
187
242
Widget build (BuildContext context) {
188
243
super .build (context);
189
244
return Container (
190
245
width: widget.width ?? double .infinity,
191
246
height: widget.height ?? double .infinity,
192
- color: Colors .transparent ,
247
+ color: widget.fillColor ,
193
248
child: widget.showControls
194
249
? Control (
195
250
key: controlKey,
196
251
player: widget.player,
252
+ enterFullscreen: enterFullscreen,
253
+ exitFullscreen: exitFullscreen,
254
+ isFullscreen: false ,
255
+ showFullscreenButton: widget.showFullscreenButton,
197
256
progressBarThumbRadius: widget.progressBarThumbRadius,
198
257
progressBarThumbGlowRadius: widget.progressBarThumbGlowRadius,
199
258
progressBarActiveColor: widget.progressBarActiveColor,
0 commit comments