Banner
A banner keeps a message in the page while it still matters. Use one when a condition affects the reader’s next action, such as editing a draft offline.
Show a connection change
#Choose Go offline. Read what will happen to your changes, then reconnect to clear the message.
components/banner/appliance/show_connection_status.dart
import 'package:flutter/widgets.dart';
import 'package:appliance_ui/appliance_ui.dart';
class ShowConnectionStatus extends StatefulWidget {
const ShowConnectionStatus({super.key});
@override
State<ShowConnectionStatus> createState() => _ShowConnectionStatusState();
}
class _ShowConnectionStatusState extends State<ShowConnectionStatus> {
bool offline = false;
@override
Widget build(BuildContext context) => ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 440),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
if (offline) ...[
const ApplianceBanner(
title: 'Sync paused',
message: 'Edits will sync when you reconnect.',
),
const SizedBox(height: 12),
],
ApplianceButton(
offline ? 'Reconnect' : 'Go offline',
onPressed: () => setState(() => offline = !offline),
),
],
),
);
}
Parameters
ApplianceBanner API ↗title- Heading that names the condition.
message- Explanation of what the connection change means.
tone- Chooses the notice’s visual emphasis.
onClose- Handles the notice’s close action.
Shared behaviour
- Keyboard and focus. Tab to Go offline and activate it. The same control lets you reconnect when the banner is visible.
- Screen readers. Read the banner heading and the explanation together. The button’s name changes with the connection state.
- Direction and type. The heading and explanation follow reading direction. At larger type the message can occupy several lines.