PMU_PIbd32_Kamcharova_K.A/lib/pages/character_detail_page.dart

62 lines
1.9 KiB
Dart
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import 'package:flutter/material.dart';
import '../character.dart'; // Убедитесь, что путь правильный
class CharacterDetailPage extends StatelessWidget {
final Character character;
// Конструктор с обязательным параметром
const CharacterDetailPage({Key? key, required this.character}) : super(key: key);
@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,
),
],
),
),
);
}
}