PIbd-31_MasenkinMS_PMU/lib/view/details_page/details_page.dart

79 lines
2.3 KiB
Dart
Raw Normal View History

2024-09-30 02:09:26 +04:00
import 'package:flutter/material.dart';
import 'package:pmu_labworks/domain/models/comment.dart';
class DetailsPage extends StatelessWidget {
final CommentModel model;
const DetailsPage(this.model, {super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('${model.user.nickname}\'s comment'),
),
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(
padding: const EdgeInsets.symmetric(
vertical: 4.0, horizontal: 8.0),
color: Colors.black.withOpacity(0.6),
child: Text(
model.user.nickname,
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,
),
),
],
),
),
);
}
}