@@ -6,10 +6,7 @@ import 'package:flutter/material.dart';
66import 'package:video_player/video_player.dart' ;
77
88class ChewieDemo extends StatefulWidget {
9- const ChewieDemo ({
10- super .key,
11- this .title = 'Chewie Demo' ,
12- });
9+ const ChewieDemo ({super .key, this .title = 'Chewie Demo' });
1310
1411 final String title;
1512
@@ -47,13 +44,15 @@ class _ChewieDemoState extends State<ChewieDemo> {
4744 ];
4845
4946 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+ );
5453 await Future .wait ([
5554 _videoPlayerController1.initialize (),
56- _videoPlayerController2.initialize ()
55+ _videoPlayerController2.initialize (),
5756 ]);
5857 _createChewieController ();
5958 setState (() {});
@@ -93,7 +92,7 @@ class _ChewieDemoState extends State<ChewieDemo> {
9392 TextSpan (
9493 text: 'subtitles' ,
9594 style: TextStyle (color: Colors .blue, fontSize: 18 ),
96- )
95+ ),
9796 ],
9897 ),
9998 ),
@@ -127,17 +126,17 @@ class _ChewieDemoState extends State<ChewieDemo> {
127126 },
128127 subtitle: Subtitles (subtitles),
129128 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+ ),
141140
142141 hideControlsTimer: const Duration (seconds: 1 ),
143142
@@ -176,27 +175,26 @@ class _ChewieDemoState extends State<ChewieDemo> {
176175 platform: _platform ?? Theme .of (context).platform,
177176 ),
178177 home: Scaffold (
179- appBar: AppBar (
180- title: Text (widget.title),
181- ),
178+ appBar: AppBar (title: Text (widget.title)),
182179 body: Column (
183180 children: < Widget > [
184181 Expanded (
185182 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+ ),
200198 ),
201199 ),
202200 TextButton (
@@ -261,7 +259,7 @@ class _ChewieDemoState extends State<ChewieDemo> {
261259 child: Text ("Portrait Video" ),
262260 ),
263261 ),
264- )
262+ ),
265263 ],
266264 ),
267265 Row (
@@ -291,7 +289,7 @@ class _ChewieDemoState extends State<ChewieDemo> {
291289 child: Text ("iOS controls" ),
292290 ),
293291 ),
294- )
292+ ),
295293 ],
296294 ),
297295 Row (
@@ -324,7 +322,7 @@ class _ChewieDemoState extends State<ChewieDemo> {
324322 }
325323 },
326324 ),
327- )
325+ ),
328326 ],
329327 ),
330328 ),
@@ -369,14 +367,15 @@ class _DelaySliderState extends State<DelaySlider> {
369367 ),
370368 trailing: IconButton (
371369 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+ },
380379 ),
381380 );
382381 }
0 commit comments