103 lines
3.2 KiB
Dart
103 lines
3.2 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:permainan_kata_anak_sd/study_page.dart';
|
|
import 'package:permainan_kata_anak_sd/play_page.dart';
|
|
import 'utils/audio_manager.dart';
|
|
|
|
class StartPage extends StatelessWidget {
|
|
final Function(String) onKingdomSelected;
|
|
|
|
const StartPage({
|
|
required this.onKingdomSelected,
|
|
Key? key,
|
|
}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
body: Container(
|
|
decoration: const BoxDecoration(
|
|
image: DecorationImage(
|
|
image: AssetImage('assets/images/background.jpg'),
|
|
fit: BoxFit.cover, // Menutupi seluruh layar
|
|
),
|
|
),
|
|
child: Stack(
|
|
children: [
|
|
// Konten Utama
|
|
Center(
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
GestureDetector(
|
|
onTap: () {
|
|
AudioManager.playClickSound();
|
|
Navigator.push(
|
|
context,
|
|
MaterialPageRoute(
|
|
builder: (context) =>
|
|
StudyPage(onKingdomSelected: onKingdomSelected),
|
|
),
|
|
);
|
|
},
|
|
child: Container(
|
|
width: 200,
|
|
height: 200,
|
|
decoration: BoxDecoration(
|
|
image: const DecorationImage(
|
|
image: AssetImage('assets/icons/learning.png'),
|
|
fit: BoxFit.contain,
|
|
),
|
|
borderRadius: BorderRadius.circular(10),
|
|
),
|
|
),
|
|
),
|
|
const SizedBox(height: 40),
|
|
GestureDetector(
|
|
onTap: () {
|
|
AudioManager.playClickSound();
|
|
Navigator.push(
|
|
context,
|
|
MaterialPageRoute(
|
|
builder: (context) =>
|
|
PlayPage(onKingdomSelected: onKingdomSelected),
|
|
),
|
|
);
|
|
},
|
|
child: Container(
|
|
width: 200,
|
|
height: 200,
|
|
decoration: BoxDecoration(
|
|
image: const DecorationImage(
|
|
image: AssetImage('assets/icons/playing.png'),
|
|
fit: BoxFit.contain,
|
|
),
|
|
borderRadius: BorderRadius.circular(10),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
|
|
Positioned(
|
|
top: 10,
|
|
right: 10,
|
|
child: IconButton(
|
|
icon: Image.asset(
|
|
'assets/icons/exit.png',
|
|
width: 40,
|
|
height: 40,
|
|
),
|
|
onPressed: () {
|
|
AudioManager.playClickSound();
|
|
Navigator.pop(context);
|
|
},
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|