Search field in the bar, refresh and Back as bar pieces, even Cupertino actions (F8/F28/F10/F11/F20/F1)
- Search: field, compact Kind menu and syntax help in the bar's actions pill; bounds shown only when truncated; rows with bold title, kind tag and one muted line; results run behind the bar in a start-aligned 840 column. - AppSearchField: one search field per platform (Search, Schedules, Runs filter). - BarIconButton: whole 44pt/48dp bar actions; Runs, bell and Pipelines icons use the same 44pt targets on Cupertino. - Templates and Schedules pages put Refresh in the bar and use the shared round SegmentedBackButton; Templates shows one Back at a time. - PipelineBackButton is the round segmented Back. - notes/pages-fixes.md records the batch, tests and evidence.
This commit is contained in:
@@ -1,26 +1,56 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../../ui/input/app_search_field.dart';
|
||||
import '../../../../ui/navigation/bar_icon_button.dart';
|
||||
import 'schedule_list_controller.dart';
|
||||
|
||||
const scheduleSearchFieldKey = ValueKey<String>('schedule-search-field');
|
||||
const scheduleFilterKey = ValueKey<String>('schedule-filter');
|
||||
const scheduleRefreshKey = ValueKey<String>('schedule-refresh');
|
||||
|
||||
/// Search, enabled filter and the read-only refresh control.
|
||||
/// Refresh for the list, as a bar action: the platform's activity indicator
|
||||
/// in the same touch target while a read is in flight.
|
||||
class ScheduleRefreshAction extends StatelessWidget {
|
||||
const ScheduleRefreshAction({
|
||||
super.key,
|
||||
required this.controller,
|
||||
required this.cupertino,
|
||||
required this.onRefresh,
|
||||
});
|
||||
|
||||
final SchedulesController controller;
|
||||
final bool cupertino;
|
||||
final VoidCallback onRefresh;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => BarIconButton(
|
||||
key: controller.isLoading ? null : scheduleRefreshKey,
|
||||
cupertino: cupertino,
|
||||
icon: Icons.refresh,
|
||||
cupertinoIcon: CupertinoIcons.refresh,
|
||||
label: 'Refresh schedules',
|
||||
busy: controller.isLoading,
|
||||
busyLabel: 'Refreshing schedules',
|
||||
onPressed: onRefresh,
|
||||
);
|
||||
}
|
||||
|
||||
/// Search and the enabled filter; the refresh control too when no bar above
|
||||
/// carries it ([onRefresh] null leaves it to the bar).
|
||||
class ScheduleListToolbar extends StatelessWidget {
|
||||
const ScheduleListToolbar({
|
||||
super.key,
|
||||
required this.controller,
|
||||
required this.searchController,
|
||||
required this.cupertino,
|
||||
required this.onRefresh,
|
||||
this.onRefresh,
|
||||
});
|
||||
|
||||
final SchedulesController controller;
|
||||
final TextEditingController searchController;
|
||||
final bool cupertino;
|
||||
final VoidCallback onRefresh;
|
||||
final VoidCallback? onRefresh;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -44,8 +74,14 @@ class ScheduleListToolbar extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
_refresh(context),
|
||||
if (onRefresh case final refresh?) ...[
|
||||
const SizedBox(width: 8),
|
||||
ScheduleRefreshAction(
|
||||
controller: controller,
|
||||
cupertino: cupertino,
|
||||
onRefresh: refresh,
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -67,40 +103,14 @@ class ScheduleListToolbar extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _search(BuildContext context) {
|
||||
if (cupertino) {
|
||||
return CupertinoSearchTextField(
|
||||
key: scheduleSearchFieldKey,
|
||||
controller: searchController,
|
||||
placeholder: 'Search schedules',
|
||||
onChanged: controller.setQuery,
|
||||
onSuffixTap: () {
|
||||
searchController.clear();
|
||||
controller.clearQuery();
|
||||
},
|
||||
);
|
||||
}
|
||||
return TextField(
|
||||
key: scheduleSearchFieldKey,
|
||||
controller: searchController,
|
||||
onChanged: controller.setQuery,
|
||||
textInputAction: TextInputAction.search,
|
||||
decoration: InputDecoration(
|
||||
hintText: 'Search schedules',
|
||||
prefixIcon: const Icon(Icons.search),
|
||||
suffixIcon: controller.query.isEmpty
|
||||
? null
|
||||
: IconButton(
|
||||
tooltip: 'Clear search',
|
||||
icon: const Icon(Icons.clear),
|
||||
onPressed: () {
|
||||
searchController.clear();
|
||||
controller.clearQuery();
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
Widget _search(BuildContext context) => AppSearchField(
|
||||
fieldKey: scheduleSearchFieldKey,
|
||||
controller: searchController,
|
||||
cupertino: cupertino,
|
||||
placeholder: 'Search schedules',
|
||||
onChanged: controller.setQuery,
|
||||
onCleared: controller.clearQuery,
|
||||
);
|
||||
|
||||
Widget _filter(BuildContext context) {
|
||||
if (cupertino) {
|
||||
@@ -136,38 +146,6 @@ class ScheduleListToolbar extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _refresh(BuildContext context) {
|
||||
if (controller.isLoading) {
|
||||
return Semantics(
|
||||
label: 'Refreshing schedules',
|
||||
liveRegion: true,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: cupertino
|
||||
? const CupertinoActivityIndicator()
|
||||
: const CircularProgressIndicator(strokeWidth: 2),
|
||||
),
|
||||
);
|
||||
}
|
||||
if (cupertino) {
|
||||
return Semantics(
|
||||
label: 'Refresh schedules',
|
||||
child: CupertinoButton(
|
||||
key: scheduleRefreshKey,
|
||||
padding: EdgeInsets.zero,
|
||||
onPressed: onRefresh,
|
||||
child: const Icon(CupertinoIcons.refresh),
|
||||
),
|
||||
);
|
||||
}
|
||||
return IconButton(
|
||||
key: scheduleRefreshKey,
|
||||
tooltip: 'Refresh schedules',
|
||||
onPressed: onRefresh,
|
||||
icon: const Icon(Icons.refresh),
|
||||
);
|
||||
}
|
||||
|
||||
TextStyle? _metaStyle(BuildContext context) => cupertino
|
||||
? CupertinoTheme.of(context).textTheme.tabLabelTextStyle.copyWith(
|
||||
color: CupertinoColors.secondaryLabel.resolveFrom(context),
|
||||
|
||||
@@ -20,6 +20,7 @@ class SchedulesListView extends StatelessWidget {
|
||||
required this.cupertino,
|
||||
required this.onOpen,
|
||||
required this.onRefresh,
|
||||
this.refreshInToolbar = true,
|
||||
});
|
||||
|
||||
final SchedulesController controller;
|
||||
@@ -29,6 +30,9 @@ class SchedulesListView extends StatelessWidget {
|
||||
final ValueChanged<SavedSchedule> onOpen;
|
||||
final VoidCallback onRefresh;
|
||||
|
||||
/// False when the page's bar carries Refresh instead.
|
||||
final bool refreshInToolbar;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
@@ -37,7 +41,7 @@ class SchedulesListView extends StatelessWidget {
|
||||
controller: controller,
|
||||
searchController: searchController,
|
||||
cupertino: cupertino,
|
||||
onRefresh: onRefresh,
|
||||
onRefresh: refreshInToolbar ? onRefresh : null,
|
||||
),
|
||||
Expanded(child: _body(context)),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user