Skip to content

Commit 10ea517

Browse files
committed
Rime-Wanxiang-Updater:improve:操作部分按钮改为三行两列布局
1 parent b38e529 commit 10ea517

1 file changed

Lines changed: 45 additions & 15 deletions

File tree

Rime-Wanxiang-Updater/components/HomeView.tsx

Lines changed: 45 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
NavigationStack,
77
Script,
88
Section,
9+
Divider,
910
Spacer,
1011
Text,
1112
HStack,
@@ -98,7 +99,7 @@ function normalizeMetaScheme(
9899
}
99100
}
100101

101-
function CenterRowButton(props: { title: string; disabled?: boolean; onPress: () => void }) {
102+
function GridButton(props: { title: string; disabled?: boolean; onPress: () => void }) {
102103
const haptic = () => {
103104
try {
104105
;(globalThis as any).HapticFeedback?.mediumImpact?.()
@@ -111,15 +112,19 @@ function CenterRowButton(props: { title: string; disabled?: boolean; onPress: ()
111112
props.onPress()
112113
}}
113114
disabled={props.disabled}
115+
buttonStyle="plain"
116+
tint={props.disabled ? "secondaryLabel" : "systemBlue"}
117+
frame={{ maxWidth: "infinity", minHeight: 60 }}
114118
>
115-
<HStack frame={{ width: "100%" as any }} padding={{ top: 14, bottom: 14 }}>
116-
<Text opacity={0} frame={{ width: 1 }}>
117-
.
118-
</Text>
119-
<Spacer />
120-
<Text font="headline">{props.title}</Text>
121-
<Spacer />
122-
</HStack>
119+
<Text
120+
font="headline"
121+
frame={{ maxWidth: "infinity" }}
122+
multilineTextAlignment="center"
123+
foregroundStyle={props.disabled ? "secondaryLabel" : "systemBlue"}
124+
padding={{ top: 18, bottom: 18 }}
125+
>
126+
{props.title}
127+
</Text>
123128
</Button>
124129
)
125130
}
@@ -643,12 +648,37 @@ export function HomeView() {
643648
</Section>
644649

645650
<Section header={<Text>操作</Text>}>
646-
<CenterRowButton title="检查更新" onPress={onCheckUpdate} disabled={busy || !pathUsable} />
647-
<CenterRowButton title="自动更新" onPress={onAutoUpdate} disabled={busy || !pathUsable} />
648-
<CenterRowButton title="更新方案" onPress={onUpdateScheme} disabled={busy || !pathUsable} />
649-
<CenterRowButton title="更新词库" onPress={onUpdateDict} disabled={busy || !pathUsable} />
650-
<CenterRowButton title="更新模型" onPress={onUpdateModel} disabled={busy || !pathUsable} />
651-
<CenterRowButton title="部署输入法" onPress={onDeploy} disabled={busy || !pathUsable} />
651+
<VStack spacing={0}>
652+
<HStack spacing={0} alignment="center" frame={{ minHeight: 64 }}>
653+
<VStack frame={{ maxWidth: "infinity" }}>
654+
<GridButton title="更新方案" onPress={onUpdateScheme} disabled={busy || !pathUsable} />
655+
</VStack>
656+
<Divider frame={{ height: 48 }} />
657+
<VStack frame={{ maxWidth: "infinity" }}>
658+
<GridButton title="部署输入法" onPress={onDeploy} disabled={busy || !pathUsable} />
659+
</VStack>
660+
</HStack>
661+
<Divider />
662+
<HStack spacing={0} alignment="center" frame={{ minHeight: 64 }}>
663+
<VStack frame={{ maxWidth: "infinity" }}>
664+
<GridButton title="更新词库" onPress={onUpdateDict} disabled={busy || !pathUsable} />
665+
</VStack>
666+
<Divider frame={{ height: 48 }} />
667+
<VStack frame={{ maxWidth: "infinity" }}>
668+
<GridButton title="检查更新" onPress={onCheckUpdate} disabled={busy || !pathUsable} />
669+
</VStack>
670+
</HStack>
671+
<Divider />
672+
<HStack spacing={0} alignment="center" frame={{ minHeight: 64 }}>
673+
<VStack frame={{ maxWidth: "infinity" }}>
674+
<GridButton title="更新模型" onPress={onUpdateModel} disabled={busy || !pathUsable} />
675+
</VStack>
676+
<Divider frame={{ height: 48 }} />
677+
<VStack frame={{ maxWidth: "infinity" }}>
678+
<GridButton title="自动更新" onPress={onAutoUpdate} disabled={busy || !pathUsable} />
679+
</VStack>
680+
</HStack>
681+
</VStack>
652682
</Section>
653683

654684
<Section header={<Text>状态</Text>}>

0 commit comments

Comments
 (0)