Linear progress
A linear progress indicator shows how far a task has advanced. Use a determinate value when you know how much work is left.
Track four uploads
#One of four files has finished. Complete another file to advance the indicator by a quarter. Start over after the fourth.
components/linear-progress/appliance/track_uploads.dart
import 'package:flutter/widgets.dart';
import 'package:appliance_ui/appliance_ui.dart';
class TrackUploads extends StatefulWidget {
const TrackUploads({super.key});
@override
State<TrackUploads> createState() => _TrackUploadsState();
}
class _TrackUploadsState extends State<TrackUploads> {
int completed = 1;
@override
Widget build(BuildContext context) => ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 320),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
SizedBox(
width: double.infinity,
child: ApplianceProgressBar(
value: completed / 4,
semanticLabel: 'Uploading files',
),
),
const SizedBox(height: 12),
Text('Uploaded $completed of 4 files'),
const SizedBox(height: 12),
ApplianceButton(
completed == 4 ? 'Start over' : 'Complete next file',
onPressed: () =>
setState(() => completed = completed == 4 ? 1 : completed + 1),
),
],
),
);
}
Parameters
ApplianceProgressBar API ↗value- Completed files divided by the total.
semanticLabel- Names the task the bar measures.
height- Sets the height of the progress track.
Shared behaviour
- Keyboard and focus. Tab to Complete next file and activate it repeatedly. The progress display itself does not need to be operated.
- Screen readers. Read the completed file count after each activation. Compare it with the value exposed by the indicator.
- Direction and type. Try RTL to inspect the fill direction and larger type to see the count above the control.