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
# 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/

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';
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<void> Function() downloadFn;
@override
@ -26,8 +25,7 @@ class VideoCustomControls extends StatefulWidget {
}
}
class _VideoCustomControlsState extends TIMUIKitState<VideoCustomControls>
with SingleTickerProviderStateMixin {
class _VideoCustomControlsState extends TIMUIKitState<VideoCustomControls> with SingleTickerProviderStateMixin {
late VideoPlayerValue _latestValue;
bool _hideStuff = true;
Timer? _hideTimer;
@ -77,17 +75,13 @@ class _VideoCustomControlsState extends TIMUIKitState<VideoCustomControls>
alignment: Alignment.center,
children: <Widget>[
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<VideoCustomControls>
child: Row(
children: <Widget>[
_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<VideoCustomControls>
));
}
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<VideoCustomControls>
_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,