build method
Build the widget.
Implementation
@override
Widget build(final BuildContext context) {
final days = duration.inDays;
final hours = duration.inHours % 24;
final minutes = duration.inMinutes % 60;
final seconds = duration.inSeconds % 60;
final milliseconds = duration.inMilliseconds % 1000;
final parts = [
if (days > 0) '${days}D',
if (hours > 0) '${hours}H',
if (minutes > 0) '${minutes}M',
if (seconds > 0) '${seconds}S',
if (milliseconds > 0) '${milliseconds}MS',
];
return ListTile(
autofocus: autofocus,
title: Text(title),
subtitle: Text(parts.join(' ')),
onTap: () => context.pushWidgetBuilder(
(final builderContext) => EditDurationScreen(
duration: duration,
onChanged: onChanged,
title: screenTitle,
),
),
);
}