floatingExtendedChipWithSilentDownload function
Widget
floatingExtendedChipWithSilentDownload({
- required BuildContext context,
- required String? latestVersion,
- required String appVersion,
- required UpdatStatus status,
- required void checkForUpdate(),
- required void openDialog(),
- required void startUpdate(),
- required Future<
void> launchInstaller(), - required void dismissUpdate(),
Implementation
Widget floatingExtendedChipWithSilentDownload({
required BuildContext context,
required String? latestVersion,
required String appVersion,
required UpdatStatus status,
required void Function() checkForUpdate,
required void Function() openDialog,
required void Function() startUpdate,
required Future<void> Function() launchInstaller,
required void Function() dismissUpdate,
}) {
if (UpdatStatus.available == status ||
UpdatStatus.availableWithChangelog == status) {
startUpdate();
}
if (UpdatStatus.readyToInstall == status) {
return Card(
child: Padding(
padding: const EdgeInsets.all(16),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"Update Ready",
style: Theme.of(context).textTheme.titleMedium,
),
const SizedBox(height: 8),
Text(
"Version ${latestVersion.toString()} is now ready to be installed!",
style: Theme.of(context).textTheme.bodyMedium,
),
const SizedBox(height: 8),
Text(
"You are currently running version $appVersion.",
style: Theme.of(context).textTheme.bodyMedium,
),
const SizedBox(height: 8),
Text(
"Update now to get the latest features and fixes.",
style: Theme.of(context).textTheme.bodyMedium,
),
const SizedBox(height: 15),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
mainAxisSize: MainAxisSize.min,
children: [
TextButton(
onPressed: dismissUpdate,
child: const Text('Later'),
),
const SizedBox(width: 10),
ElevatedButton.icon(
onPressed: startUpdate,
icon: const Icon(Icons.install_desktop_rounded),
label: const Text('Install Now'),
),
],
),
],
),
),
);
}
return Container();
}