2024-09-30 02:09:26 +04:00
|
|
|
import 'package:flutter/material.dart';
|
2024-10-02 02:39:17 +04:00
|
|
|
import 'package:pmu_labworks/components/extensions/context_x.dart';
|
2024-09-30 02:09:26 +04:00
|
|
|
import 'package:pmu_labworks/domain/models/comment.dart';
|
|
|
|
|
|
|
|
class DetailsPage extends StatelessWidget {
|
2024-09-30 22:15:55 +04:00
|
|
|
final CommentData model;
|
2024-09-30 02:09:26 +04:00
|
|
|
|
|
|
|
const DetailsPage(this.model, {super.key});
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Scaffold(
|
|
|
|
appBar: AppBar(
|
2024-09-30 18:24:51 +04:00
|
|
|
title: Text(
|
2024-10-02 02:39:17 +04:00
|
|
|
context.locale.comment(model.user.nickname),
|
2024-09-30 18:24:51 +04:00
|
|
|
),
|
2024-09-30 02:09:26 +04:00
|
|
|
),
|
|
|
|
body: Padding(
|
|
|
|
padding: const EdgeInsets.all(16.0),
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Stack(
|
|
|
|
children: [
|
|
|
|
ClipRRect(
|
|
|
|
borderRadius: BorderRadius.circular(8.0),
|
|
|
|
child: model.user.avatarUrl != null
|
|
|
|
? Image.network(
|
|
|
|
model.user.avatarUrl!,
|
|
|
|
height: 150,
|
|
|
|
width: 150,
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
)
|
|
|
|
: Container(
|
|
|
|
height: 150,
|
|
|
|
width: 150,
|
|
|
|
color: Colors.grey,
|
|
|
|
child: const Icon(Icons.person, size: 50),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Positioned(
|
|
|
|
left: 8,
|
|
|
|
bottom: 8,
|
|
|
|
child: Container(
|
2024-10-02 02:39:17 +04:00
|
|
|
padding: const EdgeInsets.symmetric(vertical: 4.0, horizontal: 8.0),
|
2024-09-30 02:09:26 +04:00
|
|
|
color: Colors.black.withOpacity(0.6),
|
|
|
|
child: Text(
|
2024-09-30 18:24:51 +04:00
|
|
|
_shortenNickname(model.user.nickname, maxLength: 13),
|
2024-09-30 02:09:26 +04:00
|
|
|
style: const TextStyle(
|
|
|
|
color: Colors.white,
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
fontSize: 16,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
const SizedBox(height: 24),
|
|
|
|
Text(
|
|
|
|
model.title,
|
|
|
|
style: const TextStyle(
|
|
|
|
fontSize: 24,
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
const SizedBox(height: 16),
|
|
|
|
Text(
|
|
|
|
model.text,
|
|
|
|
style: const TextStyle(
|
|
|
|
fontSize: 16,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
2024-09-30 18:24:51 +04:00
|
|
|
|
|
|
|
String _shortenNickname(String nickname, {int maxLength = 15}) {
|
|
|
|
if (nickname.length > maxLength) {
|
|
|
|
return nickname.substring(0, maxLength) + '...';
|
|
|
|
}
|
|
|
|
return nickname;
|
|
|
|
}
|
2024-09-30 02:09:26 +04:00
|
|
|
}
|