feat(account): remove local entry shortcut

This commit is contained in:
Haitao Pan 2026-04-02 10:37:56 +08:00
parent bb1682d2a7
commit ea981efd03
4 changed files with 3 additions and 94 deletions

View File

@ -212,12 +212,6 @@ class _AccountPageState extends State<AccountPage> {
child: Text(appText('登录', 'Sign In')),
),
),
const SizedBox(height: 12),
TextButton(
key: const ValueKey('account-save-local-button'),
onPressed: () => _saveProfile(settings),
child: Text(appText('保存本地入口', 'Save Local Entry')),
),
],
),
),
@ -332,15 +326,6 @@ class _AccountPageState extends State<AccountPage> {
),
],
),
const SizedBox(height: 16),
Align(
alignment: Alignment.centerLeft,
child: FilledButton(
key: const ValueKey('account-save-local-button'),
onPressed: () => _saveProfile(settings),
child: Text(appText('保存本地入口', 'Save Local Entry')),
),
),
],
),
);
@ -389,8 +374,8 @@ class _AccountPageState extends State<AccountPage> {
)
: settings.accountLocalMode
? appText(
'本地模式 · 仅保存账号入口与工作区偏好',
'Local mode · saves account entry and workspace preferences only',
'本地模式 · 仅保存工作区偏好',
'Local mode · saves workspace preferences only',
)
: appText(
'登录后会同步远端默认配置,本地保存项可以覆盖远端默认值。',

View File

@ -26,7 +26,7 @@ void main() {
expect(find.byIcon(Icons.cloud_outlined), findsOneWidget);
expect(find.byKey(const ValueKey('account-password-field')), findsOneWidget);
expect(find.widgetWithText(FilledButton, '登录'), findsOneWidget);
expect(find.byKey(const ValueKey('account-save-local-button')), findsOneWidget);
expect(find.text('保存本地入口'), findsNothing);
});
testWidgets('AccountPage logs in and shows remote sync status inline', (

View File

@ -25,31 +25,4 @@ void main() {
expect(controller.settings.accountWorkspace, 'QA Workspace');
});
testWidgets('AccountPage saves local entry from current controller values', (
WidgetTester tester,
) async {
final controller = await createTestController(tester);
await pumpPage(tester, child: AccountPage(controller: controller));
await tester.enterText(
find.byKey(const ValueKey('account-base-url-field')),
'https://accounts.mobile.example',
);
await tester.enterText(
find.byKey(const ValueKey('account-username-field')),
'mobile@example.com',
);
await tester.pumpAndSettle();
await tester.tap(find.byKey(const ValueKey('account-save-local-button')));
await tester.pumpAndSettle();
expect(
controller.settings.accountBaseUrl,
'https://accounts.mobile.example',
);
expect(controller.settings.accountUsername, 'mobile@example.com');
});
}

View File

@ -82,55 +82,6 @@ void main() {
await tester.pumpAndSettle();
}
for (final platform in <TargetPlatform>[
TargetPlatform.iOS,
TargetPlatform.android,
]) {
testWidgets(
'MobileShell saves local account entry from the workspace account page on $platform',
(WidgetTester tester) async {
final controller = await createTestController(tester);
await pumpMobileShell(
tester,
child: MobileShell(controller: controller),
platform: platform,
);
await tester.tap(find.text('工作区'));
await tester.pumpAndSettle();
final accountEntry = find.text('账号').first;
await tester.ensureVisible(accountEntry);
await tester.pumpAndSettle();
await tester.tap(accountEntry);
await tester.pumpAndSettle();
await tester.enterText(
find.byKey(const ValueKey('account-base-url-field')),
'https://accounts.qa.example',
);
await tester.enterText(
find.byKey(const ValueKey('account-username-field')),
'qa@example.com',
);
await tester.pumpAndSettle();
final saveButton = find.widgetWithText(FilledButton, '保存本地入口');
await tester.ensureVisible(saveButton);
await tester.pumpAndSettle();
await tester.tap(saveButton);
await tester.pump(const Duration(milliseconds: 300));
await tester.pumpAndSettle();
expect(
controller.settings.accountBaseUrl,
'https://accounts.qa.example',
);
expect(controller.settings.accountUsername, 'qa@example.com');
},
);
}
testWidgets('MobileShell workspace launcher routes into module pages', (
WidgetTester tester,
) async {