78 lines
2.5 KiB
Dart
78 lines
2.5 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:pmu/domain/models/card.dart';
|
|
import 'package:url_launcher/url_launcher.dart';
|
|
import 'package:pmu/components/extensions/context_x.dart';
|
|
|
|
|
|
class DetailsPage extends StatelessWidget {
|
|
final CardData data;
|
|
|
|
const DetailsPage(this.data, {super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
backgroundColor: Colors.lightBlue, foregroundColor: Colors.white),
|
|
body: SingleChildScrollView(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Padding(
|
|
padding: const EdgeInsets.only(
|
|
bottom: 4.0, top: 8.0, left: 8.0, right: 8.0),
|
|
child: Text(
|
|
data.text,
|
|
style: const TextStyle(
|
|
color: Colors.black,
|
|
fontWeight: FontWeight.w500,
|
|
fontSize: 26),
|
|
),
|
|
),
|
|
Padding(
|
|
padding: const EdgeInsets.only(
|
|
bottom: 16.0, top: 8.0, left: 8.0, right: 8.0),
|
|
child: SizedBox(
|
|
width: double.infinity,
|
|
child: ClipRRect(
|
|
borderRadius: BorderRadius.circular(10.0),
|
|
child: Image.network(
|
|
data.imageUrl ?? '',
|
|
fit: BoxFit.cover,
|
|
)),
|
|
)),
|
|
Padding(
|
|
padding: const EdgeInsets.only(
|
|
bottom: 4.0, top: 8.0, left: 8.0, right: 8.0),
|
|
child: Text(
|
|
data.descText,
|
|
style: Theme.of(context).textTheme.bodyMedium,
|
|
),
|
|
),
|
|
Padding(
|
|
padding: const EdgeInsets.only(
|
|
bottom: 4.0, top: 8.0, left: 8.0, right: 8.0),
|
|
child: Text(
|
|
data.date,
|
|
style: const TextStyle(
|
|
color: Colors.black,
|
|
fontWeight: FontWeight.w500,
|
|
fontSize: 16),
|
|
),
|
|
),
|
|
Padding(
|
|
padding: const EdgeInsets.only(
|
|
bottom: 4.0, top: 8.0, left: 0.0, right: 8.0),
|
|
child: TextButton(
|
|
onPressed: () => launchUrl(Uri.parse(data.id ??
|
|
'https://newsapi.org/docs/endpoints/everything')),
|
|
child: Text('${context.locale.goToLink}'),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|