From e473c935cd449c57df084e77f81a49d3540c1179 Mon Sep 17 00:00:00 2001 From: Max Date: Wed, 7 Jan 2026 20:57:46 +0800 Subject: [PATCH] style: enforce 120 chars line length in vs code --- .gitignore | 3 ++- .vscode/settings.json | 11 ++++++++ lib/ui/widgets/video_custom_control.dart | 33 +++++++----------------- 3 files changed, 22 insertions(+), 25 deletions(-) create mode 100644 .vscode/settings.json diff --git a/.gitignore b/.gitignore index 6607119..9ddc1a2 100644 --- a/.gitignore +++ b/.gitignore @@ -20,7 +20,8 @@ # The .vscode folder contains launch configuration and tasks you configure in # VS Code which you may wish to be included in version control, so this line # is commented out by default. -.vscode/ +.vscode/* +!.vscode/settings.json # Flutter/Dart/Pub related **/doc/api/ diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..32830d1 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,11 @@ +{ + "dart.lineLength": 120, + "[dart]": { + "editor.defaultFormatter": "Dart-Code.dart-code", + "editor.formatOnSave": true, + "editor.ensureNewlineAtEndOfFile": true, + "editor.rulers": [ + 120 + ] + } +} \ No newline at end of file diff --git a/lib/ui/widgets/video_custom_control.dart b/lib/ui/widgets/video_custom_control.dart index 536ed14..bccc209 100644 --- a/lib/ui/widgets/video_custom_control.dart +++ b/lib/ui/widgets/video_custom_control.dart @@ -16,8 +16,7 @@ import 'package:video_player/video_player.dart'; import 'center_play_button.dart'; class VideoCustomControls extends StatefulWidget { - const VideoCustomControls({required this.downloadFn, Key? key}) - : super(key: key); + const VideoCustomControls({required this.downloadFn, Key? key}) : super(key: key); final Future Function() downloadFn; @override @@ -26,8 +25,7 @@ class VideoCustomControls extends StatefulWidget { } } -class _VideoCustomControlsState extends TIMUIKitState - with SingleTickerProviderStateMixin { +class _VideoCustomControlsState extends TIMUIKitState with SingleTickerProviderStateMixin { late VideoPlayerValue _latestValue; bool _hideStuff = true; Timer? _hideTimer; @@ -77,17 +75,13 @@ class _VideoCustomControlsState extends TIMUIKitState alignment: Alignment.center, children: [ if (_latestValue.isBuffering) - const Center( - child: CircularProgressIndicator(color: Colors.white)) + const Center(child: CircularProgressIndicator(color: Colors.white)) else _buildHitArea(), Positioned( bottom: 0, width: MediaQuery.of(context).size.width, - child: Column(children: [ - _buildVideoControlBar(context), - _buildBottomBar() - ]), + child: Column(children: [_buildVideoControlBar(context), _buildBottomBar()]), ), if (isLoading) Container( @@ -207,14 +201,8 @@ class _VideoCustomControlsState extends TIMUIKitState child: Row( children: [ _buildPlayPause(controller, iconColor), - if (chewieController.isLive) - const Expanded(child: Text('LIVE')) - else - _buildPositionStart(iconColor), - if (chewieController.isLive) - const SizedBox() - else - _buildProgressBar(), + if (chewieController.isLive) const Expanded(child: Text('LIVE')) else _buildPositionStart(iconColor), + if (chewieController.isLive) const SizedBox() else _buildProgressBar(), if (!chewieController.isLive) _buildPositionEnd(iconColor), ], ), @@ -250,8 +238,7 @@ class _VideoCustomControlsState extends TIMUIKitState )); } - GestureDetector _buildPlayPause( - VideoPlayerController controller, Color color) { + GestureDetector _buildPlayPause(VideoPlayerController controller, Color color) { return GestureDetector( onTap: _playPause, child: Container( @@ -327,8 +314,7 @@ class _VideoCustomControlsState extends TIMUIKitState _hideStuff = true; chewieController.toggleFullScreen(); - _showAfterExpandCollapseTimer = - Timer(const Duration(milliseconds: 300), () { + _showAfterExpandCollapseTimer = Timer(const Duration(milliseconds: 300), () { setState(() { _cancelAndRestartTimer(); }); @@ -424,8 +410,7 @@ class _PlaybackSpeedDialog extends TIMUIKitStatelessWidget { Widget tuiBuild(BuildContext context, TUIKitBuildValue value) { final TUITheme theme = value.theme; - final Color selectedColor = - theme.primaryColor ?? Theme.of(context).primaryColor; + final Color selectedColor = theme.primaryColor ?? Theme.of(context).primaryColor; return ListView.builder( shrinkWrap: true,