PMU_PIbd32_Kamcharova_K.A/lib/pages/character_detail_page.dart

61 lines
1.8 KiB
Dart
Raw Normal View History

2024-12-03 16:42:54 +04:00
import 'package:flutter/material.dart';
2024-12-21 20:38:35 +04:00
import 'package:identity/data/dtos/character_dto.dart';
import '../domain/models/character.dart';
import '../components/locale/l10n/app_locale.dart';
2024-12-03 16:42:54 +04:00
class CharacterDetailPage extends StatelessWidget {
2024-12-21 20:38:35 +04:00
final CharacterDto characterDTO;
2024-12-03 16:42:54 +04:00
2024-12-10 13:41:28 +04:00
const CharacterDetailPage({Key? key, required this.characterDTO}) : super(key: key);
2024-12-03 16:42:54 +04:00
@override
Widget build(BuildContext context) {
final appLocale = AppLocale.of(context);
final characterTitle = appLocale?.characterTitle(characterDTO.name) ?? characterDTO.name;
2024-12-03 16:42:54 +04:00
return Scaffold(
appBar: AppBar(
title: Text(characterTitle),
2024-12-03 16:42:54 +04:00
),
body: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Center(
child: Image.network(
2024-12-10 13:41:28 +04:00
characterDTO.imageUrl,
2024-12-03 16:42:54 +04:00
height: 200,
width: 200,
fit: BoxFit.cover,
),
),
const SizedBox(height: 20),
2024-12-03 16:42:54 +04:00
Text(
2024-12-10 13:41:28 +04:00
characterDTO.name,
style: const TextStyle(fontSize: 24, fontWeight: FontWeight.bold),
2024-12-03 16:42:54 +04:00
),
const SizedBox(height: 10),
2024-12-03 16:42:54 +04:00
Text(
2024-12-10 13:41:28 +04:00
characterDTO.typeString,
2024-12-03 16:42:54 +04:00
style: TextStyle(fontSize: 18, color: Colors.grey[600]),
),
const SizedBox(height: 20),
2024-12-03 16:42:54 +04:00
Text(
appLocale?.likeButton?.toString() ?? 'Like',
style: const TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
2024-12-03 16:42:54 +04:00
),
const SizedBox(height: 10),
2024-12-03 16:42:54 +04:00
Text(
2024-12-10 13:41:28 +04:00
characterDTO.backstory,
style: const TextStyle(fontSize: 14),
2024-12-03 16:42:54 +04:00
maxLines: null,
softWrap: true,
),
],
),
),
);
}
}