Blame view

lib/pages/video/zone/video_zone_player_page.dart 16.9 KB
383462ef   吴启风   feat: 新增视频专区列表与播放功能
1
2
  import 'dart:async';
  
7e98b732   吴启风   feat: 完善视频播放与本地进度缓存
3
4
  import 'package:chewie/chewie.dart';
  import 'package:flutter/foundation.dart';
383462ef   吴启风   feat: 新增视频专区列表与播放功能
5
  import 'package:flutter/material.dart';
7e98b732   吴启风   feat: 完善视频播放与本地进度缓存
6
  import 'package:flutter/services.dart';
383462ef   吴启风   feat: 新增视频专区列表与播放功能
7
8
  import 'package:video_player/video_player.dart';
  import 'package:wow_english/common/request/dao/video_dao.dart';
dbca8811   吴启风   fix: 修复视频兼容性并增加渲染...
9
  import 'package:wow_english/common/utils/video_playback_diagnostics.dart';
7e98b732   吴启风   feat: 完善视频播放与本地进度缓存
10
  import 'package:wow_english/common/utils/video_progress_cache.dart';
dbca8811   吴启风   fix: 修复视频兼容性并增加渲染...
11
12
  import 'package:wow_english/common/utils/video_rendering_preference.dart';
  import 'package:wow_english/utils/toast_util.dart';
383462ef   吴启风   feat: 新增视频专区列表与播放功能
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
  
  import 'video_zone_item.dart';
  
  class VideoZonePlayerPage extends StatefulWidget {
    const VideoZonePlayerPage({
      super.key,
      required this.items,
      this.initialVideoId,
    }) : assert(items.length > 0, '视频播放列表不能为空');
  
    final List<VideoZoneItem> items;
    final int? initialVideoId;
  
    @override
    State<VideoZonePlayerPage> createState() => _VideoZonePlayerPageState();
  }
  
  class _VideoZonePlayerPageState extends State<VideoZonePlayerPage>
      with WidgetsBindingObserver {
dbca8811   吴启风   fix: 修复视频兼容性并增加渲染...
32
33
34
35
36
    static const _initializeTimeout = Duration(seconds: 10);
    static const _playerCommandTimeout = Duration(seconds: 5);
    static const _progressReadTimeout = Duration(seconds: 2);
    static const _bufferingWarningDelay = Duration(seconds: 10);
  
383462ef   吴启风   feat: 新增视频专区列表与播放功能
37
    VideoPlayerController? _controller;
7e98b732   吴启风   feat: 完善视频播放与本地进度缓存
38
39
    ChewieController? _chewieController;
    Timer? _cacheTimer;
dbca8811   吴启风   fix: 修复视频兼容性并增加渲染...
40
    Timer? _bufferingTimer;
383462ef   吴启风   feat: 新增视频专区列表与播放功能
41
42
    late int _currentIndex;
    double _playbackSpeed = 1;
383462ef   吴启风   feat: 新增视频专区列表与播放功能
43
44
    bool _switchingVideo = false;
    bool _handlingCompletion = false;
dbca8811   吴启风   fix: 修复视频兼容性并增加渲染...
45
    bool _bufferingWarningShown = false;
7e98b732   吴启风   feat: 完善视频播放与本地进度缓存
46
    bool? _lastIsPlaying;
383462ef   吴启风   feat: 新增视频专区列表与播放功能
47
48
49
50
51
52
53
54
55
    int? _completedReportedVideoId;
    Object? _loadError;
  
    VideoZoneItem get _currentItem => widget.items[_currentIndex];
  
    @override
    void initState() {
      super.initState();
      WidgetsBinding.instance.addObserver(this);
7e98b732   吴启风   feat: 完善视频播放与本地进度缓存
56
57
58
      unawaited(
        SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersiveSticky),
      );
383462ef   吴启风   feat: 新增视频专区列表与播放功能
59
60
61
62
63
64
65
66
      final index = widget.initialVideoId == null
          ? 0
          : widget.items.indexWhere((item) => item.id == widget.initialVideoId);
      _currentIndex = index < 0 ? 0 : index;
      _loadCurrentVideo();
    }
  
    Future<void> _loadCurrentVideo() async {
7e98b732   吴启风   feat: 完善视频播放与本地进度缓存
67
68
      final useCupertinoControls = defaultTargetPlatform == TargetPlatform.iOS;
      _cacheTimer?.cancel();
dbca8811   吴启风   fix: 修复视频兼容性并增加渲染...
69
70
      _bufferingTimer?.cancel();
      _bufferingWarningShown = false;
383462ef   吴启风   feat: 新增视频专区列表与播放功能
71
      final oldController = _controller;
7e98b732   吴启风   feat: 完善视频播放与本地进度缓存
72
73
74
75
      final oldChewieController = _chewieController;
      if (oldController?.value.isInitialized == true) {
        _playbackSpeed = oldController!.value.playbackSpeed;
      }
383462ef   吴启风   feat: 新增视频专区列表与播放功能
76
      oldController?.removeListener(_onVideoChanged);
7e98b732   吴启风   feat: 完善视频播放与本地进度缓存
77
      _lastIsPlaying = null;
729eb6df   吴启风   fix: 优化安卓视频播放兼容性
78
79
      final controller = VideoPlayerController.networkUrl(
        Uri.parse(_currentItem.videoUrl),
dbca8811   吴启风   fix: 修复视频兼容性并增加渲染...
80
        viewType: VideoRenderingPreference.viewType,
729eb6df   吴启风   fix: 优化安卓视频播放兼容性
81
      );
383462ef   吴启风   feat: 新增视频专区列表与播放功能
82
      _controller = controller;
7e98b732   吴启风   feat: 完善视频播放与本地进度缓存
83
      _chewieController = null;
383462ef   吴启风   feat: 新增视频专区列表与播放功能
84
85
86
87
      _loadError = null;
      if (mounted) {
        setState(() {});
      }
dbca8811   吴启风   fix: 修复视频兼容性并增加渲染...
88
      var stage = '释放旧播放器';
383462ef   吴启风   feat: 新增视频专区列表与播放功能
89
      try {
dbca8811   吴启风   fix: 修复视频兼容性并增加渲染...
90
91
92
93
        oldChewieController?.dispose();
        await oldController?.dispose().timeout(_playerCommandTimeout);
        stage = '初始化视频流';
        await controller.initialize().timeout(_initializeTimeout);
383462ef   吴启风   feat: 新增视频专区列表与播放功能
94
95
96
97
        if (!mounted || controller != _controller) {
          await controller.dispose();
          return;
        }
dbca8811   吴启风   fix: 修复视频兼容性并增加渲染...
98
99
100
101
102
103
        stage = '配置播放器';
        await controller.setLooping(false).timeout(_playerCommandTimeout);
        await controller
            .setPlaybackSpeed(_playbackSpeed)
            .timeout(_playerCommandTimeout);
        stage = '读取本地播放进度';
7e98b732   吴启风   feat: 完善视频播放与本地进度缓存
104
105
106
107
108
        final savedProgress = await _resumeProgressFor(_currentItem.id);
        if (!mounted || controller != _controller) {
          await controller.dispose();
          return;
        }
383462ef   吴启风   feat: 新增视频专区列表与播放功能
109
110
        if (savedProgress > 0 &&
            savedProgress < controller.value.duration.inSeconds) {
dbca8811   吴启风   fix: 修复视频兼容性并增加渲染...
111
112
113
114
115
116
117
118
119
120
121
122
123
124
          stage = '恢复播放进度';
          try {
            await controller
                .seekTo(Duration(seconds: savedProgress))
                .timeout(_playerCommandTimeout);
          } on TimeoutException catch (error) {
            debugPrint(
              '恢复本地视频进度超时(videoId=${_currentItem.id}): $error',
            );
            _showVideoToast('恢复进度超时,已尝试从头播放');
          } catch (error) {
            debugPrint('恢复本地视频进度失败(videoId=${_currentItem.id}): $error');
            _showVideoToast('恢复进度失败,已尝试从头播放');
          }
383462ef   吴启风   feat: 新增视频专区列表与播放功能
125
        }
dbca8811   吴启风   fix: 修复视频兼容性并增加渲染...
126
        stage = '创建播放界面';
7e98b732   吴启风   feat: 完善视频播放与本地进度缓存
127
        _lastIsPlaying = controller.value.isPlaying;
383462ef   吴启风   feat: 新增视频专区列表与播放功能
128
        controller.addListener(_onVideoChanged);
dbca8811   吴启风   fix: 修复视频兼容性并增加渲染...
129
        _updateBufferingWatch(controller);
7e98b732   吴启风   feat: 完善视频播放与本地进度缓存
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
        _chewieController = ChewieController(
          videoPlayerController: controller,
          autoPlay: true,
          looping: false,
          allowFullScreen: false,
          allowPlaybackSpeedChanging: true,
          draggableProgressBar: true,
          allowedScreenSleep: false,
          playbackSpeeds: const [0.5, 0.75, 1, 1.25, 1.5, 2],
          customControls:
              useCupertinoControls ? null : const _VideoMaterialControls(),
          optionsTranslation: OptionsTranslation(
            playbackSpeedButtonText: '播放速度',
            cancelButtonText: '取消',
          ),
          materialProgressColors: ChewieProgressColors(
            playedColor: const Color(0xFF00B6F1),
            handleColor: const Color(0xFF00B6F1),
            bufferedColor: Colors.white54,
            backgroundColor: Colors.white24,
          ),
          cupertinoProgressColors: ChewieProgressColors(
            playedColor: const Color(0xFF00B6F1),
            handleColor: const Color(0xFF00B6F1),
            bufferedColor: Colors.white54,
            backgroundColor: Colors.white24,
          ),
          placeholder: const ColoredBox(color: Colors.black),
          errorBuilder: (_, __) => const Center(
            child: Text(
              '视频播放失败',
              style: TextStyle(color: Colors.white, fontSize: 18),
            ),
          ),
        );
383462ef   吴启风   feat: 新增视频专区列表与播放功能
165
        _handlingCompletion = false;
7e98b732   吴启风   feat: 完善视频播放与本地进度缓存
166
167
168
169
170
171
172
        _cacheTimer = Timer.periodic(
          const Duration(seconds: 30),
          (_) {
            if (_controller?.value.isPlaying == true) {
              unawaited(_cacheCurrentProgress());
            }
          },
383462ef   吴启风   feat: 新增视频专区列表与播放功能
173
174
175
        );
        setState(() {});
      } catch (error) {
dbca8811   吴启风   fix: 修复视频兼容性并增加渲染...
176
177
178
179
180
181
182
183
184
        final failedCurrentController = controller == _controller;
        if (failedCurrentController) {
          controller.removeListener(_onVideoChanged);
          _bufferingTimer?.cancel();
          _bufferingTimer = null;
          _cacheTimer?.cancel();
          _cacheTimer = null;
          _chewieController?.dispose();
          _chewieController = null;
383462ef   吴启风   feat: 新增视频专区列表与播放功能
185
        }
dbca8811   吴启风   fix: 修复视频兼容性并增加渲染...
186
187
188
189
190
191
192
193
194
195
        await VideoPlaybackDiagnostics.disposeController(
          controller,
          context: '视频专区初始化失败($stage)',
        );
        if (!mounted || !failedCurrentController) return;
        _controller = null;
        final message = _diagnosticMessage(stage, error);
        debugPrint('$message (videoId=${_currentItem.id}): $error');
        _showVideoToast('$message(视频ID: ${_currentItem.id})');
        setState(() => _loadError = error);
383462ef   吴启风   feat: 新增视频专区列表与播放功能
196
197
198
199
200
201
      }
    }
  
    void _onVideoChanged() {
      final controller = _controller;
      if (!mounted || controller == null) return;
dbca8811   吴启风   fix: 修复视频兼容性并增加渲染...
202
      _updateBufferingWatch(controller);
d2b3433a   吴启风   fix: 修复部分安卓设备视频持续加载
203
204
205
      if (controller.value.hasError && _loadError == null) {
        final error = controller.value.errorDescription ?? '未知播放器错误';
        debugPrint('视频播放失败(videoId=${_currentItem.id}): $error');
dbca8811   吴启风   fix: 修复视频兼容性并增加渲染...
206
207
208
        _showVideoToast(
          '${_diagnosticMessage('播放/解码', error)}(视频ID: ${_currentItem.id})',
        );
d2b3433a   吴启风   fix: 修复部分安卓设备视频持续加载
209
210
211
        setState(() => _loadError = error);
        return;
      }
7e98b732   吴启风   feat: 完善视频播放与本地进度缓存
212
213
214
215
216
      final isPlaying = controller.value.isPlaying;
      if (_lastIsPlaying != null && _lastIsPlaying != isPlaying) {
        unawaited(_cacheCurrentProgress());
      }
      _lastIsPlaying = isPlaying;
383462ef   吴启风   feat: 新增视频专区列表与播放功能
217
218
219
220
221
222
      if (controller.value.isCompleted &&
          !_switchingVideo &&
          !_handlingCompletion &&
          _completedReportedVideoId != _currentItem.id) {
        _handlingCompletion = true;
        unawaited(_handleVideoCompleted());
383462ef   吴启风   feat: 新增视频专区列表与播放功能
223
      }
383462ef   吴启风   feat: 新增视频专区列表与播放功能
224
225
    }
  
dbca8811   吴启风   fix: 修复视频兼容性并增加渲染...
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
    void _updateBufferingWatch(VideoPlayerController controller) {
      if (!controller.value.isBuffering) {
        _bufferingTimer?.cancel();
        _bufferingTimer = null;
        _bufferingWarningShown = false;
        return;
      }
      if (_bufferingTimer != null || _bufferingWarningShown) return;
      _bufferingTimer = Timer(_bufferingWarningDelay, () {
        _bufferingTimer = null;
        if (!mounted ||
            controller != _controller ||
            !controller.value.isBuffering) {
          return;
        }
        _bufferingWarningShown = true;
        final error = controller.value.errorDescription;
        final reason =
            error == null ? '网络缓冲或设备解码可能异常' : _diagnosticMessage('播放/解码', error);
        debugPrint('视频持续缓冲(videoId=${_currentItem.id}): $reason ${error ?? ''}');
        _showVideoToast('视频持续缓冲超过10秒:$reason(视频ID: ${_currentItem.id})');
      });
    }
  
383462ef   吴启风   feat: 新增视频专区列表与播放功能
250
251
252
    Future<void> _playNext({bool currentCompleted = false}) async {
      if (_switchingVideo || _currentIndex >= widget.items.length - 1) return;
      _switchingVideo = true;
7e98b732   吴启风   feat: 完善视频播放与本地进度缓存
253
      await _reportCurrentProgress(completed: currentCompleted);
383462ef   吴启风   feat: 新增视频专区列表与播放功能
254
255
256
257
258
259
260
261
262
      setState(() => _currentIndex++);
      await _loadCurrentVideo();
      _switchingVideo = false;
    }
  
    Future<void> _handleVideoCompleted() async {
      if (_currentIndex < widget.items.length - 1) {
        await _playNext(currentCompleted: true);
      } else {
7e98b732   吴启风   feat: 完善视频播放与本地进度缓存
263
        await _reportCurrentProgress(completed: true);
383462ef   吴启风   feat: 新增视频专区列表与播放功能
264
265
266
267
      }
      _handlingCompletion = false;
    }
  
383462ef   吴启风   feat: 新增视频专区列表与播放功能
268
269
270
    @override
    void dispose() {
      WidgetsBinding.instance.removeObserver(this);
7e98b732   吴启风   feat: 完善视频播放与本地进度缓存
271
272
273
274
      unawaited(
        SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersiveSticky),
      );
      _cacheTimer?.cancel();
dbca8811   吴启风   fix: 修复视频兼容性并增加渲染...
275
      _bufferingTimer?.cancel();
383462ef   吴启风   feat: 新增视频专区列表与播放功能
276
      _controller?.removeListener(_onVideoChanged);
7e98b732   吴启风   feat: 完善视频播放与本地进度缓存
277
278
      unawaited(_reportCurrentProgress());
      _chewieController?.dispose();
383462ef   吴启风   feat: 新增视频专区列表与播放功能
279
280
281
282
283
284
      _controller?.dispose();
      super.dispose();
    }
  
    @override
    void didChangeAppLifecycleState(AppLifecycleState state) {
7e98b732   吴启风   feat: 完善视频播放与本地进度缓存
285
286
287
288
289
      if (state == AppLifecycleState.resumed) {
        unawaited(
          SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersiveSticky),
        );
      } else if (state == AppLifecycleState.inactive ||
383462ef   吴启风   feat: 新增视频专区列表与播放功能
290
291
          state == AppLifecycleState.paused ||
          state == AppLifecycleState.detached) {
7e98b732   吴启风   feat: 完善视频播放与本地进度缓存
292
        unawaited(_cacheCurrentProgress());
383462ef   吴启风   feat: 新增视频专区列表与播放功能
293
294
295
      }
    }
  
7e98b732   吴启风   feat: 完善视频播放与本地进度缓存
296
    Future<void> _reportCurrentProgress({bool? completed}) async {
383462ef   吴启风   feat: 新增视频专区列表与播放功能
297
298
      final controller = _controller;
      if (controller == null || !controller.value.isInitialized) return;
7e98b732   吴启风   feat: 完善视频播放与本地进度缓存
299
300
      final currentItem = _currentItem;
      final durationSeconds = controller.value.duration.inSeconds;
383462ef   吴启风   feat: 新增视频专区列表与播放功能
301
302
303
      final progressSeconds = controller.value.position.inSeconds
          .clamp(0, durationSeconds > 0 ? durationSeconds : 0);
      final isCompleted = completed ?? controller.value.isCompleted;
7e98b732   吴启风   feat: 完善视频播放与本地进度缓存
304
305
306
307
308
309
310
      await _persistCachedProgress(
        videoId: currentItem.id,
        progressSeconds: progressSeconds,
        durationSeconds: durationSeconds,
        completed: isCompleted,
      );
      if (isCompleted && _completedReportedVideoId == currentItem.id) return;
383462ef   吴启风   feat: 新增视频专区列表与播放功能
311
312
      try {
        await VideoDao.savePlayRecord(
7e98b732   吴启风   feat: 完善视频播放与本地进度缓存
313
          videoId: currentItem.id,
383462ef   吴启风   feat: 新增视频专区列表与播放功能
314
315
316
317
          progressSeconds: progressSeconds,
          durationSeconds: durationSeconds,
          completed: isCompleted,
        );
7e98b732   吴启风   feat: 完善视频播放与本地进度缓存
318
        if (isCompleted) _completedReportedVideoId = currentItem.id;
383462ef   吴启风   feat: 新增视频专区列表与播放功能
319
320
321
322
323
      } catch (error) {
        debugPrint('保存视频播放记录失败: $error');
      }
    }
  
7e98b732   吴启风   feat: 完善视频播放与本地进度缓存
324
325
    Future<int> _resumeProgressFor(int videoId) async {
      try {
dbca8811   吴启风   fix: 修复视频兼容性并增加渲染...
326
327
        final cached =
            await VideoProgressCache.get(videoId).timeout(_progressReadTimeout);
7e98b732   吴启风   feat: 完善视频播放与本地进度缓存
328
        if (cached != null) return cached.progressSeconds;
dbca8811   吴启风   fix: 修复视频兼容性并增加渲染...
329
330
331
      } on TimeoutException catch (error) {
        debugPrint('读取本地视频进度超时(videoId=$videoId): $error');
        _showVideoToast('本地进度读取超时,已从头播放');
7e98b732   吴启风   feat: 完善视频播放与本地进度缓存
332
333
      } catch (error) {
        debugPrint('读取本地视频播放进度失败: $error');
dbca8811   吴启风   fix: 修复视频兼容性并增加渲染...
334
        _showVideoToast('本地进度读取失败,已从头播放');
7e98b732   吴启风   feat: 完善视频播放与本地进度缓存
335
336
337
338
      }
      return 0;
    }
  
dbca8811   吴启风   fix: 修复视频兼容性并增加渲染...
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
    String _diagnosticMessage(String stage, Object error) {
      final detail = error.toString().toLowerCase();
      if (error is TimeoutException) {
        if (stage == '初始化视频流') return '视频初始化超时,请检查网络或设备解码能力';
        if (stage == '释放旧播放器') return '播放器释放超时,请退出后重试';
        if (stage == '配置播放器') return '播放器配置超时,设备可能不支持当前播放参数';
        if (stage == '恢复播放进度') return '恢复播放进度超时';
        return '$stage超时';
      }
      if (detail.contains('decoder') ||
          detail.contains('codec') ||
          detail.contains('mediacodec') ||
          detail.contains('acodec')) {
        return '视频解码器启动失败,可能是设备兼容性问题';
      }
      if (detail.contains('http') ||
          detail.contains('socket') ||
          detail.contains('network') ||
          detail.contains('connection') ||
          detail.contains('source error') ||
          detail.contains('sourceerror')) {
        return '视频网络请求失败,请检查网络或视频地址';
      }
      if (stage == '初始化视频流') return '视频流初始化失败';
      if (stage == '配置播放器') return '播放器配置失败';
      if (stage == '播放/解码') return '视频播放/解码失败,请检查网络或设备兼容性';
      return '$stage失败';
    }
  
    void _showVideoToast(String message) {
      showToast(message, duration: const Duration(seconds: 4));
    }
  
7e98b732   吴启风   feat: 完善视频播放与本地进度缓存
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
    Future<void> _cacheCurrentProgress() async {
      final controller = _controller;
      if (controller == null || !controller.value.isInitialized) return;
      final currentItem = _currentItem;
      final durationSeconds = controller.value.duration.inSeconds;
      final progressSeconds = controller.value.position.inSeconds
          .clamp(0, durationSeconds > 0 ? durationSeconds : 0);
      await _persistCachedProgress(
        videoId: currentItem.id,
        progressSeconds: progressSeconds,
        durationSeconds: durationSeconds,
        completed: controller.value.isCompleted,
      );
    }
  
    Future<void> _persistCachedProgress({
      required int videoId,
      required int progressSeconds,
      required int durationSeconds,
      required bool completed,
    }) async {
      try {
        if (completed) {
          await VideoProgressCache.remove(videoId);
        } else {
          await VideoProgressCache.save(
            videoId: videoId,
            progressSeconds: progressSeconds,
            durationSeconds: durationSeconds,
          );
        }
      } catch (error) {
        debugPrint('保存本地视频播放进度失败: $error');
      }
    }
  
383462ef   吴启风   feat: 新增视频专区列表与播放功能
408
409
410
    @override
    Widget build(BuildContext context) {
      final controller = _controller;
7e98b732   吴启风   feat: 完善视频播放与本地进度缓存
411
412
413
414
415
416
417
      final chewieController = _chewieController;
      return MediaQuery.removePadding(
        context: context,
        removeTop: true,
        child: Scaffold(
          backgroundColor: Colors.black,
          body: Stack(
383462ef   吴启风   feat: 新增视频专区列表与播放功能
418
419
            fit: StackFit.expand,
            children: [
7e98b732   吴启风   feat: 完善视频播放与本地进度缓存
420
421
422
              if (controller?.value.isInitialized == true &&
                  chewieController != null)
                Chewie(controller: chewieController)
383462ef   吴启风   feat: 新增视频专区列表与播放功能
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
              else if (_loadError != null)
                Center(
                  child: Column(
                    mainAxisSize: MainAxisSize.min,
                    children: [
                      const Text('视频加载失败',
                          style: TextStyle(color: Colors.white, fontSize: 18)),
                      const SizedBox(height: 12),
                      FilledButton(
                          onPressed: _loadCurrentVideo, child: const Text('重试')),
                    ],
                  ),
                )
              else
                const Center(child: CircularProgressIndicator()),
7e98b732   吴启风   feat: 完善视频播放与本地进度缓存
438
439
440
441
              SafeArea(
                top: false,
                child: Align(
                  alignment: Alignment.topLeft,
383462ef   吴启风   feat: 新增视频专区列表与播放功能
442
443
                  child: Row(
                    children: [
7e98b732   吴启风   feat: 完善视频播放与本地进度缓存
444
445
446
447
448
                      IconButton(
                        onPressed: () => Navigator.of(context).pop(),
                        icon: const Icon(Icons.arrow_back_ios_new,
                            color: Colors.white),
                      ),
383462ef   吴启风   feat: 新增视频专区列表与播放功能
449
                      Expanded(
7e98b732   吴启风   feat: 完善视频播放与本地进度缓存
450
451
452
453
454
455
                        child: Text(
                          _currentItem.title,
                          maxLines: 1,
                          overflow: TextOverflow.ellipsis,
                          style:
                              const TextStyle(color: Colors.white, fontSize: 20),
383462ef   吴启风   feat: 新增视频专区列表与播放功能
456
457
                        ),
                      ),
383462ef   吴启风   feat: 新增视频专区列表与播放功能
458
459
460
                    ],
                  ),
                ),
7e98b732   吴启风   feat: 完善视频播放与本地进度缓存
461
              ),
383462ef   吴启风   feat: 新增视频专区列表与播放功能
462
463
464
465
466
            ],
          ),
        ),
      );
    }
7e98b732   吴启风   feat: 完善视频播放与本地进度缓存
467
  }
383462ef   吴启风   feat: 新增视频专区列表与播放功能
468
  
7e98b732   吴启风   feat: 完善视频播放与本地进度缓存
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
  class _VideoMaterialControls extends StatelessWidget {
    const _VideoMaterialControls();
  
    @override
    Widget build(BuildContext context) {
      return Theme(
        data: Theme.of(context).copyWith(
          iconButtonTheme: IconButtonThemeData(
            style: IconButton.styleFrom(
              minimumSize: const Size.square(72),
              padding: const EdgeInsets.all(20),
            ),
          ),
        ),
        child: const MaterialControls(),
      );
383462ef   吴启风   feat: 新增视频专区列表与播放功能
485
486
    }
  }