fix(app): runs attention action shares the filter toolbar row
This commit is contained in:
@@ -12,9 +12,10 @@ import 'runs_controller.dart';
|
||||
/// The buttons sit in a single horizontally scrollable row so a phone at a
|
||||
/// doubled text scale can still reach them without crushing the list.
|
||||
class RunsFilters extends StatelessWidget {
|
||||
const RunsFilters({super.key, required this.controller});
|
||||
const RunsFilters({super.key, required this.controller, this.action});
|
||||
|
||||
final RunsController controller;
|
||||
final Widget? action;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -37,6 +38,7 @@ class RunsFilters extends StatelessWidget {
|
||||
Widget _materialToolbar(int count) => Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
if (action case final action?) ...[action, const SizedBox(width: 4)],
|
||||
PopupMenuButton<_FilterChoice>(
|
||||
tooltip: count > 0
|
||||
? '$count active ${count == 1 ? 'filter' : 'filters'}'
|
||||
@@ -154,6 +156,7 @@ class RunsFilters extends StatelessWidget {
|
||||
Widget _cupertinoToolbar(BuildContext context, int count) => Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
if (action case final action?) ...[action, const SizedBox(width: 4)],
|
||||
CupertinoButton(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 6),
|
||||
minimumSize: Size.zero,
|
||||
|
||||
@@ -75,7 +75,19 @@ class RunsList extends StatelessWidget {
|
||||
onChanged: controller.setQuery,
|
||||
),
|
||||
),
|
||||
RunsFilters(controller: controller),
|
||||
RunsFilters(
|
||||
controller: controller,
|
||||
action: NeedsYouRunsHeading(
|
||||
rows: controller.runs,
|
||||
frames: controller.repository.gateway.frames,
|
||||
onOpen: (entry) => onSelected(entry.runId),
|
||||
syncToken: syncToken,
|
||||
store: attentionStore,
|
||||
now: attentionNow,
|
||||
notifications: notifications,
|
||||
attention: attention,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: controller.visibleRuns.isEmpty
|
||||
? const Center(child: Text('No runs found.'))
|
||||
@@ -85,33 +97,18 @@ class RunsList extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _heading(BuildContext context) => Padding(
|
||||
padding: const EdgeInsetsDirectional.fromSTEB(16, 8, 16, 0),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
child: controller.usage == null
|
||||
? const SizedBox.shrink()
|
||||
: Text(
|
||||
'Usage: ${controller.usage}',
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
NeedsYouRunsHeading(
|
||||
rows: controller.runs,
|
||||
frames: controller.repository.gateway.frames,
|
||||
onOpen: (entry) => onSelected(entry.runId),
|
||||
syncToken: syncToken,
|
||||
store: attentionStore,
|
||||
now: attentionNow,
|
||||
notifications: notifications,
|
||||
attention: attention,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
Widget _heading(BuildContext context) {
|
||||
final usage = controller.usage;
|
||||
if (usage == null) return const SizedBox.shrink();
|
||||
return Padding(
|
||||
padding: const EdgeInsetsDirectional.fromSTEB(16, 8, 16, 0),
|
||||
child: Text(
|
||||
'Usage: $usage',
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _groupedRuns(BuildContext context) {
|
||||
final groups = groupRunsByDay(controller.visibleRuns, DateTime.now());
|
||||
|
||||
Reference in New Issue
Block a user