Skip to content

Commit 233a326

Browse files
update code for new lint
1 parent b9991e9 commit 233a326

29 files changed

+1367
-1134
lines changed

flutter_vlc_player/example/ios/Runner.xcodeproj/project.pbxproj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
archiveVersion = 1;
44
classes = {
55
};
6-
objectVersion = 51;
6+
objectVersion = 54;
77
objects = {
88

99
/* Begin PBXBuildFile section */
@@ -211,6 +211,7 @@
211211
/* Begin PBXShellScriptBuildPhase section */
212212
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
213213
isa = PBXShellScriptBuildPhase;
214+
alwaysOutOfDate = 1;
214215
buildActionMask = 2147483647;
215216
files = (
216217
);
@@ -264,6 +265,7 @@
264265
};
265266
9740EEB61CF901F6004384FC /* Run Script */ = {
266267
isa = PBXShellScriptBuildPhase;
268+
alwaysOutOfDate = 1;
267269
buildActionMask = 2147483647;
268270
files = (
269271
);

flutter_vlc_player/example/ios/Runner/Info.plist

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,5 +54,7 @@
5454
</array>
5555
<key>UIViewControllerBasedStatusBarAppearance</key>
5656
<false/>
57+
<key>UIApplicationSupportsIndirectInputEvents</key>
58+
<true/>
5759
</dict>
5860
</plist>

flutter_vlc_player/example/lib/controls_overlay.dart

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
import 'package:flutter/material.dart';
2+
23
import 'package:flutter_vlc_player/flutter_vlc_player.dart';
34

45
class ControlsOverlay extends StatelessWidget {
5-
const ControlsOverlay({Key key, this.controller}) : super(key: key);
6-
7-
final VlcPlayerController controller;
8-
96
static const double _playButtonIconSize = 80;
107
static const double _replayButtonIconSize = 100;
118
static const double _seekButtonIconSize = 48;
@@ -15,11 +12,15 @@ class ControlsOverlay extends StatelessWidget {
1512

1613
static const Color _iconColor = Colors.white;
1714

15+
final VlcPlayerController controller;
16+
17+
const ControlsOverlay({Key key, this.controller}) : super(key: key);
18+
1819
@override
1920
Widget build(BuildContext context) {
2021
return AnimatedSwitcher(
21-
duration: Duration(milliseconds: 50),
22-
reverseDuration: Duration(milliseconds: 200),
22+
duration: const Duration(milliseconds: 50),
23+
reverseDuration: const Duration(milliseconds: 200),
2324
child: Builder(
2425
builder: (ctx) {
2526
if (controller.value.isEnded || controller.value.hasError) {
@@ -29,7 +30,7 @@ class ControlsOverlay extends StatelessWidget {
2930
onPressed: _replay,
3031
color: _iconColor,
3132
iconSize: _replayButtonIconSize,
32-
icon: Icon(Icons.replay),
33+
icon: const Icon(Icons.replay),
3334
),
3435
),
3536
);
@@ -40,7 +41,7 @@ class ControlsOverlay extends StatelessWidget {
4041
case PlayingState.stopped:
4142
case PlayingState.paused:
4243
return SizedBox.expand(
43-
child: Container(
44+
child: ColoredBox(
4445
color: Colors.black45,
4546
child: FittedBox(
4647
child: Row(
@@ -51,19 +52,19 @@ class ControlsOverlay extends StatelessWidget {
5152
onPressed: () => _seekRelative(_seekStepBackward),
5253
color: _iconColor,
5354
iconSize: _seekButtonIconSize,
54-
icon: Icon(Icons.replay_10),
55+
icon: const Icon(Icons.replay_10),
5556
),
5657
IconButton(
5758
onPressed: _play,
5859
color: _iconColor,
5960
iconSize: _playButtonIconSize,
60-
icon: Icon(Icons.play_arrow),
61+
icon: const Icon(Icons.play_arrow),
6162
),
6263
IconButton(
6364
onPressed: () => _seekRelative(_seekStepForward),
6465
color: _iconColor,
6566
iconSize: _seekButtonIconSize,
66-
icon: Icon(Icons.forward_10),
67+
icon: const Icon(Icons.forward_10),
6768
),
6869
],
6970
),
@@ -88,13 +89,13 @@ class ControlsOverlay extends StatelessWidget {
8889
onPressed: _replay,
8990
color: _iconColor,
9091
iconSize: _replayButtonIconSize,
91-
icon: Icon(Icons.replay),
92+
icon: const Icon(Icons.replay),
9293
),
9394
),
9495
);
9596

9697
default:
97-
return SizedBox.shrink();
98+
return const SizedBox.shrink();
9899
}
99100
},
100101
),

flutter_vlc_player/example/lib/main.dart

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import 'package:flutter/material.dart';
2-
import 'multiple_tab.dart';
3-
import 'single_tab.dart';
2+
import 'package:flutter_vlc_player_example/multiple_tab.dart';
3+
import 'package:flutter_vlc_player_example/single_tab.dart';
44

55
void main() {
66
runApp(
@@ -10,29 +10,31 @@ void main() {
1010
);
1111
}
1212

13+
// ignore: prefer-match-file-name
1314
class App extends StatefulWidget {
1415
@override
1516
_AppState createState() => _AppState();
1617
}
1718

1819
class _AppState extends State<App> {
20+
static const _length = 2;
1921
@override
2022
Widget build(BuildContext context) {
2123
return DefaultTabController(
22-
length: 2,
24+
length: _length,
2325
child: Scaffold(
2426
appBar: AppBar(
2527
centerTitle: true,
26-
title: Text('Vlc Player Example'),
27-
bottom: TabBar(
28+
title: const Text('Vlc Player Example'),
29+
bottom: const TabBar(
2830
tabs: [
2931
Tab(text: 'Single'),
3032
Tab(text: 'Multiple'),
3133
],
3234
),
3335
),
3436
body: TabBarView(
35-
physics: NeverScrollableScrollPhysics(),
37+
physics: const NeverScrollableScrollPhysics(),
3638
children: [
3739
SingleTab(),
3840
MultipleTab(),

flutter_vlc_player/example/lib/multiple_tab.dart

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
import 'package:flutter/material.dart';
22
import 'package:flutter_vlc_player/flutter_vlc_player.dart';
33

4-
import 'vlc_player_with_controls.dart';
4+
import 'package:flutter_vlc_player_example/vlc_player_with_controls.dart';
55

66
class MultipleTab extends StatefulWidget {
77
@override
88
_MultipleTabState createState() => _MultipleTabState();
99
}
1010

1111
class _MultipleTabState extends State<MultipleTab> {
12+
static const _heightWithControls = 400.0;
13+
static const _heightWithoutControls = 300.0;
14+
1215
List<VlcPlayerController> controllers;
1316
List<String> urls = [
1417
'https://www.tomandjerryonline.com/Videos/Ford%20Mondeo%20-%20Tom%20and%20Jerry.mov',
@@ -23,7 +26,7 @@ class _MultipleTabState extends State<MultipleTab> {
2326
super.initState();
2427
controllers = <VlcPlayerController>[];
2528
for (var i = 0; i < urls.length; i++) {
26-
var controller = VlcPlayerController.network(
29+
final controller = VlcPlayerController.network(
2730
urls[i],
2831
hwAcc: HwAcc.full,
2932
autoPlay: false,
@@ -42,27 +45,26 @@ class _MultipleTabState extends State<MultipleTab> {
4245

4346
@override
4447
Widget build(BuildContext context) {
45-
return Container(
46-
child: ListView.separated(
47-
itemCount: controllers.length,
48-
separatorBuilder: (_, index) {
49-
return Divider(height: 5, thickness: 5, color: Colors.grey);
50-
},
51-
itemBuilder: (_, index) {
52-
return Container(
53-
height: showPlayerControls ? 400 : 300,
54-
child: VlcPlayerWithControls(
55-
controller: controllers[index],
56-
showControls: showPlayerControls,
57-
),
58-
);
59-
},
60-
),
48+
return ListView.separated(
49+
itemCount: controllers.length,
50+
separatorBuilder: (_, index) {
51+
return const Divider(height: 5, thickness: 5, color: Colors.grey);
52+
},
53+
itemBuilder: (_, index) {
54+
return SizedBox(
55+
height:
56+
showPlayerControls ? _heightWithControls : _heightWithoutControls,
57+
child: VlcPlayerWithControls(
58+
controller: controllers[index],
59+
showControls: showPlayerControls,
60+
),
61+
);
62+
},
6163
);
6264
}
6365

6466
@override
65-
void dispose() async {
67+
Future<void> dispose() async {
6668
super.dispose();
6769
for (final controller in controllers) {
6870
await controller.stopRendererScanning();

0 commit comments

Comments
 (0)