Skip to content

Commit

Permalink
Merge pull request #43 from miru-project/fix/ui-and-extension-setting…
Browse files Browse the repository at this point in the history
…s-display-errors

Fix UI and extension settings display errors
  • Loading branch information
MiaoMint authored Aug 28, 2023
2 parents 3413f00 + 73806c5 commit d513b85
Show file tree
Hide file tree
Showing 7 changed files with 84 additions and 163 deletions.
5 changes: 2 additions & 3 deletions lib/models/extension_setting.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,8 @@ class ExtensionSetting {
late ExtensionSettingType type;
// 描述
String? description;
// 如果是 radio 类型,这里是各项选项,且必填 , 存储为 ["key:value","key:value"]
// 为啥不直接用 map,因为 isar 还不支持 map 类型
List<String>? options;

String? options;

static ExtensionSettingType stringToType(String type) {
switch (type) {
Expand Down
176 changes: 54 additions & 122 deletions lib/models/extension_setting.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions lib/pages/detail/widgets/detail_continue_play.dart
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ class _DetailContinuePlayState extends State<DetailContinuePlay> {
'episode': history!.episodeTitle,
},
),
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
style: ButtonStyle(
minimumSize: MaterialStateProperty.all(
Expand Down
12 changes: 2 additions & 10 deletions lib/pages/extension_settings/view.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'dart:convert';
import 'dart:io';

import 'package:flutter/material.dart';
Expand Down Expand Up @@ -80,14 +81,10 @@ class _ExtensionSettingsPageState extends State<ExtensionSettingsPage> {
));
}
if (setting.type == ExtensionSettingType.radio) {
final map = <String, String>{};
final map = Map<String, String>.from(jsonDecode(setting.options!));
list.add(SettingsRadiosTile(
title: setting.title,
itemNameValue: () {
for (final item in setting.options!) {
final split = item.split(':');
map[split[0]] = split[1];
}
return map;
}(),
buildSubtitle: () => setting.description ?? '',
Expand All @@ -101,11 +98,6 @@ class _ExtensionSettingsPageState extends State<ExtensionSettingsPage> {
setState(() {});
},
buildGroupValue: () => setting.value ?? setting.defaultValue,
trailing: Text(
map.entries
.firstWhere((element) => element.value == setting.value)
.key,
),
));
}
if (setting.type == ExtensionSettingType.toggle) {
Expand Down
7 changes: 6 additions & 1 deletion lib/pages/watch/widgets/video/video_player.dart
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,12 @@ class _VideoPlayerState extends State<VideoPlayer> {
maxHeight: 200,
maxWidth: maxWidth,
),
child: _c.cuurentMessageWidget.value,
child: DefaultTextStyle(
style: const TextStyle(
color: Colors.white,
),
child: _c.cuurentMessageWidget.value!,
),
).animate().fade(),
),
],
Expand Down
Loading

0 comments on commit d513b85

Please sign in to comment.