License rész javítás

This commit is contained in:
2025-10-13 16:36:49 +02:00
committed by 4831c0
parent 41ff65d50b
commit f01b9d4fd5

View File

@@ -324,74 +324,90 @@ class _SettingsScreenState extends FirkaState<SettingsScreen> {
continue;
}
if (item is ShowLicensePage) {
widgets.add(FutureBuilder<List<LicenseEntry>>(
future: LicenseRegistry.licenses.toList(),
builder: (BuildContext context,
AsyncSnapshot<List<LicenseEntry>> snapshot) {
if (!snapshot.hasData) {
return Center(
child:
CircularProgressIndicator(color: appStyle.colors.accent));
}
final licenses = snapshot.data!;
final shownPackages = <String>{};
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();
},
widgets.add(
FutureBuilder<List<LicenseEntry>>(
future: LicenseRegistry.licenses.toList(),
builder: (BuildContext context,
AsyncSnapshot<List<LicenseEntry>> snapshot) {
if (!snapshot.hasData) {
return Center(
child: CircularProgressIndicator(
color: appStyle.colors.accent));
}
final licenses = snapshot.data!;
final shownPackages = <String>{};
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: licenses
.where((license) => 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(
backgroundColor: appStyle.colors.card,
title: Text(
packageName,
style: const TextStyle(
fontWeight: FontWeight.bold),
),
],
);
},
);
},
child: FirkaCard(left: [
Text(
packageName,
style: appStyle.fonts.B_14R
.apply(color: appStyle.colors.textPrimary),
),
]),
)
],
),
);
}).toList(),
);
},
));
content: SingleChildScrollView(
child: Text(
paragraphs,
style: appStyle.fonts.B_15SB.apply(
color: appStyle.colors.textPrimary),
),
),
actions: [
TextButton(
child: Text(
widget.data.l10n.close,
style: appStyle.fonts.B_14R.apply(
color:
appStyle.colors.textSecondary),
),
onPressed: () {
Navigator.of(context).pop();
},
),
],
);
},
);
},
child: FirkaCard(left: [
Text(
packageName,
style: appStyle.fonts.B_14R
.apply(color: appStyle.colors.textPrimary),
),
]),
),
],
),
);
}).toList(),
);
},
),
);
continue;
}