2026-01-15 12:28:40 +03:00
|
|
|
|
import 'package:flutter/foundation.dart';
|
|
|
|
|
|
import 'package:flutter/material.dart';
|
2026-01-17 13:09:20 +03:00
|
|
|
|
import 'package:umbrix/core/localization/translations.dart';
|
|
|
|
|
|
import 'package:umbrix/gen/assets.gen.dart';
|
2026-01-15 12:28:40 +03:00
|
|
|
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
|
|
|
|
|
|
|
|
|
|
|
class LicensesScreen extends HookConsumerWidget {
|
|
|
|
|
|
const LicensesScreen({super.key});
|
|
|
|
|
|
|
|
|
|
|
|
static Future<String> _loadAllLicenses() async {
|
|
|
|
|
|
final licenses = await LicenseRegistry.licenses.toList();
|
|
|
|
|
|
final buffer = StringBuffer();
|
|
|
|
|
|
|
|
|
|
|
|
for (final license in licenses) {
|
|
|
|
|
|
for (final package in license.packages) {
|
|
|
|
|
|
buffer.writeln(package);
|
|
|
|
|
|
}
|
|
|
|
|
|
buffer.writeln();
|
|
|
|
|
|
|
|
|
|
|
|
final paragraphs = license.paragraphs.toList();
|
|
|
|
|
|
for (final paragraph in paragraphs) {
|
|
|
|
|
|
buffer.writeln(paragraph.text);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
buffer.writeln();
|
|
|
|
|
|
buffer.writeln('=' * 80);
|
|
|
|
|
|
buffer.writeln();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return buffer.toString();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
|
Widget build(BuildContext context, WidgetRef ref) {
|
|
|
|
|
|
final t = ref.watch(translationsProvider);
|
|
|
|
|
|
return Scaffold(
|
|
|
|
|
|
appBar: AppBar(
|
|
|
|
|
|
title: Text(t.about.licenses),
|
|
|
|
|
|
),
|
|
|
|
|
|
body: Column(
|
|
|
|
|
|
children: [
|
|
|
|
|
|
// Заголовок с логотипом
|
|
|
|
|
|
Container(
|
|
|
|
|
|
padding: const EdgeInsets.all(24),
|
|
|
|
|
|
child: Column(
|
|
|
|
|
|
children: [
|
|
|
|
|
|
Assets.images.umbrixLogo.image(
|
|
|
|
|
|
width: 64,
|
|
|
|
|
|
height: 64,
|
|
|
|
|
|
fit: BoxFit.contain,
|
|
|
|
|
|
),
|
|
|
|
|
|
const SizedBox(height: 12),
|
|
|
|
|
|
const Text(
|
|
|
|
|
|
'0.1.0',
|
|
|
|
|
|
style: TextStyle(fontSize: 16),
|
|
|
|
|
|
),
|
|
|
|
|
|
],
|
|
|
|
|
|
),
|
|
|
|
|
|
),
|
|
|
|
|
|
const Divider(height: 1),
|
|
|
|
|
|
// Весь текст лицензий
|
|
|
|
|
|
Expanded(
|
|
|
|
|
|
child: FutureBuilder<String>(
|
|
|
|
|
|
future: _loadAllLicenses(),
|
|
|
|
|
|
builder: (context, snapshot) {
|
|
|
|
|
|
if (snapshot.connectionState == ConnectionState.waiting) {
|
|
|
|
|
|
return const Center(child: CircularProgressIndicator());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (snapshot.hasError) {
|
|
|
|
|
|
return Center(child: Text('Ошибка: ${snapshot.error}'));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return SingleChildScrollView(
|
|
|
|
|
|
padding: const EdgeInsets.all(16),
|
|
|
|
|
|
child: SelectableText(
|
|
|
|
|
|
snapshot.data ?? '',
|
|
|
|
|
|
style: const TextStyle(
|
|
|
|
|
|
fontSize: 5.5,
|
|
|
|
|
|
fontFamily: 'monospace',
|
|
|
|
|
|
height: 1.4,
|
|
|
|
|
|
),
|
|
|
|
|
|
),
|
|
|
|
|
|
);
|
|
|
|
|
|
},
|
|
|
|
|
|
),
|
|
|
|
|
|
),
|
|
|
|
|
|
],
|
|
|
|
|
|
),
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|