4차 수정

This commit is contained in:
2026-06-18 17:57:08 +09:00
parent 7325b47d81
commit f418338fa1

View File

@@ -12,10 +12,7 @@ class SmartGardenApp extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return MaterialApp( return MaterialApp(
title: 'Smart Garden', title: 'Smart Garden',
theme: ThemeData( theme: ThemeData(primarySwatch: Colors.green, useMaterial3: true),
primarySwatch: Colors.green,
useMaterial3: true,
),
home: const SmartGardenScreen(), home: const SmartGardenScreen(),
debugShowCheckedModeBanner: false, debugShowCheckedModeBanner: false,
); );
@@ -57,15 +54,18 @@ class _SmartGardenScreenState extends State<SmartGardenScreen> {
} }
void _initializeVideo() { void _initializeVideo() {
_videoController = VideoPlayerController.asset('assets/videos/basic_img.mp4') _videoController =
..initialize().then((_) { VideoPlayerController.asset('assets/videos/basic_img.mp4')
..initialize()
.then((_) {
_videoController.setLooping(true); _videoController.setLooping(true);
_videoController.setVolume(0.0); _videoController.setVolume(0.0);
_videoController.play(); _videoController.play();
setState(() { setState(() {
_isVideoInitialized = true; _isVideoInitialized = true;
}); });
}).catchError((error) { })
.catchError((error) {
print('비디오 로드 오류: $error'); print('비디오 로드 오류: $error');
}); });
} }
@@ -88,11 +88,7 @@ class _SmartGardenScreenState extends State<SmartGardenScreen> {
// 사용자 메시지 추가 // 사용자 메시지 추가
setState(() { setState(() {
_messages.add( _messages.add(
ChatMessage( ChatMessage(text: text, isUser: true, timestamp: DateTime.now()),
text: text,
isUser: true,
timestamp: DateTime.now(),
),
); );
}); });
@@ -148,6 +144,14 @@ class _SmartGardenScreenState extends State<SmartGardenScreen> {
fit: BoxFit.cover, fit: BoxFit.cover,
), ),
), ),
child: Center(
child: Container(
margin: const EdgeInsets.all(40),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16),
border: Border.all(color: Color(0xFFE0E0E0), width: 1),
),
child: Row( child: Row(
children: [ children: [
// 좌측 캐릭터 영역 (60%) // 좌측 캐릭터 영역 (60%)
@@ -175,7 +179,10 @@ class _SmartGardenScreenState extends State<SmartGardenScreen> {
borderRadius: BorderRadius.circular(12), borderRadius: BorderRadius.circular(12),
), ),
child: const Center( child: const Center(
child: Text('🌱', style: TextStyle(fontSize: 28)), child: Text(
'🌱',
style: TextStyle(fontSize: 28),
),
), ),
), ),
const SizedBox(width: 16), const SizedBox(width: 16),
@@ -227,7 +234,9 @@ class _SmartGardenScreenState extends State<SmartGardenScreen> {
height: 180, height: 180,
decoration: BoxDecoration( decoration: BoxDecoration(
color: Color(0xFFF1F8E9), color: Color(0xFFF1F8E9),
borderRadius: BorderRadius.circular(12), borderRadius: BorderRadius.circular(
12,
),
border: Border.all( border: Border.all(
color: Color(0xFFC8E6C9), color: Color(0xFFC8E6C9),
width: 1, width: 1,
@@ -260,7 +269,11 @@ class _SmartGardenScreenState extends State<SmartGardenScreen> {
const SizedBox(height: 40), const SizedBox(height: 40),
// 캐릭터 정보 + 설명 문구 // 캐릭터 정보 + 설명 문구
Padding( Padding(
padding: const EdgeInsets.only(left: 30, bottom: 30, right: 30), padding: const EdgeInsets.only(
left: 30,
bottom: 30,
right: 30,
),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
@@ -271,7 +284,8 @@ class _SmartGardenScreenState extends State<SmartGardenScreen> {
width: 48, width: 48,
height: 48, height: 48,
decoration: BoxDecoration( decoration: BoxDecoration(
color: Color(0xFFC8E6C9), // ← 연한 초록 배경 추가 color: Color(0xFFC8E6C9),
// ← 연한 초록 배경 추가
borderRadius: BorderRadius.circular(24), borderRadius: BorderRadius.circular(24),
), ),
child: ClipRRect( child: ClipRRect(
@@ -284,7 +298,8 @@ class _SmartGardenScreenState extends State<SmartGardenScreen> {
), ),
const SizedBox(width: 12), const SizedBox(width: 12),
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment:
CrossAxisAlignment.start,
children: [ children: [
const Text( const Text(
'푸미', '푸미',
@@ -414,7 +429,8 @@ class _SmartGardenScreenState extends State<SmartGardenScreen> {
child: Material( child: Material(
color: Colors.transparent, color: Colors.transparent,
child: InkWell( child: InkWell(
onTap: () => _sendQuickQuestion('현재 온도는?'), onTap: () =>
_sendQuickQuestion('현재 온도는?'),
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(8),
child: Padding( child: Padding(
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(
@@ -422,7 +438,8 @@ class _SmartGardenScreenState extends State<SmartGardenScreen> {
vertical: 12, vertical: 12,
), ),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment:
MainAxisAlignment.center,
children: [ children: [
const Text( const Text(
'🌡️', '🌡️',
@@ -459,7 +476,8 @@ class _SmartGardenScreenState extends State<SmartGardenScreen> {
child: Material( child: Material(
color: Colors.transparent, color: Colors.transparent,
child: InkWell( child: InkWell(
onTap: () => _sendQuickQuestion('현재 습도는?'), onTap: () =>
_sendQuickQuestion('현재 습도는?'),
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(8),
child: Padding( child: Padding(
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(
@@ -467,7 +485,8 @@ class _SmartGardenScreenState extends State<SmartGardenScreen> {
vertical: 12, vertical: 12,
), ),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment:
MainAxisAlignment.center,
children: [ children: [
const Text( const Text(
'💧', '💧',
@@ -512,7 +531,8 @@ class _SmartGardenScreenState extends State<SmartGardenScreen> {
vertical: 12, vertical: 12,
), ),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment:
MainAxisAlignment.center,
children: [ children: [
const Text( const Text(
'💦', '💦',
@@ -556,7 +576,9 @@ class _SmartGardenScreenState extends State<SmartGardenScreen> {
child: TextField( child: TextField(
controller: _textController, controller: _textController,
onSubmitted: (value) { onSubmitted: (value) {
_sendMessage(_textController.text); // 엔터로 전송 _sendMessage(
_textController.text,
); // 엔터로 전송
}, },
decoration: InputDecoration( decoration: InputDecoration(
hintText: '메시지를 입력하세요...', hintText: '메시지를 입력하세요...',
@@ -565,7 +587,8 @@ class _SmartGardenScreenState extends State<SmartGardenScreen> {
color: Color(0xFF9E9E9E), color: Color(0xFF9E9E9E),
), ),
border: InputBorder.none, border: InputBorder.none,
contentPadding: const EdgeInsets.symmetric( contentPadding:
const EdgeInsets.symmetric(
horizontal: 16, horizontal: 16,
vertical: 12, vertical: 12,
), ),
@@ -610,7 +633,10 @@ class _SmartGardenScreenState extends State<SmartGardenScreen> {
), ),
], ],
), ),
)); ),
),
),
);
} }
} }
@@ -624,8 +650,9 @@ class _ChatBubble extends StatelessWidget {
return Padding( return Padding(
padding: const EdgeInsets.only(bottom: 12), padding: const EdgeInsets.only(bottom: 12),
child: Row( child: Row(
mainAxisAlignment: mainAxisAlignment: message.isUser
message.isUser ? MainAxisAlignment.end : MainAxisAlignment.start, ? MainAxisAlignment.end
: MainAxisAlignment.start,
children: [ children: [
if (!message.isUser) ...[ if (!message.isUser) ...[
Container( Container(
@@ -647,10 +674,7 @@ class _ChatBubble extends StatelessWidget {
], ],
Flexible( Flexible(
child: Container( child: Container(
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10),
horizontal: 16,
vertical: 10,
),
decoration: BoxDecoration( decoration: BoxDecoration(
color: message.isUser color: message.isUser
? Color(0xFFE8F5E9) // ← 연한 녹색 ? Color(0xFFE8F5E9) // ← 연한 녹색
@@ -711,21 +735,12 @@ class _QuickButton extends StatelessWidget {
decoration: BoxDecoration( decoration: BoxDecoration(
color: bgColor, color: bgColor,
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(8),
border: Border.all( border: Border.all(color: textColor.withOpacity(0.2), width: 0.5),
color: textColor.withOpacity(0.2),
width: 0.5,
),
),
padding: const EdgeInsets.symmetric(
horizontal: 12,
vertical: 10,
), ),
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 10),
child: Column( child: Column(
children: [ children: [
Text( Text(emoji, style: const TextStyle(fontSize: 18)),
emoji,
style: const TextStyle(fontSize: 18),
),
const SizedBox(height: 4), const SizedBox(height: 4),
Text( Text(
title, title,