Skip to content

Commit ac17970

Browse files
author
k.akmalova
committed
refactor: refactored
1 parent de3e76b commit ac17970

File tree

1 file changed

+149
-149
lines changed

1 file changed

+149
-149
lines changed

example/lib/app/app.dart

Lines changed: 149 additions & 149 deletions
Original file line numberDiff line numberDiff line change
@@ -175,157 +175,157 @@ class _ChewieDemoState extends State<ChewieDemo> {
175175
platform: _platform ?? Theme.of(context).platform,
176176
),
177177
home: Scaffold(
178-
appBar: AppBar(
179-
title: Text(widget.title),
180-
),
181-
body: Column(
182-
children: <Widget>[
183-
Expanded(
184-
child: Center(
185-
child: _chewieController != null &&
186-
_chewieController!
187-
.videoPlayerController.value.isInitialized
188-
? Chewie(
189-
controller: _chewieController!,
190-
)
191-
: const Column(
192-
mainAxisAlignment: MainAxisAlignment.center,
193-
children: [
194-
CircularProgressIndicator(),
195-
SizedBox(height: 20),
196-
Text('Loading'),
197-
],
198-
),
199-
),
200-
),
201-
TextButton(
202-
onPressed: () {
203-
_chewieController?.enterFullScreen();
204-
},
205-
child: const Text('Fullscreen'),
206-
),
207-
Row(
208-
children: <Widget>[
209-
Expanded(
210-
child: TextButton(
211-
onPressed: () {
212-
setState(() {
213-
_videoPlayerController1.pause();
214-
_videoPlayerController1.seekTo(Duration.zero);
215-
_createChewieController();
216-
});
217-
},
218-
child: const Padding(
219-
padding: EdgeInsets.symmetric(vertical: 16.0),
220-
child: Text("Landscape Video"),
221-
),
222-
),
223-
),
224-
Expanded(
225-
child: TextButton(
226-
onPressed: () {
227-
setState(() {
228-
_videoPlayerController2.pause();
229-
_videoPlayerController2.seekTo(Duration.zero);
230-
_chewieController = _chewieController!.copyWith(
231-
videoPlayerController: _videoPlayerController2,
232-
autoPlay: true,
233-
looping: true,
234-
/* subtitle: Subtitles([
235-
Subtitle(
236-
index: 0,
237-
start: Duration.zero,
238-
end: const Duration(seconds: 10),
239-
text: 'Hello from subtitles',
240-
),
241-
Subtitle(
242-
index: 0,
243-
start: const Duration(seconds: 10),
244-
end: const Duration(seconds: 20),
245-
text: 'Whats up? :)',
246-
),
247-
]),
248-
subtitleBuilder: (context, subtitle) => Container(
249-
padding: const EdgeInsets.all(10.0),
250-
child: Text(
251-
subtitle,
252-
style: const TextStyle(color: Colors.white),
253-
),
254-
), */
255-
);
256-
});
257-
},
258-
child: const Padding(
259-
padding: EdgeInsets.symmetric(vertical: 16.0),
260-
child: Text("Portrait Video"),
261-
),
262-
),
263-
)
264-
],
265-
),
266-
Row(
267-
children: <Widget>[
268-
Expanded(
269-
child: TextButton(
270-
onPressed: () {
271-
setState(() {
272-
_platform = TargetPlatform.android;
273-
});
274-
},
275-
child: const Padding(
276-
padding: EdgeInsets.symmetric(vertical: 16.0),
277-
child: Text("Android controls"),
278-
),
279-
),
280-
),
281-
Expanded(
282-
child: TextButton(
283-
onPressed: () {
284-
setState(() {
285-
_platform = TargetPlatform.iOS;
286-
});
287-
},
288-
child: const Padding(
289-
padding: EdgeInsets.symmetric(vertical: 16.0),
290-
child: Text("iOS controls"),
291-
),
292-
),
293-
)
294-
],
295-
),
296-
Row(
297-
children: <Widget>[
298-
Expanded(
299-
child: TextButton(
300-
onPressed: () {
301-
setState(() {
302-
_platform = TargetPlatform.windows;
303-
});
304-
},
305-
child: const Padding(
306-
padding: EdgeInsets.symmetric(vertical: 16.0),
307-
child: Text("Desktop controls"),
308-
),
309-
),
310-
),
311-
],
312-
),
313-
if (Platform.isAndroid)
314-
ListTile(
315-
title: const Text("Delay"),
316-
subtitle: DelaySlider(
178+
appBar: AppBar(
179+
title: Text(widget.title),
180+
),
181+
body: Column(
182+
children: <Widget>[
183+
Expanded(
184+
child: Center(
185+
child: _chewieController != null &&
186+
_chewieController!
187+
.videoPlayerController.value.isInitialized
188+
? Chewie(
189+
controller: _chewieController!,
190+
)
191+
: const Column(
192+
mainAxisAlignment: MainAxisAlignment.center,
193+
children: [
194+
CircularProgressIndicator(),
195+
SizedBox(height: 20),
196+
Text('Loading'),
197+
],
198+
),
199+
),
200+
),
201+
TextButton(
202+
onPressed: () {
203+
_chewieController?.enterFullScreen();
204+
},
205+
child: const Text('Fullscreen'),
206+
),
207+
Row(
208+
children: <Widget>[
209+
Expanded(
210+
child: TextButton(
211+
onPressed: () {
212+
setState(() {
213+
_videoPlayerController1.pause();
214+
_videoPlayerController1.seekTo(Duration.zero);
215+
_createChewieController();
216+
});
217+
},
218+
child: const Padding(
219+
padding: EdgeInsets.symmetric(vertical: 16.0),
220+
child: Text("Landscape Video"),
221+
),
222+
),
223+
),
224+
Expanded(
225+
child: TextButton(
226+
onPressed: () {
227+
setState(() {
228+
_videoPlayerController2.pause();
229+
_videoPlayerController2.seekTo(Duration.zero);
230+
_chewieController = _chewieController!.copyWith(
231+
videoPlayerController: _videoPlayerController2,
232+
autoPlay: true,
233+
looping: true,
234+
/* subtitle: Subtitles([
235+
Subtitle(
236+
index: 0,
237+
start: Duration.zero,
238+
end: const Duration(seconds: 10),
239+
text: 'Hello from subtitles',
240+
),
241+
Subtitle(
242+
index: 0,
243+
start: const Duration(seconds: 10),
244+
end: const Duration(seconds: 20),
245+
text: 'Whats up? :)',
246+
),
247+
]),
248+
subtitleBuilder: (context, subtitle) => Container(
249+
padding: const EdgeInsets.all(10.0),
250+
child: Text(
251+
subtitle,
252+
style: const TextStyle(color: Colors.white),
253+
),
254+
), */
255+
);
256+
});
257+
},
258+
child: const Padding(
259+
padding: EdgeInsets.symmetric(vertical: 16.0),
260+
child: Text("Portrait Video"),
261+
),
262+
),
263+
)
264+
],
265+
),
266+
Row(
267+
children: <Widget>[
268+
Expanded(
269+
child: TextButton(
270+
onPressed: () {
271+
setState(() {
272+
_platform = TargetPlatform.android;
273+
});
274+
},
275+
child: const Padding(
276+
padding: EdgeInsets.symmetric(vertical: 16.0),
277+
child: Text("Android controls"),
278+
),
279+
),
280+
),
281+
Expanded(
282+
child: TextButton(
283+
onPressed: () {
284+
setState(() {
285+
_platform = TargetPlatform.iOS;
286+
});
287+
},
288+
child: const Padding(
289+
padding: EdgeInsets.symmetric(vertical: 16.0),
290+
child: Text("iOS controls"),
291+
),
292+
),
293+
)
294+
],
295+
),
296+
Row(
297+
children: <Widget>[
298+
Expanded(
299+
child: TextButton(
300+
onPressed: () {
301+
setState(() {
302+
_platform = TargetPlatform.windows;
303+
});
304+
},
305+
child: const Padding(
306+
padding: EdgeInsets.symmetric(vertical: 16.0),
307+
child: Text("Desktop controls"),
308+
),
309+
),
310+
),
311+
],
312+
),
313+
if (Platform.isAndroid)
314+
ListTile(
315+
title: const Text("Delay"),
316+
subtitle: DelaySlider(
317317
delay:
318318
_chewieController?.progressIndicatorDelay?.inMilliseconds,
319-
onSave: (delay) async {
320-
if (delay != null) {
321-
bufferDelay = delay == 0 ? null : delay;
322-
await initializePlayer();
323-
}
324-
},
325-
),
326-
)
327-
],
328-
),
319+
onSave: (delay) async {
320+
if (delay != null) {
321+
bufferDelay = delay == 0 ? null : delay;
322+
await initializePlayer();
323+
}
324+
},
325+
),
326+
)
327+
],
328+
),
329329
),
330330
);
331331
}

0 commit comments

Comments
 (0)