PMU_PIbd32_Kamcharova_K.A/lib/pages/character_detail_page.dart

60 lines
1.8 KiB
Dart

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