Skip to content

Commit 97bea94

Browse files
committed
- Several lints fixed for better performance
1 parent e2c647a commit 97bea94

File tree

6 files changed

+16
-17
lines changed

6 files changed

+16
-17
lines changed

lib/src/center_play_button.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ class CenterPlayButton extends StatelessWidget {
2121

2222
@override
2323
Widget build(BuildContext context) {
24-
return Container(
24+
return ColoredBox(
2525
color: Colors.transparent,
2626
child: Center(
2727
child: UnconstrainedBox(
2828
child: AnimatedOpacity(
2929
opacity: show ? 1.0 : 0.0,
3030
duration: const Duration(milliseconds: 300),
31-
child: Container(
31+
child: DecoratedBox(
3232
decoration: BoxDecoration(
3333
color: backgroundColor,
3434
shape: BoxShape.circle,

lib/src/cupertino/cupertino_controls.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -203,14 +203,14 @@ class _CupertinoControlsState extends State<CupertinoControls>
203203

204204
Widget _buildSubtitles(Subtitles subtitles) {
205205
if (!_subtitleOn) {
206-
return Container();
206+
return const SizedBox();
207207
}
208208
if (_subtitlesPosition == null) {
209-
return Container();
209+
return const SizedBox();
210210
}
211211
final currentSubtitle = subtitles.getByPosition(_subtitlesPosition!);
212212
if (currentSubtitle.isEmpty) {
213-
return Container();
213+
return const SizedBox();
214214
}
215215

216216
if (chewieController.subtitleBuilder != null) {
@@ -395,7 +395,7 @@ class _CupertinoControlsState extends State<CupertinoControls>
395395
borderRadius: BorderRadius.circular(10.0),
396396
child: BackdropFilter(
397397
filter: ui.ImageFilter.blur(sigmaX: 10.0),
398-
child: Container(
398+
child: ColoredBox(
399399
color: backgroundColor,
400400
child: Container(
401401
height: barHeight,
@@ -468,7 +468,7 @@ class _CupertinoControlsState extends State<CupertinoControls>
468468
Widget _buildSubtitleToggle(Color iconColor, double barHeight) {
469469
//if don't have subtitle hiden button
470470
if (chewieController.subtitle?.isEmpty ?? true) {
471-
return Container();
471+
return const SizedBox();
472472
}
473473
return GestureDetector(
474474
onTap: _subtitleToggle,

lib/src/helpers/adaptive_controls.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import 'package:chewie/chewie.dart';
2-
import 'package:chewie/src/material/material_desktop_controls.dart';
32
import 'package:flutter/material.dart';
43

54
class AdaptiveControls extends StatelessWidget {

lib/src/material/material_controls.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,11 +213,11 @@ class _MaterialControlsState extends State<MaterialControls>
213213

214214
Widget _buildSubtitles(BuildContext context, Subtitles subtitles) {
215215
if (!_subtitleOn) {
216-
return Container();
216+
return const SizedBox();
217217
}
218218
final currentSubtitle = subtitles.getByPosition(_subtitlesPosition);
219219
if (currentSubtitle.isEmpty) {
220-
return Container();
220+
return const SizedBox();
221221
}
222222

223223
if (chewieController.subtitleBuilder != null) {
@@ -446,7 +446,7 @@ class _MaterialControlsState extends State<MaterialControls>
446446
Widget _buildSubtitleToggle() {
447447
//if don't have subtitle hiden button
448448
if (chewieController.subtitle?.isEmpty ?? true) {
449-
return Container();
449+
return const SizedBox();
450450
}
451451
return GestureDetector(
452452
onTap: _onSubtitleTap,

lib/src/material/material_desktop_controls.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,11 +206,11 @@ class _MaterialDesktopControlsState extends State<MaterialDesktopControls>
206206

207207
Widget _buildSubtitles(BuildContext context, Subtitles subtitles) {
208208
if (!_subtitleOn) {
209-
return Container();
209+
return const SizedBox();
210210
}
211211
final currentSubtitle = subtitles.getByPosition(_subtitlesPosition);
212212
if (currentSubtitle.isEmpty) {
213-
return Container();
213+
return const SizedBox();
214214
}
215215

216216
if (chewieController.subtitleBuilder != null) {

lib/src/player_with_controls.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class PlayerWithControls extends StatelessWidget {
2626
) {
2727
return chewieController.showControls
2828
? chewieController.customControls ?? const AdaptiveControls()
29-
: Container();
29+
: const SizedBox();
3030
}
3131

3232
Widget _buildPlayerWithControls(
@@ -65,9 +65,9 @@ class PlayerWithControls extends StatelessWidget {
6565
duration: const Duration(
6666
milliseconds: 250,
6767
),
68-
child: Container(
69-
decoration: const BoxDecoration(color: Colors.black54),
70-
child: Container(),
68+
child: const DecoratedBox(
69+
decoration: BoxDecoration(color: Colors.black54),
70+
child: SizedBox(),
7171
),
7272
),
7373
),

0 commit comments

Comments
 (0)