Merge branch 'worktree-agent-a82ec5e9fdf8ca159' into integrate/gaps-e
# Conflicts: # app/test/features/search/search_bar_layout_test.dart
This commit is contained in:
@@ -36,8 +36,9 @@ class ScheduleRefreshAction extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
/// Search and the enabled filter; the refresh control too when no bar above
|
||||
/// carries it ([onRefresh] null leaves it to the bar).
|
||||
/// Search and the enabled filter, and the count; the refresh control too when
|
||||
/// no bar above carries it ([onRefresh] null leaves it to the bar). The list
|
||||
/// floats it as a glass strip under the page's bar.
|
||||
class ScheduleListToolbar extends StatelessWidget {
|
||||
const ScheduleListToolbar({
|
||||
super.key,
|
||||
@@ -55,14 +56,15 @@ class ScheduleListToolbar extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 12, 16, 8),
|
||||
padding: const EdgeInsets.fromLTRB(12, 12, 12, 8),
|
||||
child: _search(context),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
@@ -87,7 +89,7 @@ class ScheduleListToolbar extends StatelessWidget {
|
||||
),
|
||||
if (controller.hasLoaded)
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 8, 16, 4),
|
||||
padding: const EdgeInsets.fromLTRB(12, 8, 12, 0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
@@ -99,6 +101,7 @@ class ScheduleListToolbar extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../../ui/adaptive/floating_bar_layout.dart';
|
||||
import '../../../../ui/adaptive/top_bar_notices.dart';
|
||||
import '../../../../ui/adaptive/top_glass_strip.dart';
|
||||
import '../../domain/saved_schedule.dart';
|
||||
import 'schedule_list_controller.dart';
|
||||
import 'schedule_list_row.dart';
|
||||
@@ -8,9 +11,18 @@ import 'schedule_list_toolbar.dart';
|
||||
|
||||
const scheduleListKey = ValueKey<String>('schedule-list');
|
||||
const scheduleRetryKey = ValueKey<String>('schedule-retry');
|
||||
const scheduleToolbarKey = ValueKey<String>('schedule-toolbar');
|
||||
|
||||
/// The widest the search and filter strip grows on a wide window.
|
||||
const double kScheduleToolbarMaxWidth = 720;
|
||||
|
||||
/// Platform-adaptive list body. It owns no navigation chrome; the shell frames
|
||||
/// it as the Schedules destination.
|
||||
///
|
||||
/// Search, the filter and the count float as one glass strip just under the
|
||||
/// page's top bar, and the list scrolls behind both: it pads its first row
|
||||
/// clear of them at rest. The strip keeps its place whatever the list shows,
|
||||
/// so typing a query that empties the list never drops the field's focus.
|
||||
class SchedulesListView extends StatelessWidget {
|
||||
const SchedulesListView({
|
||||
super.key,
|
||||
@@ -35,42 +47,44 @@ class SchedulesListView extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
children: [
|
||||
ScheduleListToolbar(
|
||||
return FloatingBarOverlay(
|
||||
edge: FloatingBarEdge.top,
|
||||
bar: TopGlassStrip(
|
||||
key: scheduleToolbarKey,
|
||||
cupertino: cupertino,
|
||||
maxWidth: kScheduleToolbarMaxWidth,
|
||||
padding: EdgeInsets.zero,
|
||||
child: ScheduleListToolbar(
|
||||
controller: controller,
|
||||
searchController: searchController,
|
||||
cupertino: cupertino,
|
||||
onRefresh: refreshInToolbar ? onRefresh : null,
|
||||
),
|
||||
Expanded(child: _body(context)),
|
||||
],
|
||||
),
|
||||
child: Builder(builder: _body),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _body(BuildContext context) {
|
||||
final failure = controller.failure;
|
||||
if (failure != null && controller.schedules.isEmpty) {
|
||||
return _failureState(context, failure);
|
||||
return BelowTopBar(child: _failureState(context, failure));
|
||||
}
|
||||
if (controller.isInitialLoading) {
|
||||
return BelowTopBar(child: _loadingState(context));
|
||||
}
|
||||
if (controller.isInitialLoading) return _loadingState(context);
|
||||
if (controller.schedules.isEmpty) {
|
||||
return _emptyState('No schedules yet.');
|
||||
return BelowTopBar(child: _emptyState('No schedules yet.'));
|
||||
}
|
||||
final content = controller.visibleSchedules.isEmpty
|
||||
? _emptyState(controller.emptyMessage)
|
||||
: _list(context);
|
||||
// The banner slot is always present so a failed or recovered refresh does
|
||||
// not change the list's ancestors. Replacing the ListView would rebuild the
|
||||
// Scrollable and drop the user's scroll offset.
|
||||
return Column(
|
||||
children: [
|
||||
if (failure != null)
|
||||
_failureBanner(context, failure)
|
||||
else
|
||||
const SizedBox.shrink(),
|
||||
Expanded(child: content),
|
||||
],
|
||||
? BelowTopBar(child: _emptyState(controller.emptyMessage))
|
||||
: Builder(builder: _list);
|
||||
// A failed refresh shows under the strip without changing the list's
|
||||
// ancestors: replacing the ListView would rebuild the Scrollable and drop
|
||||
// the user's scroll offset.
|
||||
return TopBarNotices(
|
||||
notices: [if (failure != null) _failureBanner(context, failure)],
|
||||
child: content,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -79,7 +93,10 @@ class SchedulesListView extends StatelessWidget {
|
||||
return ListView.builder(
|
||||
key: scheduleListKey,
|
||||
controller: scrollController,
|
||||
padding: const EdgeInsets.only(top: 4, bottom: 24),
|
||||
padding: withBarClearance(
|
||||
context,
|
||||
const EdgeInsets.only(top: 4, bottom: 24),
|
||||
),
|
||||
itemCount: schedules.length,
|
||||
itemBuilder: (context, index) {
|
||||
final schedule = schedules[index];
|
||||
|
||||
Reference in New Issue
Block a user