Przeglądaj źródła

Remove new statement

Ben Hagen 6 lat temu
rodzic
commit
990d8396db

+ 9 - 9
lib/src/chewie_player.dart

@@ -79,7 +79,7 @@ class Chewie extends StatefulWidget {
 
   @override
   State<StatefulWidget> createState() {
-    return new _ChewiePlayerState();
+    return _ChewiePlayerState();
   }
 }
 
@@ -89,7 +89,7 @@ class _ChewiePlayerState extends State<Chewie> {
 
   @override
   Widget build(BuildContext context) {
-    return new PlayerWithControls(
+    return PlayerWithControls(
       controller: _controller,
       onExpandCollapse: () => _pushFullScreenWidget(context),
       aspectRatio: widget.aspectRatio ?? _calculateAspectRatio(context),
@@ -111,15 +111,15 @@ class _ChewiePlayerState extends State<Chewie> {
 
   Widget _buildFullScreenVideo(
       BuildContext context, Animation<double> animation) {
-    return new Scaffold(
+    return Scaffold(
       resizeToAvoidBottomPadding: false,
-      body: new Container(
+      body: Container(
         alignment: Alignment.center,
         color: Colors.black,
-        child: new PlayerWithControls(
+        child: PlayerWithControls(
           controller: _controller,
           onExpandCollapse: () =>
-              new Future<dynamic>.value(Navigator.of(context).pop()),
+              Future<dynamic>.value(Navigator.of(context).pop()),
           aspectRatio: widget.aspectRatio ?? _calculateAspectRatio(context),
           fullScreen: true,
           isLive: widget.isLive,
@@ -135,7 +135,7 @@ class _ChewiePlayerState extends State<Chewie> {
     Animation<double> animation,
     Animation<double> secondaryAnimation,
   ) {
-    return new AnimatedBuilder(
+    return AnimatedBuilder(
       animation: animation,
       builder: (BuildContext context, Widget child) {
         return _buildFullScreenVideo(context, animation);
@@ -187,8 +187,8 @@ class _ChewiePlayerState extends State<Chewie> {
 
   Future<dynamic> _pushFullScreenWidget(BuildContext context) async {
     final isAndroid = Theme.of(context).platform == TargetPlatform.android;
-    final TransitionRoute<Null> route = new PageRouteBuilder<Null>(
-      settings: new RouteSettings(isInitialRoute: false),
+    final TransitionRoute<Null> route = PageRouteBuilder<Null>(
+      settings: RouteSettings(isInitialRoute: false),
       pageBuilder: _fullScreenRoutePageBuilder,
     );
 

+ 4 - 4
lib/src/chewie_progress_colors.dart

@@ -11,8 +11,8 @@ class ChewieProgressColors {
     Color bufferedColor: const Color.fromRGBO(30, 30, 200, 0.2),
     Color handleColor: const Color.fromRGBO(200, 200, 200, 1.0),
     Color backgroundColor: const Color.fromRGBO(200, 200, 200, 0.5),
-  })  : playedPaint = new Paint()..color = playedColor,
-        bufferedPaint = new Paint()..color = bufferedColor,
-        handlePaint = new Paint()..color = handleColor,
-        backgroundPaint = new Paint()..color = backgroundColor;
+  })  : playedPaint = Paint()..color = playedColor,
+        bufferedPaint = Paint()..color = bufferedColor,
+        handlePaint = Paint()..color = handleColor,
+        backgroundPaint = Paint()..color = backgroundColor;
 }

+ 94 - 94
lib/src/cupertino_controls.dart

@@ -33,7 +33,7 @@ class CupertinoControls extends StatefulWidget {
 
   @override
   State<StatefulWidget> createState() {
-    return new _CupertinoControlsState();
+    return _CupertinoControlsState();
   }
 }
 
@@ -55,7 +55,7 @@ class _CupertinoControlsState extends State<CupertinoControls> {
     final barHeight = orientation == Orientation.portrait ? 30.0 : 47.0;
     final buttonPadding = orientation == Orientation.portrait ? 16.0 : 24.0;
 
-    return new Column(
+    return Column(
       children: <Widget>[
         _buildTopBar(
             backgroundColor, iconColor, controller, barHeight, buttonPadding),
@@ -101,25 +101,25 @@ class _CupertinoControlsState extends State<CupertinoControls> {
     VideoPlayerController controller,
     double barHeight,
   ) {
-    return new AnimatedOpacity(
+    return AnimatedOpacity(
       opacity: _hideStuff ? 0.0 : 1.0,
-      duration: new Duration(milliseconds: 300),
-      child: new Container(
+      duration: Duration(milliseconds: 300),
+      child: Container(
         color: Colors.transparent,
         alignment: Alignment.bottomCenter,
-        margin: new EdgeInsets.all(marginSize),
-        child: new ClipRect(
-          child: new BackdropFilter(
-            filter: new ui.ImageFilter.blur(
+        margin: EdgeInsets.all(marginSize),
+        child: ClipRect(
+          child: BackdropFilter(
+            filter: ui.ImageFilter.blur(
               sigmaX: 10.0,
               sigmaY: 10.0,
             ),
-            child: new Container(
+            child: Container(
               height: barHeight,
-              decoration: new BoxDecoration(
+              decoration: BoxDecoration(
                 color: backgroundColor,
-                borderRadius: new BorderRadius.all(
-                  new Radius.circular(10.0),
+                borderRadius: BorderRadius.all(
+                  Radius.circular(10.0),
                 ),
               ),
               child: widget.isLive
@@ -130,7 +130,7 @@ class _CupertinoControlsState extends State<CupertinoControls> {
                         _buildLive(iconColor),
                       ],
                     )
-                  : new Row(
+                  : Row(
                       children: <Widget>[
                         _buildSkipBack(iconColor, barHeight),
                         _buildPlayPause(controller, iconColor, barHeight),
@@ -148,11 +148,11 @@ class _CupertinoControlsState extends State<CupertinoControls> {
   }
 
   Widget _buildLive(Color iconColor) {
-    return new Padding(
-      padding: new EdgeInsets.only(right: 12.0),
-      child: new Text(
+    return Padding(
+      padding: EdgeInsets.only(right: 12.0),
+      child: Text(
         'LIVE',
-        style: new TextStyle(color: iconColor, fontSize: 12.0),
+        style: TextStyle(color: iconColor, fontSize: 12.0),
       ),
     );
   }
@@ -163,28 +163,28 @@ class _CupertinoControlsState extends State<CupertinoControls> {
     double barHeight,
     double buttonPadding,
   ) {
-    return new GestureDetector(
+    return GestureDetector(
       onTap: _onExpandCollapse,
-      child: new AnimatedOpacity(
+      child: AnimatedOpacity(
         opacity: _hideStuff ? 0.0 : 1.0,
-        duration: new Duration(milliseconds: 300),
-        child: new ClipRect(
-          child: new BackdropFilter(
-            filter: new ui.ImageFilter.blur(sigmaX: 10.0),
-            child: new Container(
+        duration: Duration(milliseconds: 300),
+        child: ClipRect(
+          child: BackdropFilter(
+            filter: ui.ImageFilter.blur(sigmaX: 10.0),
+            child: Container(
               height: barHeight,
-              padding: new EdgeInsets.only(
+              padding: EdgeInsets.only(
                 left: buttonPadding,
                 right: buttonPadding,
               ),
-              decoration: new BoxDecoration(
+              decoration: BoxDecoration(
                 color: backgroundColor,
-                borderRadius: new BorderRadius.all(
-                  new Radius.circular(10.0),
+                borderRadius: BorderRadius.all(
+                  Radius.circular(10.0),
                 ),
               ),
-              child: new Center(
-                child: new Icon(
+              child: Center(
+                child: Icon(
                   widget.fullScreen
                       ? OpenIconicIcons.fullscreenExit
                       : OpenIconicIcons.fullscreenEnter,
@@ -200,8 +200,8 @@ class _CupertinoControlsState extends State<CupertinoControls> {
   }
 
   Expanded _buildHitArea() {
-    return new Expanded(
-      child: new GestureDetector(
+    return Expanded(
+      child: GestureDetector(
         onTap: _latestValue != null && _latestValue.isPlaying
             ? _cancelAndRestartTimer
             : () {
@@ -211,7 +211,7 @@ class _CupertinoControlsState extends State<CupertinoControls> {
                   _hideStuff = false;
                 });
               },
-        child: new Container(
+        child: Container(
           color: Colors.transparent,
         ),
       ),
@@ -225,7 +225,7 @@ class _CupertinoControlsState extends State<CupertinoControls> {
     double barHeight,
     double buttonPadding,
   ) {
-    return new GestureDetector(
+    return GestureDetector(
       onTap: () {
         _cancelAndRestartTimer();
 
@@ -236,26 +236,26 @@ class _CupertinoControlsState extends State<CupertinoControls> {
           controller.setVolume(0.0);
         }
       },
-      child: new AnimatedOpacity(
+      child: AnimatedOpacity(
         opacity: _hideStuff ? 0.0 : 1.0,
-        duration: new Duration(milliseconds: 300),
-        child: new ClipRect(
-          child: new BackdropFilter(
-            filter: new ui.ImageFilter.blur(sigmaX: 10.0),
-            child: new Container(
-              decoration: new BoxDecoration(
+        duration: Duration(milliseconds: 300),
+        child: ClipRect(
+          child: BackdropFilter(
+            filter: ui.ImageFilter.blur(sigmaX: 10.0),
+            child: Container(
+              decoration: BoxDecoration(
                 color: backgroundColor,
-                borderRadius: new BorderRadius.all(
-                  new Radius.circular(10.0),
+                borderRadius: BorderRadius.all(
+                  Radius.circular(10.0),
                 ),
               ),
-              child: new Container(
+              child: Container(
                 height: barHeight,
-                padding: new EdgeInsets.only(
+                padding: EdgeInsets.only(
                   left: buttonPadding,
                   right: buttonPadding,
                 ),
-                child: new Icon(
+                child: Icon(
                   (_latestValue != null && _latestValue.volume > 0)
                       ? Icons.volume_up
                       : Icons.volume_off,
@@ -275,16 +275,16 @@ class _CupertinoControlsState extends State<CupertinoControls> {
     Color iconColor,
     double barHeight,
   ) {
-    return new GestureDetector(
+    return GestureDetector(
       onTap: _playPause,
-      child: new Container(
+      child: Container(
         height: barHeight,
         color: Colors.transparent,
-        padding: new EdgeInsets.only(
+        padding: EdgeInsets.only(
           left: 6.0,
           right: 6.0,
         ),
-        child: new Icon(
+        child: Icon(
           controller.value.isPlaying
               ? OpenIconicIcons.mediaPause
               : OpenIconicIcons.mediaPlay,
@@ -297,13 +297,13 @@ class _CupertinoControlsState extends State<CupertinoControls> {
 
   Widget _buildPosition(Color iconColor) {
     final position =
-        _latestValue != null ? _latestValue.position : new Duration(seconds: 0);
+        _latestValue != null ? _latestValue.position : Duration(seconds: 0);
 
-    return new Padding(
-      padding: new EdgeInsets.only(right: 12.0),
-      child: new Text(
+    return Padding(
+      padding: EdgeInsets.only(right: 12.0),
+      child: Text(
         formatDuration(position),
-        style: new TextStyle(
+        style: TextStyle(
           color: iconColor,
           fontSize: 12.0,
         ),
@@ -314,34 +314,34 @@ class _CupertinoControlsState extends State<CupertinoControls> {
   Widget _buildRemaining(Color iconColor) {
     final position = _latestValue != null && _latestValue.duration != null
         ? _latestValue.duration - _latestValue.position
-        : new Duration(seconds: 0);
+        : Duration(seconds: 0);
 
-    return new Padding(
-      padding: new EdgeInsets.only(right: 12.0),
-      child: new Text(
+    return Padding(
+      padding: EdgeInsets.only(right: 12.0),
+      child: Text(
         '-${formatDuration(position)}',
-        style: new TextStyle(color: iconColor, fontSize: 12.0),
+        style: TextStyle(color: iconColor, fontSize: 12.0),
       ),
     );
   }
 
   GestureDetector _buildSkipBack(Color iconColor, double barHeight) {
-    return new GestureDetector(
+    return GestureDetector(
       onTap: _skipBack,
-      child: new Container(
+      child: Container(
         height: barHeight,
         color: Colors.transparent,
-        margin: new EdgeInsets.only(left: 10.0),
-        padding: new EdgeInsets.only(
+        margin: EdgeInsets.only(left: 10.0),
+        padding: EdgeInsets.only(
           left: 6.0,
           right: 6.0,
         ),
-        child: new Transform(
+        child: Transform(
           alignment: Alignment.center,
-          transform: new Matrix4.skewY(0.0)
+          transform: Matrix4.skewY(0.0)
             ..rotateX(math.pi)
             ..rotateZ(math.pi),
-          child: new Icon(
+          child: Icon(
             OpenIconicIcons.reload,
             color: iconColor,
             size: 12.0,
@@ -352,19 +352,19 @@ class _CupertinoControlsState extends State<CupertinoControls> {
   }
 
   GestureDetector _buildSkipForward(Color iconColor, double barHeight) {
-    return new GestureDetector(
+    return GestureDetector(
       onTap: _skipForward,
-      child: new Container(
+      child: Container(
         height: barHeight,
         color: Colors.transparent,
-        padding: new EdgeInsets.only(
+        padding: EdgeInsets.only(
           left: 6.0,
           right: 8.0,
         ),
-        margin: new EdgeInsets.only(
+        margin: EdgeInsets.only(
           right: 8.0,
         ),
-        child: new Icon(
+        child: Icon(
           OpenIconicIcons.reload,
           color: iconColor,
           size: 12.0,
@@ -380,18 +380,18 @@ class _CupertinoControlsState extends State<CupertinoControls> {
     double barHeight,
     double buttonPadding,
   ) {
-    return new Container(
+    return Container(
       height: barHeight,
-      margin: new EdgeInsets.only(
+      margin: EdgeInsets.only(
         top: marginSize,
         right: marginSize,
         left: marginSize,
       ),
-      child: new Row(
+      child: Row(
         children: <Widget>[
           _buildExpandButton(
               backgroundColor, iconColor, barHeight, buttonPadding),
-          new Expanded(child: new Container()),
+          Expanded(child: Container()),
           _buildMuteButton(
               controller, backgroundColor, iconColor, barHeight, buttonPadding),
         ],
@@ -420,7 +420,7 @@ class _CupertinoControlsState extends State<CupertinoControls> {
       _startHideTimer();
     }
 
-    _initTimer = new Timer(new Duration(milliseconds: 200), () {
+    _initTimer = Timer(Duration(milliseconds: 200), () {
       setState(() {
         _hideStuff = false;
       });
@@ -432,7 +432,7 @@ class _CupertinoControlsState extends State<CupertinoControls> {
       _hideStuff = true;
 
       widget.onExpandCollapse().then((dynamic _) {
-        _expandCollapseTimer = new Timer(new Duration(milliseconds: 300), () {
+        _expandCollapseTimer = Timer(Duration(milliseconds: 300), () {
           setState(() {
             _cancelAndRestartTimer();
           });
@@ -442,10 +442,10 @@ class _CupertinoControlsState extends State<CupertinoControls> {
   }
 
   Widget _buildProgressBar() {
-    return new Expanded(
-      child: new Padding(
-        padding: new EdgeInsets.only(right: 12.0),
-        child: new CupertinoVideoProgressBar(
+    return Expanded(
+      child: Padding(
+        padding: EdgeInsets.only(right: 12.0),
+        child: CupertinoVideoProgressBar(
           widget.controller,
           onDragStart: () {
             _hideTimer?.cancel();
@@ -454,26 +454,26 @@ class _CupertinoControlsState extends State<CupertinoControls> {
             _startHideTimer();
           },
           colors: widget.progressColors ??
-              new ChewieProgressColors(
-                playedColor: new Color.fromARGB(
+              ChewieProgressColors(
+                playedColor: Color.fromARGB(
                   120,
                   255,
                   255,
                   255,
                 ),
-                handleColor: new Color.fromARGB(
+                handleColor: Color.fromARGB(
                   255,
                   255,
                   255,
                   255,
                 ),
-                bufferedColor: new Color.fromARGB(
+                bufferedColor: Color.fromARGB(
                   60,
                   255,
                   255,
                   255,
                 ),
-                backgroundColor: new Color.fromARGB(
+                backgroundColor: Color.fromARGB(
                   20,
                   255,
                   255,
@@ -507,23 +507,23 @@ class _CupertinoControlsState extends State<CupertinoControls> {
 
   void _skipBack() {
     _cancelAndRestartTimer();
-    final beginning = new Duration(seconds: 0).inMilliseconds;
+    final beginning = Duration(seconds: 0).inMilliseconds;
     final skip =
-        (_latestValue.position - new Duration(seconds: 15)).inMilliseconds;
+        (_latestValue.position - Duration(seconds: 15)).inMilliseconds;
     widget.controller
-        .seekTo(new Duration(milliseconds: math.max(skip, beginning)));
+        .seekTo(Duration(milliseconds: math.max(skip, beginning)));
   }
 
   void _skipForward() {
     _cancelAndRestartTimer();
     final end = _latestValue.duration.inMilliseconds;
     final skip =
-        (_latestValue.position + new Duration(seconds: 15)).inMilliseconds;
-    widget.controller.seekTo(new Duration(milliseconds: math.min(skip, end)));
+        (_latestValue.position + Duration(seconds: 15)).inMilliseconds;
+    widget.controller.seekTo(Duration(milliseconds: math.min(skip, end)));
   }
 
   void _startHideTimer() {
-    _hideTimer = new Timer(const Duration(seconds: 3), () {
+    _hideTimer = Timer(const Duration(seconds: 3), () {
       setState(() {
         _hideStuff = true;
       });

+ 27 - 27
lib/src/cupertino_progress_bar.dart

@@ -16,11 +16,11 @@ class CupertinoVideoProgressBar extends StatefulWidget {
     this.onDragEnd,
     this.onDragStart,
     this.onDragUpdate,
-  }) : colors = colors ?? new ChewieProgressColors();
+  }) : colors = colors ?? ChewieProgressColors();
 
   @override
   _VideoProgressBarState createState() {
-    return new _VideoProgressBarState();
+    return _VideoProgressBarState();
   }
 }
 
@@ -59,16 +59,16 @@ class _VideoProgressBarState extends State<CupertinoVideoProgressBar> {
       controller.seekTo(position);
     }
 
-    return new GestureDetector(
+    return GestureDetector(
       child: (controller.value.hasError)
-          ? new Text(controller.value.errorDescription)
-          : new Center(
-              child: new Container(
+          ? Text(controller.value.errorDescription)
+          : Center(
+              child: Container(
                 height: MediaQuery.of(context).size.height,
                 width: MediaQuery.of(context).size.width,
                 color: Colors.transparent,
-                child: new CustomPaint(
-                  painter: new _ProgressBarPainter(
+                child: CustomPaint(
+                  painter: _ProgressBarPainter(
                     controller.value,
                     widget.colors,
                   ),
@@ -135,12 +135,12 @@ class _ProgressBarPainter extends CustomPainter {
     final baseOffset = size.height / 2 - barHeight / 2.0;
 
     canvas.drawRRect(
-      new RRect.fromRectAndRadius(
-        new Rect.fromPoints(
-          new Offset(0.0, baseOffset),
-          new Offset(size.width, baseOffset + barHeight),
+      RRect.fromRectAndRadius(
+        Rect.fromPoints(
+          Offset(0.0, baseOffset),
+          Offset(size.width, baseOffset + barHeight),
         ),
-        new Radius.circular(4.0),
+        Radius.circular(4.0),
       ),
       colors.backgroundPaint,
     );
@@ -154,35 +154,35 @@ class _ProgressBarPainter extends CustomPainter {
       final double start = range.startFraction(value.duration) * size.width;
       final double end = range.endFraction(value.duration) * size.width;
       canvas.drawRRect(
-        new RRect.fromRectAndRadius(
-          new Rect.fromPoints(
-            new Offset(start, baseOffset),
-            new Offset(end, baseOffset + barHeight),
+        RRect.fromRectAndRadius(
+          Rect.fromPoints(
+            Offset(start, baseOffset),
+            Offset(end, baseOffset + barHeight),
           ),
-          new Radius.circular(4.0),
+          Radius.circular(4.0),
         ),
         colors.bufferedPaint,
       );
     }
     canvas.drawRRect(
-      new RRect.fromRectAndRadius(
-        new Rect.fromPoints(
-          new Offset(0.0, baseOffset),
-          new Offset(playedPart, baseOffset + barHeight),
+      RRect.fromRectAndRadius(
+        Rect.fromPoints(
+          Offset(0.0, baseOffset),
+          Offset(playedPart, baseOffset + barHeight),
         ),
-        new Radius.circular(4.0),
+        Radius.circular(4.0),
       ),
       colors.playedPaint,
     );
 
-    final shadowPath = new Path()
-      ..addOval(new Rect.fromCircle(
-          center: new Offset(playedPart, baseOffset + barHeight / 2),
+    final shadowPath = Path()
+      ..addOval(Rect.fromCircle(
+          center: Offset(playedPart, baseOffset + barHeight / 2),
           radius: handleHeight));
 
     canvas.drawShadow(shadowPath, Colors.black, 0.2, false);
     canvas.drawCircle(
-      new Offset(playedPart, baseOffset + barHeight / 2),
+      Offset(playedPart, baseOffset + barHeight / 2),
       handleHeight,
       colors.handlePaint,
     );

+ 52 - 52
lib/src/material_controls.dart

@@ -26,7 +26,7 @@ class MaterialControls extends StatefulWidget {
 
   @override
   State<StatefulWidget> createState() {
-    return new _MaterialControlsState();
+    return _MaterialControlsState();
   }
 }
 
@@ -44,7 +44,7 @@ class _MaterialControlsState extends State<MaterialControls> {
 
   @override
   Widget build(BuildContext context) {
-    return new Column(
+    return Column(
       children: <Widget>[
         _latestValue != null &&
                     !_latestValue.isPlaying &&
@@ -96,13 +96,13 @@ class _MaterialControlsState extends State<MaterialControls> {
   ) {
     final iconColor = Theme.of(context).textTheme.button.color;
 
-    return new AnimatedOpacity(
+    return AnimatedOpacity(
       opacity: _hideStuff ? 0.0 : 1.0,
-      duration: new Duration(milliseconds: 300),
-      child: new Container(
+      duration: Duration(milliseconds: 300),
+      child: Container(
         height: barHeight,
         color: Theme.of(context).dialogBackgroundColor,
-        child: new Row(
+        child: Row(
           children: <Widget>[
             _buildPlayPause(controller),
             widget.isLive
@@ -118,20 +118,20 @@ class _MaterialControlsState extends State<MaterialControls> {
   }
 
   GestureDetector _buildExpandButton() {
-    return new GestureDetector(
+    return GestureDetector(
       onTap: _onExpandCollapse,
-      child: new AnimatedOpacity(
+      child: AnimatedOpacity(
         opacity: _hideStuff ? 0.0 : 1.0,
-        duration: new Duration(milliseconds: 300),
-        child: new Container(
+        duration: Duration(milliseconds: 300),
+        child: Container(
           height: barHeight,
-          margin: new EdgeInsets.only(right: 12.0),
-          padding: new EdgeInsets.only(
+          margin: EdgeInsets.only(right: 12.0),
+          padding: EdgeInsets.only(
             left: 8.0,
             right: 8.0,
           ),
-          child: new Center(
-            child: new Icon(
+          child: Center(
+            child: Icon(
               widget.fullScreen ? Icons.fullscreen_exit : Icons.fullscreen,
             ),
           ),
@@ -141,8 +141,8 @@ class _MaterialControlsState extends State<MaterialControls> {
   }
 
   Expanded _buildHitArea() {
-    return new Expanded(
-      child: new GestureDetector(
+    return Expanded(
+      child: GestureDetector(
         onTap: _latestValue != null && _latestValue.isPlaying
             ? _cancelAndRestartTimer
             : () {
@@ -152,24 +152,24 @@ class _MaterialControlsState extends State<MaterialControls> {
                   _hideStuff = true;
                 });
               },
-        child: new Container(
+        child: Container(
           color: Colors.transparent,
-          child: new Center(
-            child: new AnimatedOpacity(
+          child: Center(
+            child: AnimatedOpacity(
               opacity:
                   _latestValue != null && !_latestValue.isPlaying && !_dragging
                       ? 1.0
                       : 0.0,
-              duration: new Duration(milliseconds: 300),
-              child: new GestureDetector(
-                child: new Container(
-                  decoration: new BoxDecoration(
+              duration: Duration(milliseconds: 300),
+              child: GestureDetector(
+                child: Container(
+                  decoration: BoxDecoration(
                     color: Theme.of(context).dialogBackgroundColor,
-                    borderRadius: new BorderRadius.circular(48.0),
+                    borderRadius: BorderRadius.circular(48.0),
                   ),
-                  child: new Padding(
-                    padding: new EdgeInsets.all(12.0),
-                    child: new Icon(Icons.play_arrow, size: 32.0),
+                  child: Padding(
+                    padding: EdgeInsets.all(12.0),
+                    child: Icon(Icons.play_arrow, size: 32.0),
                   ),
                 ),
               ),
@@ -183,7 +183,7 @@ class _MaterialControlsState extends State<MaterialControls> {
   GestureDetector _buildMuteButton(
     VideoPlayerController controller,
   ) {
-    return new GestureDetector(
+    return GestureDetector(
       onTap: () {
         _cancelAndRestartTimer();
 
@@ -194,18 +194,18 @@ class _MaterialControlsState extends State<MaterialControls> {
           controller.setVolume(0.0);
         }
       },
-      child: new AnimatedOpacity(
+      child: AnimatedOpacity(
         opacity: _hideStuff ? 0.0 : 1.0,
-        duration: new Duration(milliseconds: 300),
-        child: new ClipRect(
-          child: new Container(
-            child: new Container(
+        duration: Duration(milliseconds: 300),
+        child: ClipRect(
+          child: Container(
+            child: Container(
               height: barHeight,
-              padding: new EdgeInsets.only(
+              padding: EdgeInsets.only(
                 left: 8.0,
                 right: 8.0,
               ),
-              child: new Icon(
+              child: Icon(
                 (_latestValue != null && _latestValue.volume > 0)
                     ? Icons.volume_up
                     : Icons.volume_off,
@@ -218,17 +218,17 @@ class _MaterialControlsState extends State<MaterialControls> {
   }
 
   GestureDetector _buildPlayPause(VideoPlayerController controller) {
-    return new GestureDetector(
+    return GestureDetector(
       onTap: _playPause,
-      child: new Container(
+      child: Container(
         height: barHeight,
         color: Colors.transparent,
-        margin: new EdgeInsets.only(left: 8.0, right: 4.0),
-        padding: new EdgeInsets.only(
+        margin: EdgeInsets.only(left: 8.0, right: 4.0),
+        padding: EdgeInsets.only(
           left: 12.0,
           right: 12.0,
         ),
-        child: new Icon(
+        child: Icon(
           controller.value.isPlaying ? Icons.pause : Icons.play_arrow,
         ),
       ),
@@ -243,11 +243,11 @@ class _MaterialControlsState extends State<MaterialControls> {
         ? _latestValue.duration
         : Duration.zero;
 
-    return new Padding(
-      padding: new EdgeInsets.only(right: 24.0),
-      child: new Text(
+    return Padding(
+      padding: EdgeInsets.only(right: 24.0),
+      child: Text(
         '${formatDuration(position)} / ${formatDuration(duration)}',
-        style: new TextStyle(
+        style: TextStyle(
           fontSize: 14.0,
         ),
       ),
@@ -274,7 +274,7 @@ class _MaterialControlsState extends State<MaterialControls> {
       _startHideTimer();
     }
 
-    _showTimer = new Timer(new Duration(milliseconds: 200), () {
+    _showTimer = Timer(Duration(milliseconds: 200), () {
       setState(() {
         _hideStuff = false;
       });
@@ -287,7 +287,7 @@ class _MaterialControlsState extends State<MaterialControls> {
 
       widget.onExpandCollapse().then((dynamic _) {
         _showAfterExpandCollapseTimer =
-            new Timer(new Duration(milliseconds: 300), () {
+            Timer(Duration(milliseconds: 300), () {
           setState(() {
             _cancelAndRestartTimer();
           });
@@ -317,7 +317,7 @@ class _MaterialControlsState extends State<MaterialControls> {
   }
 
   void _startHideTimer() {
-    _hideTimer = new Timer(const Duration(seconds: 3), () {
+    _hideTimer = Timer(const Duration(seconds: 3), () {
       setState(() {
         _hideStuff = true;
       });
@@ -331,10 +331,10 @@ class _MaterialControlsState extends State<MaterialControls> {
   }
 
   Widget _buildProgressBar() {
-    return new Expanded(
-      child: new Padding(
-        padding: new EdgeInsets.only(right: 20.0),
-        child: new MaterialVideoProgressBar(
+    return Expanded(
+      child: Padding(
+        padding: EdgeInsets.only(right: 20.0),
+        child: MaterialVideoProgressBar(
           widget.controller,
           onDragStart: () {
             setState(() {
@@ -351,7 +351,7 @@ class _MaterialControlsState extends State<MaterialControls> {
             _startHideTimer();
           },
           colors: widget.progressColors ??
-              new ChewieProgressColors(
+              ChewieProgressColors(
                   playedColor: Theme.of(context).accentColor,
                   handleColor: Theme.of(context).accentColor,
                   bufferedColor: Theme.of(context).backgroundColor,

+ 24 - 24
lib/src/material_progress_bar.dart

@@ -16,11 +16,11 @@ class MaterialVideoProgressBar extends StatefulWidget {
     this.onDragEnd,
     this.onDragStart,
     this.onDragUpdate,
-  }) : colors = colors ?? new ChewieProgressColors();
+  }) : colors = colors ?? ChewieProgressColors();
 
   @override
   _VideoProgressBarState createState() {
-    return new _VideoProgressBarState();
+    return _VideoProgressBarState();
   }
 }
 
@@ -59,16 +59,16 @@ class _VideoProgressBarState extends State<MaterialVideoProgressBar> {
       controller.seekTo(position);
     }
 
-    return new GestureDetector(
+    return GestureDetector(
       child: (controller.value.hasError)
-          ? new Text(controller.value.errorDescription)
-          : new Center(
-              child: new Container(
+          ? Text(controller.value.errorDescription)
+          : Center(
+              child: Container(
                 height: MediaQuery.of(context).size.height / 2,
                 width: MediaQuery.of(context).size.width,
                 color: Colors.transparent,
-                child: new CustomPaint(
-                  painter: new _ProgressBarPainter(
+                child: CustomPaint(
+                  painter: _ProgressBarPainter(
                     controller.value,
                     widget.colors,
                   ),
@@ -133,12 +133,12 @@ class _ProgressBarPainter extends CustomPainter {
     final height = 2.0;
 
     canvas.drawRRect(
-      new RRect.fromRectAndRadius(
-        new Rect.fromPoints(
-          new Offset(0.0, size.height / 2),
-          new Offset(size.width, size.height / 2 + height),
+      RRect.fromRectAndRadius(
+        Rect.fromPoints(
+          Offset(0.0, size.height / 2),
+          Offset(size.width, size.height / 2 + height),
         ),
-        new Radius.circular(4.0),
+        Radius.circular(4.0),
       ),
       colors.backgroundPaint,
     );
@@ -152,28 +152,28 @@ class _ProgressBarPainter extends CustomPainter {
       final double start = range.startFraction(value.duration) * size.width;
       final double end = range.endFraction(value.duration) * size.width;
       canvas.drawRRect(
-        new RRect.fromRectAndRadius(
-          new Rect.fromPoints(
-            new Offset(start, size.height / 2),
-            new Offset(end, size.height / 2 + height),
+        RRect.fromRectAndRadius(
+          Rect.fromPoints(
+            Offset(start, size.height / 2),
+            Offset(end, size.height / 2 + height),
           ),
-          new Radius.circular(4.0),
+          Radius.circular(4.0),
         ),
         colors.bufferedPaint,
       );
     }
     canvas.drawRRect(
-      new RRect.fromRectAndRadius(
-        new Rect.fromPoints(
-          new Offset(0.0, size.height / 2),
-          new Offset(playedPart, size.height / 2 + height),
+      RRect.fromRectAndRadius(
+        Rect.fromPoints(
+          Offset(0.0, size.height / 2),
+          Offset(playedPart, size.height / 2 + height),
         ),
-        new Radius.circular(4.0),
+        Radius.circular(4.0),
       ),
       colors.playedPaint,
     );
     canvas.drawCircle(
-      new Offset(playedPart, size.height / 2 + height / 2),
+      Offset(playedPart, size.height / 2 + height / 2),
       height * 3,
       colors.handlePaint,
     );

+ 16 - 16
lib/src/player_with_controls.dart

@@ -36,7 +36,7 @@ class PlayerWithControls extends StatefulWidget {
 
   @override
   State createState() {
-    return new _VideoPlayerWithControlsState();
+    return _VideoPlayerWithControlsState();
   }
 }
 
@@ -45,10 +45,10 @@ class _VideoPlayerWithControlsState extends State<PlayerWithControls> {
   Widget build(BuildContext context) {
     final controller = widget.controller;
 
-    return new Center(
-      child: new Container(
+    return Center(
+      child: Container(
         width: MediaQuery.of(context).size.width,
-        child: new AspectRatio(
+        child: AspectRatio(
           aspectRatio: widget.aspectRatio,
           child: _buildPlayerWithControls(controller, context),
         ),
@@ -58,16 +58,16 @@ class _VideoPlayerWithControlsState extends State<PlayerWithControls> {
 
   Container _buildPlayerWithControls(
       VideoPlayerController controller, BuildContext context) {
-    return new Container(
-      child: new Stack(
+    return Container(
+      child: Stack(
         children: <Widget>[
-          widget.placeholder ?? new Container(),
-          new Center(
-            child: new Hero(
+          widget.placeholder ?? Container(),
+          Center(
+            child: Hero(
               tag: controller,
-              child: new AspectRatio(
+              child: AspectRatio(
                 aspectRatio: widget.aspectRatio,
-                child: new VideoPlayer(controller),
+                child: VideoPlayer(controller),
               ),
             ),
           ),
@@ -83,7 +83,7 @@ class _VideoPlayerWithControlsState extends State<PlayerWithControls> {
   ) {
     return widget.showControls
         ? Theme.of(context).platform == TargetPlatform.android
-            ? new MaterialControls(
+            ? MaterialControls(
                 controller: controller,
                 onExpandCollapse: widget.onExpandCollapse,
                 fullScreen: widget.fullScreen,
@@ -91,9 +91,9 @@ class _VideoPlayerWithControlsState extends State<PlayerWithControls> {
                 autoPlay: widget.autoPlay,
                 isLive: widget.isLive,
               )
-            : new CupertinoControls(
-                backgroundColor: new Color.fromRGBO(41, 41, 41, 0.7),
-                iconColor: new Color.fromARGB(255, 200, 200, 200),
+            : CupertinoControls(
+                backgroundColor: Color.fromRGBO(41, 41, 41, 0.7),
+                iconColor: Color.fromARGB(255, 200, 200, 200),
                 controller: controller,
                 onExpandCollapse: widget.onExpandCollapse,
                 fullScreen: widget.fullScreen,
@@ -101,7 +101,7 @@ class _VideoPlayerWithControlsState extends State<PlayerWithControls> {
                 autoPlay: widget.autoPlay,
                 isLive: widget.isLive,
               )
-        : new Container();
+        : Container();
   }
 
   @override