import 'package:flutter/material.dart'; import '../../../core/contracts/player_gestures.dart'; import '../../../shared/widgets/setting_select.dart'; import '../../player/gestures/gesture_action.dart' as g; import '../utils/settings_labels.dart'; class SeekDurationRow extends StatelessWidget { final String title; final int seconds; final ValueChanged onChanged; static const _options = [5, 10, 15, 20, 30, 45, 60, 90, 120]; const SeekDurationRow({ super.key, required this.title, required this.seconds, required this.onChanged, }); @override Widget build(BuildContext context) { final theme = Theme.of(context); return Padding( padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 16), child: Row( children: [ Expanded( child: Text( title, style: theme.textTheme.bodyMedium?.copyWith( fontWeight: FontWeight.w500, ), ), ), SettingSelect( value: seconds, options: _options, labelOf: (value) => '$value 秒', onChanged: (v) { if (v != null) onChanged(v); }, ), ], ), ); } } class GestureSpeedRow extends StatelessWidget { final String title; final double value; final ValueChanged onChanged; static const _options = [ 0.5, 0.75, 1.0, 1.25, 1.5, 1.75, 2.0, 2.5, 3.0, 4.0, 8.0, ]; const GestureSpeedRow({ super.key, required this.title, required this.value, required this.onChanged, }); @override Widget build(BuildContext context) { final theme = Theme.of(context); return Padding( padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 16), child: Row( children: [ Expanded( child: Text( title, style: theme.textTheme.bodyMedium?.copyWith( fontWeight: FontWeight.w500, ), ), ), SettingSelect( value: value, options: _options, labelOf: formatMenuSpeed, onChanged: (v) { if (v != null) onChanged(v); }, ), ], ), ); } } class GestureActionRow extends StatelessWidget { final String title; final g.GestureKind kind; final GestureAction value; final ValueChanged onChanged; const GestureActionRow({ super.key, required this.title, required this.kind, required this.value, required this.onChanged, }); @override Widget build(BuildContext context) { final theme = Theme.of(context); final options = g.allowedActionsFor(kind); return Padding( padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 16), child: Row( children: [ Expanded( child: Text( title, style: theme.textTheme.bodyMedium?.copyWith( fontWeight: FontWeight.w500, ), ), ), SettingSelect( value: value, options: options, labelOf: g.gestureActionLabel, onChanged: (v) { if (v != null) onChanged(v); }, ), ], ), ); } }