2024-12-03 16:42:54 +04:00
|
|
|
|
import 'package:flutter/material.dart';
|
2024-12-10 13:06:37 +04:00
|
|
|
|
import '../models/character.dart'; // Убедитесь, что путь правильный
|
2024-12-03 16:42:54 +04:00
|
|
|
|
|
|
|
|
|
class CharacterDetailPage extends StatelessWidget {
|
|
|
|
|
final Character character;
|
|
|
|
|
|
2024-12-10 13:04:11 +04:00
|
|
|
|
// Конструктор с обязательным параметром
|
|
|
|
|
const CharacterDetailPage({Key? key, required this.character}) : super(key: key);
|
2024-12-03 16:42:54 +04:00
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
return Scaffold(
|
|
|
|
|
appBar: AppBar(
|
|
|
|
|
title: Text(character.name),
|
|
|
|
|
),
|
|
|
|
|
body: Padding(
|
|
|
|
|
padding: const EdgeInsets.all(16.0),
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
// Изображение персонажа
|
|
|
|
|
Center(
|
|
|
|
|
child: Image.network(
|
|
|
|
|
character.imageUrl,
|
|
|
|
|
height: 200,
|
|
|
|
|
width: 200,
|
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: 20),
|
|
|
|
|
|
|
|
|
|
Text(
|
|
|
|
|
character.name, // Имя персонажа
|
|
|
|
|
style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: 10),
|
|
|
|
|
Text(
|
|
|
|
|
character.typeString, // Тип персонажа (Survivor или Hunter)
|
|
|
|
|
style: TextStyle(fontSize: 18, color: Colors.grey[600]),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: 20),
|
|
|
|
|
|
|
|
|
|
// Предыстория персонажа
|
|
|
|
|
Text(
|
|
|
|
|
'Полное описание:',
|
|
|
|
|
style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: 10),
|
|
|
|
|
// Текст предыстории
|
|
|
|
|
Text(
|
|
|
|
|
character.backstory,
|
|
|
|
|
style: TextStyle(fontSize: 14),
|
|
|
|
|
maxLines: null,
|
|
|
|
|
softWrap: true,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|