mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
@@ -2,9 +2,9 @@ import 'package:PiliPlus/pages/setting/models/extra_settings.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class ExtraSetting extends StatefulWidget {
|
||||
const ExtraSetting({super.key, this.showAppBar});
|
||||
const ExtraSetting({super.key, this.showAppBar = true});
|
||||
|
||||
final bool? showAppBar;
|
||||
final bool showAppBar;
|
||||
|
||||
@override
|
||||
State<ExtraSetting> createState() => _ExtraSettingState();
|
||||
@@ -15,14 +15,16 @@ class _ExtraSettingState extends State<ExtraSetting> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final showAppBar = widget.showAppBar;
|
||||
final padding = MediaQuery.viewPaddingOf(context);
|
||||
return Scaffold(
|
||||
resizeToAvoidBottomInset: false,
|
||||
appBar: widget.showAppBar == false
|
||||
? null
|
||||
: AppBar(title: const Text('其它设置')),
|
||||
appBar: showAppBar ? AppBar(title: const Text('其它设置')) : null,
|
||||
body: ListView(
|
||||
padding: EdgeInsets.only(
|
||||
bottom: MediaQuery.viewPaddingOf(context).bottom + 100,
|
||||
left: showAppBar ? padding.left : 0,
|
||||
right: showAppBar ? padding.right : 0,
|
||||
bottom: padding.bottom + 100,
|
||||
),
|
||||
children: settings.map((item) => item.widget).toList(),
|
||||
),
|
||||
|
||||
@@ -16,9 +16,9 @@ class SettingsModel {
|
||||
final String? subtitle;
|
||||
final StringGetter? getSubtitle;
|
||||
final String? setKey;
|
||||
final bool? defaultVal;
|
||||
final bool defaultVal;
|
||||
final ValueChanged<bool>? onChanged;
|
||||
final bool? needReboot;
|
||||
final bool needReboot;
|
||||
final Widget? leading;
|
||||
final Widget Function()? getTrailing;
|
||||
final Function? onTap;
|
||||
@@ -32,9 +32,9 @@ class SettingsModel {
|
||||
this.subtitle,
|
||||
this.getSubtitle,
|
||||
this.setKey,
|
||||
this.defaultVal,
|
||||
this.defaultVal = false,
|
||||
this.onChanged,
|
||||
this.needReboot,
|
||||
this.needReboot = false,
|
||||
this.leading,
|
||||
this.getTrailing,
|
||||
this.onTap,
|
||||
@@ -49,9 +49,6 @@ class SettingsModel {
|
||||
subtitle: subtitle,
|
||||
getSubtitle: getSubtitle,
|
||||
setKey: setKey,
|
||||
defaultVal: defaultVal,
|
||||
onChanged: onChanged,
|
||||
needReboot: needReboot,
|
||||
leading: leading,
|
||||
getTrailing: getTrailing,
|
||||
onTap: onTap,
|
||||
|
||||
@@ -449,7 +449,6 @@ List<SettingsModel> get styleSettings => [
|
||||
contentPadding: const EdgeInsets.symmetric(vertical: 16),
|
||||
title: const Text('Color Picker'),
|
||||
content: SlideColorPicker(
|
||||
showResetBtn: false,
|
||||
color: reduceLuxColor ?? Colors.white,
|
||||
callback: (Color? color) {
|
||||
if (color != null && color != reduceLuxColor) {
|
||||
|
||||
@@ -68,11 +68,13 @@ class _BarSetPageState extends State<BarSetPage> {
|
||||
),
|
||||
body: ReorderableListView(
|
||||
onReorder: onReorder,
|
||||
footer: SizedBox(
|
||||
height: MediaQuery.viewPaddingOf(context).bottom + 30,
|
||||
footer: Padding(
|
||||
padding:
|
||||
MediaQuery.viewPaddingOf(context).copyWith(top: 0, left: 0) +
|
||||
const EdgeInsets.only(right: 34, top: 10),
|
||||
child: const Align(
|
||||
alignment: Alignment.centerRight,
|
||||
child: Text('*长按拖动排序 '),
|
||||
child: Text('*长按拖动排序'),
|
||||
),
|
||||
),
|
||||
children: defaultBars
|
||||
|
||||
@@ -53,142 +53,145 @@ class _ColorSelectPageState extends State<ColorSelectPage> {
|
||||
TextStyle subTitleStyle = theme.textTheme.labelMedium!.copyWith(
|
||||
color: theme.colorScheme.outline,
|
||||
);
|
||||
final size = Get.size;
|
||||
final size = MediaQuery.sizeOf(context);
|
||||
final padding = MediaQuery.viewPaddingOf(
|
||||
context,
|
||||
).copyWith(top: 0, bottom: 0);
|
||||
return Scaffold(
|
||||
resizeToAvoidBottomInset: false,
|
||||
appBar: AppBar(title: const Text('选择应用主题')),
|
||||
body: SafeArea(
|
||||
bottom: false,
|
||||
child: ListView(
|
||||
children: [
|
||||
ListTile(
|
||||
onTap: () async {
|
||||
ThemeType? result = await showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return SelectDialog<ThemeType>(
|
||||
title: '主题模式',
|
||||
value: ctr.themeType.value,
|
||||
values: ThemeType.values.map((e) => (e, e.desc)).toList(),
|
||||
);
|
||||
},
|
||||
);
|
||||
if (result != null) {
|
||||
try {
|
||||
Get.find<MineController>().themeType.value = result;
|
||||
} catch (_) {}
|
||||
ctr.themeType.value = result;
|
||||
GStorage.setting.put(SettingBoxKey.themeMode, result.index);
|
||||
Get.changeThemeMode(result.toThemeMode);
|
||||
}
|
||||
},
|
||||
leading: Container(
|
||||
width: 40,
|
||||
alignment: Alignment.center,
|
||||
child: const Icon(Icons.flashlight_on_outlined),
|
||||
),
|
||||
title: Text('主题模式', style: titleStyle),
|
||||
subtitle: Obx(
|
||||
() => Text(
|
||||
'当前模式:${ctr.themeType.value.desc}',
|
||||
style: subTitleStyle,
|
||||
),
|
||||
body: ListView(
|
||||
children: [
|
||||
ListTile(
|
||||
onTap: () async {
|
||||
ThemeType? result = await showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return SelectDialog<ThemeType>(
|
||||
title: '主题模式',
|
||||
value: ctr.themeType.value,
|
||||
values: ThemeType.values.map((e) => (e, e.desc)).toList(),
|
||||
);
|
||||
},
|
||||
);
|
||||
if (result != null) {
|
||||
try {
|
||||
Get.find<MineController>().themeType.value = result;
|
||||
} catch (_) {}
|
||||
ctr.themeType.value = result;
|
||||
GStorage.setting.put(SettingBoxKey.themeMode, result.index);
|
||||
Get.changeThemeMode(result.toThemeMode);
|
||||
}
|
||||
},
|
||||
leading: Container(
|
||||
width: 40,
|
||||
alignment: Alignment.center,
|
||||
child: const Icon(Icons.flashlight_on_outlined),
|
||||
),
|
||||
title: Text('主题模式', style: titleStyle),
|
||||
subtitle: Obx(
|
||||
() => Text(
|
||||
'当前模式:${ctr.themeType.value.desc}',
|
||||
style: subTitleStyle,
|
||||
),
|
||||
),
|
||||
Obx(
|
||||
() => ListTile(
|
||||
enabled: ctr.type.value != 0,
|
||||
title: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
const Text('调色板风格'),
|
||||
PopupMenuButton(
|
||||
enabled: ctr.type.value != 0,
|
||||
initialValue: _dynamicSchemeVariant,
|
||||
onSelected: (item) {
|
||||
_dynamicSchemeVariant = item;
|
||||
GStorage.setting.put(
|
||||
SettingBoxKey.schemeVariant,
|
||||
item.index,
|
||||
);
|
||||
Get.forceAppUpdate();
|
||||
},
|
||||
itemBuilder: (context) => FlexSchemeVariant.values
|
||||
.map(
|
||||
(item) => PopupMenuItem<FlexSchemeVariant>(
|
||||
value: item,
|
||||
child: Text(item.variantName),
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
_dynamicSchemeVariant.variantName,
|
||||
style: TextStyle(
|
||||
height: 1,
|
||||
fontSize: 13,
|
||||
color: ctr.type.value == 0
|
||||
? theme.colorScheme.outline.withValues(
|
||||
alpha: 0.8,
|
||||
)
|
||||
: theme.colorScheme.secondary,
|
||||
),
|
||||
strutStyle: const StrutStyle(leading: 0, height: 1),
|
||||
),
|
||||
Obx(
|
||||
() => ListTile(
|
||||
enabled: ctr.type.value != 0,
|
||||
title: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
const Text('调色板风格'),
|
||||
PopupMenuButton(
|
||||
enabled: ctr.type.value != 0,
|
||||
initialValue: _dynamicSchemeVariant,
|
||||
onSelected: (item) {
|
||||
_dynamicSchemeVariant = item;
|
||||
GStorage.setting.put(
|
||||
SettingBoxKey.schemeVariant,
|
||||
item.index,
|
||||
);
|
||||
Get.forceAppUpdate();
|
||||
},
|
||||
itemBuilder: (context) => FlexSchemeVariant.values
|
||||
.map(
|
||||
(item) => PopupMenuItem<FlexSchemeVariant>(
|
||||
value: item,
|
||||
child: Text(item.variantName),
|
||||
),
|
||||
Icon(
|
||||
size: 20,
|
||||
Icons.keyboard_arrow_right,
|
||||
)
|
||||
.toList(),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
_dynamicSchemeVariant.variantName,
|
||||
style: TextStyle(
|
||||
height: 1,
|
||||
fontSize: 13,
|
||||
color: ctr.type.value == 0
|
||||
? theme.colorScheme.outline.withValues(
|
||||
alpha: 0.8,
|
||||
)
|
||||
: theme.colorScheme.secondary,
|
||||
),
|
||||
],
|
||||
),
|
||||
strutStyle: const StrutStyle(leading: 0, height: 1),
|
||||
),
|
||||
Icon(
|
||||
size: 20,
|
||||
Icons.keyboard_arrow_right,
|
||||
color: ctr.type.value == 0
|
||||
? theme.colorScheme.outline.withValues(
|
||||
alpha: 0.8,
|
||||
)
|
||||
: theme.colorScheme.secondary,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
leading: Container(
|
||||
width: 40,
|
||||
alignment: Alignment.center,
|
||||
child: const Icon(Icons.palette_outlined),
|
||||
),
|
||||
subtitle: Text(
|
||||
_dynamicSchemeVariant.description,
|
||||
style: const TextStyle(fontSize: 12),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
leading: Container(
|
||||
width: 40,
|
||||
alignment: Alignment.center,
|
||||
child: const Icon(Icons.palette_outlined),
|
||||
),
|
||||
subtitle: Text(
|
||||
_dynamicSchemeVariant.description,
|
||||
style: const TextStyle(fontSize: 12),
|
||||
),
|
||||
),
|
||||
Obx(
|
||||
() => RadioListTile(
|
||||
value: 0,
|
||||
title: const Text('动态取色'),
|
||||
groupValue: ctr.type.value,
|
||||
onChanged: (dynamic val) {
|
||||
ctr
|
||||
..type.value = 0
|
||||
..setting.put(SettingBoxKey.dynamicColor, true);
|
||||
Get.forceAppUpdate();
|
||||
},
|
||||
),
|
||||
),
|
||||
Obx(
|
||||
() => RadioListTile(
|
||||
value: 0,
|
||||
title: const Text('动态取色'),
|
||||
groupValue: ctr.type.value,
|
||||
onChanged: (dynamic val) {
|
||||
ctr
|
||||
..type.value = 0
|
||||
..setting.put(SettingBoxKey.dynamicColor, true);
|
||||
Get.forceAppUpdate();
|
||||
},
|
||||
),
|
||||
Obx(
|
||||
() => RadioListTile(
|
||||
value: 1,
|
||||
title: const Text('指定颜色'),
|
||||
groupValue: ctr.type.value,
|
||||
onChanged: (dynamic val) {
|
||||
ctr
|
||||
..type.value = 1
|
||||
..setting.put(SettingBoxKey.dynamicColor, false);
|
||||
Get.forceAppUpdate();
|
||||
},
|
||||
),
|
||||
),
|
||||
Obx(
|
||||
() => RadioListTile(
|
||||
value: 1,
|
||||
title: const Text('指定颜色'),
|
||||
groupValue: ctr.type.value,
|
||||
onChanged: (dynamic val) {
|
||||
ctr
|
||||
..type.value = 1
|
||||
..setting.put(SettingBoxKey.dynamicColor, false);
|
||||
Get.forceAppUpdate();
|
||||
},
|
||||
),
|
||||
AnimatedSize(
|
||||
),
|
||||
Padding(
|
||||
padding: padding,
|
||||
child: AnimatedSize(
|
||||
curve: Curves.easeInOut,
|
||||
alignment: Alignment.topCenter,
|
||||
duration: const Duration(milliseconds: 200),
|
||||
@@ -239,8 +242,11 @@ class _ColorSelectPageState extends State<ColorSelectPage> {
|
||||
),
|
||||
),
|
||||
),
|
||||
...[
|
||||
IgnorePointer(
|
||||
),
|
||||
...[
|
||||
Padding(
|
||||
padding: padding,
|
||||
child: IgnorePointer(
|
||||
child: Container(
|
||||
height: size.height / 2,
|
||||
width: size.width,
|
||||
@@ -248,21 +254,21 @@ class _ColorSelectPageState extends State<ColorSelectPage> {
|
||||
child: const HomePage(),
|
||||
),
|
||||
),
|
||||
IgnorePointer(
|
||||
child: NavigationBar(
|
||||
destinations: NavigationBarType.values
|
||||
.map(
|
||||
(item) => NavigationDestination(
|
||||
icon: item.icon,
|
||||
label: item.label,
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
),
|
||||
),
|
||||
IgnorePointer(
|
||||
child: NavigationBar(
|
||||
destinations: NavigationBarType.values
|
||||
.map(
|
||||
(item) => NavigationDestination(
|
||||
icon: item.icon,
|
||||
label: item.label,
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -62,45 +62,44 @@ class _SetDisplayModeState extends State<SetDisplayMode> {
|
||||
return Scaffold(
|
||||
resizeToAvoidBottomInset: false,
|
||||
appBar: AppBar(title: const Text('屏幕帧率设置')),
|
||||
body: SafeArea(
|
||||
bottom: false,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 25, top: 10, bottom: 5),
|
||||
child: Text(
|
||||
'没有生效?重启app试试',
|
||||
style: TextStyle(color: Theme.of(context).colorScheme.outline),
|
||||
),
|
||||
body: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding:
|
||||
MediaQuery.viewPaddingOf(context).copyWith(top: 0, bottom: 0) +
|
||||
const EdgeInsets.only(left: 25, top: 10, bottom: 5),
|
||||
child: Text(
|
||||
'没有生效?重启app试试',
|
||||
style: TextStyle(color: Theme.of(context).colorScheme.outline),
|
||||
),
|
||||
Expanded(
|
||||
child: ListView.builder(
|
||||
itemCount: modes.length,
|
||||
itemBuilder: (context, index) {
|
||||
final DisplayMode mode = modes[index];
|
||||
return RadioListTile<DisplayMode>(
|
||||
value: mode,
|
||||
title: mode == DisplayMode.auto
|
||||
? const Text('自动')
|
||||
: Text('$mode${mode == active ? ' [系统]' : ''}'),
|
||||
groupValue: preferred,
|
||||
onChanged: (DisplayMode? newMode) {
|
||||
FlutterDisplayMode.setPreferredMode(
|
||||
newMode!,
|
||||
).whenComplete(
|
||||
() => Future.delayed(
|
||||
const Duration(milliseconds: 100),
|
||||
fetchAll,
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: ListView.builder(
|
||||
itemCount: modes.length,
|
||||
itemBuilder: (context, index) {
|
||||
final DisplayMode mode = modes[index];
|
||||
return RadioListTile<DisplayMode>(
|
||||
value: mode,
|
||||
title: mode == DisplayMode.auto
|
||||
? const Text('自动')
|
||||
: Text('$mode${mode == active ? ' [系统]' : ''}'),
|
||||
groupValue: preferred,
|
||||
onChanged: (DisplayMode? newMode) {
|
||||
FlutterDisplayMode.setPreferredMode(
|
||||
newMode!,
|
||||
).whenComplete(
|
||||
() => Future.delayed(
|
||||
const Duration(milliseconds: 100),
|
||||
fetchAll,
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -55,7 +55,6 @@ class _FontSizeSelectPageState extends State<FontSizeSelectPage> {
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.all(20),
|
||||
decoration: BoxDecoration(
|
||||
border: Border(
|
||||
|
||||
@@ -181,7 +181,7 @@ class _LogsPageState extends State<LogsPage> {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
spacing: 5,
|
||||
children: [
|
||||
@@ -222,8 +222,7 @@ class _LogsPageState extends State<LogsPage> {
|
||||
],
|
||||
),
|
||||
Card(
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(12.0),
|
||||
child: SelectableText(log.body),
|
||||
),
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:PiliPlus/common/widgets/list_tile.dart';
|
||||
import 'package:PiliPlus/common/widgets/view_safe_area.dart';
|
||||
import 'package:PiliPlus/pages/setting/widgets/switch_item.dart';
|
||||
import 'package:PiliPlus/utils/context_ext.dart';
|
||||
import 'package:PiliPlus/utils/storage.dart';
|
||||
import 'package:PiliPlus/utils/storage_key.dart';
|
||||
import 'package:PiliPlus/utils/storage_pref.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/material.dart' hide ListTile;
|
||||
import 'package:flutter/services.dart' show FilteringTextInputFormatter;
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:get/get.dart' hide ContextExtensionss;
|
||||
|
||||
@@ -2,9 +2,9 @@ import 'package:PiliPlus/pages/setting/models/play_settings.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class PlaySetting extends StatefulWidget {
|
||||
const PlaySetting({super.key, this.showAppBar});
|
||||
const PlaySetting({super.key, this.showAppBar = true});
|
||||
|
||||
final bool? showAppBar;
|
||||
final bool showAppBar;
|
||||
|
||||
@override
|
||||
State<PlaySetting> createState() => _PlaySettingState();
|
||||
@@ -15,14 +15,16 @@ class _PlaySettingState extends State<PlaySetting> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final showAppBar = widget.showAppBar;
|
||||
final padding = MediaQuery.viewPaddingOf(context);
|
||||
return Scaffold(
|
||||
resizeToAvoidBottomInset: false,
|
||||
appBar: widget.showAppBar == false
|
||||
? null
|
||||
: AppBar(title: const Text('播放器设置')),
|
||||
appBar: showAppBar ? AppBar(title: const Text('播放器设置')) : null,
|
||||
body: ListView(
|
||||
padding: EdgeInsets.only(
|
||||
bottom: MediaQuery.viewPaddingOf(context).bottom + 100,
|
||||
left: showAppBar ? padding.left : 0,
|
||||
right: showAppBar ? padding.right : 0,
|
||||
bottom: padding.bottom + 100,
|
||||
),
|
||||
children: settings.map((item) => item.widget).toList(),
|
||||
),
|
||||
|
||||
@@ -2,9 +2,9 @@ import 'package:PiliPlus/pages/setting/models/privacy_settings.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class PrivacySetting extends StatefulWidget {
|
||||
const PrivacySetting({super.key, this.showAppBar});
|
||||
const PrivacySetting({super.key, this.showAppBar = true});
|
||||
|
||||
final bool? showAppBar;
|
||||
final bool showAppBar;
|
||||
|
||||
@override
|
||||
State<PrivacySetting> createState() => _PrivacySettingState();
|
||||
@@ -15,14 +15,16 @@ class _PrivacySettingState extends State<PrivacySetting> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final showAppBar = widget.showAppBar;
|
||||
final padding = MediaQuery.viewPaddingOf(context);
|
||||
return Scaffold(
|
||||
resizeToAvoidBottomInset: false,
|
||||
appBar: widget.showAppBar == false
|
||||
? null
|
||||
: AppBar(title: const Text('隐私设置')),
|
||||
appBar: showAppBar ? AppBar(title: const Text('隐私设置')) : null,
|
||||
body: ListView(
|
||||
padding: EdgeInsets.only(
|
||||
bottom: MediaQuery.viewPaddingOf(context).bottom + 100,
|
||||
left: showAppBar ? padding.left : 0,
|
||||
right: showAppBar ? padding.right : 0,
|
||||
bottom: padding.bottom + 100,
|
||||
),
|
||||
children: settings.map((item) => item.widget).toList(),
|
||||
),
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import 'package:PiliPlus/common/widgets/list_tile.dart';
|
||||
import 'package:PiliPlus/pages/setting/models/model.dart';
|
||||
import 'package:PiliPlus/pages/setting/models/recommend_settings.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/material.dart' hide ListTile;
|
||||
|
||||
class RecommendSetting extends StatefulWidget {
|
||||
const RecommendSetting({super.key, this.showAppBar});
|
||||
const RecommendSetting({super.key, this.showAppBar = true});
|
||||
|
||||
final bool? showAppBar;
|
||||
final bool showAppBar;
|
||||
|
||||
@override
|
||||
State<RecommendSetting> createState() => _RecommendSettingState();
|
||||
@@ -24,6 +25,8 @@ class _RecommendSettingState extends State<RecommendSetting> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final showAppBar = widget.showAppBar;
|
||||
final padding = MediaQuery.viewPaddingOf(context);
|
||||
final theme = Theme.of(context);
|
||||
return Scaffold(
|
||||
resizeToAvoidBottomInset: false,
|
||||
@@ -32,7 +35,9 @@ class _RecommendSettingState extends State<RecommendSetting> {
|
||||
: AppBar(title: const Text('推荐流设置')),
|
||||
body: ListView(
|
||||
padding: EdgeInsets.only(
|
||||
bottom: MediaQuery.viewPaddingOf(context).bottom + 100,
|
||||
left: showAppBar ? padding.left : 0,
|
||||
right: showAppBar ? padding.right : 0,
|
||||
bottom: padding.bottom + 100,
|
||||
),
|
||||
children: [
|
||||
...part.map((item) => item.widget),
|
||||
|
||||
@@ -8,12 +8,12 @@ class SlideColorPicker extends StatefulWidget {
|
||||
super.key,
|
||||
required this.color,
|
||||
required this.callback,
|
||||
this.showResetBtn,
|
||||
this.showResetBtn = false,
|
||||
});
|
||||
|
||||
final Color color;
|
||||
final Function(Color? color) callback;
|
||||
final bool? showResetBtn;
|
||||
final bool showResetBtn;
|
||||
|
||||
@override
|
||||
State<SlideColorPicker> createState() => _SlideColorPickerState();
|
||||
@@ -158,7 +158,7 @@ class _SlideColorPickerState extends State<SlideColorPicker> {
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
if (widget.showResetBtn != false) ...[
|
||||
if (widget.showResetBtn) ...[
|
||||
const SizedBox(width: 16),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
|
||||
@@ -2,9 +2,9 @@ import 'package:PiliPlus/pages/setting/models/style_settings.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class StyleSetting extends StatefulWidget {
|
||||
const StyleSetting({super.key, this.showAppBar});
|
||||
const StyleSetting({super.key, this.showAppBar = true});
|
||||
|
||||
final bool? showAppBar;
|
||||
final bool showAppBar;
|
||||
|
||||
@override
|
||||
State<StyleSetting> createState() => _StyleSettingState();
|
||||
@@ -15,14 +15,16 @@ class _StyleSettingState extends State<StyleSetting> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final showAppBar = widget.showAppBar;
|
||||
final padding = MediaQuery.viewPaddingOf(context);
|
||||
return Scaffold(
|
||||
resizeToAvoidBottomInset: false,
|
||||
appBar: widget.showAppBar == false
|
||||
? null
|
||||
: AppBar(title: const Text('外观设置')),
|
||||
appBar: showAppBar ? AppBar(title: const Text('外观设置')) : null,
|
||||
body: ListView(
|
||||
padding: EdgeInsets.only(
|
||||
bottom: MediaQuery.viewPaddingOf(context).bottom + 100,
|
||||
left: showAppBar ? padding.left : 0,
|
||||
right: showAppBar ? padding.right : 0,
|
||||
bottom: padding.bottom + 100,
|
||||
),
|
||||
children: settings.map((item) => item.widget).toList(),
|
||||
),
|
||||
|
||||
@@ -2,9 +2,9 @@ import 'package:PiliPlus/pages/setting/models/video_settings.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class VideoSetting extends StatefulWidget {
|
||||
const VideoSetting({super.key, this.showAppBar});
|
||||
const VideoSetting({super.key, this.showAppBar = true});
|
||||
|
||||
final bool? showAppBar;
|
||||
final bool showAppBar;
|
||||
|
||||
@override
|
||||
State<VideoSetting> createState() => _VideoSettingState();
|
||||
@@ -15,14 +15,16 @@ class _VideoSettingState extends State<VideoSetting> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final showAppBar = widget.showAppBar;
|
||||
final padding = MediaQuery.viewPaddingOf(context);
|
||||
return Scaffold(
|
||||
resizeToAvoidBottomInset: false,
|
||||
appBar: widget.showAppBar == false
|
||||
? null
|
||||
: AppBar(title: const Text('音视频设置')),
|
||||
appBar: showAppBar ? AppBar(title: const Text('音视频设置')) : null,
|
||||
body: ListView(
|
||||
padding: EdgeInsets.only(
|
||||
bottom: MediaQuery.viewPaddingOf(context).bottom + 100,
|
||||
left: showAppBar ? padding.left : 0,
|
||||
right: showAppBar ? padding.right : 0,
|
||||
bottom: padding.bottom + 100,
|
||||
),
|
||||
children: settings.map((item) => item.widget).toList(),
|
||||
),
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import 'package:PiliPlus/common/widgets/list_tile.dart';
|
||||
import 'package:PiliPlus/common/widgets/view_safe_area.dart';
|
||||
import 'package:PiliPlus/http/login.dart';
|
||||
import 'package:PiliPlus/models/common/setting_type.dart';
|
||||
import 'package:PiliPlus/pages/about/view.dart';
|
||||
@@ -12,9 +14,8 @@ import 'package:PiliPlus/pages/setting/widgets/multi_select_dialog.dart';
|
||||
import 'package:PiliPlus/pages/webdav/view.dart';
|
||||
import 'package:PiliPlus/utils/accounts.dart';
|
||||
import 'package:PiliPlus/utils/accounts/account.dart';
|
||||
import 'package:PiliPlus/utils/context_ext.dart';
|
||||
import 'package:PiliPlus/utils/extension.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/material.dart' hide ListTile;
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:get/get.dart' hide ContextExtensionss;
|
||||
import 'package:material_design_icons_flutter/material_design_icons_flutter.dart';
|
||||
@@ -87,17 +88,16 @@ class _SettingPageState extends State<SettingPage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
_isPortrait = context.isPortrait;
|
||||
_isPortrait = MediaQuery.sizeOf(context).isPortrait;
|
||||
return Scaffold(
|
||||
resizeToAvoidBottomInset: false,
|
||||
appBar: AppBar(
|
||||
title: _isPortrait ? const Text('设置') : Text(_type.title),
|
||||
),
|
||||
body: _isPortrait
|
||||
? _buildList(theme)
|
||||
: SafeArea(
|
||||
bottom: false,
|
||||
child: Row(
|
||||
body: ViewSafeArea(
|
||||
child: _isPortrait
|
||||
? _buildList(theme)
|
||||
: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(
|
||||
@@ -137,7 +137,7 @@ class _SettingPageState extends State<SettingPage> {
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -165,14 +165,13 @@ class _SettingPageState extends State<SettingPage> {
|
||||
}
|
||||
|
||||
Widget _buildList(ThemeData theme) {
|
||||
final padding = MediaQuery.viewPaddingOf(context);
|
||||
TextStyle titleStyle = theme.textTheme.titleMedium!;
|
||||
TextStyle subTitleStyle = theme.textTheme.labelMedium!.copyWith(
|
||||
color: theme.colorScheme.outline,
|
||||
);
|
||||
return ListView(
|
||||
padding: EdgeInsets.only(
|
||||
bottom: MediaQuery.viewPaddingOf(context).bottom + 100,
|
||||
),
|
||||
padding: EdgeInsets.only(bottom: padding.bottom + 100),
|
||||
children: [
|
||||
_buildSearchItem(theme),
|
||||
..._items
|
||||
@@ -280,7 +279,11 @@ class _SettingPageState extends State<SettingPage> {
|
||||
}
|
||||
|
||||
Widget _buildSearchItem(ThemeData theme) => Padding(
|
||||
padding: const EdgeInsets.only(left: 16, right: 16, bottom: 8),
|
||||
padding: const EdgeInsets.only(
|
||||
left: 16,
|
||||
right: 16,
|
||||
bottom: 8,
|
||||
),
|
||||
child: Material(
|
||||
type: MaterialType.transparency,
|
||||
child: InkWell(
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:PiliPlus/common/widgets/list_tile.dart';
|
||||
import 'package:flutter/material.dart' hide ListTile;
|
||||
|
||||
typedef StringGetter = String Function();
|
||||
|
||||
@@ -8,9 +9,6 @@ class NormalItem extends StatefulWidget {
|
||||
final String? subtitle;
|
||||
final StringGetter? getSubtitle;
|
||||
final String? setKey;
|
||||
final bool? defaultVal;
|
||||
final ValueChanged<bool>? onChanged;
|
||||
final bool? needReboot;
|
||||
final Widget? leading;
|
||||
final Widget Function()? getTrailing;
|
||||
final Function? onTap;
|
||||
@@ -23,9 +21,6 @@ class NormalItem extends StatefulWidget {
|
||||
this.subtitle,
|
||||
this.getSubtitle,
|
||||
this.setKey,
|
||||
this.defaultVal,
|
||||
this.onChanged,
|
||||
this.needReboot,
|
||||
this.leading,
|
||||
this.getTrailing,
|
||||
this.onTap,
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import 'package:PiliPlus/common/widgets/list_tile.dart';
|
||||
import 'package:PiliPlus/utils/storage.dart';
|
||||
import 'package:PiliPlus/utils/storage_key.dart';
|
||||
import 'package:PiliPlus/utils/storage_pref.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/material.dart' hide ListTile;
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
@@ -9,9 +10,9 @@ class SetSwitchItem extends StatefulWidget {
|
||||
final String? title;
|
||||
final String? subtitle;
|
||||
final String? setKey;
|
||||
final bool? defaultVal;
|
||||
final bool defaultVal;
|
||||
final ValueChanged<bool>? onChanged;
|
||||
final bool? needReboot;
|
||||
final bool needReboot;
|
||||
final Widget? leading;
|
||||
final Function? onTap;
|
||||
final EdgeInsetsGeometry? contentPadding;
|
||||
@@ -21,9 +22,9 @@ class SetSwitchItem extends StatefulWidget {
|
||||
this.title,
|
||||
this.subtitle,
|
||||
this.setKey,
|
||||
this.defaultVal,
|
||||
this.defaultVal = false,
|
||||
this.onChanged,
|
||||
this.needReboot,
|
||||
this.needReboot = false,
|
||||
this.leading,
|
||||
this.onTap,
|
||||
this.contentPadding,
|
||||
@@ -44,7 +45,7 @@ class _SetSwitchItemState extends State<SetSwitchItem> {
|
||||
} else {
|
||||
val = GStorage.setting.get(
|
||||
widget.setKey,
|
||||
defaultValue: widget.defaultVal ?? false,
|
||||
defaultValue: widget.defaultVal,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -109,7 +110,7 @@ class _SetSwitchItemState extends State<SetSwitchItem> {
|
||||
}
|
||||
|
||||
widget.onChanged?.call(val);
|
||||
if (widget.needReboot == true) {
|
||||
if (widget.needReboot) {
|
||||
SmartDialog.showToast('重启生效');
|
||||
}
|
||||
setState(() {});
|
||||
|
||||
Reference in New Issue
Block a user