spotube/lib/components/root/update_dialog.dart
Kingkor Roy Tirtho a77b6776e8
refactor: Dart based Github Workflow CLI (#1490)
* feat: add build dart script for windows

* feat: add android build support

* feat: add linux build support

* feat: add macos build support

* feat: add ios build support

* feat: add deps install command and workflow file

* cd: what?

* cd: what?

* cd: what?

* cd: update workflow inputs

* cd: replace release binary

* cd: run flutter pub get

* cd: use dpkg zstd instead of xz, windows disable innoInstall, fix channel enum.name and reset pubspec after changing build no for nightly

* cd: fix tar copy path

* cd: fix copy linux command

* cd: fix windows inno depend and fix android aab path

* cd: idk

* cd: linux why???

* cd: windows choco copy failed

* cd: use dart tar archive for creating tar file

* cd: fix linux file copy error

* cd: use tar command directly

* feat: add linux_arm platform

* cd: add linux_arm platform

* cd: don't know what?

* feat: notification about nightly channel update

* chore: fix some errors parsing nightly version info
2024-05-09 15:26:58 +06:00

57 lines
1.8 KiB
Dart

import 'package:flutter/material.dart';
import 'package:spotube/components/shared/links/anchor_button.dart';
import 'package:url_launcher/url_launcher_string.dart';
import 'package:version/version.dart';
class RootAppUpdateDialog extends StatelessWidget {
final Version? version;
final int? nightlyBuildNum;
const RootAppUpdateDialog({super.key, this.version}) : nightlyBuildNum = null;
const RootAppUpdateDialog.nightly({super.key, required this.nightlyBuildNum})
: version = null;
@override
Widget build(BuildContext context) {
const url = "https://spotube.krtirtho.dev/downloads";
const nightlyUrl = "https://spotube.krtirtho.dev/downloads/nightly";
return AlertDialog(
title: const Text("Spotube has an update"),
actions: [
FilledButton(
child: const Text("Download Now"),
onPressed: () => launchUrlString(
nightlyBuildNum != null ? nightlyUrl : url,
mode: LaunchMode.externalApplication,
),
),
],
content: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text(
nightlyBuildNum != null
? "Spotube Nightly $nightlyBuildNum has been released"
: "Spotube v$version has been released",
),
if (nightlyBuildNum == null)
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Text("Read the latest "),
AnchorButton(
"release notes",
style: const TextStyle(color: Colors.blue),
onTap: () => launchUrlString(
url,
mode: LaunchMode.externalApplication,
),
),
],
),
],
),
);
}
}