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
@@ -2,10 +2,12 @@ import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
import '../icons/app_icons.dart';
|
||||
import '../theme/app_theme.dart';
|
||||
import '../theme/menu_metrics.dart';
|
||||
import 'native_context_menu.dart';
|
||||
import 'app_combobox.dart';
|
||||
import 'menu_trigger_focus.dart';
|
||||
|
||||
part 'app_menu.freezed.dart';
|
||||
|
||||
@@ -203,7 +205,7 @@ class _AppMenuItemState extends State<AppMenuItem> {
|
||||
? null
|
||||
: SizedBox.square(
|
||||
dimension: AppMenuMetrics.iconSize,
|
||||
child: widget.selected! ? const Icon(Icons.check) : null,
|
||||
child: widget.selected! ? const Icon(AppIcons.check) : null,
|
||||
),
|
||||
child: widget.selectOption
|
||||
? Row(
|
||||
@@ -219,7 +221,7 @@ class _AppMenuItemState extends State<AppMenuItem> {
|
||||
SizedBox.square(
|
||||
dimension: 16,
|
||||
child: widget.selected == true
|
||||
? const Icon(Icons.check, size: 16)
|
||||
? const Icon(AppIcons.check, size: 16)
|
||||
: null,
|
||||
),
|
||||
],
|
||||
@@ -261,7 +263,7 @@ class AppMenuSeparator extends StatelessWidget {
|
||||
horizontal: AppMenuMetrics.iconGap,
|
||||
vertical: AppMenuMetrics.separatorVerticalPadding,
|
||||
),
|
||||
child: Divider(height: 1, thickness: 1),
|
||||
child: Divider(height: 1),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -335,53 +337,67 @@ class AppDropdownMenu extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _AppDropdownMenuState extends State<AppDropdownMenu> {
|
||||
final _focus = FocusNode();
|
||||
final _controller = MenuController();
|
||||
late final _triggerFocus = MenuTriggerFocus(controller: _controller);
|
||||
FocusNode get _focus => _triggerFocus.node;
|
||||
final _entryKey = GlobalKey();
|
||||
// MenuAnchor owns a scroll view. Do not let its offset read or overwrite
|
||||
// an enclosing inspector's expansion state or scroll position.
|
||||
final _menuStorage = PageStorageBucket();
|
||||
@override
|
||||
void dispose() {
|
||||
_focus.dispose();
|
||||
_triggerFocus.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => MenuAnchor(
|
||||
controller: _controller,
|
||||
childFocusNode: _focus,
|
||||
consumeOutsideTap: true,
|
||||
crossAxisUnconstrained: widget.crossAxisUnconstrained,
|
||||
alignmentOffset: widget.alignmentOffset,
|
||||
style:
|
||||
(widget.menuStyle ??
|
||||
AppMenuStyle.panel(context, minWidth: widget.minWidth))
|
||||
.copyWith(
|
||||
maximumSize: widget.maxHeight == null
|
||||
? null
|
||||
: WidgetStatePropertyAll(
|
||||
Size(double.infinity, widget.maxHeight!),
|
||||
),
|
||||
),
|
||||
onClose: widget.onClose,
|
||||
onOpen: () => _focusMenu(_entryKey),
|
||||
menuChildren: [
|
||||
for (var i = 0; i < widget.items.length; i++)
|
||||
if (i == 0)
|
||||
Builder(key: _entryKey, builder: (_) => widget.items[i])
|
||||
else
|
||||
widget.items[i],
|
||||
],
|
||||
builder: (context, controller, _) => Shortcuts(
|
||||
shortcuts: const {
|
||||
SingleActivator(LogicalKeyboardKey.arrowDown): ActivateIntent(),
|
||||
Widget build(BuildContext context) => PageStorage(
|
||||
bucket: _menuStorage,
|
||||
child: MenuAnchor(
|
||||
controller: _controller,
|
||||
childFocusNode: _focus,
|
||||
// Close on outside clicks without swallowing the target control's action.
|
||||
consumeOutsideTap: false,
|
||||
crossAxisUnconstrained: widget.crossAxisUnconstrained,
|
||||
alignmentOffset: widget.alignmentOffset,
|
||||
style:
|
||||
(widget.menuStyle ??
|
||||
AppMenuStyle.panel(context, minWidth: widget.minWidth))
|
||||
.copyWith(
|
||||
maximumSize: widget.maxHeight == null
|
||||
? null
|
||||
: WidgetStatePropertyAll(
|
||||
Size(double.infinity, widget.maxHeight!),
|
||||
),
|
||||
),
|
||||
onClose: () {
|
||||
_triggerFocus.onClose();
|
||||
widget.onClose?.call();
|
||||
},
|
||||
child: widget.builder(
|
||||
context,
|
||||
!widget.enabled
|
||||
? null
|
||||
: () {
|
||||
controller.isOpen ? controller.close() : controller.open();
|
||||
},
|
||||
_focus,
|
||||
onOpen: () {
|
||||
_triggerFocus.onOpen();
|
||||
_focusMenu(_entryKey);
|
||||
},
|
||||
menuChildren: [
|
||||
for (var i = 0; i < widget.items.length; i++)
|
||||
if (i == 0)
|
||||
Builder(key: _entryKey, builder: (_) => widget.items[i])
|
||||
else
|
||||
widget.items[i],
|
||||
],
|
||||
builder: (context, controller, _) => Shortcuts(
|
||||
shortcuts: const {
|
||||
SingleActivator(LogicalKeyboardKey.arrowDown): ActivateIntent(),
|
||||
},
|
||||
child: widget.builder(
|
||||
context,
|
||||
!widget.enabled
|
||||
? null
|
||||
: () {
|
||||
controller.isOpen ? controller.close() : controller.open();
|
||||
},
|
||||
_focus,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -495,9 +511,18 @@ class AppSelect<T> extends StatelessWidget {
|
||||
: Size.fromHeight(controlHeight!),
|
||||
minimumSize: Size(
|
||||
0,
|
||||
outlined
|
||||
? AppControlSize.input
|
||||
: AppControlSize.small,
|
||||
controlHeight ??
|
||||
(AppTheme.isDesktop(context)
|
||||
? outlined
|
||||
? theme
|
||||
.inputDecorationTheme
|
||||
.constraints
|
||||
?.minHeight ??
|
||||
AppDesktopMetrics.input
|
||||
: AppDesktopMetrics.iconButton
|
||||
: outlined
|
||||
? AppControlSize.input
|
||||
: AppControlSize.small),
|
||||
),
|
||||
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
||||
shape: RoundedRectangleBorder(
|
||||
@@ -530,7 +555,7 @@ class AppSelect<T> extends StatelessWidget {
|
||||
),
|
||||
const SizedBox(width: AppSpacing.small),
|
||||
Icon(
|
||||
Icons.expand_more,
|
||||
AppIcons.expandMore,
|
||||
size: 16,
|
||||
color: colors.onSurfaceVariant.withValues(
|
||||
alpha: .5,
|
||||
@@ -563,6 +588,7 @@ class _AppContextMenuState extends State<AppContextMenu> {
|
||||
final _controller = MenuController();
|
||||
final _focus = FocusNode();
|
||||
final _entryKey = GlobalKey();
|
||||
final _menuStorage = PageStorageBucket();
|
||||
Offset _anchorPosition = Offset.zero;
|
||||
bool _focusFirstItem = false;
|
||||
bool _opening = false;
|
||||
@@ -640,17 +666,22 @@ class _AppContextMenuState extends State<AppContextMenu> {
|
||||
Positioned(
|
||||
left: _anchorPosition.dx,
|
||||
top: _anchorPosition.dy,
|
||||
child: MenuAnchor(
|
||||
controller: _controller,
|
||||
childFocusNode: _focus,
|
||||
consumeOutsideTap: true,
|
||||
crossAxisUnconstrained: false,
|
||||
style: AppMenuStyle.panel(context),
|
||||
onOpen: () {
|
||||
if (_focusFirstItem) _focusMenu(_entryKey);
|
||||
},
|
||||
menuChildren: _items(context),
|
||||
child: const IgnorePointer(child: SizedBox.square(dimension: 1)),
|
||||
child: PageStorage(
|
||||
bucket: _menuStorage,
|
||||
child: MenuAnchor(
|
||||
controller: _controller,
|
||||
childFocusNode: _focus,
|
||||
// Nested anchors share their parent's open state. Consuming an
|
||||
// outside tap here would also block clicks outside that parent.
|
||||
consumeOutsideTap: false,
|
||||
crossAxisUnconstrained: false,
|
||||
style: AppMenuStyle.panel(context),
|
||||
onOpen: () {
|
||||
if (_focusFirstItem) _focusMenu(_entryKey);
|
||||
},
|
||||
menuChildren: _items(context),
|
||||
child: const IgnorePointer(child: SizedBox.square(dimension: 1)),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
Reference in new issue
Block a user