Mobiles_programming/lib/presentation/details_page/details_page.dart
2024-10-29 18:39:40 +04:00

69 lines
2.3 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/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:mobiles_labs_5th_semester/domain/models/game.dart';
class DetailsPage extends StatelessWidget {
final GameData data;
const DetailsPage(this.data, {super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Color.fromARGB(255, 56, 90, 128),
//backgroundColor: Color.fromARGB(255, 46, 65, 80),
iconTheme: IconThemeData(color: Colors.white)
),
backgroundColor: Color.fromARGB(255, 46, 65, 80),
//backgroundColor: Color.fromARGB(255, 56, 90, 128),
body: Center(
//прокрутка по вертикали на случай, если описание длинное
child: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: [
SizedBox(
height: 220,
width: MediaQuery.of(context).size.width,
child: Image.network(
data.image ?? '',
fit: BoxFit.fill,
errorBuilder: (_, __, ___) => const Placeholder(),
),
),
Padding(
padding: const EdgeInsets.only(top: 12.0, bottom: 12.0),
child: Text(
data.name,
style: const TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 40,
),
textAlign: TextAlign.center,
),
),
Text(
data.description ?? 'У игры нет описания',
style: const TextStyle(
color: Colors.white,
fontSize: 24,
),
softWrap: true,
// textAlign: TextAlign.left
textAlign: TextAlign.justify
),
]
),
),
)
)
);
}
}