Keep settings and delivery updates together
Preserve the reviewed grouped Settings page while fixing its embedded phone safe area, and land the accompanying notification, walkthrough, terminal, and documentation updates captured by this run.
This commit is contained in:
@@ -16,11 +16,24 @@ const deviceDeliveryNote =
|
||||
'quiet "Pipelines is connected" notification while it runs.';
|
||||
const deviceDeliveryBatteryLabel = 'Allow background delivery';
|
||||
const deviceDeliveryNotificationsLabel = 'Allow notifications';
|
||||
const deviceDeliveryWarningTitle = 'Delivery can pause while idle';
|
||||
const deviceDeliveryWarningText =
|
||||
'Android may pause Pipelines in the background, so notifications can '
|
||||
'arrive late. Allow background delivery above.';
|
||||
const deviceDeliverySamsungNote =
|
||||
'Samsung phones: also add Pipelines under Settings › Battery › '
|
||||
'Background usage limits › Never sleeping apps.';
|
||||
const deviceDeliveryLogTitle = 'Connection log';
|
||||
const deviceDeliveryLogEmpty = 'No connection events yet';
|
||||
|
||||
abstract final class DeviceDeliveryKeys {
|
||||
static const toggle = ValueKey<String>('settings.deviceDelivery.toggle');
|
||||
static const status = ValueKey<String>('settings.deviceDelivery.status');
|
||||
static const battery = ValueKey<String>('settings.deviceDelivery.battery');
|
||||
static const batteryWarning = ValueKey<String>(
|
||||
'settings.deviceDelivery.batteryWarning',
|
||||
);
|
||||
static const log = ValueKey<String>('settings.deviceDelivery.log');
|
||||
static const permission = ValueKey<String>(
|
||||
'settings.deviceDelivery.permission',
|
||||
);
|
||||
@@ -66,7 +79,7 @@ class _SettingsDeviceDeliverySectionState
|
||||
void initState() {
|
||||
super.initState();
|
||||
_lifecycle;
|
||||
unawaited(_controller.load());
|
||||
unawaited(_controller.open());
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -136,7 +149,45 @@ class _SettingsDeviceDeliverySectionState
|
||||
enabled: !status.batteryExempt && !_controller.busy,
|
||||
onTap: () => unawaited(_controller.allowBackgroundDelivery()),
|
||||
),
|
||||
if (status != null && enabled && !status.batteryExempt)
|
||||
SettingsRow(
|
||||
key: DeviceDeliveryKeys.batteryWarning,
|
||||
leading: Icon(
|
||||
Icons.warning_amber_rounded,
|
||||
color: settingsErrorColor(context),
|
||||
),
|
||||
title: const Text(deviceDeliveryWarningTitle),
|
||||
subtitle: Text(
|
||||
'$deviceDeliveryWarningText\n$deviceDeliverySamsungNote',
|
||||
),
|
||||
),
|
||||
if (status != null)
|
||||
ExpansionTile(
|
||||
key: DeviceDeliveryKeys.log,
|
||||
title: const Text(deviceDeliveryLogTitle),
|
||||
children: _logRows(),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
List<Widget> _logRows() {
|
||||
final events = _controller.events;
|
||||
if (events.isEmpty) {
|
||||
return const <Widget>[ListTile(title: Text(deviceDeliveryLogEmpty))];
|
||||
}
|
||||
return [
|
||||
for (final event in events)
|
||||
ListTile(
|
||||
dense: true,
|
||||
title: Text(event.title),
|
||||
subtitle: Text(
|
||||
[
|
||||
event.timeLabel,
|
||||
if (event.detail != null) event.detail!,
|
||||
].join('\n'),
|
||||
),
|
||||
),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -184,15 +184,26 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final content = SafeArea(
|
||||
bottom: false,
|
||||
child: SettingsSearchPage(sections: _pageSections()),
|
||||
);
|
||||
if (widget.embedded) return content;
|
||||
final page = SettingsSearchPage(sections: _pageSections());
|
||||
if (widget.embedded) {
|
||||
// The shell's floating tab bar sits over this body, and the body reads
|
||||
// the bar's height as its bottom padding. The page's rows are controls
|
||||
// and text, so they stop at the bar's top edge instead of scrolling
|
||||
// under the glass where they cannot be read. The reserved space is
|
||||
// removed from the page's own inset so it is not counted twice.
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(bottom: MediaQuery.paddingOf(context).bottom),
|
||||
child: MediaQuery.removePadding(
|
||||
context: context,
|
||||
removeBottom: true,
|
||||
child: SafeArea(bottom: false, child: page),
|
||||
),
|
||||
);
|
||||
}
|
||||
return Scaffold(
|
||||
extendBodyBehindAppBar: true,
|
||||
appBar: const SegmentedBar(title: 'Settings'),
|
||||
body: content,
|
||||
body: SafeArea(bottom: false, child: page),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user