Bladeren bron

Sort constructor declarations before other members

Ben Hagen 6 jaren geleden
bovenliggende
commit
f2e66aadf8

+ 2 - 2
example/lib/main.dart

@@ -11,10 +11,10 @@ void main() {
 }
 
 class ChewieDemo extends StatefulWidget {
-  final String title;
-
   ChewieDemo({this.title = 'Chewie Demo'});
 
+  final String title;
+
   @override
   State<StatefulWidget> createState() {
     return _ChewieDemoState();

+ 5 - 5
lib/src/chewie_progress_colors.dart

@@ -1,11 +1,6 @@
 import 'package:flutter/rendering.dart';
 
 class ChewieProgressColors {
-  final Paint playedPaint;
-  final Paint bufferedPaint;
-  final Paint handlePaint;
-  final Paint backgroundPaint;
-
   ChewieProgressColors({
     Color playedColor: const Color.fromRGBO(255, 0, 0, 0.7),
     Color bufferedColor: const Color.fromRGBO(30, 30, 200, 0.2),
@@ -15,4 +10,9 @@ class ChewieProgressColors {
         bufferedPaint = Paint()..color = bufferedColor,
         handlePaint = Paint()..color = handleColor,
         backgroundPaint = Paint()..color = backgroundColor;
+
+  final Paint playedPaint;
+  final Paint bufferedPaint;
+  final Paint handlePaint;
+  final Paint backgroundPaint;
 }

+ 3 - 3
lib/src/cupertino_controls.dart

@@ -12,14 +12,14 @@ import 'package:open_iconic_flutter/open_iconic_flutter.dart';
 import 'package:video_player/video_player.dart';
 
 class CupertinoControls extends StatefulWidget {
-  final Color backgroundColor;
-  final Color iconColor;
-
   CupertinoControls({
     @required this.backgroundColor,
     @required this.iconColor,
   });
 
+  final Color backgroundColor;
+  final Color iconColor;
+
   @override
   State<StatefulWidget> createState() {
     return _CupertinoControlsState();

+ 11 - 12
lib/src/cupertino_progress_bar.dart

@@ -4,12 +4,6 @@ import 'package:flutter/widgets.dart';
 import 'package:video_player/video_player.dart';
 
 class CupertinoVideoProgressBar extends StatefulWidget {
-  final VideoPlayerController controller;
-  final ChewieProgressColors colors;
-  final Function() onDragStart;
-  final Function() onDragEnd;
-  final Function() onDragUpdate;
-
   CupertinoVideoProgressBar(
     this.controller, {
     ChewieProgressColors colors,
@@ -18,6 +12,12 @@ class CupertinoVideoProgressBar extends StatefulWidget {
     this.onDragUpdate,
   }) : colors = colors ?? ChewieProgressColors();
 
+  final VideoPlayerController controller;
+  final ChewieProgressColors colors;
+  final Function() onDragStart;
+  final Function() onDragEnd;
+  final Function() onDragUpdate;
+
   @override
   _VideoProgressBarState createState() {
     return _VideoProgressBarState();
@@ -25,16 +25,15 @@ class CupertinoVideoProgressBar extends StatefulWidget {
 }
 
 class _VideoProgressBarState extends State<CupertinoVideoProgressBar> {
-  VoidCallback listener;
-
-  bool _controllerWasPlaying = false;
-
   _VideoProgressBarState() {
     listener = () {
       setState(() {});
     };
   }
 
+  VoidCallback listener;
+  bool _controllerWasPlaying = false;
+
   VideoPlayerController get controller => widget.controller;
 
   @override
@@ -118,11 +117,11 @@ class _VideoProgressBarState extends State<CupertinoVideoProgressBar> {
 }
 
 class _ProgressBarPainter extends CustomPainter {
+  _ProgressBarPainter(this.value, this.colors);
+
   VideoPlayerValue value;
   ChewieProgressColors colors;
 
-  _ProgressBarPainter(this.value, this.colors);
-
   @override
   bool shouldRepaint(CustomPainter painter) {
     return true;

+ 11 - 12
lib/src/material_progress_bar.dart

@@ -4,12 +4,6 @@ import 'package:flutter/widgets.dart';
 import 'package:video_player/video_player.dart';
 
 class MaterialVideoProgressBar extends StatefulWidget {
-  final VideoPlayerController controller;
-  final ChewieProgressColors colors;
-  final Function() onDragStart;
-  final Function() onDragEnd;
-  final Function() onDragUpdate;
-
   MaterialVideoProgressBar(
     this.controller, {
     ChewieProgressColors colors,
@@ -18,6 +12,12 @@ class MaterialVideoProgressBar extends StatefulWidget {
     this.onDragUpdate,
   }) : colors = colors ?? ChewieProgressColors();
 
+  final VideoPlayerController controller;
+  final ChewieProgressColors colors;
+  final Function() onDragStart;
+  final Function() onDragEnd;
+  final Function() onDragUpdate;
+
   @override
   _VideoProgressBarState createState() {
     return _VideoProgressBarState();
@@ -25,16 +25,15 @@ class MaterialVideoProgressBar extends StatefulWidget {
 }
 
 class _VideoProgressBarState extends State<MaterialVideoProgressBar> {
-  VoidCallback listener;
-
-  bool _controllerWasPlaying = false;
-
   _VideoProgressBarState() {
     listener = () {
       setState(() {});
     };
   }
 
+  VoidCallback listener;
+  bool _controllerWasPlaying = false;
+
   VideoPlayerController get controller => widget.controller;
 
   @override
@@ -118,11 +117,11 @@ class _VideoProgressBarState extends State<MaterialVideoProgressBar> {
 }
 
 class _ProgressBarPainter extends CustomPainter {
+  _ProgressBarPainter(this.value, this.colors);
+
   VideoPlayerValue value;
   ChewieProgressColors colors;
 
-  _ProgressBarPainter(this.value, this.colors);
-
   @override
   bool shouldRepaint(CustomPainter painter) {
     return true;