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