dispaly gecko version in about dialog

This commit is contained in:
Fabian Freund
2025-09-22 13:54:13 +02:00
parent 4661386024
commit 8e5e858c9a
10 changed files with 117 additions and 31 deletions
@@ -22,7 +22,7 @@ import 'dart:async';
import 'package:exceptions/exceptions.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart';
import 'package:weblibre/core/providers/format.dart';
import 'package:weblibre/features/about/data/repositories/package_info_repository.dart';
import 'package:weblibre/features/about/domain/providers.dart';
import 'package:weblibre/features/bangs/data/models/bang_group.dart';
import 'package:weblibre/features/bangs/domain/repositories/sync.dart';
@@ -1,28 +0,0 @@
/*
* Copyright (c) 2024-2025 Fabian Freund.
*
* This file is part of WebLibre
* (see https://weblibre.eu).
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import 'package:package_info_plus/package_info_plus.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart';
part 'package_info_repository.g.dart';
@Riverpod(keepAlive: true)
Future<PackageInfo> packageInfo(Ref ref) {
return PackageInfo.fromPlatform();
}
@@ -0,0 +1,15 @@
import 'package:flutter_mozilla_components/flutter_mozilla_components.dart';
import 'package:package_info_plus/package_info_plus.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart';
part 'providers.g.dart';
@Riverpod(keepAlive: true)
Future<PackageInfo> packageInfo(Ref ref) {
return PackageInfo.fromPlatform();
}
@Riverpod()
Future<String> geckoVersion(Ref ref) {
return GeckoBrowserService().getGeckoVersion();
}
@@ -1,6 +1,6 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'package_info_repository.dart';
part of 'providers.dart';
// **************************************************************************
// RiverpodGenerator
@@ -47,3 +47,36 @@ final class PackageInfoProvider
}
String _$packageInfoHash() => r'cc57db7b4684ab0d5df0f050b8ea045a3658e89a';
@ProviderFor(geckoVersion)
const geckoVersionProvider = GeckoVersionProvider._();
final class GeckoVersionProvider
extends $FunctionalProvider<AsyncValue<String>, String, FutureOr<String>>
with $FutureModifier<String>, $FutureProvider<String> {
const GeckoVersionProvider._()
: super(
from: null,
argument: null,
retry: null,
name: r'geckoVersionProvider',
isAutoDispose: true,
dependencies: null,
$allTransitiveDependencies: null,
);
@override
String debugGetCreateSourceHash() => _$geckoVersionHash();
@$internal
@override
$FutureProviderElement<String> $createElement($ProviderPointer pointer) =>
$FutureProviderElement(pointer);
@override
FutureOr<String> create(Ref ref) {
return geckoVersion(ref);
}
}
String _$geckoVersionHash() => r'3a8639b5d1d07c60a789cf705ede09a91cbaee63';
@@ -20,7 +20,7 @@
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:weblibre/features/about/data/repositories/package_info_repository.dart';
import 'package:weblibre/features/about/domain/providers.dart';
class AboutDialogScreen extends HookConsumerWidget {
const AboutDialogScreen();
@@ -42,6 +42,18 @@ class AboutDialogScreen extends HookConsumerWidget {
applicationName: packageInfo.appName,
applicationVersion: packageInfo.version,
applicationLegalese: 'Copyright © Fabian Freund, 2025',
children: [
Padding(
padding: const EdgeInsets.only(top: 32.0),
child: Consumer(
builder: (context, ref, child) {
final geckoVersion = ref.watch(geckoVersionProvider);
return Text('Gecko Version: ${geckoVersion.value}');
},
),
),
],
);
}
}