diff --git a/lib/HistoricalRecord.dart b/lib/HistoricalRecord.dart index 7aff251..4ed303a 100644 --- a/lib/HistoricalRecord.dart +++ b/lib/HistoricalRecord.dart @@ -186,7 +186,7 @@ class _FallDetailPageState extends State { void initState() { super.initState(); BetterPlayerConfiguration betterPlayerConfiguration = - BetterPlayerConfiguration( + const BetterPlayerConfiguration( aspectRatio: 16 / 9, fit: BoxFit.contain, ); @@ -225,6 +225,7 @@ class _FallDetailPageState extends State { videoFormat: BetterPlayerVideoFormat.hls, ); _betterPlayerController.setupDataSource(dataSource); + setState(() {}); // 重新繪製畫面 } } catch (e) { @@ -253,11 +254,10 @@ class _FallDetailPageState extends State { SizedBox(height: 10), Text('跌倒地點: ${widget.fallDetail['跌倒地點']}', style: TextStyle(fontSize: 18)), // 在這裡可以添加更多詳細資料 - if (_betterPlayerController != null) - AspectRatio( - aspectRatio: 16 / 9, - child: BetterPlayer(controller: _betterPlayerController), - ), + if (fhvideoId != '') AspectRatio( + aspectRatio: 16 / 9, + child: BetterPlayer(controller: _betterPlayerController), + ), ], ), ),