import 'package:flutter/material.dart'; import 'utils/audio_manager.dart'; class CurriculumHinduBuddhaPage extends StatefulWidget { @override _CurriculumHinduBuddhaPageState createState() => _CurriculumHinduBuddhaPageState(); } class _CurriculumHinduBuddhaPageState extends State { int _currentImageIndex = 0; late final PageController _pageController = PageController(initialPage: _currentImageIndex); final List _images = [ 'assets/materi_kerajaan_hindubuddha/materi_kalingga.png', 'assets/materi_kerajaan_hindubuddha/materi_kutai.png', 'assets/materi_kerajaan_hindubuddha/materi_mataram.png', 'assets/materi_kerajaan_hindubuddha/materi_majapahit.png', 'assets/materi_kerajaan_hindubuddha/materi_sriwijaya.png', 'assets/materi_kerajaan_hindubuddha/materi_kediri.png', 'assets/materi_kerajaan_hindubuddha/materi_singasari.png', 'assets/materi_kerajaan_hindubuddha/materi_tarumanegara.png', ]; @override void initState() { super.initState(); } @override void dispose() { _pageController.dispose(); super.dispose(); } @override Widget build(BuildContext context) { return Scaffold( body: Container( decoration: const BoxDecoration( image: DecorationImage( image: AssetImage('assets/images/background_materi.png'), fit: BoxFit.cover, // Menutupi seluruh layar ), ), child: Stack( children: [ // Konten petunjuk di tengah halaman Align( alignment: const Alignment(0.0, -0.3), child: SizedBox( width: 310, height: 650, child: PageView.builder( controller: _pageController, itemCount: _images.length, onPageChanged: (index) { setState(() { _currentImageIndex = index; }); AudioManager.playClickSound(); }, itemBuilder: (context, index) { return Container( decoration: BoxDecoration( image: DecorationImage( image: AssetImage(_images[index]), fit: BoxFit.fill, ), ), padding: const EdgeInsets.symmetric( horizontal: 60, vertical: 10, ), ); }, ), ), ), // Tombol back di pojok kanan atas untuk kembali ke halaman sebelumnya Positioned( top: 10, right: 10, child: IconButton( icon: Image.asset( 'assets/icons/exit.png', width: 40, height: 40, ), onPressed: () { AudioManager.playClickSound(); Navigator.pop(context); }, ), ), ], ), ), ); } }