@@ -24,74 +24,75 @@ class _State extends State<AudioScreen> {
2424
2525 @override
2626 Widget build (BuildContext context) => Scaffold (
27- appBar: AppBar (
28- title: const Text ('AudioScreen' ),
27+ appBar: AppBar (
28+ title: const Text ('AudioScreen' ),
29+ ),
30+ body: ListView (
31+ children: < Widget > [
32+ CheckboxListTile (
33+ value: autoplay,
34+ onChanged: (v) => _setState (() => autoplay = v == true ),
35+ title: const Text ('autoplay' ),
2936 ),
30- body: ListView (
31- children: < Widget > [
32- CheckboxListTile (
33- value: autoplay,
34- onChanged: (v) => _setState (() => autoplay = v == true ),
35- title: const Text ('autoplay' ),
36- ),
37- CheckboxListTile (
38- value: loop,
39- onChanged: (v) => _setState (() => loop = v == true ),
40- title: const Text ('loop' ),
41- ),
42- CheckboxListTile (
43- value: muted,
44- onChanged: (v) => _setState (() => muted = v == true ),
45- title: const Text ('muted' ),
46- ),
47- CheckboxListTile (
48- value: preload,
49- onChanged: (v) => _setState (() => preload = v == true ),
50- title: const Text ('preload' ),
51- ),
52- ListTile (
53- title: const Text ('HTML:' ),
54- subtitle: Text (_html),
55- ),
56- ListTile (
57- title: const Text ('Rendered:' ),
58- subtitle: HtmlWidget (
59- _html,
60- key: Key (_html),
61- baseUrl: Uri .parse (
62- 'https://interactive-examples.mdn.mozilla.net/pages/tabbed/audio.html' ,
63- ),
64- ),
37+ CheckboxListTile (
38+ value: loop,
39+ onChanged: (v) => _setState (() => loop = v == true ),
40+ title: const Text ('loop' ),
41+ ),
42+ CheckboxListTile (
43+ value: muted,
44+ onChanged: (v) => _setState (() => muted = v == true ),
45+ title: const Text ('muted' ),
46+ ),
47+ CheckboxListTile (
48+ value: preload,
49+ onChanged: (v) => _setState (() => preload = v == true ),
50+ title: const Text ('preload' ),
51+ ),
52+ ListTile (
53+ title: const Text ('HTML:' ),
54+ subtitle: Text (_html),
55+ ),
56+ ListTile (
57+ title: const Text ('Rendered:' ),
58+ subtitle: HtmlWidget (
59+ _html,
60+ key: Key (_html),
61+ baseUrl: Uri .parse (
62+ 'https://interactive-examples.mdn.mozilla.net/pages/tabbed/audio.html' ,
6563 ),
66- const Center (child: Text ('----' )),
67- ],
64+ ),
6865 ),
69- );
66+ const Center (child: Text ('----' )),
67+ ],
68+ ),
69+ );
7070
7171 void _setState (VoidCallback callback) => setState (() {
72- callback ();
72+ callback ();
7373
74- final attributes = < String > [];
75- if (autoplay) {
76- attributes.add ('autoplay' );
77- }
78- if (loop) {
79- attributes.add ('loop' );
80- }
81- if (muted) {
82- attributes.add ('muted' );
83- }
84- if (preload) {
85- attributes.add ('preload' );
86- }
74+ final attributes = < String > [];
75+ if (autoplay) {
76+ attributes.add ('autoplay' );
77+ }
78+ if (loop) {
79+ attributes.add ('loop' );
80+ }
81+ if (muted) {
82+ attributes.add ('muted' );
83+ }
84+ if (preload) {
85+ attributes.add ('preload' );
86+ }
8787
88- _html = '''
88+ _html =
89+ '''
8990<figure>
9091 <audio src="/media/cc0-audio/t-rex-roar.mp3" ${attributes .join (' ' )}>
9192 Sorry, <code>AUDIO</code> tag is not supported.
9293 </audio>
9394 <figcaption>Source: <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/audio">developer.mozilla.org</a></figcaption>
9495</figure>
9596''' ;
96- });
97+ });
9798}
0 commit comments