거의 최종본

This commit is contained in:
girinb
2025-09-14 00:34:18 +09:00
parent 82b536be4b
commit bf06420d91
42 changed files with 202 additions and 81 deletions

View File

@@ -2,9 +2,15 @@
class Assets {
Assets._();
static const String audio001 = 'assets/audio/001.wav';
static const String audio002 = 'assets/audio/002.wav';
static const String audio003 = 'assets/audio/003.wav';
static const String audio1 = 'assets/audio/1.mp3';
static const String audio2 = 'assets/audio/2.mp3';
static const String audio3 = 'assets/audio/3.mp3';
static const String audio4 = 'assets/audio/4.mp3';
static const String audio5 = 'assets/audio/5.mp3';
static const String audio6 = 'assets/audio/6.mp3';
static const String audio7 = 'assets/audio/7.mp3';
static const String audio8 = 'assets/audio/8.mp3';
static const String audio9 = 'assets/audio/9.mp3';
static const String goSubsetsButton01 = 'assets/images/go_subsets/Button_01.webp';
static const String goSubsetsButton02 = 'assets/images/go_subsets/Button_02.webp';
static const String goSubsetsButton03 = 'assets/images/go_subsets/Button_03.webp';
@@ -15,6 +21,7 @@ class Assets {
static const String goSubsetsButton08 = 'assets/images/go_subsets/Button_08.webp';
static const String goSubsetsButton09 = 'assets/images/go_subsets/Button_09.webp';
static const String imagesMainBack = 'assets/images/Main_Back.webp';
static const String imagesTitle = 'assets/images/title.webp';
static const String subsetsSub01 = 'assets/images/subsets/Sub_01.webp';
static const String subsetsSub02 = 'assets/images/subsets/Sub_02.webp';
static const String subsetsSub03 = 'assets/images/subsets/Sub_03.webp';
@@ -27,6 +34,7 @@ class Assets {
static const String uiUI5minus = 'assets/images/ui/UI_5minus.webp';
static const String uiUI5plus = 'assets/images/ui/UI_5plus.webp';
static const String uiUIBack = 'assets/images/ui/UI_Back.webp';
static const String uiUIPause = 'assets/images/ui/UI_Pause.webp';
static const String uiUIPlay = 'assets/images/ui/UI_Play.webp';
static const String uiUIReplay = 'assets/images/ui/UI_Replay.webp';

View File

@@ -1,8 +1,7 @@
import 'dart:io';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:poet/poet_screen.dart';
import 'package:poet_repository/poet_screen.dart';
void main() {
WidgetsFlutterBinding.ensureInitialized();
@@ -28,6 +27,10 @@ class PoetStudyScreen extends StatefulWidget {
class _PoetStudyScreenState extends State<PoetStudyScreen>
with WidgetsBindingObserver {
// Variables to control grid spacing
final double _crossAxisSpacing = 1.0;
final double _mainAxisSpacing = 1.0;
@override
void initState() {
super.initState();
@@ -36,7 +39,7 @@ class _PoetStudyScreenState extends State<PoetStudyScreen>
}
void _setSystemUIOverlayStyle() {
if (Platform.isAndroid) {
if (defaultTargetPlatform == TargetPlatform.android) {
SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersiveSticky);
}
}
@@ -45,7 +48,9 @@ class _PoetStudyScreenState extends State<PoetStudyScreen>
void dispose() {
WidgetsBinding.instance.removeObserver(this);
// When the main screen is disposed, restore the system UI
SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge);
if (defaultTargetPlatform == TargetPlatform.android) {
SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge);
}
super.dispose();
}
@@ -70,19 +75,21 @@ class _PoetStudyScreenState extends State<PoetStudyScreen>
),
// Main content
SafeArea(
child: Padding(
padding: const EdgeInsets.all(20.0),
child: Column(
children: [
Expanded(
child: Center(
Transform.translate(
offset: Offset(0.0, -40.0), // Move up by 40 pixels
child: Center(
child: Padding(
padding: const EdgeInsets.all(150.0),
child: Column(
mainAxisSize: MainAxisSize.min, // Use minimum space
children: [
Center(
child: GridView.builder(
gridDelegate:
const SliverGridDelegateWithFixedCrossAxisCount(
SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 3,
crossAxisSpacing: 15,
mainAxisSpacing: 15,
crossAxisSpacing: _crossAxisSpacing,
mainAxisSpacing: _mainAxisSpacing,
),
itemCount: 9,
shrinkWrap: true,
@@ -92,8 +99,20 @@ class _PoetStudyScreenState extends State<PoetStudyScreen>
},
),
),
),
],
SizedBox(height: 30), // Added space
Align(
alignment: Alignment.centerLeft,
child: Padding(
padding: const EdgeInsets.only(left: 5),
child: Image.asset(
'assets/images/title.webp',
width: 500, // Adjust as needed
height: 100, // Adjust as needed
),
),
),
],
),
),
),
),
@@ -119,8 +138,8 @@ class _PoetStudyScreenState extends State<PoetStudyScreen>
children: [
Image.asset(
'assets/images/go_subsets/Button_${(index + 1).toString().padLeft(2, '0')}.webp',
width: 325,
height: 325,
width: 260,
height: 260,
fit: BoxFit.contain,
),
],

View File

@@ -1,5 +1,4 @@
import 'dart:io';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:audioplayers/audioplayers.dart';
import 'package:flutter/services.dart';
@@ -30,7 +29,7 @@ class _PoetScreenState extends State<PoetScreen> with WidgetsBindingObserver {
_backgroundImage =
'assets/images/subsets/Sub_${(widget.selectedIndex + 1).toString().padLeft(2, '0')}.webp';
_source = AssetSource('audio/00${(widget.selectedIndex + 1).toString()}.wav');
_source = AssetSource('audio/${(widget.selectedIndex + 1).toString()}.mp3');
_audioPlayer.onPlayerStateChanged.listen((state) {
if (mounted) {
@@ -67,7 +66,7 @@ class _PoetScreenState extends State<PoetScreen> with WidgetsBindingObserver {
}
void _setSystemUIOverlayStyle() {
if (Platform.isAndroid) {
if (defaultTargetPlatform == TargetPlatform.android) {
SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersiveSticky);
}
}
@@ -82,6 +81,7 @@ class _PoetScreenState extends State<PoetScreen> with WidgetsBindingObserver {
Future<void> _setAudio() async {
try {
await _audioPlayer.setSource(_source);
_audioPlayer.play(_source);
} catch (e) {
// Handle error, e.g., show a snackbar
print("Error setting audio source: $e");
@@ -91,9 +91,9 @@ class _PoetScreenState extends State<PoetScreen> with WidgetsBindingObserver {
@override
void dispose() {
WidgetsBinding.instance.removeObserver(this);
if (Platform.isAndroid) {
SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge);
}
// if (defaultTargetPlatform == TargetPlatform.android) {
// SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge);
// }
_audioPlayer.dispose();
super.dispose();
}
@@ -121,21 +121,23 @@ class _PoetScreenState extends State<PoetScreen> with WidgetsBindingObserver {
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
// 상단 바 (뒤로가기, 제목, 새로고침)
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
_buildCircularImageButton('assets/images/ui/UI_Back.webp', () {
// 이 버튼을 누르면 이전 화면으로 돌아갑니다.
Navigator.pop(context);
}, size: 50, imageSize: 25),
_buildCircularImageButton('assets/images/ui/UI_Replay.webp', () {
// Refresh action here
}, size: 50, imageSize: 25),
],
Padding(
padding: const EdgeInsets.only(top: 50.0,left: 25),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
_buildCircularImageButton('assets/images/ui/UI_Back.webp', () {
// 이 버튼을 누르면 이전 화면으로 돌아갑니다.
Navigator.pop(context);
}, size: 90, imageSize: 90),
// _buildCircularImageButton('assets/images/ui/UI_Replay.webp', () {
// // Refresh action here
// }, size: 100, imageSize: 100),
],
),
),
// 하단 음악 제어
_buildMusicControls(),
],
),
@@ -177,15 +179,16 @@ class _PoetScreenState extends State<PoetScreen> with WidgetsBindingObserver {
final newPosition = _position - const Duration(seconds: 5);
_audioPlayer.seek(newPosition > Duration.zero ? newPosition : Duration.zero);
}),
const SizedBox(width: 16),
const SizedBox(width: 100),
_buildPlayPauseButton(),
const SizedBox(width: 16),
const SizedBox(width: 100),
_buildCircularImageButton('assets/images/ui/UI_5plus.webp', () {
final newPosition = _position + const Duration(seconds: 5);
_audioPlayer.seek(newPosition < _duration ? newPosition : _duration);
}),
],
),
],
);
}
@@ -204,37 +207,33 @@ class _PoetScreenState extends State<PoetScreen> with WidgetsBindingObserver {
}
},
child: Container(
width: 80,
height: 80,
decoration: BoxDecoration(
color: const Color(0xFFF07B41),
shape: BoxShape.circle,
border: Border.all(color: Colors.white, width: 2),
),
width: 150,
height: 150,
child: Center(
child: _isPlaying
? const Icon(Icons.pause, color: Colors.white, size: 50)
? Image.asset(
'assets/images/ui/UI_Pause.webp',
width: 191,
height: 190,
)
: Image.asset(
'assets/images/ui/UI_Play.webp',
width: 50,
height: 50,
width: 191,
height: 190,
),
),
),
);
}
Widget _buildCircularImageButton(String imagePath, VoidCallback onPressed, {double size = 80, double imageSize = 50}) {
Widget _buildCircularImageButton(String imagePath, VoidCallback onPressed, {double size = 100, double imageSize = 100}) {
return GestureDetector(
onTap: onPressed,
child: Container(
width: size,
height: size,
decoration: BoxDecoration(
color: const Color(0xFFF07B41),
shape: BoxShape.circle,
border: Border.all(color: Colors.white, width: 2),
),
child: Center(
child: Image.asset(
imagePath,
@@ -258,5 +257,5 @@ class _PoetScreenState extends State<PoetScreen> with WidgetsBindingObserver {
].join(':');
}
}
}