added release notes dialog to settings

This commit is contained in:
Vadim 2024-05-22 22:25:35 +02:00
parent 2b600b2b2d
commit 845fa4e79c

View file

@ -1,5 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:lightmeter/generated/l10n.dart'; import 'package:lightmeter/generated/l10n.dart';
import 'package:lightmeter/screens/shared/release_notes_dialog/widget_dialog_release_notes.dart';
import 'package:package_info_plus/package_info_plus.dart'; import 'package:package_info_plus/package_info_plus.dart';
class VersionListTile extends StatelessWidget { class VersionListTile extends StatelessWidget {
@ -7,12 +8,18 @@ class VersionListTile extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return ListTile( return FutureBuilder<PackageInfo>(
leading: const Icon(Icons.info_outline), future: PackageInfo.fromPlatform(),
title: Text(S.of(context).version), builder: (context, snapshot) => ListTile(
trailing: FutureBuilder<PackageInfo>( leading: const Icon(Icons.info_outline),
future: PackageInfo.fromPlatform(), title: Text(S.of(context).version),
builder: (context, snapshot) => snapshot.data != null onTap: snapshot.data != null
? () => showDialog(
context: context,
builder: (_) => ReleaseNotesDialog(version: snapshot.data!.version),
)
: null,
trailing: snapshot.data != null
? Text(S.of(context).versionNumber(snapshot.data!.version, snapshot.data!.buildNumber)) ? Text(S.of(context).versionNumber(snapshot.data!.version, snapshot.data!.buildNumber))
: const SizedBox.shrink(), : const SizedBox.shrink(),
), ),