Skeleton
A skeleton reserves space for content that is still loading. Match the placeholder to what will appear there and give the wait a visible name.
Load file details
#Read the loading state, then choose Show details. The placeholder gives way to a file name and its owner. Choose Reload to try again.
components/skeleton/appliance/load_file_details.dart
import 'package:flutter/widgets.dart';
import 'package:appliance_ui/appliance_ui.dart';
class LoadFileDetails extends StatefulWidget {
const LoadFileDetails({super.key});
@override
State<LoadFileDetails> createState() => _LoadFileDetailsState();
}
class _LoadFileDetailsState extends State<LoadFileDetails> {
bool loading = true;
@override
Widget build(BuildContext context) => ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 280),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
spacing: 10,
children: [
if (loading) ...[
const Text('Loading file details'),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
spacing: 8,
children: [
const ApplianceSkeleton(width: 176, height: 16),
const ApplianceSkeleton(width: 120, height: 12),
],
),
] else ...[
const Text('Planning notes'),
const Text('Owner: Mara Chen'),
],
ApplianceButton(
loading ? 'Show details' : 'Reload',
onPressed: () => setState(() => loading = !loading),
),
],
),
);
}
Parameters
ApplianceSkeleton API ↗width- Width of one placeholder line.
height- Thickness of that line.
Shared behaviour
- Keyboard and focus. The skeleton requires no keyboard interaction. Tab to the button to switch between the loading state and the file.
- Screen readers. The example names the wait and supplies real text when it finishes. Read both states and check what the look announces for the placeholder.
- Direction and type. The file text follows the page direction and can wrap at larger sizes. The placeholder stands in the same content area.