77/// Two ConnState-keyed treatments, read through the seam ([connStateProvider] ):
88/// * **Disconnected** — a quiet `folder_off` [EmptyState] with guidance and NO
99/// destructive actions (nothing to act on).
10- /// * **Connected** — a breadcrumb + action bar (Up / Refresh / New file / New
11- /// folder / Upload / GitHub import) over the live listing. Tapping a folder
12- /// descends; tapping
10+ /// * **Connected** — a breadcrumb + responsive, single-row action toolbar
11+ /// (Select / Refresh / New file / New folder / Upload / GitHub import) over
12+ /// the live listing. Lower-priority actions move into a labelled overflow
13+ /// only when all six targets do not fit. Tapping a folder descends; tapping
1314/// a file opens it in the editor. Each row carries rename/delete affordances.
1415/// A determinate transfer bar shows during a transfer; a typed failure is
1516/// surfaced as an ARB-localized message (FR-FILES-3), never a raw code.
@@ -40,8 +41,19 @@ import 'package:pyble/theme/theme.dart';
4041import 'file_explorer_controller.dart' ;
4142
4243/// Stable interaction keys used by widget, golden, and hardware acceptance
43- /// tests for the visible-file multi-delete workflow (ADR-0043).
44+ /// tests for the normal toolbar and visible-file multi-delete workflow
45+ /// (ADR-0043).
4446const Key kFilesSelectActionKey = ValueKey <String >('filesSelectAction' );
47+ const Key kFilesNormalActionsRowKey = ValueKey <String >('filesNormalActionsRow' );
48+ const Key kFilesActionsOverflowButtonKey = ValueKey <String >(
49+ 'filesActionsOverflowButton' ,
50+ );
51+ const Key kFilesOverflowRefreshKey = ValueKey <String >('filesOverflowRefresh' );
52+ const Key kFilesOverflowNewFileKey = ValueKey <String >('filesOverflowNewFile' );
53+ const Key kFilesOverflowNewFolderKey = ValueKey <String >(
54+ 'filesOverflowNewFolder' ,
55+ );
56+ const Key kFilesOverflowUploadKey = ValueKey <String >('filesOverflowUpload' );
4557const Key kFilesSelectionBarKey = ValueKey <String >('filesSelectionBar' );
4658const Key kFilesSelectAllShownKey = ValueKey <String >('filesSelectAllShown' );
4759const Key kFilesBulkDeleteActionKey = ValueKey <String >('filesBulkDeleteAction' );
@@ -552,8 +564,9 @@ class _ExplorerState extends ConsumerState<_Explorer> {
552564 }
553565}
554566
555- /// The breadcrumb + action bar. Actions live in a [Wrap] so they never overflow
556- /// a narrow pane.
567+ enum _FilesOverflowAction { refresh, newFile, newFolder, upload }
568+
569+ /// The breadcrumb + responsive one-row action toolbar.
557570class _ActionBar extends StatelessWidget {
558571 const _ActionBar ({
559572 required this .state,
@@ -580,6 +593,21 @@ class _ActionBar extends StatelessWidget {
580593 @override
581594 Widget build (BuildContext context) {
582595 final ColorScheme scheme = Theme .of (context).colorScheme;
596+ final Widget selectAction = IconButton (
597+ key: kFilesSelectActionKey,
598+ focusNode: selectFocus,
599+ tooltip: l10n.filesActionSelect,
600+ onPressed: canSelect ? onSelect : null ,
601+ icon: const Icon (Icons .checklist_outlined),
602+ );
603+ final Widget githubAction = IconButton (
604+ focusNode: githubImportFocus,
605+ tooltip: githubImportEnabled
606+ ? l10n.githubImportAction
607+ : l10n.githubImportRequiresReady,
608+ icon: const Icon (Icons .cloud_download_outlined),
609+ onPressed: githubImportEnabled ? openGithubImport : null ,
610+ );
583611 return Column (
584612 crossAxisAlignment: CrossAxisAlignment .stretch,
585613 children: < Widget > [
@@ -615,47 +643,113 @@ class _ActionBar extends StatelessWidget {
615643 alignment: Alignment .centerRight,
616644 child: Padding (
617645 padding: const EdgeInsets .symmetric (horizontal: SignalSpacing .xs),
618- child: Wrap (
619- spacing: SignalSpacing .xs,
620- crossAxisAlignment: WrapCrossAlignment .center,
621- children: < Widget > [
622- TextButton .icon (
623- key: kFilesSelectActionKey,
624- focusNode: selectFocus,
625- style: TextButton .styleFrom (minimumSize: const Size (48 , 48 )),
626- onPressed: canSelect ? onSelect : null ,
627- icon: const Icon (Icons .checklist_outlined),
628- label: Text (l10n.filesActionSelect),
629- ),
630- IconButton (
631- tooltip: l10n.filesActionRefresh,
632- icon: const Icon (Icons .refresh),
633- onPressed: () => ctrl.refresh (),
634- ),
635- IconButton (
636- tooltip: l10n.filesEmptyCta,
637- icon: const Icon (Icons .note_add_outlined),
638- onPressed: () => _promptNewFile (context, ctrl, l10n),
639- ),
640- IconButton (
641- tooltip: l10n.filesActionNewFolder,
642- icon: const Icon (Icons .create_new_folder_outlined),
643- onPressed: () => _promptNewFolder (context, ctrl, l10n),
644- ),
645- IconButton (
646- tooltip: l10n.filesActionUpload,
647- icon: const Icon (Icons .upload_file_outlined),
648- onPressed: () => ctrl.uploadCurrentBuffer (),
649- ),
650- IconButton (
651- focusNode: githubImportFocus,
652- tooltip: githubImportEnabled
653- ? l10n.githubImportAction
654- : l10n.githubImportRequiresReady,
655- icon: const Icon (Icons .cloud_download_outlined),
656- onPressed: githubImportEnabled ? openGithubImport : null ,
657- ),
658- ],
646+ child: LayoutBuilder (
647+ builder: (BuildContext context, BoxConstraints constraints) {
648+ // Six direct Material targets need 288 dp. Below that exact
649+ // bound, keep the two priority actions visible and move the
650+ // remaining four into one labelled, accessible menu.
651+ final bool compact = constraints.maxWidth < 6 * 48 ;
652+ return SizedBox (
653+ key: kFilesNormalActionsRowKey,
654+ height: 48 ,
655+ child: Row (
656+ mainAxisAlignment: MainAxisAlignment .end,
657+ children: compact
658+ ? < Widget > [
659+ selectAction,
660+ githubAction,
661+ PopupMenuButton <_FilesOverflowAction >(
662+ key: kFilesActionsOverflowButtonKey,
663+ tooltip: l10n.filesMoreActions,
664+ constraints: const BoxConstraints (
665+ minWidth: 220 ,
666+ maxWidth: 320 ,
667+ ),
668+ icon: const Icon (Icons .more_vert),
669+ onSelected: (_FilesOverflowAction action) {
670+ switch (action) {
671+ case _FilesOverflowAction .refresh:
672+ ctrl.refresh ();
673+ break ;
674+ case _FilesOverflowAction .newFile:
675+ _promptNewFile (context, ctrl, l10n);
676+ break ;
677+ case _FilesOverflowAction .newFolder:
678+ _promptNewFolder (context, ctrl, l10n);
679+ break ;
680+ case _FilesOverflowAction .upload:
681+ ctrl.uploadCurrentBuffer ();
682+ break ;
683+ }
684+ },
685+ itemBuilder: (BuildContext context) =>
686+ < PopupMenuEntry <_FilesOverflowAction >> [
687+ PopupMenuItem <_FilesOverflowAction >(
688+ key: kFilesOverflowRefreshKey,
689+ value: _FilesOverflowAction .refresh,
690+ child: _FilesOverflowLabel (
691+ icon: Icons .refresh,
692+ label: l10n.filesActionRefresh,
693+ ),
694+ ),
695+ PopupMenuItem <_FilesOverflowAction >(
696+ key: kFilesOverflowNewFileKey,
697+ value: _FilesOverflowAction .newFile,
698+ child: _FilesOverflowLabel (
699+ icon: Icons .note_add_outlined,
700+ label: l10n.filesEmptyCta,
701+ ),
702+ ),
703+ PopupMenuItem <_FilesOverflowAction >(
704+ key: kFilesOverflowNewFolderKey,
705+ value: _FilesOverflowAction .newFolder,
706+ child: _FilesOverflowLabel (
707+ icon: Icons .create_new_folder_outlined,
708+ label: l10n.filesActionNewFolder,
709+ ),
710+ ),
711+ PopupMenuItem <_FilesOverflowAction >(
712+ key: kFilesOverflowUploadKey,
713+ value: _FilesOverflowAction .upload,
714+ child: _FilesOverflowLabel (
715+ icon: Icons .upload_file_outlined,
716+ label: l10n.filesActionUpload,
717+ ),
718+ ),
719+ ],
720+ ),
721+ ]
722+ : < Widget > [
723+ selectAction,
724+ IconButton (
725+ tooltip: l10n.filesActionRefresh,
726+ icon: const Icon (Icons .refresh),
727+ onPressed: () => ctrl.refresh (),
728+ ),
729+ IconButton (
730+ tooltip: l10n.filesEmptyCta,
731+ icon: const Icon (Icons .note_add_outlined),
732+ onPressed: () =>
733+ _promptNewFile (context, ctrl, l10n),
734+ ),
735+ IconButton (
736+ tooltip: l10n.filesActionNewFolder,
737+ icon: const Icon (
738+ Icons .create_new_folder_outlined,
739+ ),
740+ onPressed: () =>
741+ _promptNewFolder (context, ctrl, l10n),
742+ ),
743+ IconButton (
744+ tooltip: l10n.filesActionUpload,
745+ icon: const Icon (Icons .upload_file_outlined),
746+ onPressed: () => ctrl.uploadCurrentBuffer (),
747+ ),
748+ githubAction,
749+ ],
750+ ),
751+ );
752+ },
659753 ),
660754 ),
661755 ),
@@ -664,6 +758,22 @@ class _ActionBar extends StatelessWidget {
664758 }
665759}
666760
761+ class _FilesOverflowLabel extends StatelessWidget {
762+ const _FilesOverflowLabel ({required this .icon, required this .label});
763+
764+ final IconData icon;
765+ final String label;
766+
767+ @override
768+ Widget build (BuildContext context) => Row (
769+ children: < Widget > [
770+ Icon (icon, size: 20 ),
771+ const SizedBox (width: SignalSpacing .md),
772+ Expanded (child: Text (label)),
773+ ],
774+ );
775+ }
776+
667777/// Session-scoped replacement for the ordinary Files actions. It stays compact
668778/// on a wide tablet pane and deliberately reflows into two rows for a narrow
669779/// phone/pane or large text, preserving every 48 dp action target.
0 commit comments