chore: Follow up update snackbar
This commit is contained in:
parent
448a111c48
commit
c447c2087f
1 changed files with 3 additions and 20 deletions
|
|
@ -11,7 +11,6 @@ abstract class UpdateNotifier {
|
||||||
static const String versionStoreKey = 'last_known_version';
|
static const String versionStoreKey = 'last_known_version';
|
||||||
|
|
||||||
static void showUpdateSnackBar(BuildContext context) async {
|
static void showUpdateSnackBar(BuildContext context) async {
|
||||||
final theme = Theme.of(context);
|
|
||||||
final scaffoldMessenger = ScaffoldMessenger.of(context);
|
final scaffoldMessenger = ScaffoldMessenger.of(context);
|
||||||
final currentVersion = await PlatformInfos.getVersion();
|
final currentVersion = await PlatformInfos.getVersion();
|
||||||
final store = await SharedPreferences.getInstance();
|
final store = await SharedPreferences.getInstance();
|
||||||
|
|
@ -19,27 +18,11 @@ abstract class UpdateNotifier {
|
||||||
|
|
||||||
if (currentVersion != storedVersion) {
|
if (currentVersion != storedVersion) {
|
||||||
if (storedVersion != null) {
|
if (storedVersion != null) {
|
||||||
ScaffoldFeatureController? controller;
|
scaffoldMessenger.showSnackBar(
|
||||||
controller = scaffoldMessenger.showSnackBar(
|
|
||||||
SnackBar(
|
SnackBar(
|
||||||
duration: const Duration(seconds: 30),
|
duration: const Duration(seconds: 30),
|
||||||
content: Row(
|
showCloseIcon: true,
|
||||||
children: [
|
content: Text(L10n.of(context).updateInstalled(currentVersion)),
|
||||||
IconButton(
|
|
||||||
icon: Icon(
|
|
||||||
Icons.close_outlined,
|
|
||||||
size: 20,
|
|
||||||
color: theme.colorScheme.onPrimary,
|
|
||||||
),
|
|
||||||
onPressed: () => controller?.close(),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
child: Text(
|
|
||||||
L10n.of(context).updateInstalled(currentVersion),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
action: SnackBarAction(
|
action: SnackBarAction(
|
||||||
label: L10n.of(context).changelog,
|
label: L10n.of(context).changelog,
|
||||||
onPressed: () => launchUrlString(AppConfig.changelogUrl),
|
onPressed: () => launchUrlString(AppConfig.changelogUrl),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue