feat: Android TV support (#503)

Co-authored-by: PartyDonut <PartyDonut@users.noreply.github.com>
This commit is contained in:
PartyDonut 2025-09-28 21:07:49 +02:00 committed by GitHub
parent 7ab8c015b9
commit c299492d6d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
168 changed files with 12019 additions and 3073 deletions

View file

@ -1,12 +1,14 @@
import 'package:flutter/material.dart';
import 'package:fladder/screens/shared/flat_button.dart';
import 'package:fladder/widgets/shared/ensure_visible.dart';
class SettingsListTile extends StatelessWidget {
final Widget label;
final Widget? subLabel;
final Widget? trailing;
final bool selected;
final bool autoFocus;
final IconData? icon;
final Widget? leading;
final Color? contentColor;
@ -16,6 +18,7 @@ class SettingsListTile extends StatelessWidget {
this.subLabel,
this.trailing,
this.selected = false,
this.autoFocus = false,
this.leading,
this.icon,
this.contentColor,
@ -52,6 +55,12 @@ class SettingsListTile extends StatelessWidget {
margin: EdgeInsets.zero,
child: FlatButton(
onTap: onTap,
autoFocus: autoFocus,
onFocusChange: (value) {
if (value) {
context.ensureVisible();
}
},
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 16,
@ -66,6 +75,7 @@ class SettingsListTile extends StatelessWidget {
child: ClipRRect(
borderRadius: BorderRadius.circular(12),
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.start,
children: [
DefaultTextStyle.merge(
@ -85,7 +95,7 @@ class SettingsListTile extends StatelessWidget {
children: [
Material(
color: Colors.transparent,
textStyle: Theme.of(context).textTheme.titleLarge,
textStyle: Theme.of(context).textTheme.titleLarge?.copyWith(color: contentColor),
child: label,
),
if (subLabel != null)
@ -93,7 +103,7 @@ class SettingsListTile extends StatelessWidget {
opacity: 0.65,
child: Material(
color: Colors.transparent,
textStyle: Theme.of(context).textTheme.labelLarge,
textStyle: Theme.of(context).textTheme.labelLarge?.copyWith(color: contentColor),
child: subLabel,
),
),
@ -101,9 +111,12 @@ class SettingsListTile extends StatelessWidget {
),
),
if (trailing != null)
Padding(
padding: const EdgeInsets.only(left: 16),
child: trailing,
ExcludeFocusTraversal(
excluding: onTap != null,
child: Padding(
padding: const EdgeInsets.only(left: 16),
child: trailing,
),
)
],
),