Skip to content

基于自定义规则的番剧采集APP,支持流媒体在线观看,支持弹幕,支持实时超分辨率。

fix(player): restore compact mobile danmaku input sheet

Predidit05b19ba71ffd
diff --git a/lib/pages/video/danmaku_send_sheet.dart b/lib/pages/video/danmaku_send_sheet.dart
new file mode 100644
index 00000000..b46cd9c0
--- /dev/null
+++ b/lib/pages/video/danmaku_send_sheet.dart
@@ -0,0 +1,75 @@
+import 'package:flutter/material.dart';
+
+Future<String?> showMobileDanmakuInputSheet(BuildContext context) {
+ return showModalBottomSheet<String>(
+ context: context,
+ shape: const BeveledRectangleBorder(),
+ isScrollControlled: true,
+ builder: (context) => const _MobileDanmakuInputSheet(),
+ );
+}
+
+class _MobileDanmakuInputSheet extends StatefulWidget {
+ const _MobileDanmakuInputSheet();
+
+ @override
+ State<_MobileDanmakuInputSheet> createState() =>
+ _MobileDanmakuInputSheetState();
+}
+
+class _MobileDanmakuInputSheetState extends State<_MobileDanmakuInputSheet> {
+ String _danmakuText = '';
+
+ void _submit([String? value]) {
+ Navigator.of(context).pop(value ?? _danmakuText);
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ return Padding(
+ padding: EdgeInsets.only(
+ bottom: MediaQuery.viewInsetsOf(context).bottom,
+ left: 8,
+ ),
+ child: Row(
+ mainAxisAlignment: MainAxisAlignment.center,
+ children: [
+ Expanded(
+ child: Container(
+ constraints: const BoxConstraints(maxHeight: 34),
+ child: TextField(
+ style: const TextStyle(fontSize: 15),
+ autofocus: true,
+ textInputAction: TextInputAction.send,
+ textAlignVertical: TextAlignVertical.center,
+ onChanged: (value) => _danmakuText = value,
+ onSubmitted: _submit,
+ decoration: const InputDecoration(
+ filled: true,
+ floatingLabelBehavior: FloatingLabelBehavior.never,
+ hintText: '发个友善的弹幕见证当下',
+ hintStyle: TextStyle(fontSize: 14),
+ alignLabelWithHint: true,
+ contentPadding:
+ EdgeInsets.symmetric(vertical: 8, horizontal: 12),
+ border: OutlineInputBorder(
+ borderSide: BorderSide.none,
+ borderRadius: BorderRadius.all(Radius.circular(20)),
+ ),
+ ),
+ ),
+ ),
+ ),
+ IconButton(
+ tooltip: '发送',
+ onPressed: _submit,
+ icon: Icon(
+ Icons.send_rounded,
+ color: Theme.of(context).colorScheme.primary,
+ ),
+ ),
+ ],
+ ),
+ );
+ }
+}
diff --git a/lib/pages/video/video_page.dart b/lib/pages/video/video_page.dart
index 0b30c200..29226bbf 100644
--- a/lib/pages/video/video_page.dart
+++ b/lib/pages/video/video_page.dart
@@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_modular/flutter_modular.dart';
import 'package:kazumi/pages/player/player_controller.dart';
import 'package:kazumi/pages/video/video_controller.dart';
+import 'package:kazumi/pages/video/danmaku_send_sheet.dart';
import 'package:kazumi/pages/video/video_playback_args.dart';
import 'package:kazumi/pages/history/history_controller.dart';
import 'package:kazumi/services/logging/logger.dart';
@@ -489,52 +490,7 @@ class _VideoPageState extends State<VideoPage>
}
Future<void> showMobileDanmakuInput() async {
- String danmakuText = '';
- final message = await showAdaptiveBottomSheet<String>(
- context: context,
- builder: (context) {
- return Padding(
- padding: EdgeInsets.fromLTRB(
- 16,
- 12,
- 16,
- 16 + MediaQuery.viewInsetsOf(context).bottom,
- ),
- child: Row(
- crossAxisAlignment: CrossAxisAlignment.center,
- children: [
- Expanded(
- child: TextField(
- autofocus: true,
- textInputAction: TextInputAction.send,
- onChanged: (value) => danmakuText = value,
- onSubmitted: (message) {
- Navigator.of(context).pop(message);
- },
- decoration: const InputDecoration(
- filled: true,
- hintText: '发个友善的弹幕见证当下',
- prefixIcon: Icon(Icons.chat_bubble_outline_rounded),
- border: OutlineInputBorder(
- borderSide: BorderSide.none,
- borderRadius: BorderRadius.all(Radius.circular(20)),
- ),
- ),
- ),
- ),
- const SizedBox(width: 12),
- IconButton.filled(
- tooltip: '发送',
- onPressed: () {
- Navigator.of(context).pop(danmakuText);
- },
- icon: const Icon(Icons.send_rounded),
- ),
- ],
- ),
- );
- },
- );
+ final message = await showMobileDanmakuInputSheet(context);
if (!mounted || message == null) {
return;