1
1
import 'dart:ui' ;
2
2
3
+ import 'package:command_palette/command_palette.dart' ;
3
4
import 'package:flutter/cupertino.dart' ;
4
5
import 'package:flutter/material.dart' ;
5
6
import 'package:flutter/services.dart' ;
@@ -9,6 +10,7 @@ import 'package:movie/app/modules/home/views/parse_vip_manage.dart';
9
10
import 'package:movie/app/widget/helper.dart' ;
10
11
import 'package:movie/app/widget/window_appbar.dart' ;
11
12
import 'package:movie/widget/simple_html/flutter_html.dart' ;
13
+ import 'package:simple/x.dart' ;
12
14
import 'package:xi/adapters/mac_cms.dart' ;
13
15
import 'package:xi/xi.dart' ;
14
16
@@ -46,6 +48,8 @@ class _PlayViewState extends State<PlayView> {
46
48
47
49
FocusNode focusNode = FocusNode ();
48
50
51
+ ScrollController scrollController = ScrollController ();
52
+
49
53
bool get canBeShowParseVipButton {
50
54
return home.parseVipList.isNotEmpty;
51
55
}
@@ -163,10 +167,28 @@ class _PlayViewState extends State<PlayView> {
163
167
),
164
168
),
165
169
body: Shortcuts (
166
- shortcuts: const {
167
- SingleActivator (LogicalKeyboardKey .escape): DismissIntent (),
168
- SingleActivator (LogicalKeyboardKey .backspace): DismissIntent (),
169
- SingleActivator (LogicalKeyboardKey .enter): ActivateIntent (),
170
+ shortcuts: {
171
+ // esc
172
+ const SingleActivator (LogicalKeyboardKey .escape):
173
+ const DismissIntent (),
174
+ // backspace
175
+ const SingleActivator (LogicalKeyboardKey .backspace):
176
+ const DismissIntent (),
177
+ // enter
178
+ const SingleActivator (LogicalKeyboardKey .enter):
179
+ const ActivateIntent (),
180
+ // ctrl-p
181
+ const SingleActivator (LogicalKeyboardKey .keyP, control: true ):
182
+ ScrollUpIntent (),
183
+ // ctrl-n
184
+ const SingleActivator (LogicalKeyboardKey .keyN, control: true ):
185
+ ScrollDownIntent (),
186
+ // // cmd-shift-[
187
+ // const SingleActivator(LogicalKeyboardKey.braceLeft /* { */,
188
+ // meta: true, shift: true): TabSwitchLeftIntent(),
189
+ // // cmd-shift-]
190
+ // const SingleActivator(LogicalKeyboardKey.braceRight /* } */,
191
+ // meta: true, shift: true): TabSwitchRightIntent(),
170
192
},
171
193
child: Actions (
172
194
actions: {
@@ -186,6 +208,18 @@ class _PlayViewState extends State<PlayView> {
186
208
return null ;
187
209
},
188
210
),
211
+ ScrollUpIntent : CallbackAction <ScrollUpIntent >(
212
+ onInvoke: (_) {
213
+ scrollUp (scrollController);
214
+ return null ;
215
+ },
216
+ ),
217
+ ScrollDownIntent : CallbackAction <ScrollDownIntent >(
218
+ onInvoke: (_) {
219
+ scrollDown (scrollController);
220
+ return null ;
221
+ },
222
+ ),
189
223
},
190
224
child: Focus (
191
225
autofocus: true ,
@@ -196,6 +230,7 @@ class _PlayViewState extends State<PlayView> {
196
230
color: context.isDarkMode ? Colors .white : Colors .black,
197
231
),
198
232
child: SingleChildScrollView (
233
+ controller: scrollController,
199
234
child: Column (
200
235
mainAxisAlignment: MainAxisAlignment .start,
201
236
crossAxisAlignment: CrossAxisAlignment .start,
@@ -349,17 +384,21 @@ class _PlayViewState extends State<PlayView> {
349
384
},
350
385
);
351
386
}
352
- return CupertinoSlidingSegmentedControl (
353
- backgroundColor: Colors .black26,
354
- thumbColor: context.isDarkMode
355
- ? Colors .blue
356
- : Colors .white,
357
- onValueChanged: (value) {
358
- if (value == null ) return ;
359
- play.changeTabIndex (value);
360
- },
361
- groupValue: play.tabIndex,
362
- children: tabviewData,
387
+ return Padding (
388
+ padding: const EdgeInsets .symmetric (
389
+ horizontal: 12 ),
390
+ child: CupertinoSlidingSegmentedControl (
391
+ backgroundColor: Colors .black26,
392
+ thumbColor: context.isDarkMode
393
+ ? Colors .blue
394
+ : Colors .white,
395
+ onValueChanged: (value) {
396
+ if (value == null ) return ;
397
+ play.changeTabIndex (value);
398
+ },
399
+ groupValue: play.tabIndex,
400
+ children: tabviewData,
401
+ ),
363
402
);
364
403
}),
365
404
),
0 commit comments