From f55cc65f0796992539a27ccef77d9e199e7026b8 Mon Sep 17 00:00:00 2001 From: balint1414 Date: Thu, 9 Oct 2025 20:57:55 +0200 Subject: [PATCH] =?UTF-8?q?License=20men=C3=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../screens/settings/settings_screen.dart | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/firka/lib/ui/phone/screens/settings/settings_screen.dart b/firka/lib/ui/phone/screens/settings/settings_screen.dart index 9c63b823..c9226b7f 100644 --- a/firka/lib/ui/phone/screens/settings/settings_screen.dart +++ b/firka/lib/ui/phone/screens/settings/settings_screen.dart @@ -11,6 +11,7 @@ import 'package:firka/main.dart'; import 'package:firka/ui/model/style.dart'; import 'package:firka/ui/phone/screens/login/login_screen.dart'; import 'package:firka/ui/widget/firka_icon.dart'; +import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:isar/isar.dart'; @@ -307,6 +308,70 @@ class _SettingsScreenState extends FirkaState { continue; } + if (item is ShowLicensePage) { + widgets.add( + FutureBuilder>( + future: LicenseRegistry.licenses.toList(), + builder: (BuildContext context, AsyncSnapshot> snapshot) { + if (!snapshot.hasData) { + return Center(child: CircularProgressIndicator()); + } + final licenses = snapshot.data!; + final shownPackages = {}; + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: licenses.where((license) { + return license.packages.any((pkg) => !shownPackages.contains(pkg)); + }).map((license) { + final packageName = license.packages.firstWhere( + (pkg) => !shownPackages.contains(pkg), + orElse: () => license.packages.first, + ); + shownPackages.add(packageName); + final paragraphs = license.paragraphs.map((p) => p.text).join('\n\n'); + return Padding( + padding: const EdgeInsets.symmetric(vertical: 8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + GestureDetector( + onTap: () { + showDialog( + context: context, + builder: (BuildContext context) { + return AlertDialog( + title: Text(packageName, style: TextStyle(fontWeight: FontWeight.bold)), + content: SingleChildScrollView( + child: Text(paragraphs), + ), + actions: [ + TextButton( + child: Text(widget.data.l10n.close), + onPressed: () { + Navigator.of(context).pop(); + }, + ), + ], + ); + }, + ); + }, + child: FirkaCard(left: [ + Text( + packageName, + style: TextStyle(color: Colors.black, fontWeight: FontWeight.bold), + ), + ]), + ) + ], + ), + );}).toList(), + ); + }, + ) + ); + continue; + } if (item is SettingsAppIconPreview) { widgets.add(Container(