frosty/lib/screens/settings/video_settings.dart
Tommy Chow 04e5479acd add keep screen awake setting
adds a user-controlled toggle (default on) under video settings that
controls whether wakelock is enabled during channel sessions. previously
wakelock was unconditional with no way to turn it off.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 23:58:32 -08:00

81 lines
3.1 KiB
Dart

import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter_mobx/flutter_mobx.dart';
import 'package:frosty/screens/settings/stores/settings_store.dart';
import 'package:frosty/screens/settings/widgets/settings_list_switch.dart';
import 'package:frosty/utils.dart';
import 'package:frosty/widgets/section_header.dart';
import 'package:frosty/widgets/settings_page_layout.dart';
class VideoSettings extends StatelessWidget {
final SettingsStore settingsStore;
const VideoSettings({super.key, required this.settingsStore});
@override
Widget build(BuildContext context) {
return Observer(
builder: (context) => SettingsPageLayout(
children: [
const SectionHeader('Player', isFirst: true),
SettingsListSwitch(
title: 'Enable video',
value: settingsStore.showVideo,
onChanged: (newValue) => settingsStore.showVideo = newValue,
),
if (!Platform.isIOS || isIPad())
SettingsListSwitch(
title: 'Default to highest quality',
value: settingsStore.defaultToHighestQuality,
onChanged: (newValue) =>
settingsStore.defaultToHighestQuality = newValue,
),
if (Platform.isAndroid)
SettingsListSwitch(
title: 'Use fast video rendering',
subtitle: const Text(
'Uses a faster WebView rendering method. Disable if you experience crashes while watching streams.',
),
value: settingsStore.useTextureRendering,
onChanged: (newValue) =>
settingsStore.useTextureRendering = newValue,
),
SettingsListSwitch(
title: 'Keep screen awake',
subtitle: const Text(
'Prevents the screen from sleeping while a channel is open.',
),
value: settingsStore.keepScreenAwake,
onChanged: (newValue) => settingsStore.keepScreenAwake = newValue,
),
const SectionHeader('Overlay'),
SettingsListSwitch(
title: 'Use custom video overlay',
subtitle: const Text(
'Replaces Twitch\'s default web overlay with a mobile-friendly version.',
),
value: settingsStore.showOverlay,
onChanged: (newValue) => settingsStore.showOverlay = newValue,
),
SettingsListSwitch(
title: 'Long-press player to toggle overlay',
subtitle: const Text(
'Allows switching between Twitch\'s overlay and the custom overlay.',
),
value: settingsStore.toggleableOverlay,
onChanged: (newValue) => settingsStore.toggleableOverlay = newValue,
),
SettingsListSwitch(
title: 'Show latency',
subtitle: const Text(
'Displays the stream latency in the video overlay.',
),
value: settingsStore.showLatency,
onChanged: (newValue) => settingsStore.showLatency = newValue,
),
],
),
);
}
}