feat(workspace): 桌面工作区、主题与交互更新,发布 0.1.2
Gitea CI / Check code and tests (push) Successful in 6m37s
Gitea CI / Build Windows x64 app (push) Successful in 3m18s
Gitea CI / Build Android APK (push) Successful in 3m47s
Gitea CI / Audit and package Windows x64 (push) Successful in 1m7s
Gitea CI / Assemble and validate CI artifacts (push) Successful in 50s
Gitea CI / Gitea CI passed (push) Successful in 2s
Gitea Release / Prepare draft Release (push) Successful in 9s
Gitea Release / Upload Android to draft Release (push) Successful in 16s
Gitea Release / Upload Windows to draft Release (push) Successful in 22s
Gitea Release / Verify and publish Release (push) Successful in 14s
Gitea CI / Check code and tests (push) Successful in 6m37s
Gitea CI / Build Windows x64 app (push) Successful in 3m18s
Gitea CI / Build Android APK (push) Successful in 3m47s
Gitea CI / Audit and package Windows x64 (push) Successful in 1m7s
Gitea CI / Assemble and validate CI artifacts (push) Successful in 50s
Gitea CI / Gitea CI passed (push) Successful in 2s
Gitea Release / Prepare draft Release (push) Successful in 9s
Gitea Release / Upload Android to draft Release (push) Successful in 16s
Gitea Release / Upload Windows to draft Release (push) Successful in 22s
Gitea Release / Verify and publish Release (push) Successful in 14s
This commit was merged in pull request #13.
This commit is contained in:
1 parent
aa5255d1e4
commit
abc1868550
260 files changed
+43964
-5591
No files matched your search
@@ -9,10 +9,12 @@ import '../../shared/layout/workspace_layout_metrics.dart';
|
||||
|
||||
import '../../workspace/persistence/project_location_directory.dart';
|
||||
|
||||
import 'package:cutdex_ui/icons.dart';
|
||||
import 'package:cutdex_ui/theme.dart';
|
||||
import 'package:cutdex_ui/widgets.dart';
|
||||
|
||||
import 'appearance_settings.dart';
|
||||
import 'timeline_ruler_settings_field.dart';
|
||||
import 'language_settings.dart';
|
||||
import 'location_settings.dart';
|
||||
import 'mcp_settings_panel.dart';
|
||||
@@ -31,11 +33,13 @@ class SettingsContent extends ConsumerStatefulWidget {
|
||||
this.initialTab = 0,
|
||||
this.navigationRequest = 0,
|
||||
this.cardLayout = false,
|
||||
}) : assert(initialTab >= 0 && initialTab <= 2);
|
||||
this.onBack,
|
||||
}) : assert(initialTab >= 0 && initialTab <= 3);
|
||||
|
||||
final int initialTab;
|
||||
final int navigationRequest;
|
||||
final bool cardLayout;
|
||||
final VoidCallback? onBack;
|
||||
|
||||
final (String, String)? workspace;
|
||||
|
||||
@@ -68,6 +72,14 @@ class _SettingsContentState extends ConsumerState<SettingsContent> {
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _setPalette(AppPalette palette) async {
|
||||
await ref
|
||||
.read(settingsOperationProvider('palette').notifier)
|
||||
.run(
|
||||
() => ref.read(paletteSettingsProvider.notifier).setPalette(palette),
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _setLanguage(AppLanguage language) async {
|
||||
await ref
|
||||
.read(settingsOperationProvider('language').notifier)
|
||||
@@ -84,10 +96,6 @@ class _SettingsContentState extends ConsumerState<SettingsContent> {
|
||||
);
|
||||
|
||||
Widget _buildContent(BuildContext context) {
|
||||
final appearanceSave = ref.watch(settingsOperationProvider('appearance'));
|
||||
final languageSave = ref.watch(settingsOperationProvider('language'));
|
||||
final appearance = ref.watch(appearanceSettingsProvider);
|
||||
final language = ref.watch(languageSettingsProvider);
|
||||
return LayoutBuilder(
|
||||
builder: (context, constraints) => Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
@@ -103,6 +111,7 @@ class _SettingsContentState extends ConsumerState<SettingsContent> {
|
||||
_SettingsNavigation(
|
||||
value: _tab,
|
||||
compact: constraints.maxWidth < 600,
|
||||
onBack: widget.onBack,
|
||||
onChanged: (value) => setState(() => _tab = value),
|
||||
),
|
||||
),
|
||||
@@ -113,11 +122,9 @@ class _SettingsContentState extends ConsumerState<SettingsContent> {
|
||||
width: WorkspaceLayoutMetrics.desktopSpacing,
|
||||
)
|
||||
else
|
||||
VerticalDivider(
|
||||
key: const Key('settings-sidebar-divider'),
|
||||
const VerticalDivider(
|
||||
key: Key('settings-sidebar-divider'),
|
||||
width: 1,
|
||||
thickness: 1,
|
||||
color: Theme.of(context).colorScheme.outlineVariant,
|
||||
),
|
||||
Expanded(
|
||||
child: _surface(
|
||||
@@ -136,86 +143,58 @@ class _SettingsContentState extends ConsumerState<SettingsContent> {
|
||||
padding: _settingsContentPadding,
|
||||
child: SettingsPageSection(
|
||||
title: context.l10n.general,
|
||||
icon: Icons.settings_outlined,
|
||||
icon: AppIcons.settings,
|
||||
children: [
|
||||
AppField(
|
||||
label: context.l10n.appearance,
|
||||
orientation: AppFieldOrientation.horizontal,
|
||||
error:
|
||||
(appearanceSave.hasError
|
||||
? context.l10n.saveAppearanceFailed
|
||||
: null) ??
|
||||
(appearance.hasError
|
||||
? context.l10n.loadAppearanceFailed
|
||||
: null),
|
||||
child: SizedBox(
|
||||
width: AppSettingsMetrics.controlWidth,
|
||||
child: AppSelect<AppAppearance>(
|
||||
emptyLabel: context.l10n.noMatchingOptions,
|
||||
controlHeight:
|
||||
AppSettingsMetrics.controlHeight,
|
||||
value:
|
||||
appearance.asData?.value ??
|
||||
AppAppearance.system,
|
||||
label: context.l10n.theme,
|
||||
options: [
|
||||
AppSelectOption(
|
||||
AppAppearance.system,
|
||||
context.l10n.system,
|
||||
),
|
||||
AppSelectOption(
|
||||
AppAppearance.penLight,
|
||||
'Pen · ${context.l10n.light}',
|
||||
),
|
||||
AppSelectOption(
|
||||
AppAppearance.penDark,
|
||||
'Pen · ${context.l10n.dark}',
|
||||
),
|
||||
],
|
||||
onChanged:
|
||||
appearanceSave.isLoading ||
|
||||
appearance.isLoading
|
||||
? null
|
||||
: _setMode,
|
||||
),
|
||||
),
|
||||
),
|
||||
AppField(
|
||||
label: context.l10n.language,
|
||||
orientation: AppFieldOrientation.horizontal,
|
||||
error:
|
||||
(languageSave.hasError
|
||||
? context.l10n.saveLanguageFailed
|
||||
: null) ??
|
||||
(language.hasError
|
||||
? context.l10n.loadLanguageFailed
|
||||
: null),
|
||||
child: SizedBox(
|
||||
width: AppSettingsMetrics.controlWidth,
|
||||
child: AppSelect<AppLanguage>(
|
||||
emptyLabel: context.l10n.noMatchingOptions,
|
||||
controlHeight:
|
||||
AppSettingsMetrics.controlHeight,
|
||||
value:
|
||||
language.asData?.value ??
|
||||
AppLanguage.system,
|
||||
Consumer(
|
||||
builder: (context, ref, _) {
|
||||
final language = ref.watch(
|
||||
languageSettingsProvider,
|
||||
);
|
||||
final languageSave = ref.watch(
|
||||
settingsOperationProvider('language'),
|
||||
);
|
||||
return AppField(
|
||||
label: context.l10n.language,
|
||||
options: [
|
||||
for (final option in AppLanguage.values)
|
||||
AppSelectOption(
|
||||
option,
|
||||
option == AppLanguage.system
|
||||
? context.l10n.system
|
||||
: option.nativeName,
|
||||
),
|
||||
],
|
||||
onChanged:
|
||||
languageSave.isLoading ||
|
||||
language.isLoading
|
||||
? null
|
||||
: _setLanguage,
|
||||
),
|
||||
),
|
||||
orientation: AppFieldOrientation.horizontal,
|
||||
error:
|
||||
(languageSave.hasError
|
||||
? context.l10n.saveLanguageFailed
|
||||
: null) ??
|
||||
(language.hasError
|
||||
? context.l10n.loadLanguageFailed
|
||||
: null),
|
||||
child: SizedBox(
|
||||
width: AppSettingsMetrics.controlWidth,
|
||||
child: AppSelect<AppLanguage>(
|
||||
emptyLabel:
|
||||
context.l10n.noMatchingOptions,
|
||||
controlHeight:
|
||||
AppTheme.isDesktop(context)
|
||||
? AppDesktopMetrics.button
|
||||
: AppSettingsMetrics.controlHeight,
|
||||
value:
|
||||
language.asData?.value ??
|
||||
AppLanguage.system,
|
||||
label: context.l10n.language,
|
||||
options: [
|
||||
for (final option
|
||||
in AppLanguage.values)
|
||||
AppSelectOption(
|
||||
option,
|
||||
option == AppLanguage.system
|
||||
? context.l10n.system
|
||||
: option.nativeName,
|
||||
),
|
||||
],
|
||||
onChanged:
|
||||
languageSave.isLoading ||
|
||||
language.isLoading
|
||||
? null
|
||||
: _setLanguage,
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
const _ProjectLocationField(),
|
||||
const _ResourceLocationField(),
|
||||
@@ -246,6 +225,136 @@ class _SettingsContentState extends ConsumerState<SettingsContent> {
|
||||
),
|
||||
),
|
||||
),
|
||||
ExcludeFocus(
|
||||
excluding: _tab != 3,
|
||||
child: TickerMode(
|
||||
enabled: _tab == 3,
|
||||
child: SingleChildScrollView(
|
||||
primary: false,
|
||||
padding: _settingsContentPadding,
|
||||
child: SettingsPageSection(
|
||||
title: context.l10n.appearance,
|
||||
icon: AppIcons.appearance,
|
||||
children: [
|
||||
Consumer(
|
||||
builder: (context, ref, _) {
|
||||
final palette = ref.watch(
|
||||
paletteSettingsProvider,
|
||||
);
|
||||
final paletteSave = ref.watch(
|
||||
settingsOperationProvider('palette'),
|
||||
);
|
||||
return AppField(
|
||||
label: context.l10n.colorPalette,
|
||||
orientation: AppFieldOrientation.horizontal,
|
||||
error:
|
||||
(paletteSave.hasError
|
||||
? context.l10n.saveAppearanceFailed
|
||||
: null) ??
|
||||
(palette.hasError
|
||||
? context.l10n.loadAppearanceFailed
|
||||
: null),
|
||||
child: SizedBox(
|
||||
width: AppSettingsMetrics.controlWidth,
|
||||
child: AppSelect<AppPalette>(
|
||||
key: const Key(
|
||||
'settings-color-palette',
|
||||
),
|
||||
emptyLabel:
|
||||
context.l10n.noMatchingOptions,
|
||||
controlHeight:
|
||||
AppTheme.isDesktop(context)
|
||||
? AppDesktopMetrics.button
|
||||
: AppSettingsMetrics.controlHeight,
|
||||
value:
|
||||
palette.asData?.value ??
|
||||
AppPalette.graphite,
|
||||
label: context.l10n.colorPalette,
|
||||
options: [
|
||||
AppSelectOption(
|
||||
AppPalette.graphite,
|
||||
context.l10n.paletteGraphite,
|
||||
),
|
||||
AppSelectOption(
|
||||
AppPalette.violet,
|
||||
context.l10n.paletteViolet,
|
||||
),
|
||||
AppSelectOption(
|
||||
AppPalette.teal,
|
||||
context.l10n.paletteTeal,
|
||||
),
|
||||
],
|
||||
onChanged:
|
||||
paletteSave.isLoading ||
|
||||
palette.isLoading
|
||||
? null
|
||||
: _setPalette,
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
Consumer(
|
||||
builder: (context, ref, _) {
|
||||
final appearance = ref.watch(
|
||||
appearanceSettingsProvider,
|
||||
);
|
||||
final appearanceSave = ref.watch(
|
||||
settingsOperationProvider('appearance'),
|
||||
);
|
||||
return AppField(
|
||||
label: context.l10n.theme,
|
||||
orientation: AppFieldOrientation.horizontal,
|
||||
error:
|
||||
(appearanceSave.hasError
|
||||
? context.l10n.saveAppearanceFailed
|
||||
: null) ??
|
||||
(appearance.hasError
|
||||
? context.l10n.loadAppearanceFailed
|
||||
: null),
|
||||
child: SizedBox(
|
||||
width: AppSettingsMetrics.controlWidth,
|
||||
child: AppSelect<AppAppearance>(
|
||||
emptyLabel:
|
||||
context.l10n.noMatchingOptions,
|
||||
controlHeight:
|
||||
AppTheme.isDesktop(context)
|
||||
? AppDesktopMetrics.button
|
||||
: AppSettingsMetrics.controlHeight,
|
||||
value:
|
||||
appearance.asData?.value ??
|
||||
AppAppearance.system,
|
||||
label: context.l10n.theme,
|
||||
options: [
|
||||
AppSelectOption(
|
||||
AppAppearance.system,
|
||||
context.l10n.system,
|
||||
),
|
||||
AppSelectOption(
|
||||
AppAppearance.penLight,
|
||||
context.l10n.light,
|
||||
),
|
||||
AppSelectOption(
|
||||
AppAppearance.penDark,
|
||||
context.l10n.dark,
|
||||
),
|
||||
],
|
||||
onChanged:
|
||||
appearanceSave.isLoading ||
|
||||
appearance.isLoading
|
||||
? null
|
||||
: _setMode,
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
const TimelineRulerSettingsField(),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -262,20 +371,36 @@ class _SettingsNavigation extends StatelessWidget {
|
||||
required this.value,
|
||||
required this.compact,
|
||||
required this.onChanged,
|
||||
this.onBack,
|
||||
});
|
||||
|
||||
final int value;
|
||||
final bool compact;
|
||||
final ValueChanged<int> onChanged;
|
||||
final VoidCallback? onBack;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
final entries = [
|
||||
(context.l10n.general, Icons.settings_outlined),
|
||||
(context.l10n.agentSettings, Icons.auto_awesome_outlined),
|
||||
('MCP', Icons.terminal_outlined),
|
||||
(0, context.l10n.general, AppIcons.settings),
|
||||
(3, context.l10n.appearance, AppIcons.appearance),
|
||||
(1, context.l10n.agentSettings, AppIcons.assistant),
|
||||
(2, 'MCP', AppIcons.terminal),
|
||||
];
|
||||
final title = Text(
|
||||
context.l10n.settings,
|
||||
style: theme.textTheme.titleSmall?.copyWith(fontSize: 16),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
);
|
||||
final back = IconButton(
|
||||
key: const Key('settings-sidebar-back'),
|
||||
tooltip: MaterialLocalizations.of(context).backButtonTooltip,
|
||||
onPressed: onBack,
|
||||
style: AppTheme.projectTabActionStyle(context, size: 28),
|
||||
icon: const Icon(AppIcons.arrowBack, size: 16),
|
||||
);
|
||||
return ColoredBox(
|
||||
key: const Key('settings-sidebar'),
|
||||
color: AppTheme.settingsSidebarBackground(context),
|
||||
@@ -284,26 +409,36 @@ class _SettingsNavigation extends StatelessWidget {
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(8, 0, 8, 20),
|
||||
child: Text(
|
||||
context.l10n.settings,
|
||||
style: theme.textTheme.titleSmall?.copyWith(fontSize: 16),
|
||||
),
|
||||
child: onBack == null
|
||||
? title
|
||||
: compact
|
||||
? Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [back, const SizedBox(height: 8), title],
|
||||
)
|
||||
: Row(
|
||||
children: [
|
||||
back,
|
||||
const SizedBox(width: 8),
|
||||
Expanded(child: title),
|
||||
],
|
||||
),
|
||||
),
|
||||
for (var index = 0; index < entries.length; index++)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(bottom: 1),
|
||||
child: Semantics(
|
||||
selected: value == index,
|
||||
selected: value == entries[index].$1,
|
||||
child: Tooltip(
|
||||
message: entries[index].$1,
|
||||
message: entries[index].$2,
|
||||
child: TextButton(
|
||||
key: ValueKey('settings-navigation-$index'),
|
||||
onPressed: () => onChanged(index),
|
||||
key: ValueKey('settings-navigation-${entries[index].$1}'),
|
||||
onPressed: () => onChanged(entries[index].$1),
|
||||
style: TextButton.styleFrom(
|
||||
minimumSize: const Size(0, 30),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
||||
foregroundColor: theme.colorScheme.onSurface,
|
||||
backgroundColor: value == index
|
||||
backgroundColor: value == entries[index].$1
|
||||
? theme.colorScheme.onSurface.withValues(alpha: .078)
|
||||
: Colors.transparent,
|
||||
shape: RoundedRectangleBorder(
|
||||
@@ -314,12 +449,12 @@ class _SettingsNavigation extends StatelessWidget {
|
||||
child: Row(
|
||||
children: [
|
||||
if (!compact) ...[
|
||||
Icon(entries[index].$2, size: 16),
|
||||
Icon(entries[index].$3, size: 16),
|
||||
const SizedBox(width: 8),
|
||||
],
|
||||
Expanded(
|
||||
child: Text(
|
||||
entries[index].$1,
|
||||
entries[index].$2,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
|
||||
Reference in new issue
Block a user