@@ -6,10 +6,7 @@ import 'package:flutter/material.dart';
6
6
import 'package:video_player/video_player.dart' ;
7
7
8
8
class ChewieDemo extends StatefulWidget {
9
- const ChewieDemo ({
10
- super .key,
11
- this .title = 'Chewie Demo' ,
12
- });
9
+ const ChewieDemo ({super .key, this .title = 'Chewie Demo' });
13
10
14
11
final String title;
15
12
@@ -47,13 +44,15 @@ class _ChewieDemoState extends State<ChewieDemo> {
47
44
];
48
45
49
46
Future <void > initializePlayer () async {
50
- _videoPlayerController1 =
51
- VideoPlayerController .networkUrl (Uri .parse (srcs[currPlayIndex]));
52
- _videoPlayerController2 =
53
- VideoPlayerController .networkUrl (Uri .parse (srcs[currPlayIndex]));
47
+ _videoPlayerController1 = VideoPlayerController .networkUrl (
48
+ Uri .parse (srcs[currPlayIndex]),
49
+ );
50
+ _videoPlayerController2 = VideoPlayerController .networkUrl (
51
+ Uri .parse (srcs[currPlayIndex]),
52
+ );
54
53
await Future .wait ([
55
54
_videoPlayerController1.initialize (),
56
- _videoPlayerController2.initialize ()
55
+ _videoPlayerController2.initialize (),
57
56
]);
58
57
_createChewieController ();
59
58
setState (() {});
@@ -93,7 +92,7 @@ class _ChewieDemoState extends State<ChewieDemo> {
93
92
TextSpan (
94
93
text: 'subtitles' ,
95
94
style: TextStyle (color: Colors .blue, fontSize: 18 ),
96
- )
95
+ ),
97
96
],
98
97
),
99
98
),
@@ -127,17 +126,17 @@ class _ChewieDemoState extends State<ChewieDemo> {
127
126
},
128
127
subtitle: Subtitles (subtitles),
129
128
showSubtitles: true ,
130
- subtitleBuilder: (context, dynamic subtitle) => Container (
131
- padding : const EdgeInsets . all ( 10.0 ),
132
- child : subtitle is InlineSpan
133
- ? RichText (
134
- text : subtitle,
135
- )
136
- : Text (
137
- subtitle.toString (),
138
- style: const TextStyle (color: Colors .black),
139
- ),
140
- ),
129
+ subtitleBuilder:
130
+ (context, dynamic subtitle) => Container (
131
+ padding : const EdgeInsets . all ( 10.0 ),
132
+ child :
133
+ subtitle is InlineSpan
134
+ ? RichText (text : subtitle )
135
+ : Text (
136
+ subtitle.toString (),
137
+ style: const TextStyle (color: Colors .black),
138
+ ),
139
+ ),
141
140
142
141
hideControlsTimer: const Duration (seconds: 1 ),
143
142
@@ -176,27 +175,26 @@ class _ChewieDemoState extends State<ChewieDemo> {
176
175
platform: _platform ?? Theme .of (context).platform,
177
176
),
178
177
home: Scaffold (
179
- appBar: AppBar (
180
- title: Text (widget.title),
181
- ),
178
+ appBar: AppBar (title: Text (widget.title)),
182
179
body: Column (
183
180
children: < Widget > [
184
181
Expanded (
185
182
child: Center (
186
- child: _chewieController != null &&
187
- _chewieController!
188
- .videoPlayerController.value.isInitialized
189
- ? Chewie (
190
- controller: _chewieController! ,
191
- )
192
- : const Column (
193
- mainAxisAlignment: MainAxisAlignment .center,
194
- children: [
195
- CircularProgressIndicator (),
196
- SizedBox (height: 20 ),
197
- Text ('Loading' ),
198
- ],
199
- ),
183
+ child:
184
+ _chewieController != null &&
185
+ _chewieController!
186
+ .videoPlayerController
187
+ .value
188
+ .isInitialized
189
+ ? Chewie (controller: _chewieController! )
190
+ : const Column (
191
+ mainAxisAlignment: MainAxisAlignment .center,
192
+ children: [
193
+ CircularProgressIndicator (),
194
+ SizedBox (height: 20 ),
195
+ Text ('Loading' ),
196
+ ],
197
+ ),
200
198
),
201
199
),
202
200
TextButton (
@@ -261,7 +259,7 @@ class _ChewieDemoState extends State<ChewieDemo> {
261
259
child: Text ("Portrait Video" ),
262
260
),
263
261
),
264
- )
262
+ ),
265
263
],
266
264
),
267
265
Row (
@@ -291,7 +289,7 @@ class _ChewieDemoState extends State<ChewieDemo> {
291
289
child: Text ("iOS controls" ),
292
290
),
293
291
),
294
- )
292
+ ),
295
293
],
296
294
),
297
295
Row (
@@ -324,7 +322,7 @@ class _ChewieDemoState extends State<ChewieDemo> {
324
322
}
325
323
},
326
324
),
327
- )
325
+ ),
328
326
],
329
327
),
330
328
),
@@ -369,14 +367,15 @@ class _DelaySliderState extends State<DelaySlider> {
369
367
),
370
368
trailing: IconButton (
371
369
icon: const Icon (Icons .save),
372
- onPressed: saved
373
- ? null
374
- : () {
375
- widget.onSave (delay);
376
- setState (() {
377
- saved = true ;
378
- });
379
- },
370
+ onPressed:
371
+ saved
372
+ ? null
373
+ : () {
374
+ widget.onSave (delay);
375
+ setState (() {
376
+ saved = true ;
377
+ });
378
+ },
380
379
),
381
380
);
382
381
}
0 commit comments