mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-04-23 12:10:33 +08:00
opt: settings (#977)
This commit is contained in:
committed by
GitHub
parent
aaad7fc6dc
commit
34c5d6812f
@@ -1,16 +1,18 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
typedef StringGetter = String Function();
|
||||
|
||||
class NormalItem extends StatefulWidget {
|
||||
final String? title;
|
||||
final Function? getTitle;
|
||||
final StringGetter? getTitle;
|
||||
final String? subtitle;
|
||||
final Function? getSubtitle;
|
||||
final StringGetter? getSubtitle;
|
||||
final String? setKey;
|
||||
final bool? defaultVal;
|
||||
final ValueChanged<bool>? onChanged;
|
||||
final bool? needReboot;
|
||||
final Widget? leading;
|
||||
final Function? getTrailing;
|
||||
final Widget Function()? getTrailing;
|
||||
final Function? onTap;
|
||||
final EdgeInsetsGeometry? contentPadding;
|
||||
final TextStyle? titleStyle;
|
||||
@@ -30,7 +32,7 @@ class NormalItem extends StatefulWidget {
|
||||
this.contentPadding,
|
||||
this.titleStyle,
|
||||
super.key,
|
||||
});
|
||||
}) : assert(title != null || getTitle != null);
|
||||
|
||||
@override
|
||||
State<NormalItem> createState() => _NormalItemState();
|
||||
@@ -45,12 +47,12 @@ class _NormalItemState extends State<NormalItem> {
|
||||
setState(() {});
|
||||
}),
|
||||
title: Text(
|
||||
widget.title ?? widget.getTitle?.call(),
|
||||
widget.title ?? widget.getTitle!(),
|
||||
style: widget.titleStyle ?? Theme.of(context).textTheme.titleMedium!,
|
||||
),
|
||||
subtitle: widget.subtitle != null || widget.getSubtitle != null
|
||||
? Text(
|
||||
widget.subtitle ?? widget.getSubtitle?.call(),
|
||||
widget.subtitle ?? widget.getSubtitle!(),
|
||||
style: Theme.of(context).textTheme.labelMedium!.copyWith(
|
||||
color: Theme.of(context).colorScheme.outline,
|
||||
),
|
||||
|
||||
@@ -27,10 +27,11 @@ class SelectDialog<T> extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final titleMedium = Theme.of(context).textTheme.titleMedium!;
|
||||
return AlertDialog(
|
||||
clipBehavior: Clip.hardEdge,
|
||||
title: Text(title),
|
||||
contentPadding: const EdgeInsets.fromLTRB(0, 12, 0, 12),
|
||||
contentPadding: const EdgeInsets.symmetric(vertical: 12),
|
||||
content: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
@@ -43,7 +44,7 @@ class SelectDialog<T> extends StatelessWidget {
|
||||
value: item.$1,
|
||||
title: Text(
|
||||
item.$2,
|
||||
style: Theme.of(context).textTheme.titleMedium!,
|
||||
style: titleMedium,
|
||||
),
|
||||
subtitle: subtitleBuilder?.call(context, index),
|
||||
groupValue: value,
|
||||
@@ -106,8 +107,9 @@ class _CdnSelectDialogState extends State<CdnSelectDialog> {
|
||||
tryLook: false,
|
||||
videoType: VideoType.ugc,
|
||||
);
|
||||
if (!result['status']) throw Exception('无法获取视频流');
|
||||
return result['data'].dash.video.first;
|
||||
final item = result.dataOrNull?.dash?.video?.first;
|
||||
if (item == null) throw Exception('无法获取视频流');
|
||||
return item;
|
||||
}
|
||||
|
||||
Future<void> _startSpeedTest() async {
|
||||
|
||||
Reference in New Issue
Block a user