style: enforce 120 chars line length in vs code

This commit is contained in:
Max 2026-01-07 20:57:46 +08:00
parent 5ccb5adb79
commit e473c935cd
3 changed files with 22 additions and 25 deletions

3
.gitignore vendored
View File

@ -20,7 +20,8 @@
# The .vscode folder contains launch configuration and tasks you configure in # 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 # VS Code which you may wish to be included in version control, so this line
# is commented out by default. # is commented out by default.
.vscode/ .vscode/*
!.vscode/settings.json
# Flutter/Dart/Pub related # Flutter/Dart/Pub related
**/doc/api/ **/doc/api/

11
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,11 @@
{
"dart.lineLength": 120,
"[dart]": {
"editor.defaultFormatter": "Dart-Code.dart-code",
"editor.formatOnSave": true,
"editor.ensureNewlineAtEndOfFile": true,
"editor.rulers": [
120
]
}
}

View File

@ -16,8 +16,7 @@ import 'package:video_player/video_player.dart';
import 'center_play_button.dart'; import 'center_play_button.dart';
class VideoCustomControls extends StatefulWidget { class VideoCustomControls extends StatefulWidget {
const VideoCustomControls({required this.downloadFn, Key? key}) const VideoCustomControls({required this.downloadFn, Key? key}) : super(key: key);
: super(key: key);
final Future<void> Function() downloadFn; final Future<void> Function() downloadFn;
@override @override
@ -26,8 +25,7 @@ class VideoCustomControls extends StatefulWidget {
} }
} }
class _VideoCustomControlsState extends TIMUIKitState<VideoCustomControls> class _VideoCustomControlsState extends TIMUIKitState<VideoCustomControls> with SingleTickerProviderStateMixin {
with SingleTickerProviderStateMixin {
late VideoPlayerValue _latestValue; late VideoPlayerValue _latestValue;
bool _hideStuff = true; bool _hideStuff = true;
Timer? _hideTimer; Timer? _hideTimer;
@ -77,17 +75,13 @@ class _VideoCustomControlsState extends TIMUIKitState<VideoCustomControls>
alignment: Alignment.center, alignment: Alignment.center,
children: <Widget>[ children: <Widget>[
if (_latestValue.isBuffering) if (_latestValue.isBuffering)
const Center( const Center(child: CircularProgressIndicator(color: Colors.white))
child: CircularProgressIndicator(color: Colors.white))
else else
_buildHitArea(), _buildHitArea(),
Positioned( Positioned(
bottom: 0, bottom: 0,
width: MediaQuery.of(context).size.width, width: MediaQuery.of(context).size.width,
child: Column(children: [ child: Column(children: [_buildVideoControlBar(context), _buildBottomBar()]),
_buildVideoControlBar(context),
_buildBottomBar()
]),
), ),
if (isLoading) if (isLoading)
Container( Container(
@ -207,14 +201,8 @@ class _VideoCustomControlsState extends TIMUIKitState<VideoCustomControls>
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
_buildPlayPause(controller, iconColor), _buildPlayPause(controller, iconColor),
if (chewieController.isLive) if (chewieController.isLive) const Expanded(child: Text('LIVE')) else _buildPositionStart(iconColor),
const Expanded(child: Text('LIVE')) if (chewieController.isLive) const SizedBox() else _buildProgressBar(),
else
_buildPositionStart(iconColor),
if (chewieController.isLive)
const SizedBox()
else
_buildProgressBar(),
if (!chewieController.isLive) _buildPositionEnd(iconColor), if (!chewieController.isLive) _buildPositionEnd(iconColor),
], ],
), ),
@ -250,8 +238,7 @@ class _VideoCustomControlsState extends TIMUIKitState<VideoCustomControls>
)); ));
} }
GestureDetector _buildPlayPause( GestureDetector _buildPlayPause(VideoPlayerController controller, Color color) {
VideoPlayerController controller, Color color) {
return GestureDetector( return GestureDetector(
onTap: _playPause, onTap: _playPause,
child: Container( child: Container(
@ -327,8 +314,7 @@ class _VideoCustomControlsState extends TIMUIKitState<VideoCustomControls>
_hideStuff = true; _hideStuff = true;
chewieController.toggleFullScreen(); chewieController.toggleFullScreen();
_showAfterExpandCollapseTimer = _showAfterExpandCollapseTimer = Timer(const Duration(milliseconds: 300), () {
Timer(const Duration(milliseconds: 300), () {
setState(() { setState(() {
_cancelAndRestartTimer(); _cancelAndRestartTimer();
}); });
@ -424,8 +410,7 @@ class _PlaybackSpeedDialog extends TIMUIKitStatelessWidget {
Widget tuiBuild(BuildContext context, TUIKitBuildValue value) { Widget tuiBuild(BuildContext context, TUIKitBuildValue value) {
final TUITheme theme = value.theme; final TUITheme theme = value.theme;
final Color selectedColor = final Color selectedColor = theme.primaryColor ?? Theme.of(context).primaryColor;
theme.primaryColor ?? Theme.of(context).primaryColor;
return ListView.builder( return ListView.builder(
shrinkWrap: true, shrinkWrap: true,