import 'package:flutter/material.dart'; import 'package:poet/poet_screen.dart'; void main() { runApp(const MyApp()); } class MyApp extends StatelessWidget { const MyApp({super.key}); @override Widget build(BuildContext context) { // 앱의 시작 화면을 PoetStudyScreen으로 설정 return MaterialApp( home: PoetStudyScreen(), ); } } class PoetStudyScreen extends StatelessWidget { @override Widget build(BuildContext context) { return Scaffold( body: Stack( children: [ // Background Image Positioned.fill( child: Image.asset( 'assets/images/background.jpg', fit: BoxFit.cover, ), ), // Main content SafeArea( child: Padding( padding: const EdgeInsets.all(20.0), child: Column( children: [ Expanded( child: Center( child: GridView.builder( gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 3, crossAxisSpacing: 15, mainAxisSpacing: 15, ), itemCount: 9, shrinkWrap: true, physics: const NeverScrollableScrollPhysics(), itemBuilder: (context, index) { return _buildGridItem(context, index); }, ), ), ), ], ), ), ), ], ), ); } Widget _buildGridItem(BuildContext context, int index) { double screenWidth = MediaQuery.of(context).size.width; String imageName = 'swith${(index + 1).toString().padLeft(2, '0')}'; return GestureDetector( onTap: () { Navigator.push( context, MaterialPageRoute( builder: (context) => PoetScreen( selectedIndex: index, )), ); }, child: Container( decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(10), boxShadow: [ BoxShadow( color: Colors.black.withOpacity(0.1), spreadRadius: 1, blurRadius: 5, offset: const Offset(0, 3), ), ], ), child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Image.asset( 'assets/images/$imageName.png', width: screenWidth * 0.25, height: screenWidth * 0.25, fit: BoxFit.contain, ), ], ), ), ); } }