Files
2026-05-12 12:02:40 +03:00

67 lines
1.7 KiB
Dart
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart'; // ✅ Добавлен
class LinkRow extends StatelessWidget {
final String icon;
final String title;
final VoidCallback onTap;
const LinkRow({
super.key,
required this.icon,
required this.title,
required this.onTap,
});
@override
Widget build(BuildContext context) {
return InkWell(
onTap: onTap,
borderRadius: BorderRadius.circular(12),
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 14),
child: Row(
children: [
Image.asset(
icon,
width: 24,
height: 24,
),
const SizedBox(width: 12),
Expanded(
child: Text(
title,
style: const TextStyle(
color: Colors.white,
fontSize: 16,
),
),
),
Row(
children: [
Icon(Icons.arrow_forward_ios_sharp, color: const Color(0x99FFFFFF), size: 12),
Icon(Icons.arrow_forward_ios_sharp, color: const Color(0x66FFFFFF), size: 12),
Icon(Icons.arrow_forward_ios_sharp, color: const Color(0x33FFFFFF), size: 12),
],
),
],
),
),
);
}
}
// ✅ Выносим метод открытия ссылки
void openLink(String url) async {
final Uri uri = Uri.parse(url);
try {
await launchUrl(
uri,
mode: LaunchMode.externalApplication,
);
} catch (e) {
// TODO: Показать ошибку пользователю
print('Не удалось открыть ссылку: $e');
}
}