93 lines
2.4 KiB
Dart
93 lines
2.4 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:freekake/components/characcter_info.dart';
|
|
|
|
class CharacterView extends StatefulWidget {
|
|
final String title;
|
|
final String imagePath;
|
|
final String content;
|
|
// caracter info
|
|
final String charName;
|
|
final String charOrigin;
|
|
final String charSex;
|
|
|
|
const CharacterView({
|
|
super.key,
|
|
required this.title,
|
|
required this.imagePath,
|
|
required this.content,
|
|
required this.charName,
|
|
required this.charSex,
|
|
required this.charOrigin,
|
|
});
|
|
|
|
@override
|
|
_CharacterViewState createState() => _CharacterViewState();
|
|
}
|
|
|
|
class _CharacterViewState extends State<CharacterView> {
|
|
late String _content;
|
|
late String _charName;
|
|
late String _charOrigin;
|
|
late String _charSex;
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
_content = widget.content;
|
|
_charName = widget.charName;
|
|
_charSex = widget.charSex;
|
|
_charOrigin = widget.charOrigin;
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final screenHeight = MediaQuery.of(context).size.height;
|
|
|
|
return Scaffold(
|
|
backgroundColor: Colors.white,
|
|
appBar: AppBar(
|
|
title: Text(widget.title),
|
|
backgroundColor: const Color.fromARGB(255, 79, 76, 182),
|
|
),
|
|
body: Column(
|
|
children: [
|
|
// Gambar 1/3 dari tinggi layar
|
|
SizedBox(
|
|
height: 20,
|
|
child: Container(
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.only(
|
|
bottomLeft: Radius.circular(40),
|
|
bottomRight: Radius.circular(40),
|
|
),
|
|
color: Color.fromARGB(255, 79, 76, 182),
|
|
),
|
|
),
|
|
),
|
|
SizedBox(height: 10),
|
|
Padding(
|
|
padding: const EdgeInsets.all(8.0),
|
|
child: SizedBox(
|
|
height: screenHeight / 2,
|
|
width: double.infinity,
|
|
child: Image.asset(widget.imagePath, fit: BoxFit.fitHeight),
|
|
),
|
|
),
|
|
// Konten text scrollable
|
|
Expanded(
|
|
child: SingleChildScrollView(
|
|
padding: const EdgeInsets.all(18.0),
|
|
child: CharacterInfo(
|
|
nama: _charName,
|
|
kelamin: _charSex,
|
|
asal: _charOrigin,
|
|
content: _content,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|