feat: 暗黑模式 + 节流模式

- settingsStore: 移除 coverQuality,新增 darkMode / trafficSaving 布尔字段(AsyncStorage 持久化)
- utils/theme.ts: 新建 useTheme() hook,返回浅色/深色颜色表
- settings.tsx: 新增外观(浅色/深色)和流量(标准/节流)选项,移除封面图清晰度
- BigVideoCard: 节流模式跳过预加载、禁止自动播放;封面低画质;支持暗黑配色
- useVideoDetail: 节流模式下默认 qn=16(360p)
- VideoCard / LiveCard: 移除 coverQuality 依赖,改用 trafficSaving;支持暗黑配色
- index.tsx: 导航栏/搜索栏/列表背景跟随主题
- search.tsx: 页面背景/输入框/文字跟随主题
- downloads.tsx: 顶栏/背景/文字跟随主题
- _layout.tsx: StatusBar 随暗黑模式切换 light/dark
This commit is contained in:
Developer
2026-03-24 21:04:10 +08:00
parent aeaaa0af01
commit f2fc4693a6
12 changed files with 164 additions and 79 deletions

View File

@@ -40,6 +40,7 @@ import {
} from "../utils/videoRows";
import { BigVideoCard } from "../components/BigVideoCard";
import { FollowedLiveStrip } from "../components/FollowedLiveStrip";
import { useTheme } from "../utils/theme";
import type { LiveRoom } from "../services/types";
const HEADER_H = 44;
@@ -83,6 +84,7 @@ export default function HomeScreen() {
const [activeTab, setActiveTab] = useState<TabKey>("hot");
const [liveAreaId, setLiveAreaId] = useState(0);
const theme = useTheme();
const [visibleBigKey, setVisibleBigKey] = useState<string | null>(null);
const rows = useMemo(() => toListRows(pages, liveRooms), [pages, liveRooms]);
const pagerRef = useRef<PagerView>(null);
@@ -286,7 +288,7 @@ export default function HomeScreen() {
activeTab === "hot" ? headerOpacity : liveHeaderOpacity;
return (
<SafeAreaView style={styles.safe} edges={["left", "right"]}>
<SafeAreaView style={[styles.safe, { backgroundColor: theme.bg }]} edges={["left", "right"]}>
{/* 滑动切换容器 */}
<PagerView
ref={pagerRef}
@@ -410,6 +412,7 @@ export default function HomeScreen() {
styles.navBar,
{
paddingTop: insets.top,
backgroundColor: theme.card,
transform: [{ translateY: currentHeaderTranslate }],
},
]}
@@ -419,6 +422,7 @@ export default function HomeScreen() {
styles.header,
{
opacity: currentHeaderOpacity,
borderBottomColor: theme.border,
},
]}
>
@@ -439,19 +443,19 @@ export default function HomeScreen() {
</TouchableOpacity>
</View>
<TouchableOpacity
style={styles.searchBar}
style={[styles.searchBar, { backgroundColor: theme.inputBg }]}
onPress={() => router.push("/search" as any)}
activeOpacity={0.7}
>
<Ionicons name="search" size={14} color="#999" />
<Text style={styles.searchPlaceholder}>UP主...</Text>
<Ionicons name="search" size={14} color={theme.textSub} />
<Text style={[styles.searchPlaceholder, { color: theme.textSub }]}>UP主...</Text>
</TouchableOpacity>
<DownloadProgressBtn
onPress={() => router.push("/downloads" as any)}
/>
</Animated.View>
<View style={styles.tabRow}>
<View style={[styles.tabRow, { backgroundColor: theme.card }]}>
{TABS.map((tab) => (
<TouchableOpacity
key={tab.key}
@@ -462,6 +466,7 @@ export default function HomeScreen() {
<Text
style={[
styles.tabText,
{ color: theme.textSub },
activeTab === tab.key && styles.tabTextActive,
]}
>