diff --git a/README.md b/README.md index c9a4ccd..7827e17 100644 --- a/README.md +++ b/README.md @@ -1 +1,28 @@ -# pupmory \ No newline at end of file +

header

+ +

+  + +

+ +## ๐Ÿš€ Manual Deployment + +Fill out all **curly brackets** in `deploy.sh`. + +The following are required: +- `DB_URL`: Database endpoint +- `DB_USERNAME`: Database username +- `DB_PASSWORD`: Database password +- `MAIL_USERNAME`: Email SMTP username +- `MAIL_PASSWORD`: Email SMTP password +- `GPT_KEY`: OpenAI API key +- `AWS_REGION`: AWS region +- `S3_BUCKET`: AWS S3 bucket name +- `S3_ACCESS_KEY`: AWS S3 access key +- `S3_SECRET_KEY`: AWS S3 secret key +- `JWT_SECRET`: JWT secret key + +Make sure `docker` is installed in your system then execute: +``` +./deploy.sh +``` diff --git a/client/lib/check_user.dart b/client/lib/check_user.dart new file mode 100644 index 0000000..ea26f78 --- /dev/null +++ b/client/lib/check_user.dart @@ -0,0 +1,49 @@ +/// ์˜ฎ๊ธฐ๊ธฐ ๊ฐ€๋Šฅ +import 'package:flutter/material.dart'; +import 'dart:async'; +import 'package:flutter/cupertino.dart'; +//import 'package:client/memorial/watch_others.dart'; +import 'conversation/intro/intro.dart'; +import 'home.dart'; +import 'memorial/memorial_main.dart'; +import 'memorial/watch_others.dart'; +import 'mypage/mypage_main.dart'; +import 'main.dart' as main; +import 'screen.dart'; +//import 'memorial/memorial_main0919.dart'; + + +class CheckUserPage extends StatefulWidget { + const CheckUserPage({super.key, required this.title}); + + final String title; + + @override + State createState() => _CheckUserPageState(); +} + +class _CheckUserPageState extends State { + + @override + void initState() { + super.initState(); + + } + int _selectedIndex = 0; + + + + // ๋ฉ”์ธ ์œ„์ ฏ + @override + Widget build(BuildContext context) { + MediaQueryData deviceData = MediaQuery.of(context); + Size screenSize = deviceData.size; + + return Scaffold( + body: Container( + width: screenSize.width, + child: Text("๋ฏธ์ณ๋‚ ๋›ฐ๋Š”์ค‘~"), + ), + ); + } +} \ No newline at end of file diff --git a/client/lib/conversation/early_period/early_coach_mark.dart b/client/lib/conversation/early_period/early_coach_mark.dart new file mode 100644 index 0000000..d23a522 --- /dev/null +++ b/client/lib/conversation/early_period/early_coach_mark.dart @@ -0,0 +1,215 @@ +import 'dart:async'; +import 'dart:convert'; +import 'package:flutter/material.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/services.dart'; +import 'package:client/conversation/early_period/memory2.dart'; +import 'package:client/style.dart'; + + +/// ์ดˆ๊ธฐ_์ฝ”์น˜๋งˆํฌ +class EarlyMarkCoachPage extends StatefulWidget { + + static Future navigatorPush(BuildContext context) async { + return Navigator.push( + context, + MaterialPageRoute( + builder: (_) => EarlyMarkCoachPage(), + ), + ); + } + + @override + _EarlyMarkCoachPageState createState() => _EarlyMarkCoachPageState(); +} + +class _EarlyMarkCoachPageState extends State { + + FocusNode _focusNode = FocusNode(); + + @override + void initState() { + super.initState(); + _focusNode.addListener(_onFocusChange); + } + + void _onFocusChange() { + if (_focusNode.hasFocus) { + // ํ‚ค๋ณด๋“œ ์˜ฌ๋ฆฌ๊ธฐ + FocusScope.of(context).requestFocus(_focusNode); + } + } + + @override + void dispose() async { + super.dispose(); + } + + int nextPage = 0; + + List questions0 =[ + "๋‹ค๋ฅธ ์‚ฌ๋žŒ๋“ค์˜\n๊ธฐ์–ตํ• ๊ฐœ๋ฅผ ๊ตฌ๊ฒฝํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.", + "ํ•„ํ„ฐ๋กœ ๋‚˜์™€ ๋น„์Šทํ•œ ์‚ฌ๋žŒ๋“ค์˜\n์–˜๊ธฐ๋ฅผ ๋“ค์–ด๋ณด์•ผ์š”.", + "๋„์›€ ์š”์ฒญํ•˜๊ธฐ:\n๋‹ค๋ฅธ ๋ฐ˜๋ ค์ธ์—๊ฒŒ\n๋„์›€์„ ์š”์ฒญํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.", + "๋„์›€ ๋ณด๋‚ด๊ธฐ:\n๋‹ค๋ฅธ ๋ฐ˜๋ ค์ธ์ด ๋„์›€์„ ์š”์ฒญํ•˜๋ฉด\n๋„์›€์„ ๋ณด๋‚ผ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.\n๊ฐ์ •์„ ๊ต๋ฅ˜ํ•˜๊ฑฐ๋‚˜ ์ •๋ณด๋ฅผ ๋‚˜๋ˆ„์–ด๋ณด์„ธ์š”!", + ]; + + int nextQuestion = 0; + + + @override + Widget build(BuildContext context) { + MediaQueryData deviceData = MediaQuery.of(context); + Size screenSize = deviceData.size; + return + Container( + decoration: BoxDecoration( + gradient: LinearGradient( + begin: Alignment.topRight, + end: Alignment.bottomLeft, + colors: [ + Color(0xffE4ECFF), + Color(0xffA2BEFF), + ], + ) + ), + child: GestureDetector( + onTap: (){ + print(nextQuestion); + if(nextPage == 3){ + + } else if(nextPage < 3){ + nextPage++; + } + + setState(() { + }); + }, + child: Scaffold( + backgroundColor: Colors.transparent, + appBar: AppBar( + //title: Text("๊ธฐ์–ตํ• ๊ฐœ", style: TextStyle(fontSize:16, color: Colors.white ),), + //centerTitle: true, + backgroundColor: Colors.transparent, + elevation: 0.0, + automaticallyImplyLeading: false, + ),extendBodyBehindAppBar: true, + + body: + Container( + width: screenSize.width, + child: Column( + children: [ + Stack( + children: [ + + if(nextPage == 0)...[ + Padding(padding: EdgeInsets.only(left: 6, top: 145), + child: Container( + width: 260, + height: 575, + child: ClipRRect( + borderRadius: BorderRadius.circular(24.0), + child: Image.asset('assets/images/conversation/early/screen01.png', + fit: BoxFit.fill,) + ), + ), + ), + ] else if(nextPage == 1)...[ + Padding(padding: EdgeInsets.only(left: 6, top: 145), + child: Container( + width: 260, + height: 575, + child: ClipRRect( + borderRadius: BorderRadius.circular(24.0), + child: Image.asset('assets/images/conversation/early/screen02.png', + fit: BoxFit.fill,) + ), + ), + ), + ] else if(nextPage == 2)...[ + Padding(padding: EdgeInsets.only(left:6, top: 145), + child: Container( + width: 260, + height: 575, + child: ClipRRect( + borderRadius: BorderRadius.circular(24.0), + child: Image.asset('assets/images/conversation/early/screen03.png', + fit: BoxFit.fill,) + ), + ), + ), + ] else if(nextPage == 3)...[ + Padding(padding: EdgeInsets.only(left: 6, top: 145), + child: Container( + width: 260, + height: 575, + child: ClipRRect( + borderRadius: BorderRadius.circular(24.0), + child: Image.asset('assets/images/conversation/early/screen04.png', + fit: BoxFit.fill,) + ), + ), + ), + ], + + Padding(padding: EdgeInsets.only(left: 120, top: 706), + child: Container( + width: 40, + height: 2, + child: Container( + width: 40, height: 2, + color: Colors.white, + ) + ), + ), + ], + ) + ], + ), + ), + + bottomSheet: Padding( + padding: EdgeInsets.only( + bottom: MediaQuery.of(context).viewInsets.bottom * 0.001), + child: Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + if(nextPage == 3)...[ + Container( + color: Color(0xffFFFFFF).withOpacity(0), + child: Padding( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 24), + child: Container( + + width: screenSize.width, + height: 40, + child: ElevatedButton( + style: buttonChart().bluebtn3, + onPressed: () { + // ์ดˆ๊ธฐ2๋กœ ์ด๋™ + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => Memory2Page())); + }, + child: Text("๋‹ค์Œ", style: TextStyle( + fontFamily: 'Pretendard', + fontSize: 16, fontWeight: FontWeight.w500, color: Color(0xffFFFFFF))), + ), + ),), + ), + ] + ], + ), + ), + + ), + ) + + ); + + } +} diff --git a/client/lib/conversation/early_period/farewell.dart b/client/lib/conversation/early_period/farewell.dart new file mode 100644 index 0000000..b2fb0ab --- /dev/null +++ b/client/lib/conversation/early_period/farewell.dart @@ -0,0 +1,1591 @@ +import 'dart:async'; +import 'dart:convert'; +import 'package:flutter/material.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter_svg/svg.dart'; +import 'package:client/screen.dart'; +import 'package:http/http.dart' as http; +import 'package:client/progressbar/animation_progressbar.dart'; +import 'package:client/sign/sign_in.dart'; +import 'package:client/style.dart'; +import 'package:intl/intl.dart'; +import 'package:just_audio/just_audio.dart'; +import 'package:flutter_gif/flutter_gif.dart'; +import 'package:client/home.dart' as home; +import 'package:client/sign/sign_in.dart' as sign_in; +import 'package:client/main.dart'as main; + +/// ์ดˆ๊ธฐ๋Œ€ํ™”-๊ธฐ์–ต + +AudioPlayer player2 = AudioPlayer(); + +late FlutterGifController controller1, controller2, controller3; + +List voice =[ + "assets/voice/early/farewell/farewell1.mp3", + "assets/voice/early/farewell/farewell2.mp3", + "assets/voice/early/farewell/farewell_modi.mp3", + "assets/voice/early/farewell/farewell4.mp3", + "assets/voice/early/farewell/farewell5.mp3", + "assets/voice/early/farewell/farewell6.mp3", + "", + "assets/voice/early/farewell/farewell7.mp3", + "assets/voice/early/farewell/farewell8.mp3", + "assets/voice/early/farewell/farewell9.mp3", + "", + "assets/voice/early/farewell/farewell10.mp3", + "assets/voice/early/farewell/farewell11.mp3", + "assets/voice/early/farewell/farewell12.mp3", +]; + +List yesVoice =[ + "assets/voice/early/farewell/regyes1.mp3", + "assets/voice/early/farewell/regyes2.mp3", + "assets/voice/early/farewell/regyes3.mp3", + "assets/voice/early/farewell/regyes4.mp3", + "assets/voice/early/farewell/regyes5.mp3", + "assets/voice/early/farewell/regyes6.mp3", + "assets/voice/early/farewell/regyes7.mp3", + "assets/voice/early/farewell/regyes8.mp3", + "assets/voice/early/farewell/regyes9.mp3", +]; + +List noVoice =[ + "assets/voice/early/farewell/regno1.mp3", + "assets/voice/early/farewell/regno2.mp3", + "assets/voice/early/farewell/regno3.mp3", + "assets/voice/early/farewell/regno4.mp3", + "assets/voice/early/farewell/regno5.mp3", + "assets/voice/early/farewell/regno6.mp3", + "assets/voice/early/farewell/regno7.mp3", + "assets/voice/early/farewell/regno8.mp3", + "assets/voice/early/farewell/regno9.mp3", + "assets/voice/early/farewell/regno10.mp3", + "assets/voice/early/farewell/regno11.mp3", + "assets/voice/early/farewell/regno12.mp3", +]; + +List endVoice =[ + "assets/voice/early/farewell/endfarewell1.mp3", + "assets/voice/early/farewell/endfarewell2.mp3", + "assets/voice/early/farewell/endfarewell3.mp3", + "assets/voice/intro/intro2_8.mp3", + "", + "assets/voice/intro/intro2_9.mp3", +]; + + +class FarewellPage extends StatefulWidget { + + static Future navigatorPush(BuildContext context) async { + return Navigator.push( + context, + MaterialPageRoute( + builder: (_) => FarewellPage(), + ), + ); + } + + @override + _FarewellPageState createState() => _FarewellPageState(); +} + +class _FarewellPageState extends State with TickerProviderStateMixin { + + bool yes = false; // ํ›„ํšŒํ•จ -> ๋„ค ์„ ํƒ + bool ui_yes = false; + bool no = false; //ํ›„ํšŒํ•จ -> ์•„๋‹ˆ์˜ค ์„ ํƒ + bool ui_no = false; + + bool end = false; // ๋Œ€ํ™” ๋งˆ๋ฌด๋ฆฌ ๋‹จ๊ณ„ ์ง„์ž… + + int nextEnd = 0; + + int nextYes = 0; + int nextNo = 0; + + bool finish = false; // ๋ฉ”๋ชจ๋ฆฌ์–ผ ๋ฐ ๋งˆ๋ฌด๋ฆฌ + + bool selectedWeather = false; + bool chooseWeather = false; + String whatWeather = ""; + + bool selectedLocate = false; + bool chooseLocate = false; + String whatLocate = ""; + + bool selectedHow = false; + bool chooseHow = false; + String whatHow = ""; + + bool selectedNextTime = false; + bool chooseTime = false; + int whatTime = 0; + + // ํ…์ŠคํŠธ ์—๋””ํŒ… ์ปจํŠธ๋กค๋Ÿฌ๋ฅผ ์ƒ์„ฑํ•˜์—ฌ ํ•„๋“œ์— ํ• ๋‹น + final weatherController = TextEditingController(); // nextQuestion = 7์ผ๋•Œ + final nextTimeController = TextEditingController(); // nextQuestion = 7์ผ๋•Œ + final locateController = TextEditingController(); // nextQuestion = 7์ผ๋•Œ + final regretController = TextEditingController(); // nextQuestion = 7์ผ๋•Œ + final wantController = TextEditingController(); // nextQuestion = 7์ผ๋•Œ + final emotionController = TextEditingController(); // nextQuestion = 7์ผ๋•Œ + + bool selectRegret = false; + bool selectWant = false; + + List questions0 =[ + "์ข‹์•„์š”, ${home.user}๋‹˜.", //0 + "์˜ค๋Š˜์€ ${home.puppy}์™€์˜\n์ด๋ณ„์— ๋Œ€ํ•ด์„œ ์–˜๊ธฐํ•ด๋ณด๋„๋ก ํ•ด์š”.", //1 + "๋งŒ๋‚จ์ด ์žˆ์œผ๋ฉด ์ด๋ณ„์ด ์žˆ๋“ฏ์ด\n์ด๋ณ„์˜ ์ˆœ๊ฐ„์€ ๊ฒฐ๊ตญ ์ฐพ์•„์™€์š”. ", //2 + "์กฐ๊ธˆ ํž˜๋“ค๋”๋ผ๋„\n์ด๋ณ„์˜ ์ˆœ๊ฐ„์„ ๋– ์˜ฌ๋ฆฌ๋ฉฐ", //3 + "${home.user}๋‹˜์˜ ๊ฐ์ •๋“ค์„\n๊ฐ™์ด ์ •๋ฆฌํ•ด๋ณด์•„์š”.", //4 + "์ด๋ณ„์˜ ์ˆœ๊ฐ„,\n๊ทธ๋‚ ์˜ ๋‚ ์”จ๋Š” ์–ด๋• ๋‚˜์š”?", //5 + "์ด๋ณ„์˜ ์ˆœ๊ฐ„,\n๊ทธ๋‚ ์˜ ๋‚ ์”จ๋Š” ์–ด๋• ๋‚˜์š”?", //6 + + // "์•„์ด์™€์˜ ์ด๋ณ„์˜ ์ˆœ๊ฐ„์€\n() ๋‚ ์ด์—ˆ๊ตฐ์š”.", //7 + // + // "์šฐ๋ฆฌ ๋ณดํ˜ธ์ž๋‹˜๊ณผ\n์•„์ด๋Š”", //8 + // "์–ด๋–ค ์žฅ์†Œ์— ์žˆ์—ˆ๋‚˜์š”? ", //9 + // "์–ด๋–ค ์žฅ์†Œ์— ์žˆ์—ˆ๋‚˜์š”? ", //10 + // + // "๊ทธ๋ ‡๊ตฐ์š”", //11 + // "()์—์„œ", //12 + // + // "์•„์ด์™€ ์ด๋ณ„ํ•˜๋Š”\n์ˆœ๊ฐ„์„ ๋– ์˜ฌ๋ฆฌ๋ฉฐ ํ›„ํšŒ๋˜๋Š” ๋ถ€๋ถ„์ด ์žˆ๋‚˜์š”?", //13 + ]; +// ๋„ค ์„ ํƒ์‹œ + List questionYes= [ + "์–ด๋–ค ๋ถ€๋ถ„์ด ํ›„ํšŒ๊ฐ€ ๋˜๋‚˜์š”?", + "${home.user}๋‹˜์˜ ์–˜๊ธฐ๋ฅผ ๋“ค์–ด๋ณด๋‹ˆ", + "${home.puppy}๋ฅผ ํ–ฅํ•œ ๊ทธ๋ฆฌ์›€, ํ›„ํšŒโ€ฆ", + "๊ทธ ์™ธ์—๋„\n๋‹ค์–‘ํ•œ ๊ฐ์ •๋“ค์ด ๋А๊ปด์ง€๋Š” ๊ฒƒ ๊ฐ™์•„์š”.", + "์ด๋ณ„์˜ ์ˆœ๊ฐ„์€ ์ง€๋‚˜๊ฐ€๋”๋ผ๋„", + "${home.puppy}๋ฅผ ๊ทธ๋ฆฌ์›Œํ•˜๋Š” ๋งˆ์Œ์€\n์ปค์ ธ๋งŒ ๊ฐ€๋‹ˆ ๊ทธ๋Ÿฐ ๊ฒƒ ๊ฐ™์•„์š”.", + "๊ทธ๋ž˜๋„ ${home.user}๋‹˜์ด\n${home.puppy}๋ฅผ ์ถ”์–ตํ•  ์ˆ˜ ์žˆ๊ฒŒ", + "โ€˜๊ธฐ์–ตํ• ๊ฐœโ€™์—์„œ ${home.puppy}์™€์˜\n์ถ”์–ต์„ ์ €์žฅํ•ด๋ณด๋Š” ๊ฒƒ๋„", + "๊ทธ๋ฆฌ์šด ๋งˆ์Œ์„ ๋‹ฌ๋ž˜๋Š”๋ฐ\n๋„์›€์ด ๋  ๊ฒƒ ๊ฐ™์•„์š”.", + ]; + +// ์•„๋‹ˆ์˜ค ์„ ํƒ์‹œ + List questionNo =[ + "๊ทธ๋ ‡๋‹ค๋ฉด, ๋‹คํ–‰์ด์—์š”.", + "์ด๋ณ„์˜ ์ˆœ๊ฐ„์ด ์ง€๋‚˜๊ณ \nํ›„ํšŒ๊ฐ€ ๋‚จ์„ ์ˆ˜ ์žˆ์ง€๋งŒ,", + "ํ›„ํšŒ๊ฐ€ ๋‚จ์ง€ ์•Š์•˜๋‹ค๋ฉด\n๊ทธ๊ฒƒ๋„ ์ •๋ง ๋Œ€๋‹จํ•œ ์ผ์ด๋ผ๊ณ  ์ƒ๊ฐํ•ด์š”.", + "${home.user}๋‹˜.\n๋งŒ์•ฝ ${home.puppy}์™€์˜", + "์ด๋ณ„์˜ ์ˆœ๊ฐ„์œผ๋กœ ๋‹ค์‹œ ๋Œ์•„๊ฐ„๋‹ค๋ฉด\nํ•˜๊ณ  ์‹ถ์€ ๊ฒƒ๋“ค์ด ์žˆ์„๊นŒ์š”?", + "${home.user}๋‹˜์€\n์ด๋ณ„์˜ ์ˆœ๊ฐ„์„ ์ž˜ ๋ณด๋‚ด์‹  ๊ฒƒ ๊ฐ™์•„์š”.", + "๊ทธ ์ˆœ๊ฐ„์— ${home.puppy}๋„", + "${home.user}๋‹˜์˜ ๋งˆ์Œ์„\n์˜จ์ „ํžˆ ๋А๊ผˆ์„๊ฑฐ์˜ˆ์š”.", + "๊ทธ๋Ÿผ์—๋„ ${home.puppy}๋ฅผ ํ–ฅํ•œ\n๊ทธ๋ฆฌ์šด ๋งˆ์Œ์€", + "์—ฌ์ „ํ•˜๊ฒŒ ๋‚จ์•„์žˆ์ง€ ์•Š์„๊นŒ ์‹ถ์–ด์š”.", + "โ€˜๊ธฐ์–ตํ• ๊ฐœโ€™์—์„œ ${home.puppy}์™€์˜\n์ถ”์–ต์„ ์ €์žฅํ•ด๋ณด๋ฉด", + "๊ทธ๋ฆฌ์šด ๋งˆ์Œ์„ ๋‹ฌ๋ž˜๋Š”๋ฐ\n ๋„์›€์ด ๋  ๊ฒƒ ๊ฐ™์•„์š”.", + + ]; + + List questionsEnd =[ + "${home.user}๋‹˜,\n์ œ๊ฐ€ ์ค€๋น„ํ•œ ๋Œ€ํ™”๋Š” ์—ฌ๊ธฐ๊นŒ์ง€์—์š”. ", + "${home.puppy}์™€\n์ด๋ณ„์˜ ์ˆœ๊ฐ„์„ ๊ธฐ์–ตํ•˜๋ฉฐ ", + "ํ’€์ง€ ๋ชปํ•œ ${home.user}๋‹˜์˜\n๊ฐ์ •๋“ค์ด ํ’€์–ด์กŒ์œผ๋ฉด ํ•˜๋Š” ๋ฐ”๋žŒ์ด์—์š”.", + "์ž, ์ด์ œ ์šฐ๋ฆฌ๊ฐ€ ๋‹ค์‹œ\n๋งŒ๋‚˜๊ฒŒ ๋  ์‹œ๊ฐ„์„ ์•Œ๋ ค์ฃผ์„ธ์š”.", + "์ž, ์ด์ œ ์šฐ๋ฆฌ๊ฐ€ ๋‹ค์‹œ\n๋งŒ๋‚˜๊ฒŒ ๋  ์‹œ๊ฐ„์„ ์•Œ๋ ค์ฃผ์„ธ์š”.", + // "๋„ค, ${home.user}๋‹˜.\n()์‹œ๊ฐ„ ํ›„์— ๋‹ค์‹œ ๋งŒ๋‚˜์š”!", + // "๋„ค, ${home.user}๋‹˜.\n()์‹œ๊ฐ„ ํ›„์— ๋‹ค์‹œ ๋งŒ๋‚˜์š”!", + ]; + + String sentDate = ""; + // ๋Œ€ํ™” ๋‹จ๊ณ„ ์ €์žฅ + void saveCon(String aToken, String con, String nextcon) async { + // API ์—”๋“œํฌ์ธํŠธ URL + String apiUrl = 'http://3.38.1.125:8080/user/conversation-status'; + + // ์š”์ฒญ ๋ณธ๋ฌธ ๋ฐ์ดํ„ฐ + var data = { + "conversationStatus": con, + "nextConversationAt": nextcon, + }; + + // ํ—ค๋” ์ •๋ณด ์„ค์ • + Map headers = { + 'Authorization': 'Bearer $aToken', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• + 'Content-Type': 'application/json', // ์˜ˆ: JSON ์š”์ฒญ์ธ ๊ฒฝ์šฐ ํ—ค๋” ์„ค์ • + }; + + // HTTP GET ์š”์ฒญ ๋ณด๋‚ด๊ธฐ + var response = await http.put( + Uri.parse(apiUrl), + body: json.encode(data), + headers: headers, // ํ—ค๋” ์ถ”๊ฐ€ + ); + + ///var jsonResponse = utf8.decode(response.bodyBytes); + // HTTP ์‘๋‹ต ์ƒํƒœ ํ™•์ธ + if (response.statusCode == 200) { + // ์‘๋‹ต ๋ฐ์ดํ„ฐ๋ฅผ JSON ํ˜•์‹์œผ๋กœ ๋””์ฝ”๋”ฉ + print("๋Œ€ํ™” ๋‹จ๊ณ„ ๋„ฃ๊ธฐ ์„ฑ๊ณต"); + setState(() { + }); + + } else { + // ์š”์ฒญ์ด ์‹คํŒจํ•œ ๊ฒฝ์šฐ ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌ + print('HTTP ์š”์ฒญ ์‹คํŒจ..?: ${response.statusCode}'); + } + } + + FocusNode _focusNode = FocusNode(); + + double containerWidth1 = 35.0; + void updateContainerWidth1() { + // TextField ๋‚ด์šฉ์˜ ๊ธธ์ด์— ๋”ฐ๋ผ Container ๊ธธ์ด ์—…๋ฐ์ดํŠธ + setState(() { + containerWidth1 = 35.0 + (nextTimeController.text.length.toDouble() * 5.0); + }); + } + double containerWidth2 = 35.0; + void updateContainerWidth2() { + // TextField ๋‚ด์šฉ์˜ ๊ธธ์ด์— ๋”ฐ๋ผ Container ๊ธธ์ด ์—…๋ฐ์ดํŠธ + setState(() { + containerWidth2 = 35.0 + (nextTimeController.text.length.toDouble() * 5.0); + }); + } + + @override + void initState() { + super.initState(); + + main.play = true; + main.player.setAsset(main.musics[1]); + main.player.play(); + + // ์Œ์› ์ ์šฉ + for(int i= 0 ; i < voice.length; i++){ + player2.setAudioSource(AudioSource.uri( + Uri.parse(voice[i])) + ); + } + + controller1 = FlutterGifController(vsync: this); + + player2.setAsset(voice[voiceCount]); + voiceCount++; + player2.play(); + + // 2.5์ดˆ ์ ์ • + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + Timer(Duration(milliseconds: 2000), () { + controller1.stop(); + }); + + _callAPI(); + _focusNode.addListener(_onFocusChange); + } + + void _onFocusChange() { + if (_focusNode.hasFocus) { + // ํ‚ค๋ณด๋“œ ์˜ฌ๋ฆฌ๊ธฐ + FocusScope.of(context).requestFocus(_focusNode); + } + } + + @override + void dispose() async { + super.dispose(); + } + + + List introText =[]; + int nextQuestion = 0; + int voiceCount = 0; + + int voiceNoCount = 0; + int voiceYesCount = 0; + + int voiceEndCount = 0; + + + void _callAPI() async { + // ์š”์ฒญ ๋ณธ๋ฌธ ๋ฐ์ดํ„ฐ + var data = { + "stage" : "0", + "set" : "0", + "lineId" : "0" + }; + + var url = Uri.parse('http://3.38.1.125:8080/conversation/line'); // ์—”๋“œํฌ์ธํŠธ URL ์„ค์ • + + try { + var response = await http.post( + url, + body: json.encode(data), // ์š”์ฒญ ๋ณธ๋ฌธ์— ๋ฐ์ดํ„ฐ๋ฅผ JSON ํ˜•์‹์œผ๋กœ ์ธ์ฝ”๋”ฉํ•˜์—ฌ ์ „๋‹ฌ + headers: {'Content-Type': 'application/json',}, // ์š”์ฒญ ํ—ค๋”์— Content-Type ์„ค์ • + ); + + if (response.statusCode == 200) { + // ์‘๋‹ต ์„ฑ๊ณต ์‹œ์˜ ์ฒ˜๋ฆฌ + + var jsonResponse = utf8.decode(response.bodyBytes); // ์‘๋‹ต ๋ณธ๋ฌธ์„ JSON ํ˜•์‹์œผ๋กœ ๋””์ฝ”๋”ฉ + // JSON ๊ฐ’์„ ํ™œ์šฉํ•œ ์›ํ•˜๋Š” ๋™์ž‘ ์ˆ˜ํ–‰ + //utf8.decode(jsonResponse); + print(jsonResponse); + + List contentList = []; + + List parsedResponse = json.decode(jsonResponse); + + setState(() { + for (var item in parsedResponse) { + if (item['content'] != null) { + introText.add(item['content']); + } + } + }); + + + print(introText); + + print('API ํ˜ธ์ถœ ์„ฑ๊ณต: ${response.statusCode}'); + } else { + // ์š”์ฒญ ์‹คํŒจ ์‹œ์˜ ์ฒ˜๋ฆฌ + print('API ํ˜ธ์ถœ ์‹คํŒจ: ${response.statusCode}'); + } + } catch (e) { + // ์˜ˆ์™ธ ๋ฐœ์ƒ ์‹œ์˜ ์ฒ˜๋ฆฌ + print('API ํ˜ธ์ถœ ์ค‘ ์˜ˆ์™ธ ๋ฐœ์ƒ: $e'); + } + } + + @override + Widget build(BuildContext context) { + MediaQueryData deviceData = MediaQuery.of(context); + Size screenSize = deviceData.size; + return + Container( + color: Color(0xffFCCBCD), + child: GestureDetector( + onTap: (){ + print("์ด๊ฑฐ๋งŒ ์ข€ ํ™•์ธ ๋ถ€ํƒ: " + nextQuestion.toString()); + + if(nextQuestion < 6){ + nextQuestion++; // ์ธํŠธ๋กœ ์‹œ์ž‘ ํ›„ count + player2.setAsset(voice[voiceCount]); + voiceCount++; + player2.play(); + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + if(nextQuestion == 1){ + Timer(Duration(milliseconds: 4000), () { + controller1.stop(); + }); + } else if(nextQuestion == 2){ + Timer(Duration(milliseconds: 5500), () { + controller1.stop(); + }); + } else if(nextQuestion == 3){ + Timer(Duration(milliseconds: 4000), () { + controller1.stop(); + }); + } else if(nextQuestion == 4){ + Timer(Duration(milliseconds: 4000), () { + controller1.stop(); + }); + } + else if(nextQuestion == 5){ + Timer(Duration(milliseconds: 4000), () { + controller1.stop(); + }); + } + else if(nextQuestion == 6){ + Timer(Duration(milliseconds: 4000), () { + controller1.stop(); + }); + } + } + else if(nextQuestion == 6){ + // ์–ด๋–ค ๋‚ ์”จ? + } + else if(nextQuestion>6 && nextQuestion<10){ + nextQuestion++; + player2.setAsset(voice[voiceCount]); + voiceCount++; + player2.play(); + // 2.5์ดˆ ์ ์ • + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + if(nextQuestion == 8){ + Timer(Duration(milliseconds: 2000), () { + controller1.stop(); + }); + } else if(nextQuestion == 9){ + Timer(Duration(milliseconds: 2000), () { + controller1.stop(); + }); + } + } + else if(nextQuestion == 10){ + // ์–ด๋””์„œ ์žˆ์—ˆ๋Š”์ง€? + } + else if(nextQuestion >10 && nextQuestion <13){ + nextQuestion++; + player2.setAsset(voice[voiceCount]); + voiceCount++; + player2.play(); + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + if(nextQuestion == 12){ + Timer(Duration(milliseconds: 2000), () { + controller1.stop(); + }); + } else if(nextQuestion == 13){ + Timer(Duration(milliseconds: 5000), () { + controller1.stop(); + }); + } + } + else if(nextQuestion == 13){ + // ํ›„ํšŒ๋˜๋Š” ๋ถ€๋ถ„? + } + // ์—ฌ๊ธฐ์„œ ๋ถ€ํ„ฐ ํ›„ํšŒ์— ๋Œ€ํ•ด์„œ + else if(yes && nextYes == 0){ + + } + else if(yes && (nextYes > 0 && nextYes < 8) ){ + nextYes++; + player2.setAsset(yesVoice[voiceYesCount]); + voiceYesCount++; + player2.play(); + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + + if(nextYes == 2){ + Timer(Duration(milliseconds: 3000), () { + controller1.stop(); + }); + } + else if(nextYes == 3){ + Timer(Duration(milliseconds: 4000), () { + controller1.stop(); + }); + } + else if(nextYes == 4){ + Timer(Duration(milliseconds: 3000), () { + controller1.stop(); + }); + } + else if(nextYes == 5){ + Timer(Duration(milliseconds: 5000), () { + controller1.stop(); + }); + } + else if(nextYes == 6){ + Timer(Duration(milliseconds: 4000), () { + controller1.stop(); + }); + } + else if(nextYes == 7){ + Timer(Duration(milliseconds: 4000), () { + controller1.stop(); + }); + } + else if(nextYes == 8){ + Timer(Duration(milliseconds: 4000), () { + controller1.stop(); + }); + } + } + else if(no && nextNo < 4){ + nextNo++; + player2.setAsset(noVoice[voiceNoCount]); + voiceNoCount++; + player2.play(); + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + if(nextNo == 1){ + Timer(Duration(milliseconds: 4000), () { + controller1.stop(); + }); + } + else if(nextNo == 2){ + Timer(Duration(milliseconds: 5000), () { + controller1.stop(); + }); + } + else if(nextNo == 3){ + Timer(Duration(milliseconds: 3000), () { + controller1.stop(); + }); + } + else if(nextNo == 4){ + Timer(Duration(milliseconds: 5000), () { + controller1.stop(); + }); + } + } + else if(no && nextNo == 4){ + } + else if(no && (nextNo > 4 && nextNo < 11)){ + nextNo++; + player2.setAsset(noVoice[voiceNoCount]); + voiceNoCount++; + player2.play(); + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + if(nextNo == 6){ + Timer(Duration(milliseconds: 2000), () { + controller1.stop(); + }); + } + else if(nextNo == 7){ + Timer(Duration(milliseconds: 4000), () { + controller1.stop(); + }); + } + else if(nextNo == 8){ + Timer(Duration(milliseconds: 3000), () { + controller1.stop(); + }); + } + else if(nextNo == 9){ + Timer(Duration(milliseconds: 2000), () { + controller1.stop(); + }); + } + else if(nextNo == 10){ + Timer(Duration(milliseconds: 3000), () { + controller1.stop(); + }); + } + else if(nextNo == 11){ + Timer(Duration(milliseconds: 4000), () { + controller1.stop(); + }); + } + } + else if(yes && nextYes == 8){ + nextYes++; + end = true; + player2.setAsset(endVoice[voiceEndCount]); + voiceEndCount++; + player2.play(); + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + Timer(Duration(milliseconds: 4000), () { + controller1.stop(); + }); + } + else if(no && nextNo == 11){ + nextNo++; + end = true; + player2.setAsset(endVoice[voiceEndCount]); + voiceEndCount++; + player2.play(); + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + Timer(Duration(milliseconds: 4000), () { + controller1.stop(); + }); + } + else if(end && nextEnd < 4){ + nextEnd++; + player2.setAsset(endVoice[voiceEndCount]); + voiceEndCount++; + player2.play(); + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + if(nextEnd == 1){ + Timer(Duration(milliseconds: 3000), () { + controller1.stop(); + }); + } + else if(nextEnd == 2){ + Timer(Duration(milliseconds: 5000), () { + controller1.stop(); + }); + } + else if(nextEnd == 3){ + Timer(Duration(milliseconds: 4000), () { + controller1.stop(); + }); + } + } + else if(end && nextEnd == 4){ + // ์–ธ์ œ ๋งŒ๋‚ ๊นŒ์š” + } + else if(end && (nextEnd < 6 && nextEnd >4)){ + nextEnd++; + player2.setAsset(endVoice[voiceEndCount]); + voiceEndCount++; + player2.play(); + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + if(nextEnd == 6){ + Timer(Duration(milliseconds: 3000), () { + controller1.stop(); + }); + } + } + else if(end && nextEnd == 6){ + // ํ•˜๋‹จ ๋ฒ„ํŠผ + } + + + setState(() { + }); + }, + child: Scaffold( + backgroundColor: Colors.transparent, + appBar: AppBar( + //title: Text("๊ธฐ์–ตํ• ๊ฐœ", style: TextStyle(fontSize:16, color: Colors.white ),), + //centerTitle: true, + leading: IconButton( + icon: SvgPicture.asset( + 'assets/images/conversation/home_icon.svg', + ), + onPressed: () => Navigator.of(context).pop(), + ), + backgroundColor: Colors.transparent, + elevation: 0.0, + ), + //extendBodyBehindAppBar: true, + body: + SingleChildScrollView( + child: Container( + child: Column( + children: [ + SizedBox(height: 3,), + Container( + width: screenSize.width, + height: 25, + child: Padding( + padding: EdgeInsets.only( left:16, right: 16), + child: Center( + child: FAProgressBar( + currentValue: 40, + size: 5, + backgroundColor: Colors.white, + ) + ), + ), + ), + Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children:[ + SizedBox( + height: 10, + ), + Stack( + children: [ + Container( + height: 157, + width: screenSize.width, + child: + Stack( + children: [ + Center(child: SvgPicture.asset('assets/images/conversation/bubble.svg',fit: BoxFit.fill,),), + Container( + padding: const EdgeInsets.symmetric(horizontal: 32, vertical: 12, ), + child: Center( + child: Column( + children: [ + if(yes == false && no == false)...[ + if(questions0[nextQuestion].toString().contains("\n"))...[ + SizedBox(height: 28,), + Text( + questions0[nextQuestion], + textAlign: TextAlign.center, + style: textStyle.bubbletext, + ), + ]else...[ + SizedBox(height: 42,), + Text( + questions0[nextQuestion], + textAlign: TextAlign.center, + style: textStyle.bubbletext, + ), + ], + ] + // ํ›„ํšŒ ๋„ค + else if (yes && end == false) ...[ + if(questionYes[nextYes].toString().contains("\n"))...[ + SizedBox(height: 28,), + Text( + questionYes[nextYes], + textAlign: TextAlign.center, + style: textStyle.bubbletext, + ), + ]else...[ + SizedBox(height: 42,), + Text( + questionYes[nextYes], + textAlign: TextAlign.center, + style: textStyle.bubbletext, + ), + ], + // ํ›„ํšŒ ์•„๋‹ˆ์˜ค + ] else if (no && end == false) ...[ + if(questionNo[nextNo].toString().contains("\n"))...[ + SizedBox(height: 28,), + Text( + questionNo[nextNo], + textAlign: TextAlign.center, + style: textStyle.bubbletext, + ), + ]else...[ + SizedBox(height: 42,), + Text( + questionNo[nextNo], + textAlign: TextAlign.center, + style: textStyle.bubbletext, + ), + ], + ] else if(end)...[ + if(questionsEnd[nextEnd].toString().contains("\n"))...[ + SizedBox(height: 28,), + Text( + questionsEnd[nextEnd], + textAlign: TextAlign.center, + style: textStyle.bubbletext, + ), + ]else...[ + SizedBox(height: 42,), + Text( + questionsEnd[nextEnd], + textAlign: TextAlign.center, + style: textStyle.bubbletext, + ), + ], + ] + ], + ) + ) + ), + ], + ) + ), + // ๋ฌด์ง€ ์œ„์น˜ + if(nextQuestion < 6 || (nextQuestion>6 && nextQuestion<10) || (nextQuestion > 10 && nextQuestion < 13))...[ + Stack( + children: [ + // ์œ ์ € ์œ„์น˜ + Column( + children: [ + SizedBox(height: 420,), + Container( + child: SvgPicture.asset( + 'assets/images/conversation/user7.svg', + height: 282, + width: screenSize.width, + ), + ), + ], + ), + Column( + children: [ + SizedBox(height: 144,), + Container( + width: screenSize.width, + height: 375, + child: + Stack( + children: [ + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child: Image.asset('assets/images/conversation/gif/muji_ear.gif', + fit: BoxFit.cover,),), + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child: Image.asset('assets/images/conversation/gif/muji_base.gif', fit: BoxFit.cover,),), + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child: Image.asset('assets/images/conversation/gif/muji_base_eye.gif', + fit: BoxFit.cover,),), + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child:GifImage( + controller: controller1, + image: const AssetImage("assets/images/conversation/gif/muji_mouth1.gif"), + ), + // Image.asset('assets/images/conversation/gif/muji_mouth1.gif', fit: BoxFit.cover,), + ) + ], + ) + + // SvgPicture.asset( + // 'assets/images/conversation/con_muji.svg', fit: BoxFit.cover, + // ), + ), + ], + ), + ], + ), + ] + else if(nextQuestion == 6)...[ + Padding( + padding: EdgeInsets.only(top:175, left:45), + child: Container( + width: 275, + height: 120, + child: Column( + children: [ + Row( + children: [ + SizedBox(width: 75,), + Container(width: containerWidth1, + child: TextField( + style: textStyle.inputfield, + onTap: (){ + chooseWeather = true; + whatWeather = weatherController.text; + setState(() { + }); + }, + onChanged: (text){ + updateContainerWidth1(); + selectedWeather = true; + whatWeather = weatherController.text; + }, + controller: weatherController, + decoration: InputDecoration( + hintText: '์–ด๋–ค', + suffixStyle: TextStyle(color: Color(0xff83A8FF), fontSize: 20,), + hintStyle: textStyle.field, + counterText:'', + ), + maxLength: 10, + ),), + Text("๋‚ ์”จ์˜€์–ด์š”.", style: TextStyle( + fontFamily: 'Pretendard', + fontSize: 20, fontWeight: FontWeight.w500, color: Colors.black),), + ],), + SizedBox(height: 15,), + // DateFormat('MM/dd HH:mm').format(DateTime.parse(parsedResponseHR[index]['createdAt'])) + // DateFormat('MM/dd HH:mm').format(DateTime.now().add(Duration(hours: whatTime))) + Text("10์ž ์ด๋‚ด", style: TextStyle( + fontFamily: 'Pretendard', + fontSize: 16, fontWeight: FontWeight.w500, color: Color(0xffAAAAAA)),), + + ],), + ), + ), + ] + else if(nextQuestion == 10)...[ + Padding( + padding: EdgeInsets.only(top:175, left:45), + child: Container( + width: 275, + height: 120, + child: Column( + children: [ + Row( + children: [ + SizedBox(width: 75,), + Container(width: containerWidth2, + child: TextField( + style: textStyle.inputfield, + onTap: (){ + chooseLocate = true; + whatLocate = locateController.text; + setState(() { + }); + }, + onChanged: (text){ + updateContainerWidth2(); + selectedLocate = true; + whatLocate = locateController.text; + }, + controller: locateController, + decoration: InputDecoration( + hintText: '์–ด๋””', + suffixStyle: TextStyle(color: Color(0xff83A8FF), fontSize: 20,), + hintStyle: textStyle.field, + counterText:'', + ), + maxLength: 10, + ),), + Text("์— ์žˆ์—ˆ์–ด์š”.", style: TextStyle( + fontFamily: 'Pretendard', + fontSize: 20, fontWeight: FontWeight.w500, color: Colors.black),), + ],), + SizedBox(height: 15,), + // DateFormat('MM/dd HH:mm').format(DateTime.parse(parsedResponseHR[index]['createdAt'])) + // DateFormat('MM/dd HH:mm').format(DateTime.now().add(Duration(hours: whatTime))) + Text("10์ž ์ด๋‚ด", style: TextStyle( + fontFamily: 'Pretendard', + fontSize: 16, fontWeight: FontWeight.w500, color: Color(0xffAAAAAA)),), + + ],), + ), + ), + ] + else if(nextQuestion == 13)...[ + Stack( + children: [ + + Column( + children: [ + SizedBox(height: 418,), + Container( + height: 280, + width: screenSize.width, + color: Color(0xffFFFFF7), + ) + ], + ), + Column( + children: [ + SizedBox(height: 418,), + SvgPicture.asset( + 'assets/images/conversation/shadow.svg', fit: BoxFit.cover, + ), + ], + ), + + Column( + children: [ + SizedBox(height: 144,), + Container( + width: screenSize.width, + height: 375, + child: + Stack( + children: [ + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child: Image.asset('assets/images/conversation/gif/muji_ear.gif', + fit: BoxFit.cover,),), + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child: Image.asset('assets/images/conversation/gif/muji_base.gif', fit: BoxFit.cover,),), + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child: Image.asset('assets/images/conversation/gif/muji_base_eye.gif', + fit: BoxFit.cover,),), + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child:GifImage( + controller: controller1, + image: const AssetImage("assets/images/conversation/gif/muji_mouth1.gif"), + ), + // Image.asset('assets/images/conversation/gif/muji_mouth1.gif', fit: BoxFit.cover,), + ) + ], + ) + + // SvgPicture.asset( + // 'assets/images/conversation/con_muji.svg', fit: BoxFit.cover, + // ), + ), + ], + ), + + Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SizedBox(height: 444,), + Row( + children: [ + SizedBox(width: 16,), + Container( + width: 168, + height: 168, + child: ElevatedButton( + style: ui_yes? buttonChart().bluebtn2_1 : buttonChart().whitebtn_1, + onPressed: () { + //miss = true; + ui_no = false; + if(ui_yes == false){ + ui_yes = true; + } else{ + ui_yes = false; + } + // nextQuestion++; + setState(() {}); + }, + child: Container( + padding: EdgeInsets.all(8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox(height: 16,), + Text("๋„ค,\n์žˆ์–ด์š”.", style: TextStyle(fontFamily: 'Pretendard',fontSize: 16, color: ui_yes? Color(0xff333333) : Color(0xff4B5396)),), + SizedBox(height: 16,), + Text("ํ›„ํšŒ๋˜๋Š”\n๋ถ€๋ถ„์ด ์žˆ์–ด์š”.", style: TextStyle(fontFamily: 'Pretendard',fontSize: 12, color: ui_yes? Color(0xff333333) : Color(0xff4B5396)),), + SizedBox(height: 3,), + Row( + children: [ + SizedBox(width: 76,), + SvgPicture.asset('assets/images/conversation/early/yes.svg') + ], + ) + ], + ), + ) + ), + ), + SizedBox(width: 16,), + Container( + width: 168, + height: 168, + child: ElevatedButton( + style: ui_no? buttonChart().bluebtn2_1 : buttonChart().whitebtn_1, + onPressed: () { + // grief = true; + ui_yes = false; + if(ui_no == false){ + ui_no = true; + } else{ + ui_no = false; + } + // nextQuestion++; + setState(() {}); + }, + child: Container( + padding: EdgeInsets.all(8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox(height: 16,), + Text("์•„๋‹ˆ์š”,\n์—†๋Š”๊ฒƒ ๊ฐ™์•„์š”.", style: TextStyle(fontFamily: 'Pretendard',fontSize: 16, color: ui_no? Color(0xff333333) : Color(0xff4B5396)),), + SizedBox(height: 16,), + Text("ํ›„ํšŒ๋˜๋Š” ๋ถ€๋ถ„์ด\n์—†๋Š” ๊ฒƒ ๊ฐ™์•„์š”.", style: TextStyle(fontFamily: 'Pretendard',fontSize: 12, color: ui_no? Color(0xff333333) : Color(0xff4B5396)),), + SizedBox(height: 3,), + Row( + children: [ + SizedBox(width: 76,), + SvgPicture.asset('assets/images/conversation/early/no.svg') + ], + ) + ], + ), + ) + ), + ), + ], + ), + ], + ), + ], + ), + ] else if((yes && nextYes < 9) || (no && nextNo < 12) || (end && nextEnd < 4) || (end && nextEnd > 4 && nextEnd < 7))...[ + Stack( + children: [ + // ์œ ์ € ์œ„์น˜ + Column( + children: [ + SizedBox(height: 420,), + Container( + child: SvgPicture.asset( + 'assets/images/conversation/user7.svg', + height: 282, + width: screenSize.width, + ), + ), + ], + ), + Column( + children: [ + SizedBox(height: 144,), + Container( + width: screenSize.width, + height: 375, + child: + Stack( + children: [ + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child: Image.asset('assets/images/conversation/gif/muji_ear.gif', + fit: BoxFit.cover,),), + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child: Image.asset('assets/images/conversation/gif/muji_base.gif', fit: BoxFit.cover,),), + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child: Image.asset('assets/images/conversation/gif/muji_base_eye.gif', + fit: BoxFit.cover,),), + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child:GifImage( + controller: controller1, + image: const AssetImage("assets/images/conversation/gif/muji_mouth1.gif"), + ), + // Image.asset('assets/images/conversation/gif/muji_mouth1.gif', fit: BoxFit.cover,), + ) + ], + ) + + // SvgPicture.asset( + // 'assets/images/conversation/con_muji.svg', fit: BoxFit.cover, + // ), + ), + ], + ), + ], + ), + ] else if(end && nextEnd == 4)...[ + Padding( + padding: EdgeInsets.only(top:175, left:45), + child: Container( + width: 275, + height: 120, + child: Column( + children: [ + Row( + children: [ + SizedBox(width: 75,), + Container(width: 25, + child: TextField( + style: textStyle.inputfield, + onTap: (){ + chooseTime = true; + whatTime = int.parse(nextTimeController.text); + setState(() { + }); + }, + onChanged: (text){ + selectedNextTime = true; + whatTime = int.parse(nextTimeController.text); + }, + keyboardType: TextInputType.number, + inputFormatters: [FilteringTextInputFormatter.allow(RegExp('[0-9]'))], + controller: nextTimeController, + decoration: InputDecoration( + hintText: '๋ช‡', + suffixStyle: TextStyle(color: Color(0xff83A8FF), fontSize: 20,), + hintStyle: textStyle.field, + //labelText: '๋ช‡', + ), + ),), + Text("์‹œ๊ฐ„ ํ›„์— ๋งŒ๋‚˜์š”", style: TextStyle( + fontFamily: 'Pretendard', + fontSize: 20, fontWeight: FontWeight.w500, color: Colors.black),), + ],), + SizedBox(height: 15,), + // DateFormat('MM/dd HH:mm').format(DateTime.parse(parsedResponseHR[index]['createdAt'])) + // DateFormat('MM/dd HH:mm').format(DateTime.now().add(Duration(hours: whatTime))) + Text(chooseTime?"${DateFormat('MM์›” dd์ผ HH์‹œ mm๋ถ„').format(DateTime.now().add(Duration(hours: whatTime)))}":"์ตœ์†Œ 1์‹œ๊ฐ„์—์„œ 24์‹œ๊ฐ„ ์‚ฌ์ด๋กœ ์ •ํ•ด์ฃผ์„ธ์š”.", style: TextStyle( + fontFamily: 'Pretendard', + fontSize: 16, fontWeight: FontWeight.w500, color: Color(0xffAAAAAA)),), + + ],), + ), + ), + ] + + ], + ), + + ], + ), + ], + ), + ), + ), + // // nextQuestion ์ด 3๊ณผ 7์ผ๋•Œ ๋“ฑ์žฅ + bottomSheet: Padding( + padding: EdgeInsets.only( + bottom: MediaQuery.of(context).viewInsets.bottom * 0.001), + child: Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + if(nextQuestion == 6 && selectedWeather)...[ + Container( + color: Color(0xffFFFFFF).withOpacity(0.0), + child: Padding( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 24), + child: Container( + + width: screenSize.width, + height: 40, + child: ElevatedButton( + style: buttonChart().bluebtn3, + onPressed: () { + //decidedType = false; + questions0.insertAll(7, [ + "${home.puppy}์™€์˜ ์ด๋ณ„์˜ ์ˆœ๊ฐ„์€\n${whatWeather}๋‚ ์ด์—ˆ๊ตฐ์š”.", //7 + "์šฐ๋ฆฌ ${home.user}๋‹˜๊ณผ\n${home.puppy}๋Š”", //8 + "์–ด๋–ค ์žฅ์†Œ์— ์žˆ์—ˆ๋‚˜์š”? ", //9 + "์–ด๋–ค ์žฅ์†Œ์— ์žˆ์—ˆ๋‚˜์š”? ", //10 + ]); + nextQuestion++; + player2.setAsset(voice[voiceCount]); + voiceCount++; + player2.play(); + // 2.5์ดˆ ์ ์ • + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + Timer(Duration(milliseconds: 4000), () { + controller1.stop(); + }); + setState(() {}); + }, + child: Text("๋‹ค์Œ", style: TextStyle( + fontFamily: 'Pretendard', + fontSize: 16, fontWeight: FontWeight.w500, color: Color(0xffFFFFFF))), + ), + ),), + ), + ] + else if(nextQuestion == 10 && selectedLocate)...[ + Container( + color: Color(0xffFFFFFF).withOpacity(0.0), + child: Padding( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 24), + child: Container( + + width: screenSize.width, + height: 40, + child: ElevatedButton( + style: buttonChart().bluebtn3, + onPressed: () { + //decidedType = false; + questions0.insertAll(11, [ + "๊ทธ๋ ‡๊ตฐ์š”.", //11 + "${whatWeather}๋‚ \n${whatLocate}์—์„œ", //12 + "${home.puppy}์™€ ์ด๋ณ„ํ•˜๋Š”\n์ˆœ๊ฐ„์„ ๋– ์˜ฌ๋ฆฌ๋ฉฐ ํ›„ํšŒ๋˜๋Š” ๋ถ€๋ถ„์ด ์žˆ๋‚˜์š”?", //13 + ]); + nextQuestion++; + player2.setAsset(voice[voiceCount]); + voiceCount++; + player2.play(); + // 2.5์ดˆ ์ ์ • + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + Timer(Duration(milliseconds: 1000), () { + controller1.stop(); + }); + setState(() {}); + }, + child: Text("๋‹ค์Œ", style: TextStyle( + fontFamily: 'Pretendard', + fontSize: 16, fontWeight: FontWeight.w500, color: Color(0xffFFFFFF))), + ), + ),), + ), + ] + else if(nextQuestion == 13 && (ui_no || ui_yes))...[ + Container( + color: Color(0xffFFFFFF).withOpacity(0.0), + child: Padding( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 24), + child: Container( + width: screenSize.width, + height: 40, + child: ElevatedButton( + style: buttonChart().bluebtn3, + onPressed: () { + nextQuestion++; + if(ui_yes){ + yes = true; + player2.setAsset(yesVoice[voiceYesCount]); + voiceYesCount++; + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + Timer(Duration(milliseconds: 2000), () { + controller1.stop(); + }); + }else if (ui_no){ + no = true; + player2.setAsset(noVoice[voiceNoCount]); + voiceNoCount++; + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + Timer(Duration(milliseconds: 2000), () { + controller1.stop(); + }); + } + + setState(() {}); + }, + child: Text("๋‹ค์Œ"), + ), + ),), + ), + ] + else if (yes && nextYes == 0)...[ + Container( + color: Colors.white, + height: 48, + child: Padding( + padding: const EdgeInsets.only(bottom: 8.0, top: 8.0, left: 16,right: 16), + child: Stack( + children: [ + Container( + width: screenSize.width, + height: 48, + decoration: BoxDecoration( + color: Colors.white, + border: Border.all(color: selectRegret?Color(colorChart.blue):Color(0xffDDE7FD),), + borderRadius: BorderRadius.circular(30), + ), + ), + Positioned( + left: 15, + right: 30, + bottom: -4, + child: TextField( + textAlignVertical: TextAlignVertical.center, + maxLines: 1, + controller: regretController, + style: textStyle.bk14normal, + decoration: InputDecoration( + hintStyle: textStyle.grey14normal, + border: InputBorder.none, + hintText: '๋ฌด์—‡์ด ํ›„ํšŒ๋˜๋ƒ๋ฉด...'), + onChanged: (s) { + //text = s; + selectRegret = true; + }, + onTap: () {}, + ), + ), + Positioned( + left: screenSize.width - 81, + //right: 30, + bottom: 3, + top: 3, + child: ElevatedButton( + onPressed: () { + if(selectRegret){ + player2.setAsset(yesVoice[voiceYesCount]); + voiceYesCount++; + player2.play(); + + controller1.repeat( + min: 0, + max: 20, + period: const Duration(milliseconds: 1000) + ); + + Timer(Duration(milliseconds: 3000), () { + controller1.stop(); + }); + + nextYes++; + setState(() { + + }); + } + + }, + style: ElevatedButton.styleFrom( + backgroundColor: selectRegret? Color(colorChart.blue):Color(0xffDDE7FD), + fixedSize: const Size(23, 23), + shape: const CircleBorder(), + ), + child: Icon( + Icons.arrow_upward, + color: Colors.white, + size: 16, + )), + ), + ], + ), + ), + ) + + ] + else if (no && nextNo == 4)...[ + Container( + color: Colors.white, + height: 48, + child: Padding( + padding: const EdgeInsets.only(bottom: 8.0, top: 8.0, left: 16,right: 16), + child: Stack( + children: [ + Container( + width: screenSize.width, + height: 48, + decoration: BoxDecoration( + color: Colors.white, + border: Border.all(color: selectWant?Color(colorChart.blue):Color(0xffC0D2FC)), + borderRadius: BorderRadius.circular(30), + ), + ), + Positioned( + left: 15, + right: 30, + bottom: -4, + child: TextField( + textAlignVertical: TextAlignVertical.center, + maxLines: 1, + controller: regretController, + style: textStyle.bk14normal, + decoration: InputDecoration( + hintStyle: textStyle.grey14normal, + border: InputBorder.none, + hintText: '์–ด๋–ค ํ–‰๋™์ด๋‚˜ ๋ง์„ ํ•˜๊ณ ์‹ถ๋ƒ๋ฉด...'), + onChanged: (s) { + //text = s; + selectWant = true; + setState(() { + + }); + }, + onTap: () {}, + ), + ), + Positioned( + left: screenSize.width - 81, + //right: 30, + bottom: 3, + top: 3, + child: ElevatedButton( + onPressed: () { + if(selectWant){ + player2.setAsset(noVoice[voiceNoCount]); + voiceNoCount++; + player2.play(); + + controller1.repeat( + min: 0, + max: 20, + period: const Duration(milliseconds: 1000) + ); + + Timer(Duration(milliseconds: 4000), () { + controller1.stop(); + }); + + nextNo++; + setState(() { + + }); + } + }, + style: ElevatedButton.styleFrom( + backgroundColor: selectWant? Color(colorChart.blue):Color(0xffDDE7FD), + fixedSize: const Size(23, 23), + shape: const CircleBorder(), + ), + child: Icon( + Icons.arrow_upward, + color: Colors.white, + size: 16, + )), + ), + ], + ), + ), + ), + ] + else if(nextEnd == 4 && selectedNextTime)...[ + Container( + color: Color(0xffFFFFFF).withOpacity(0.0), + child: Padding( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 24), + child: Container( + + width: screenSize.width, + height: 40, + child: ElevatedButton( + style: buttonChart().bluebtn3, + onPressed: () { + questionsEnd.insertAll(5, [ + "๋„ค, ${home.user}๋‹˜.\n${whatTime}์‹œ๊ฐ„ ํ›„์— ๋‹ค์‹œ ๋งŒ๋‚˜์š”!", + "๋„ค, ${home.user}๋‹˜.\n${whatTime}์‹œ๊ฐ„ ํ›„์— ๋‹ค์‹œ ๋งŒ๋‚˜์š”!", + ]); + //decidedType = false; + nextEnd++; + player2.setAsset(endVoice[voiceEndCount]); + voiceEndCount++; + player2.play(); + // 2.5์ดˆ ์ ์ • + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + Timer(Duration(milliseconds: 3000), () { + controller1.stop(); + }); + setState(() {}); + }, + child: Text("๋‹ค์Œ", style: TextStyle( + fontFamily: 'Pretendard', + fontSize: 16, fontWeight: FontWeight.w500, color: Color(0xffFFFFFF))), + ), + ),), + ), + ] + else if(nextEnd == 6)...[ + Container( + color: Color(0xffFFFFFF).withOpacity(0.0), + child: Padding( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 24), + child: Container( + + width: screenSize.width, + height: 40, + child: ElevatedButton( + style: buttonChart().bluebtn3, + onPressed: () { + //decidedType = false; + //checkSignUp = false; + //checkSignIn = true; + checkSignUp = false; + var now = DateTime.now(); + sentDate = DateFormat('yyyy-MM-dd hh:mm:ss').format(now.toLocal()); + saveCon(sign_in.userAccessToken, "1B", sentDate); + + setState(() {}); + main.player.stop(); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => MyScreenPage(title: '์Šคํฌ๋ฆฐ ํŽ˜์ด์ง€',))); + }, + child: Text("์™„๋ฃŒ", style: TextStyle( + fontFamily: 'Pretendard', + fontSize: 16, fontWeight: FontWeight.w500, color: Color(0xffFFFFFF))), + ), + ),), + ), + ] + ], + ), + )), + ) + + ); + + } +} + diff --git a/client/lib/conversation/early_period/memory.dart b/client/lib/conversation/early_period/memory.dart new file mode 100644 index 0000000..48af964 --- /dev/null +++ b/client/lib/conversation/early_period/memory.dart @@ -0,0 +1,1393 @@ +import 'dart:async'; +import 'dart:convert'; +import 'package:flutter/material.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter_svg/svg.dart'; +import 'package:client/conversation/early_period/early_coach_mark.dart'; +import 'package:client/home.dart' as home; +import 'package:http/http.dart' as http; +import 'package:client/progressbar/animation_progressbar.dart'; +import 'package:client/style.dart'; +import 'package:just_audio/just_audio.dart'; +import 'package:flutter_gif/flutter_gif.dart'; +import 'package:client/sign/sign_in.dart' as sign_in; +import 'package:client/main.dart'as main; + +/// ์ดˆ๊ธฐ๋Œ€ํ™”-๊ธฐ์–ต + +AudioPlayer player2 = AudioPlayer(); + +late FlutterGifController controller1, controller2, controller3; + +List voice =[ + "assets/voice/early/memory/memory1.mp3", "assets/voice/early/memory/memory2.mp3", "assets/voice/early/memory/memory3.mp3", + "assets/voice/early/memory/memory4.mp3", "assets/voice/early/memory/memory5.mp3", "assets/voice/early/memory/memory6.mp3", + "assets/voice/early/memory/memory7.mp3","assets/voice/early/memory/memory8.mp3","", "assets/voice/early/memory/memory9.mp3","", + "assets/voice/early/memory/memory10.mp3", "assets/voice/early/memory/memory11.mp3", "assets/voice/early/memory/memory12.mp3", "", + "assets/voice/early/memory/memory13.mp3", "assets/voice/early/memory/memory14.mp3", "assets/voice/early/memory/memory15.mp3", +]; + +List griefVoice =[ + "assets/voice/early/memory/memorysad1.mp3", "assets/voice/early/memory/memorysad2.mp3", "assets/voice/early/memory/memorysad3.mp3", + "assets/voice/early/memory/memorysad4.mp3", "assets/voice/early/memory/memorysad5.mp3", "assets/voice/early/memory/memorysad6.mp3", + "assets/voice/early/memory/memorysad7.mp3", +]; + +List happyVoice =[ + "assets/voice/early/memory/memoryhappy1.mp3", "assets/voice/early/memory/memoryhappy2.mp3", "assets/voice/early/memory/memoryhappy3.mp3", + "assets/voice/early/memory/memoryhappy4.mp3", "assets/voice/early/memory/memoryhappy5.mp3", "assets/voice/early/memory/memoryhappy6.mp3", + "assets/voice/early/memory/memoryhappy7.mp3", "assets/voice/early/memory/memoryhappy8.mp3", "assets/voice/early/memory/memoryhappy9.mp3", + "assets/voice/early/memory/memoryhappy10.mp3", "assets/voice/early/memory/memoryhappy11.mp3", +]; + + +class MemoryPage extends StatefulWidget { + + static Future navigatorPush(BuildContext context) async { + return Navigator.push( + context, + MaterialPageRoute( + builder: (_) => MemoryPage(), + ), + ); + } + + @override + _MemoryPageState createState() => _MemoryPageState(); +} + +class _MemoryPageState extends State with TickerProviderStateMixin { + + bool grief = false; //gpt๊ฒฐ๊ณผ๊ฐ€ ์Šฌํ”” + bool happy = false; //gpt๊ฒฐ๊ณผ๊ฐ€ ํ–‰๋ณต + + int nextGrief = 0; + int nextHappy = 0; + + bool finish = false; // ๋ฉ”๋ชจ๋ฆฌ์–ผ ๋ฐ ๋งˆ๋ฌด๋ฆฌ + + bool selectedNextTime = false; + bool chooseTime = false; + String whatTime = ""; + + bool selectedLocate = false; + bool chooseLocate = false; + String whatLocate = ""; + + bool selectedHow = false; + bool chooseHow = false; + String whatHow = ""; + + // ํ…์ŠคํŠธ ์—๋””ํŒ… ์ปจํŠธ๋กค๋Ÿฌ๋ฅผ ์ƒ์„ฑํ•˜์—ฌ ํ•„๋“œ์— ํ• ๋‹น + final nextTimeController = TextEditingController(); // nextQuestion = 7์ผ๋•Œ + final locateController = TextEditingController(); // nextQuestion = 7์ผ๋•Œ + final howController = TextEditingController(); // nextQuestion = 7์ผ๋•Œ + final whatController = TextEditingController(); // nextQuestion = 7์ผ๋•Œ + final emotionController = TextEditingController(); // nextQuestion = 7์ผ๋•Œ + + bool setWhat = false; + bool setEmotion = false; + + + FocusNode _focusNode = FocusNode(); + + @override + void initState() { + super.initState(); + + main.play = true; + main.player.setAsset(main.musics[1]); + main.player.play(); + + // ์Œ์› ์ ์šฉ + for(int i= 0 ; i < voice.length; i++){ + player2.setAudioSource(AudioSource.uri( + Uri.parse(voice[i])) + ); + } + + controller1 = FlutterGifController(vsync: this); + controller2 = FlutterGifController(vsync: this); + controller3 = FlutterGifController(vsync: this); + + player2.setAsset(voice[voiceCount]); + voiceCount++; + player2.play(); + + // 2.5์ดˆ ์ ์ • + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + Timer(Duration(milliseconds: 1500), () { + controller1.stop(); + }); + + + controller3.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 2000) + ); + Timer(Duration(milliseconds: 1000), () { + controller3.stop(); + }); + + _focusNode.addListener(_onFocusChange); + } + + void _onFocusChange() { + if (_focusNode.hasFocus) { + // ํ‚ค๋ณด๋“œ ์˜ฌ๋ฆฌ๊ธฐ + FocusScope.of(context).requestFocus(_focusNode); + } + } + + @override + void dispose() async { + super.dispose(); + } + + + List introText =[]; + int nextQuestion = 0; + int voiceCount = 0; + + int happyVoiceCount = 0; + int griefVoiceCount = 0; + + double containerWidth1 = 35.0; + void updateContainerWidth1() { + // TextField ๋‚ด์šฉ์˜ ๊ธธ์ด์— ๋”ฐ๋ผ Container ๊ธธ์ด ์—…๋ฐ์ดํŠธ + setState(() { + containerWidth1 = 35.0 + (nextTimeController.text.length.toDouble() * 5.0); + }); + } + double containerWidth2 = 35.0; + void updateContainerWidth2() { + // TextField ๋‚ด์šฉ์˜ ๊ธธ์ด์— ๋”ฐ๋ผ Container ๊ธธ์ด ์—…๋ฐ์ดํŠธ + setState(() { + containerWidth2 = 35.0 + (nextTimeController.text.length.toDouble() * 5.0); + }); + } + double containerWidth3 = 35.0; + void updateContainerWidth3() { + // TextField ๋‚ด์šฉ์˜ ๊ธธ์ด์— ๋”ฐ๋ผ Container ๊ธธ์ด ์—…๋ฐ์ดํŠธ + setState(() { + containerWidth3 = 35.0 + (nextTimeController.text.length.toDouble() * 5.0); + }); + } + + // ${home.user} + + List questions0 =[ + "์ข‹์•„์š”, ${home.user}๋‹˜.", // 0 + "์‚ฌ์‹ค...\n${home.user}๋‹˜์˜ ๋งˆ์Œ์—", // 1 + "${home.puppy}๋ฅผ ํ–ฅํ•œ\n๊ทธ๋ฆฌ์›€์ด ๊ฐ€๋“ํ•ด ๋ณด์—ฌ์š”.", // 2 + "${home.puppy}์™€์˜ ๊ธฐ์–ต์„\n๋– ์˜ฌ๋ฆฌ๋ฉด", // 3 + "${home.user}๋‹˜์˜\n๊ทธ๋ฆฌ์šด ๋งˆ์Œ์„ ๋‹ฌ๋ž  ์ˆ˜ ์žˆ์ง€ ์•Š์„๊นŒ์š”?", // 4 + "์˜ค๋Š˜์€ ${home.puppy}์™€์˜\n๊ธฐ์–ต์— ๋Œ€ํ•ด ์–˜๊ธฐํ•ด๋ด์š”.", // 5 + "${home.puppy}์™€ ํ•จ๊ป˜ํ•œ\nํ•œ ๊ฐ€์ง€ ๊ธฐ์–ต์„ ๋– ์˜ฌ๋ ค์ฃผ์„ธ์š”.", // 6 + "๊ทธ๋‚ ์€ ์–ด๋–ค ๋‚ ์”จ์˜€๋‚˜์š”?", // 7 + "๊ทธ๋‚ ์€ ์–ด๋–ค ๋‚ ์”จ์˜€๋‚˜์š”?", // 8 + + // "๊ทธ๋ ‡๊ตฐ์š”. ()ํ•œ ๋‚ ์”จ์—\n์•„์ด์™€ ์–ด๋””์— ์žˆ์—ˆ๋‚˜์š”?", // 9 + // "๊ทธ๋ ‡๊ตฐ์š”. ()ํ•œ ๋‚ ์”จ์—\n์•„์ด์™€ ์–ด๋””์— ์žˆ์—ˆ๋‚˜์š”?", // 10 + // + // "()ํ•œ ๋‚ ์”จ์—\n()์—์„œ ์žˆ์—ˆ๊ตฐ์š”!", // 11 + // "๋ณดํ˜ธ์ž๋‹˜๊ณผ\n์•„์ด๋Š” ๋ญ˜ ํ•˜๊ณ  ์žˆ์—ˆ์„๊นŒ์š”?", // 12 + // "๋ณดํ˜ธ์ž๋‹˜๊ณผ\n์•„์ด๋Š” ๋ญ˜ ํ•˜๊ณ  ์žˆ์—ˆ์„๊นŒ์š”?", // 13 ๋…ธ + // + // "๊ทธ๋ ‡๋‹ค๋ฉด ๋ณดํ˜ธ์ž๋‹˜๊ณผ\n์•„์ด๋Š” ์–ด๋–ค ๋ชจ์Šต์œผ๋กœ ๋ณด์ด๋‚˜์š”?", // 14 13 + // "๊ทธ๋ ‡๋‹ค๋ฉด ๋ณดํ˜ธ์ž๋‹˜๊ณผ\n์•„์ด๋Š” ์–ด๋–ค ๋ชจ์Šต์œผ๋กœ ๋ณด์ด๋‚˜์š”?", // 15 14 + // + // "์šฐ๋ฆฌ ์•„์ด์™€\n๋ณดํ˜ธ์ž๋‹˜์˜", // 16 15 + // "()ํ•œ ๋ชจ์Šต์„\n๋– ์˜ฌ๋ ค๋ณด๋ฉด", // 17 16 + // "๋ณดํ˜ธ์ž๋‹˜์˜ ๋งˆ์Œ์€\n์–ด๋–ค ๊ฒƒ ๊ฐ™๋‚˜์š”?", // 18 17 + // "๊ณ ๋ฏผ์ค‘" // 19 18 + ]; +// ์Šฌํ”” ์„ ํƒ์‹œ + List question1_0= [ + "${home.user}๋‹˜!", + "์ง€๊ธˆ ${home.puppy}์™€์˜\n๊ธฐ์–ต์„ ์ƒ๊ฐํ•˜๋ฉฐ ๋А๋ผ๋Š” ๊ฐ์ •์€", + "๋„ˆ๋ฌด๋‚˜ ๋‹น์—ฐํ•œ ๊ฒƒ์ด์—์š”.", + "๊ทธ๋ฆฌ๊ณ  ์ด ๊ฐ์ •์„\n์ถฉ๋ถ„ํžˆ ๋А๋ผ๋Š” ๊ฒƒ๋„ ์ •๋ง ์ค‘์š”ํ•ด์š”.", + "ํ•˜์ง€๋งŒ\n์ €์˜ ๋„์›€๋งŒ์œผ๋กœ ๋ถ€์กฑํ•  ์ˆ˜ ์žˆ๊ธฐ์—", + "โ€˜ํ•จ๊ป˜ํ• ๊ฐœโ€™์—์„œ\n๋‹ค๋ฅธ ์‚ฌ๋žŒ๋“ค์˜ ์ด์•ผ๊ธฐ๋ฅผ ๋“ฃ๊ณ ", + "๋„์›€์„ ์š”์ฒญํ•ด ๋ณด๋Š” ๊ฒƒ์„ ์ถ”์ฒœ๋“œ๋ ค์š”!", + ]; + +// ํ–‰๋ณต ์„ ํƒ์‹œ + List questions1_1 =[ + "${home.user}๋‹˜!", + "${home.puppy}์™€์˜\n๊ธฐ์–ต์„ ๋– ์˜ฌ๋ ค๋ณด๋ฉด", + "๋งˆ๋ƒฅ ์Šฌํ”„๊ธฐ๋งŒ ํ•˜์ง€๋Š”\n์•Š์€ ๊ฒƒ ๊ฐ™์•„์š”!", + "${home.user}๋‹˜์˜ ๋งˆ์Œ์ด\n์ž ์‹œ๋™์•ˆ์€ ํ–‰๋ณตํ–ˆ๊ธธ ๋ฐ”๋ผ์š”.", + "์ดํ›„์—๋„ ${home.user}๋‹˜์€\n${home.puppy}๋ฅผ ์ƒ๊ฐํ•˜๋‹ค๋ณด๋ฉด", + "๋ถ„๋ช… ์Šฌํ”ˆ ๊ฐ์ •์ด ์ƒ๊ฒจ๋‚  ์ˆ˜ ์žˆ์–ด์š”.", + "๊ทธ๋Ÿด๋•Œ๋Š” โ€˜ํ•จ๊ป˜ํ• ๊ฐœโ€™์—์„œ\n๋‹ค๋ฅธ ์‚ฌ๋žŒ๋“ค์˜ ์ด์•ผ๊ธฐ๋ฅผ ๋“ฃ๊ณ ", + "๋„์›€์„ ์š”์ฒญํ•ด ๋ณด๋Š” ๊ฒƒ์„ ์ถ”์ฒœ๋“œ๋ ค์š”!", + + ]; + + List questions1_2 =[ + /// "๋ณดํ˜ธ์ž๋‹˜โ€ฆ", + // "๋‹ค๋ฅธ ์‚ฌ๋žŒ๋“ค๊ณผ ํ•จ๊ป˜\n๋„์›€์„ ์ฃผ๊ณ  ๋ฐ›์œผ๋ฉด์„œ", + // "์•ž์œผ๋กœ ๋ณดํ˜ธ์ž๋‹˜์˜ ๋งˆ์Œ์—\n์•ˆ์ •์ด ์ฐพ์•„์˜ค๊ธฐ๊นŒ์ง€", + // "๋„์›€์ด ๋˜์—ˆ์œผ๋ฉด\nํ•˜๋Š” ๋ฐ”๋žŒ์ด์—์š”.", + ]; + + List questionsEnd =[ + /// "๋ณดํ˜ธ์ž๋‹˜โ€ฆ", + // "์ด์ œ ์šฐ๋ฆฌ๊ฐ€ ๋‹ค์‹œ\n๋งŒ๋‚˜๊ฒŒ ๋  ์‹œ๊ฐ„์„ ์•Œ๋ ค์ฃผ์„ธ์š”.", + // "๋„ค, ๋ณดํ˜ธ์ž๋‹˜.\n()์‹œ๊ฐ„ ํ›„์— ๋‹ค์‹œ ๋งŒ๋‚˜์š”!", + ]; + + String result = "์Šฌํ””"; + late Map parsedResponseUser; + void sendAnswer(String aToken, String con) async { + // API ์—”๋“œํฌ์ธํŠธ URL + String apiUrl = 'http://3.38.1.125:8080/conversation/emotion/stage1/1'; + + // ์š”์ฒญ ๋ณธ๋ฌธ ๋ฐ์ดํ„ฐ + var data = { + "userAnswer": con, + }; + + // ํ—ค๋” ์ •๋ณด ์„ค์ • + Map headers = { + 'Authorization': 'Bearer $aToken', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• + 'Content-Type': 'application/json', // ์˜ˆ: JSON ์š”์ฒญ์ธ ๊ฒฝ์šฐ ํ—ค๋” ์„ค์ • + }; + + // HTTP GET ์š”์ฒญ ๋ณด๋‚ด๊ธฐ + var response = await http.post( + Uri.parse(apiUrl), + body: json.encode(data), + headers: headers, // ํ—ค๋” ์ถ”๊ฐ€ + ); + + ///var jsonResponse = utf8.decode(response.bodyBytes); + // HTTP ์‘๋‹ต ์ƒํƒœ ํ™•์ธ + if (response.statusCode == 200) { + // ์‘๋‹ต ๋ฐ์ดํ„ฐ๋ฅผ JSON ํ˜•์‹์œผ๋กœ ๋””์ฝ”๋”ฉ + print("๋Œ€ํ™” ๋‹จ๊ณ„ ๋„ฃ๊ธฐ ์„ฑ๊ณต"); + print('์„œ๋ฒ„๋กœ๋ถ€ํ„ฐ ๋ฐ›์€ ๋‚ด์šฉ ๋ฐ์ดํ„ฐ(์‚ฌ์šฉ์ž ๊ฐ์ • ์ •๋ณด): ${response.body}'); + var jsonResponse = utf8.decode(response.bodyBytes); + parsedResponseUser = json.decode(jsonResponse); + result = parsedResponseUser['emotion']; + print(result); + + if(result == "์Šฌํ””"){ + grief = true; + + nextQuestion++; + player2.setAsset(griefVoice[happyVoiceCount]); + griefVoiceCount++; + player2.play(); + + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + Timer(Duration(seconds: 1), () { + controller1.stop(); + }); + }else{ + happy = true; + + nextQuestion++; + player2.setAsset(happyVoice[happyVoiceCount]); + happyVoiceCount++; + player2.play(); + + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + Timer(Duration(seconds: 1), () { + controller1.stop(); + }); + } + + + setState(() { + }); + + } else { + // ์š”์ฒญ์ด ์‹คํŒจํ•œ ๊ฒฝ์šฐ ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌ + print('HTTP ์š”์ฒญ ์‹คํŒจ: ${response.statusCode}'); + } + } + + + @override + Widget build(BuildContext context) { + MediaQueryData deviceData = MediaQuery.of(context); + Size screenSize = deviceData.size; + return + Container( + color: Color(0xffFCCBCD), + child: GestureDetector( + onTap: (){ + SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: [SystemUiOverlay.top]); + print("ํ™•์ธ: " + nextQuestion.toString()); + + if(nextQuestion < 8){ + nextQuestion++; // ์ธํŠธ๋กœ ์‹œ์ž‘ ํ›„ count + player2.setAsset(voice[voiceCount]); + voiceCount++; + player2.play(); + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + controller2.repeat( + min: 0, + max: 32, + period: const Duration(milliseconds: 2000) + ); + if(nextQuestion == 1){ + Timer(Duration(milliseconds: 2000), () { + controller1.stop(); + }); + Timer(Duration(milliseconds: 2000), () { + controller2.stop(); + }); + } else if(nextQuestion == 2){ + Timer(Duration(milliseconds: 3000), () { + controller1.stop(); + }); // ok + Timer(Duration(milliseconds: 2000), () { + controller2.stop(); + }); + } else if(nextQuestion == 3){ + Timer(Duration(milliseconds: 2000), () { + controller1.stop(); + }); + } else if(nextQuestion == 4){ + Timer(Duration(milliseconds: 4000), () { + controller1.stop(); + }); + } + else if(nextQuestion == 5){ + Timer(Duration(milliseconds: 3500), () { + controller1.stop(); + }); + } + else if(nextQuestion == 6){ + Timer(Duration(milliseconds: 3500), () { + controller1.stop(); + }); + } + else if(nextQuestion == 7){ + Timer(Duration(milliseconds: 2500), () { + controller1.stop(); + }); + } + else if(nextQuestion == 8){ + // ํ•„์š”์—†์Œ + // Timer(Duration(milliseconds: 3000), () { + // controller1.stop(); + // }); + } + } + else if(nextQuestion == 8){ + // ์–ด๋–ค ๋‚ ์”จ? + // controller1.repeat( + // min: 0, + // max: 30, + // period: const Duration(milliseconds: 1000) + // ); + // Timer(Duration(seconds: 3), () { + // controller1.stop(); + // }); + } + else if(nextQuestion == 9){ + nextQuestion++; + player2.setAsset(voice[voiceCount]); + voiceCount++; + player2.play(); + // 2.5์ดˆ ์ ์ • + // controller1.repeat( + // min: 0, + // max: 30, + // period: const Duration(milliseconds: 1000) + // ); + // Timer(Duration(seconds: 4), () { + // controller1.stop(); + // }); + } + else if(nextQuestion == 10){ + // ์–ด๋””์„œ ์žˆ์—ˆ๋Š”์ง€? + } + else if(nextQuestion >10 && nextQuestion <12){ + nextQuestion++; + player2.setAsset(voice[voiceCount]); + voiceCount++; + player2.play(); + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + if(nextQuestion == 12){ + Timer(Duration(milliseconds: 3500), () { + controller1.stop(); + }); + } + } + else if(nextQuestion == 12){ + // ๋ญ˜ํ•˜๊ณ  ์žˆ์—ˆ๋Š”์ง€? + // controller1.repeat( + // min: 0, + // max: 30, + // period: const Duration(milliseconds: 1000) + // ); + // Timer(Duration(milliseconds: 4000), () { + // controller1.stop(); + // }); + + } + else if(nextQuestion == 13){ + nextQuestion++; + player2.setAsset(voice[voiceCount]); + voiceCount++; + player2.play(); + // controller1.repeat( + // min: 0, + // max: 30, + // period: const Duration(milliseconds: 1000) + // ); + // Timer(Duration(seconds: 5), () { + // controller1.stop(); + // }); + } + else if(nextQuestion == 14){ + // ์–ด๋–ค ๋ชจ์Šต์œผ๋กœ ๋ณด์ด๋Š”์ง€? + } + else if(nextQuestion > 14 && nextQuestion < 17){ + nextQuestion++; + player2.setAsset(voice[voiceCount]); + voiceCount++; + player2.play(); + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + if(nextQuestion == 16){ + Timer(Duration(milliseconds: 2500), () { + controller1.stop(); + }); + } else if(nextQuestion == 17){ + Timer(Duration(milliseconds: 3000), () { + controller1.stop(); + }); + } + } + else if(nextQuestion == 17){ + + } + else if(nextQuestion == 18){ + // gpt๋กœ๋ถ€ํ„ฐ ๋‹ต๋ณ€ ๊ฐ€์ ธ์˜ค๊ธฐ + // happy = true; + // nextQuestion++; + // player2.setAsset(happyVoice[happyVoiceCount]); + // happyVoiceCount++; + // player2.play(); + + // grief = true; + // nextQuestion++; + // player2.setAsset(griefVoice[happyVoiceCount]); + // griefVoiceCount++; + // player2.play(); + // + // controller1.repeat( + // min: 0, + // max: 30, + // period: const Duration(milliseconds: 1000) + // ); + // Timer(Duration(seconds: 1), () { + // controller1.stop(); + // }); + } + // ์—ฌ๊ธฐ์„œ๋ถ€ํ„ฐ๋Š” ๊ฐ์ • + else if(happy && nextHappy < 7){ + nextHappy++; + player2.setAsset(happyVoice[happyVoiceCount]); + happyVoiceCount++; + player2.play(); + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + + controller3.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 2000) + ); + + if(nextHappy == 1){ + Timer(Duration(milliseconds: 2000), () { + controller1.stop(); + }); + } + else if(nextHappy == 2){ + Timer(Duration(milliseconds: 3000), () { + controller1.stop(); + }); + Timer(Duration(milliseconds: 1000), () { + controller3.stop(); + }); + } + else if(nextHappy == 3){ + Timer(Duration(milliseconds: 4000), () { + controller1.stop(); + }); + } + else if(nextHappy == 4){ + Timer(Duration(milliseconds: 3000), () { + controller1.stop(); + }); + } + else if(nextHappy == 5){ + Timer(Duration(milliseconds: 3000), () { + controller1.stop(); + }); + } + else if(nextHappy == 6){ + Timer(Duration(seconds: 4), () { + controller1.stop(); + }); + } + else if(nextHappy == 7){ + Timer(Duration(seconds: 3), () { + controller1.stop(); + }); + } + } + else if(grief && nextGrief<6){ + nextGrief++; + player2.setAsset(griefVoice[griefVoiceCount]); + griefVoiceCount++; + player2.play(); + + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + + controller2.repeat( + min: 0, + max: 32, + period: const Duration(milliseconds: 2000) + ); + + if(nextGrief == 1){ + Timer(Duration(milliseconds: 4000), () { + controller1.stop(); + }); + Timer(Duration(milliseconds: 2000), () { + controller2.stop(); + }); + } + else if(nextGrief == 2){ + Timer(Duration(milliseconds: 2000), () { + controller1.stop(); + }); + Timer(Duration(milliseconds: 2000), () { + controller2.stop(); + }); + } + else if(nextGrief == 3){ + Timer(Duration(milliseconds: 5000), () { + controller1.stop(); + }); + } + else if(nextGrief == 4){ + Timer(Duration(milliseconds: 3000), () { + controller1.stop(); + }); + } + else if(nextGrief == 5){ + Timer(Duration(milliseconds: 3500), () { + controller1.stop(); + }); + } + else if(nextGrief == 6){ + Timer(Duration(milliseconds: 3000), () { + controller1.stop(); + }); + } + } + else if(happy && nextHappy == 7){ + // ๋ฐ‘์— ๋ฒ„ํŠผ์ด ์ƒ๊ฒจ์„œ ์ด๋™ + } + else if(grief && nextGrief == 6){ + // ๋ฐ‘์— ๋ฒ„ํŠผ์ด ์ƒ๊ฒจ์„œ ์ด๋™ + } + + setState(() { + }); + }, + child: Scaffold( + backgroundColor: Colors.transparent, + appBar: AppBar( + //title: Text("๊ธฐ์–ตํ• ๊ฐœ", style: TextStyle(fontSize:16, color: Colors.white ),), + //centerTitle: true, + leading: IconButton( + icon: SvgPicture.asset( + 'assets/images/conversation/home_icon.svg', + ), + onPressed: () => Navigator.of(context).pop(), + ), + backgroundColor: Colors.transparent, + elevation: 0.0, + ), + //extendBodyBehindAppBar: true, + body: + SingleChildScrollView( + child: Container( + child: Column( + children: [ + SizedBox(height: 3,), + Container( + width: screenSize.width, + height: 25, + child: Padding( + padding: EdgeInsets.only( left:16, right: 16), + child: Center( + child: FAProgressBar( + currentValue: 40, + size: 5, + backgroundColor: Colors.white, + ) + ), + ), + ), + Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children:[ + SizedBox( + height: 10, + ), + Stack( + children: [ + Container( + height: 157, + width: screenSize.width, + child: + Stack( + children: [ + Center(child: SvgPicture.asset('assets/images/conversation/bubble.svg',fit: BoxFit.fill,),), + Container( + padding: const EdgeInsets.symmetric(horizontal: 32, vertical: 12, ), + child: Center( + child: Column( + children: [ + if(grief == false && happy == false)...[ + if(questions0[nextQuestion].toString().contains("\n"))...[ + SizedBox(height: 28,), + Text( + questions0[nextQuestion], + textAlign: TextAlign.center, + style: textStyle.bubbletext, + ), + ]else...[ + SizedBox(height: 42,), + Text( + questions0[nextQuestion], + textAlign: TextAlign.center, + style: textStyle.bubbletext, + ), + ], + ] + // ํ–‰๋ณต์ผ์‹œ + else if (happy) ...[ + if(questions1_1[nextHappy].toString().contains("\n"))...[ + SizedBox(height: 28,), + Text( + questions1_1[nextHappy], + textAlign: TextAlign.center, + style: textStyle.bubbletext, + ), + ]else...[ + SizedBox(height: 42,), + Text( + questions1_1[nextHappy], + textAlign: TextAlign.center, + style: textStyle.bubbletext, + ), + ], + // ์Šฌํ””์ผ ์‹œ + ] else if (grief) ...[ + if(question1_0[nextGrief].toString().contains("\n"))...[ + SizedBox(height: 28,), + Text( + question1_0[nextGrief], + textAlign: TextAlign.center, + style: textStyle.bubbletext, + ), + ]else...[ + SizedBox(height: 42,), + Text( + question1_0[nextGrief], + textAlign: TextAlign.center, + style: textStyle.bubbletext, + ), + ], + ] + ], + ) + ) + ), + ], + ) + ), + // ๋ฌด์ง€ ์œ„์น˜ + if(nextQuestion < 8 || nextQuestion == 9 || (nextQuestion>10 && nextQuestion<14) || (nextQuestion > 14 && nextQuestion < 18) || nextQuestion>18)...[ + Stack( + children: [ + // ์œ ์ € ์œ„์น˜ + Column( + children: [ + SizedBox(height: 420,), + Container( + child: SvgPicture.asset( + 'assets/images/conversation/user7.svg', + height: 282, + width: screenSize.width, + ), + ), + ], + ), + Column( + children: [ + SizedBox(height: 144,), + Container( + width: screenSize.width, + height: 375, + child: + Stack( + children: [ + + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child: Image.asset('assets/images/conversation/gif/muji_ear.gif', + fit: BoxFit.cover,),), + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child: Image.asset('assets/images/conversation/gif/muji_base.gif', fit: BoxFit.cover,),), + + if(nextQuestion == 2 || nextGrief == 1 || nextGrief == 2)...[ + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child: GifImage( + controller: controller2, + image: const AssetImage("assets/images/conversation/gif/sad_muji.gif"), + ), + ), + ] else if(nextQuestion == 0 || nextQuestion == 11 || nextHappy == 2)...[ + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child: GifImage( + controller: controller3, + image: const AssetImage("assets/images/conversation/gif/smile_muji.gif"), + ), + ), + ] + else...[ + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child: Image.asset('assets/images/conversation/gif/muji_base_eye.gif', + fit: BoxFit.cover,),), + ], + + + // Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + // child: Image.asset('assets/images/conversation/gif/muji_base_eye.gif', + // fit: BoxFit.cover,),), + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child:GifImage( + controller: controller1, + image: const AssetImage("assets/images/conversation/gif/muji_mouth1.gif"), + ), + // Image.asset('assets/images/conversation/gif/muji_mouth1.gif', fit: BoxFit.cover,), + ) + ], + ) + + // SvgPicture.asset( + // 'assets/images/conversation/con_muji.svg', fit: BoxFit.cover, + // ), + ), + ], + ), + ], + ), + ] + else if(nextQuestion == 8)...[ + Padding( + padding: EdgeInsets.only(top:175, left:45), + child: Container( + width: 275, + height: 120, + child: Column( + children: [ + Row( + children: [ + SizedBox(width: 75,), + Container( + padding: EdgeInsets.only(bottom:16), + width: containerWidth1, + child: TextField( + style: textStyle.inputfield, + onTap: (){ + chooseTime = true; + whatTime = nextTimeController.text; + setState(() { + }); + + }, + onChanged: (text){ + selectedNextTime = true; + whatTime = nextTimeController.text; + updateContainerWidth1(); + }, + controller: nextTimeController, + decoration: InputDecoration( + hintText: '์–ด๋–ค', + contentPadding: EdgeInsets.only(top: 16), + suffixStyle: TextStyle(color: Color(0xff83A8FF), fontSize: 20,), + hintStyle: textStyle.field, + counterText:'', + ), + maxLength: 10, + ),), + Text(" ๋‚ ์”จ์˜€์–ด์š”.", style: TextStyle( + fontFamily: 'Pretendard', + fontSize: 20, fontWeight: FontWeight.w500, color: Colors.black),), + ],), + SizedBox(height: 8,), + // DateFormat('MM/dd HH:mm').format(DateTime.parse(parsedResponseHR[index]['createdAt'])) + // DateFormat('MM/dd HH:mm').format(DateTime.now().add(Duration(hours: whatTime))) + Text("10์ž ์ด๋‚ด", style: TextStyle( + fontFamily: 'Pretendard', + fontSize: 16, fontWeight: FontWeight.w500, color: Color(0xffAAAAAA)),), + + ],), + ), + ), + ] + else if(nextQuestion == 10)...[ + Padding( + padding: EdgeInsets.only(top:175, left:45), + child: Container( + width: 275, + height: 120, + child: Column( + children: [ + Row( + children: [ + SizedBox(width: 75,), + Container(width: containerWidth2, + padding: EdgeInsets.only(bottom:16), + child: TextField( + style: textStyle.inputfield, + onTap: (){ + chooseLocate = true; + whatLocate = locateController.text; + setState(() { + }); + }, + onChanged: (text){ + updateContainerWidth2(); + selectedLocate = true; + whatLocate = locateController.text; + }, + controller: locateController, + decoration: InputDecoration( + hintText: '์–ด๋””', + contentPadding: EdgeInsets.only(top: 16), + suffixStyle: TextStyle(color: Color(0xff83A8FF), fontSize: 20,), + hintStyle: textStyle.field, + counterText:'', + //labelText: '๋ช‡', + ), + maxLength: 10, + ),), + Text("์— ์žˆ์—ˆ์–ด์š”.", style: TextStyle( + fontFamily: 'Pretendard', + fontSize: 20, fontWeight: FontWeight.w500, color: Colors.black),), + ],), + SizedBox(height: 8,), + // DateFormat('MM/dd HH:mm').format(DateTime.parse(parsedResponseHR[index]['createdAt'])) + // DateFormat('MM/dd HH:mm').format(DateTime.now().add(Duration(hours: whatTime))) + Text("10์ž ์ด๋‚ด", style: TextStyle( + fontFamily: 'Pretendard', + fontSize: 16, fontWeight: FontWeight.w500, color: Color(0xffAAAAAA)),), + + ],), + ), + ), + ] + else if(nextQuestion == 14)...[ + Padding( + padding: EdgeInsets.only(top:175, left:45), + child: Container( + width: 275, + height: 120, + child: Column( + children: [ + Row( + children: [ + SizedBox(width: 75,), + Container( + padding: EdgeInsets.only(bottom:16), + width: containerWidth3, + child: TextField( + style: textStyle.inputfield, + onTap: (){ + chooseHow = true; + + whatHow = howController.text; + setState(() { + }); + }, + onChanged: (text){ + updateContainerWidth3(); + selectedHow = true; + whatHow = howController.text; + }, + controller: howController, + decoration: InputDecoration( + hintText: '์–ด๋–ค', + contentPadding: EdgeInsets.only(top: 16), + suffixStyle: TextStyle(color: Color(0xff83A8FF), fontSize: 20,), + hintStyle: textStyle.field, + counterText:'', + ), + maxLength: 300, + ),), + Text("๋ชจ์Šต์ด์—์š”.", style: TextStyle( + fontFamily: 'Pretendard', + fontSize: 20, fontWeight: FontWeight.w500, color: Colors.black),), + ],), + SizedBox(height: 8,), + // DateFormat('MM/dd HH:mm').format(DateTime.parse(parsedResponseHR[index]['createdAt'])) + // DateFormat('MM/dd HH:mm').format(DateTime.now().add(Duration(hours: whatTime))) + Text("10์ž ์ด๋‚ด", style: TextStyle( + fontFamily: 'Pretendard', + fontSize: 16, fontWeight: FontWeight.w500, color: Color(0xffAAAAAA)),), + + ],), + ), + ), + ] + // chat gpt ๋‹ต๋ณ€ ๋ฐ›์•„์˜ค๊ธฐ ์ „ ๊ณ ๋ฏผํ•˜๋Š” ๋ฌด์ง€ + else if(nextQuestion == 18)...[ + Stack( + children: [ + // ์œ ์ € ์œ„์น˜ + Column( + children: [ + SizedBox(height: 420,), + Container( + child: SvgPicture.asset( + 'assets/images/conversation/user7.svg', + height: 282, + width: screenSize.width, + ), + ), + ], + ), + Column( + children: [ + SizedBox(height: 144,), + Container( + width: screenSize.width, + height: 375, + child: + Stack( + children: [ + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child: Image.asset('assets/images/conversation/gif/think_back.gif', + fit: BoxFit.cover,), + ), + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child: + Image.asset('assets/images/conversation/gif/thinking1.gif', fit: BoxFit.cover,), + // GifImage( + // controller: controller1, + // image: const AssetImage("assets/images/conversation/gif/think_muji.gif"), + // ), + ), + ], + ) + // SvgPicture.asset( + // 'assets/images/conversation/con_muji.svg', fit: BoxFit.cover, + // ), + ), + ], + ), + ], + ), + ] + ], + ), + + ], + ), + ], + ), + ), + ), + + // // nextQuestion ์ด 3๊ณผ 7์ผ๋•Œ ๋“ฑ์žฅ + bottomSheet: Padding( + padding: EdgeInsets.only( + bottom: MediaQuery.of(context).viewInsets.bottom * 0.001), + child: Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + if(nextQuestion == 8 && selectedNextTime)...[ + Container( + color: Color(0xffFFFFFF).withOpacity(0), + child: Padding( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 24), + child: Container( + + width: screenSize.width, + height: 40, + child: ElevatedButton( + style: buttonChart().bluebtn3, + onPressed: () { + //decidedType = false; + questions0.insertAll(9, [ + "๊ทธ๋ ‡๊ตฐ์š”. ${whatTime} ๋‚ ์”จ์—\n${home.puppy}์™€ ์–ด๋””์— ์žˆ์—ˆ๋‚˜์š”?", // 9 + "๊ทธ๋ ‡๊ตฐ์š”. ${whatTime} ๋‚ ์”จ์—\n${home.puppy}์™€ ์–ด๋””์— ์žˆ์—ˆ๋‚˜์š”?", // 10 + ]); + nextQuestion++; + player2.setAsset(voice[voiceCount]); + voiceCount++; + player2.play(); + // 2.5์ดˆ ์ ์ • + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + Timer(Duration(milliseconds: 3500), () { + controller1.stop(); + }); + setState(() {}); + }, + child: Text("๋‹ค์Œ", style: TextStyle( + fontFamily: 'Pretendard', + fontSize: 16, fontWeight: FontWeight.w500, color: Color(0xffFFFFFF))), + ), + ),), + ), + ] + else if(nextQuestion == 10 && selectedLocate)...[ + Container( + color: Color(0xffFFFFFF).withOpacity(0), + child: Padding( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 24), + child: Container( + + width: screenSize.width, + height: 40, + child: ElevatedButton( + style: buttonChart().bluebtn3, + onPressed: () { + //decidedType = false; + questions0.insertAll(11, [ + "${whatTime} ๋‚ ์”จ์—\n${whatLocate}์—์„œ ์žˆ์—ˆ๊ตฐ์š”!", // 11 + "${home.user}๋‹˜๊ณผ\n${home.puppy}๋Š” ๋ญ˜ ํ•˜๊ณ  ์žˆ์—ˆ์„๊นŒ์š”?", // 12 + // "๋ณดํ˜ธ์ž๋‹˜๊ณผ\n์•„์ด๋Š” ๋ญ˜ ํ•˜๊ณ  ์žˆ์—ˆ์„๊นŒ์š”?", // 13 + ]); + nextQuestion++; + player2.setAsset(voice[voiceCount]); + voiceCount++; + player2.play(); + // 2.5์ดˆ ์ ์ • + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + Timer(Duration(milliseconds: 1000), () { + controller1.stop(); + }); + + controller3.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 2000) + ); + Timer(Duration(milliseconds: 1500), () { + controller3.stop(); + }); + + setState(() {}); + }, + child: Text("๋‹ค์Œ", style: TextStyle( + fontFamily: 'Pretendard', + fontSize: 16, fontWeight: FontWeight.w500, color: Color(0xffFFFFFF))), + ), + ),), + ), + ] + else if(nextQuestion == 12)...[ + Container( + color: Colors.white, + height: 48, + child: Padding( + padding: const EdgeInsets.only(bottom: 8.0, top: 8.0, left: 16,right: 16), + child: Stack( + children: [ + Container( + width: screenSize.width, + height: 48, + decoration: BoxDecoration( + color: Colors.white, + border: Border.all(color: setWhat? Color(colorChart.blue):Color(0xffC0D2FC)), + borderRadius: BorderRadius.circular(30), + ), + ), + Positioned( + left: 15, + right: 30, + bottom:-4, + child: TextField( + textAlignVertical: TextAlignVertical.center, + maxLines: 1, + controller: whatController, + style: textStyle.bk14normal, + decoration: InputDecoration( + hintStyle: textStyle.grey14normal, + border: InputBorder.none, + hintText: '๋ญ˜ ํ•˜๊ณ  ์žˆ์—ˆ๋ƒ๋ฉด...'), + onChanged: (s) { + //text = s; + setWhat = true; + setState(() { + + }); + }, + onTap: () {}, + ), + ), + Positioned( + left: screenSize.width - 80, + //right: 30, + bottom: 3, + top: 3, + child: ElevatedButton( + onPressed: () { + if(setWhat){ + player2.setAsset(voice[voiceCount]); + voiceCount++; + player2.play(); + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + + Timer(Duration(milliseconds: 4000), () { + controller1.stop(); + }); + + questions0.insertAll(13, [ + "๊ทธ๋ ‡๋‹ค๋ฉด ${home.user}๋‹˜๊ณผ\n${home.puppy}๋Š” ์–ด๋–ค ๋ชจ์Šต์œผ๋กœ ๋ณด์ด๋‚˜์š”?", // 14 + "๊ทธ๋ ‡๋‹ค๋ฉด ${home.user}๋‹˜๊ณผ\n${home.puppy}๋Š” ์–ด๋–ค ๋ชจ์Šต์œผ๋กœ ๋ณด์ด๋‚˜์š”?", // 15 + ]); + + nextQuestion++; + setState(() { + + }); + } + + }, + style: ElevatedButton.styleFrom( + backgroundColor: setWhat? Color(colorChart.blue):Color(0xffDDE7FD), + fixedSize: const Size(23, 23), + shape: const CircleBorder(), + ), + child: Icon( + Icons.arrow_upward, + color: Colors.white,size: 16, + )), + ), + ], + ), + ), + ), + ] + else if(nextQuestion == 14 && selectedHow)...[ + Container( + color: Color(0xffFFFFFF).withOpacity(0), + child: Padding( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 24), + child: Container( + width: screenSize.width, + height: 40, + child: ElevatedButton( + style: buttonChart().bluebtn3, + onPressed: () { + //decidedType = false; + questions0.insertAll(15, [ + "์šฐ๋ฆฌ ${home.puppy}์™€\n${home.user}๋‹˜์˜", // 15 + "${whatHow} ๋ชจ์Šต์„\n๋– ์˜ฌ๋ ค๋ณด๋ฉด", // 16 + "${home.user}๋‹˜์˜ ๋งˆ์Œ์€\n์–ด๋–ค ๊ฒƒ ๊ฐ™๋‚˜์š”?", // 17 + "๊ณ ๋ฏผ์ค‘", // 18 + ]); + nextQuestion++; + player2.setAsset(voice[voiceCount]); + voiceCount++; + player2.play(); + // 2.5์ดˆ ์ ์ • + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + Timer(Duration(milliseconds: 2000), () { + controller1.stop(); + }); + setState(() {}); + }, + child: Text("๋‹ค์Œ", style: TextStyle( + fontFamily: 'Pretendard', + fontSize: 16, fontWeight: FontWeight.w500, color: Color(0xffFFFFFF))), + ), + ),), + ), + ] + else if(nextQuestion == 17)...[ + Container( + color: Colors.white, + height: 48, + child: Padding( + padding: const EdgeInsets.only(bottom: 8.0, top: 8.0, left: 16,right: 16), + child: Stack( + children: [ + Container( + width: screenSize.width, + height: 48, + decoration: BoxDecoration( + color: Colors.white, + border: Border.all(color: setEmotion?Color(colorChart.blue):Color(0xffC0D2FC)), + borderRadius: BorderRadius.circular(30), + ), + ), + Positioned( + left: 15, + right: 30, + bottom:-4, + child: TextField( + textAlignVertical: TextAlignVertical.center, + maxLines: 1, + controller: emotionController, + style: textStyle.bk14normal, + decoration: InputDecoration( + hintStyle: textStyle.grey14normal, + border: InputBorder.none, + hintText: '์ œ ๋งˆ์Œ์€...'), + onChanged: (s) { + //text = s; + setEmotion = true; + setState(() { + + }); + }, + onTap: () { + + }, + ), + ), + Positioned( + left: screenSize.width - 80, + //right: 30, + bottom: 3, + top: 3, + child: ElevatedButton( + onPressed: () { + sendAnswer(sign_in.userAccessToken, emotionController.text); + // ๊ณ ๋ฏผํ•˜๋Š” ๋ฌด์ง€ ์›€์ง์ด๊ธฐ + if(setEmotion){ + nextQuestion++; + setState(() { + controller1.repeat( + min: 2, + max: 30, + period: const Duration(milliseconds: 2000) + ); + Timer(Duration(milliseconds: 1000), () { + controller1.stop(); + }); + }); + } + + }, + style: ElevatedButton.styleFrom( + backgroundColor: setEmotion? Color(colorChart.blue):Color(0xffDDE7FD), + fixedSize: const Size(3, 3), + shape: const CircleBorder(), + ), + child: Icon( + Icons.arrow_upward, + color: Colors.white,size: 16, + )), + ), + ], + ), + ), + ), + ] + else if((happy && nextHappy == 7) || (grief && nextGrief == 6))...[ + Container( + color: Color(0xffFFFFFF).withOpacity(0), + child: Padding( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 24), + child: Container( + + width: screenSize.width, + height: 40, + child: ElevatedButton( + style: buttonChart().bluebtn3, + onPressed: () { + // ํ•จ๊ป˜ํ• ๊ฐœ ์ฝ”์น˜๋งˆํฌ๋กœ ์ด๋™ + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => EarlyMarkCoachPage())); + }, + child: Text("๋‹ค์Œ", style: TextStyle( + fontFamily: 'Pretendard', + fontSize: 16, fontWeight: FontWeight.w500, color: Color(0xffFFFFFF))), + ), + ),), + ), + ] + ], + ), + )), + ) + + ); + + } +} + diff --git a/client/lib/conversation/early_period/memory2.dart b/client/lib/conversation/early_period/memory2.dart new file mode 100644 index 0000000..f1ad732 --- /dev/null +++ b/client/lib/conversation/early_period/memory2.dart @@ -0,0 +1,555 @@ +import 'dart:async'; +import 'dart:convert'; +import 'package:flutter/material.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter_svg/svg.dart'; +import 'package:client/screen.dart'; +import 'package:http/http.dart' as http; +import 'package:client/progressbar/animation_progressbar.dart'; +import 'package:client/style.dart'; +import 'package:intl/intl.dart'; +import 'package:just_audio/just_audio.dart'; +import 'package:flutter_gif/flutter_gif.dart'; +import 'package:client/home.dart' as home; +import 'package:client/sign/sign_in.dart' as sign_in; +import 'package:client/main.dart'as main; + +/// ๊ธฐ์–ต_๋งˆ๋ฌด๋ฆฌ + +AudioPlayer player2 = AudioPlayer(); + +late FlutterGifController controller1, controller2, controller3; + +List voice =[ + "assets/voice/early/memory/memoryhappy1.mp3", + "assets/voice/early/memory/memoryhappy9.mp3", + "assets/voice/early/memory/memoryhappy10.mp3", + "assets/voice/early/memory/memoryhappy11.mp3", + "assets/voice/intro/intro2_8.mp3", + "", + "assets/voice/intro/intro2_9.mp3", +]; + +class Memory2Page extends StatefulWidget { + + static Future navigatorPush(BuildContext context) async { + return Navigator.push( + context, + MaterialPageRoute( + builder: (_) => Memory2Page(), + ), + ); + } + + @override + _Memory2PageState createState() => _Memory2PageState(); +} + +class _Memory2PageState extends State with TickerProviderStateMixin { + + bool finish = false; // ๋ฉ”๋ชจ๋ฆฌ์–ผ ๋ฐ ๋งˆ๋ฌด๋ฆฌ + bool selectedNextTime = false; + bool chooseTime = false; + int whatTime = 0; + + // ํ…์ŠคํŠธ ์—๋””ํŒ… ์ปจํŠธ๋กค๋Ÿฌ๋ฅผ ์ƒ์„ฑํ•˜์—ฌ ํ•„๋“œ์— ํ• ๋‹น + final nextTimeController = TextEditingController(); // nextQuestion = 7์ผ๋•Œ + + + FocusNode _focusNode = FocusNode(); + + String sentDate = ""; + // ๋Œ€ํ™” ๋‹จ๊ณ„ ์ €์žฅ + void saveCon(String aToken, String con, String nextcon) async { + // API ์—”๋“œํฌ์ธํŠธ URL + String apiUrl = 'http://3.38.1.125:8080/user/conversation-status'; + + // ์š”์ฒญ ๋ณธ๋ฌธ ๋ฐ์ดํ„ฐ + var data = { + "conversationStatus": con, + "nextConversationAt": nextcon, + }; + + // ํ—ค๋” ์ •๋ณด ์„ค์ • + Map headers = { + 'Authorization': 'Bearer $aToken', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• + 'Content-Type': 'application/json', // ์˜ˆ: JSON ์š”์ฒญ์ธ ๊ฒฝ์šฐ ํ—ค๋” ์„ค์ • + }; + + // HTTP GET ์š”์ฒญ ๋ณด๋‚ด๊ธฐ + var response = await http.put( + Uri.parse(apiUrl), + body: json.encode(data), + headers: headers, // ํ—ค๋” ์ถ”๊ฐ€ + ); + + ///var jsonResponse = utf8.decode(response.bodyBytes); + // HTTP ์‘๋‹ต ์ƒํƒœ ํ™•์ธ + if (response.statusCode == 200) { + // ์‘๋‹ต ๋ฐ์ดํ„ฐ๋ฅผ JSON ํ˜•์‹์œผ๋กœ ๋””์ฝ”๋”ฉ + print("๋Œ€ํ™” ๋‹จ๊ณ„ ๋„ฃ๊ธฐ ์„ฑ๊ณต"); + setState(() { + }); + + } else { + // ์š”์ฒญ์ด ์‹คํŒจํ•œ ๊ฒฝ์šฐ ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌ + print('HTTP ์š”์ฒญ ์‹คํŒจ: ${response.statusCode}'); + } + } + + @override + void initState() { + super.initState(); + // ์Œ์› ์ ์šฉ + for(int i= 0 ; i < voice.length; i++){ + player2.setAudioSource(AudioSource.uri( + Uri.parse(voice[i])) + ); + } + + controller1 = FlutterGifController(vsync: this); + + player2.setAsset(voice[voiceCount]); + voiceCount++; + player2.play(); + + // 2.5์ดˆ ์ ์ • + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + Timer(Duration(milliseconds: 1000), () { + controller1.stop(); + }); + + _callAPI(); + _focusNode.addListener(_onFocusChange); + } + + void _onFocusChange() { + if (_focusNode.hasFocus) { + // ํ‚ค๋ณด๋“œ ์˜ฌ๋ฆฌ๊ธฐ + FocusScope.of(context).requestFocus(_focusNode); + } + } + + @override + void dispose() async { + super.dispose(); + } + + List introText =[]; + int nextQuestion = 0; + int voiceCount = 0; + + List questions1_4 =[ + "${home.user}๋‹˜โ€ฆ", + "๋‹ค๋ฅธ ์‚ฌ๋žŒ๋“ค๊ณผ ํ•จ๊ป˜\n๋„์›€์„ ์ฃผ๊ณ  ๋ฐ›์œผ๋ฉด์„œ", + "์•ž์œผ๋กœ ${home.user}๋‹˜์˜ ๋งˆ์Œ์—\n์•ˆ์ •์ด ์ฐพ์•„์˜ค๊ธฐ๊นŒ์ง€", + "๋„์›€์ด ๋˜์—ˆ์œผ๋ฉด\nํ•˜๋Š” ๋ฐ”๋žŒ์ด์—์š”.", + "์ด์ œ ์šฐ๋ฆฌ๊ฐ€ ๋‹ค์‹œ\n๋งŒ๋‚˜๊ฒŒ ๋  ์‹œ๊ฐ„์„ ์•Œ๋ ค์ฃผ์„ธ์š”.", + "์ด์ œ ์šฐ๋ฆฌ๊ฐ€ ๋‹ค์‹œ\n๋งŒ๋‚˜๊ฒŒ ๋  ์‹œ๊ฐ„์„ ์•Œ๋ ค์ฃผ์„ธ์š”.", + ]; + + void _callAPI() async { + // ์š”์ฒญ ๋ณธ๋ฌธ ๋ฐ์ดํ„ฐ + var data = { + "stage" : "0", + "set" : "0", + "lineId" : "0" + }; + + var url = Uri.parse('http://3.38.1.125:8080/conversation/line'); // ์—”๋“œํฌ์ธํŠธ URL ์„ค์ • + + try { + var response = await http.post( + url, + body: json.encode(data), // ์š”์ฒญ ๋ณธ๋ฌธ์— ๋ฐ์ดํ„ฐ๋ฅผ JSON ํ˜•์‹์œผ๋กœ ์ธ์ฝ”๋”ฉํ•˜์—ฌ ์ „๋‹ฌ + headers: {'Content-Type': 'application/json',}, // ์š”์ฒญ ํ—ค๋”์— Content-Type ์„ค์ • + ); + + if (response.statusCode == 200) { + // ์‘๋‹ต ์„ฑ๊ณต ์‹œ์˜ ์ฒ˜๋ฆฌ + + var jsonResponse = utf8.decode(response.bodyBytes); // ์‘๋‹ต ๋ณธ๋ฌธ์„ JSON ํ˜•์‹์œผ๋กœ ๋””์ฝ”๋”ฉ + // JSON ๊ฐ’์„ ํ™œ์šฉํ•œ ์›ํ•˜๋Š” ๋™์ž‘ ์ˆ˜ํ–‰ + //utf8.decode(jsonResponse); + print(jsonResponse); + + List contentList = []; + + List parsedResponse = json.decode(jsonResponse); + + setState(() { + for (var item in parsedResponse) { + if (item['content'] != null) { + introText.add(item['content']); + } + } + }); + + + print(introText); + + print('API ํ˜ธ์ถœ ์„ฑ๊ณต: ${response.statusCode}'); + } else { + // ์š”์ฒญ ์‹คํŒจ ์‹œ์˜ ์ฒ˜๋ฆฌ + print('API ํ˜ธ์ถœ ์‹คํŒจ: ${response.statusCode}'); + } + } catch (e) { + // ์˜ˆ์™ธ ๋ฐœ์ƒ ์‹œ์˜ ์ฒ˜๋ฆฌ + print('API ํ˜ธ์ถœ ์ค‘ ์˜ˆ์™ธ ๋ฐœ์ƒ: $e'); + } + } + + + @override + Widget build(BuildContext context) { + MediaQueryData deviceData = MediaQuery.of(context); + Size screenSize = deviceData.size; + return + Container( + color: Color(0xffFCCBCD), + child: GestureDetector( + onTap: (){ + SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: [SystemUiOverlay.top]); + print("ํ™•์ธ: " + nextQuestion.toString()); + + if(nextQuestion <5){ + nextQuestion++; + player2.setAsset(voice[voiceCount]); + voiceCount++; + player2.play(); + + // 2.5์ดˆ ์ ์ • + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + if(nextQuestion == 1){ + Timer(Duration(milliseconds: 3500), () { + controller1.stop(); + }); + } + else if(nextQuestion == 2){ + Timer(Duration(milliseconds: 4000), () { + controller1.stop(); + }); + } + else if(nextQuestion == 3){ + Timer(Duration(milliseconds: 3000), () { + controller1.stop(); + }); + } + else if(nextQuestion == 4){ + Timer(Duration(milliseconds: 4000), () { + controller1.stop(); + }); + } + + } + else if(nextQuestion == 5){ + //nextQuestion++; + } + else if(nextQuestion == 6){ + nextQuestion++; + player2.setAsset(voice[voiceCount]); + voiceCount++; + player2.play(); + + // 2.5์ดˆ ์ ์ • + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + Timer(Duration(milliseconds: 4000), () { + controller1.stop(); + }); + } + else if(nextQuestion == 7){ + + } + + setState(() { + }); + }, + child: Scaffold( + backgroundColor: Colors.transparent, + appBar: AppBar( + //title: Text("๊ธฐ์–ตํ• ๊ฐœ", style: TextStyle(fontSize:16, color: Colors.white ),), + //centerTitle: true, + leading: IconButton( + icon: SvgPicture.asset( + 'assets/images/conversation/home_icon.svg', + ), + onPressed: () => Navigator.of(context).pop(), + ), + backgroundColor: Colors.transparent, + elevation: 0.0, + ), + //extendBodyBehindAppBar: true, + body: SingleChildScrollView( + child: Container( + child: Column( + children: [ + SizedBox(height: 3,), + Container( + width: screenSize.width, + height: 25, + child: Padding( + padding: EdgeInsets.only( left:16, right: 16), + child: Center( + child: FAProgressBar( + currentValue: 40, + size: 5, + backgroundColor: Colors.white, + ) + ), + ), + ), + Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children:[ + SizedBox( + height: 10, + ), + Stack( + children: [ + Container( + height: 157, + width: screenSize.width, + child: + Stack( + children: [ + Center(child: SvgPicture.asset('assets/images/conversation/bubble.svg',fit: BoxFit.fill,),), + Container( + padding: const EdgeInsets.symmetric(horizontal: 32, vertical: 12, ), + child: Center( + child: Column( + children: [ + if(questions1_4[nextQuestion].toString().contains("\n"))...[ + SizedBox(height: 28,), + Text( + questions1_4[nextQuestion], + textAlign: TextAlign.center, + style: textStyle.bubbletext, + ), + + ]else...[ + SizedBox(height: 42,), + Text( + questions1_4[nextQuestion], + textAlign: TextAlign.center, + style: textStyle.bubbletext, + ), + ], + ], + ) + ) + ), + ], + ) + ), + // ๋ฌด์ง€ ์œ„์น˜ + if(nextQuestion < 5 || nextQuestion > 5)...[ + Stack( + children: [ + // ์œ ์ € ์œ„์น˜ + Column( + children: [ + SizedBox(height: 420,), + Container( + child: SvgPicture.asset( + 'assets/images/conversation/user7.svg', + height: 282, + width: screenSize.width, + ), + ), + ], + ), + Column( + children: [ + SizedBox(height: 144,), + Container( + width: screenSize.width, + height: 375, + child: + Stack( + children: [ + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child: Image.asset('assets/images/conversation/gif/muji_ear.gif', + fit: BoxFit.cover,),), + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child: Image.asset('assets/images/conversation/gif/muji_base.gif', fit: BoxFit.cover,),), + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child: Image.asset('assets/images/conversation/gif/muji_base_eye.gif', + fit: BoxFit.cover,),), + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child:GifImage( + controller: controller1, + image: const AssetImage("assets/images/conversation/gif/muji_mouth1.gif"), + ), + // Image.asset('assets/images/conversation/gif/muji_mouth1.gif', fit: BoxFit.cover,), + ) + ], + ) + + // SvgPicture.asset( + // 'assets/images/conversation/con_muji.svg', fit: BoxFit.cover, + // ), + ), + ], + ), + ], + ), + ] + else if(nextQuestion == 5)...[ + Padding( + padding: EdgeInsets.only(top:175, left:45), + child: Container( + width: 275, + height: 120, + child: Column( + children: [ + Row( + children: [ + SizedBox(width: 75,), + Container(width: 25, + padding: EdgeInsets.only(bottom:16), + child: TextField( + style: textStyle.inputfield, + onTap: (){ + chooseTime = true; + selectedNextTime = true; + whatTime = int.parse(nextTimeController.text); + setState(() { + }); + }, + onChanged: (text){ + whatTime = int.parse(nextTimeController.text); + }, + keyboardType: TextInputType.number, + inputFormatters: [FilteringTextInputFormatter.allow(RegExp('[0-9]'))], + controller: nextTimeController, + decoration: InputDecoration( + hintText: '๋ช‡', + contentPadding: EdgeInsets.only(top: 16), + suffixStyle: TextStyle(color: Color(0xff83A8FF), fontSize: 20,), + hintStyle: textStyle.field, + //labelText: '๋ช‡', + ), + ),), + Text("์‹œ๊ฐ„ ํ›„์— ๋งŒ๋‚˜์š”", style: TextStyle( + fontFamily: 'Pretendard', + fontSize: 20, fontWeight: FontWeight.w500, color: Colors.black),), + ],), + SizedBox(height: 8,), + // DateFormat('MM/dd HH:mm').format(DateTime.parse(parsedResponseHR[index]['createdAt'])) + // DateFormat('MM/dd HH:mm').format(DateTime.now().add(Duration(hours: whatTime))) + Text(chooseTime?"${DateFormat('MM์›” dd์ผ HH์‹œ mm๋ถ„').format(DateTime.now().add(Duration(hours: whatTime)))}":"์ตœ์†Œ 1์‹œ๊ฐ„์—์„œ 24์‹œ๊ฐ„ ์‚ฌ์ด๋กœ ์ •ํ•ด์ฃผ์„ธ์š”.", style: TextStyle( + fontFamily: 'Pretendard', + fontSize: 16, fontWeight: FontWeight.w500, color: Color(0xffAAAAAA)),), + + ],), + ), + ), + + ] + ], + ), + ], + ), + ], + ), + ),), + + // // nextQuestion ์ด 3๊ณผ 7์ผ๋•Œ ๋“ฑ์žฅ + bottomSheet: Padding( + padding: EdgeInsets.only( + bottom: MediaQuery.of(context).viewInsets.bottom * 0.001), + child: Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + if(nextQuestion == 5)...[ + Container( + color: Color(0xffFFFFFF).withOpacity(0), + child: Padding( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 24), + child: Container( + + width: screenSize.width, + height: 40, + child: ElevatedButton( + style: buttonChart().bluebtn3, + onPressed: () { + player2.setAsset(voice[voiceCount]); + voiceCount++; + player2.play(); + + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + Timer(Duration(milliseconds: 3500), () { + controller1.stop(); + }); + questions1_4.insertAll(6, [ + "๋„ค, ${home.user}๋‹˜.\n${whatTime}์‹œ๊ฐ„ ํ›„์— ๋‹ค์‹œ ๋งŒ๋‚˜์š”!", + "๋„ค, ${home.user}๋‹˜.\n${whatTime}์‹œ๊ฐ„ ํ›„์— ๋‹ค์‹œ ๋งŒ๋‚˜์š”!", + ]); + nextQuestion++; + setState(() {}); + }, + child: Text("๋‹ค์Œ", style: TextStyle( + fontFamily: 'Pretendard', + fontSize: 16, fontWeight: FontWeight.w500, color: Color(0xffFFFFFF))), + ), + ),), + ), + ] else if(nextQuestion == 7)...[ + Container( + color: Color(0xffFFFFFF).withOpacity(0), + child: Padding( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 24), + child: Container( + width: screenSize.width, + height: 40, + child: ElevatedButton( + style: buttonChart().bluebtn3, + onPressed: () { + var now = DateTime.now(); + sentDate = DateFormat('yyyy-MM-dd hh:mm:ss').format(now.toLocal()); + saveCon(sign_in.userAccessToken, "1A", sentDate); + main.player.stop(); + setState(() {}); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => MyScreenPage(title: '์Šคํฌ๋ฆฐ ํŽ˜์ด์ง€',))); + setState(() {}); + }, + child: Text("์™„๋ฃŒ", style: TextStyle( + fontFamily: 'Pretendard', + fontSize: 16, fontWeight: FontWeight.w500, color: Color(0xffFFFFFF))), + ), + ),), + ), + ] + ], + ), + )), + ) + + ); + + } +} diff --git a/client/lib/conversation/early_period/start_early.dart b/client/lib/conversation/early_period/start_early.dart new file mode 100644 index 0000000..75f292e --- /dev/null +++ b/client/lib/conversation/early_period/start_early.dart @@ -0,0 +1,1415 @@ +import 'dart:async'; +import 'dart:convert'; +import 'package:flutter/material.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter_svg/svg.dart'; +import 'package:http/http.dart' as http; +import 'package:intl/intl.dart'; +import 'package:client/conversation/early_period/memory.dart'; +import 'package:client/conversation/end_period/end.dart'; +import 'package:client/conversation/late_period/late.dart'; +import 'package:client/conversation/middle_period/the_truth_untold.dart'; +import 'package:client/progressbar/animation_progressbar.dart'; +import 'package:client/screen.dart'; +import 'package:client/style.dart'; +import 'package:client/sign/sign_in.dart' as sign_in; +import 'package:just_audio/just_audio.dart'; +import 'package:flutter_gif/flutter_gif.dart'; +import 'package:client/home.dart' as home; +import '../middle_period/sadness.dart'; +import 'farewell.dart'; +/// ๋Œ€ํ™” ์‹œ์ž‘ + +String backColor = ""; +double perc = 0; + +class StartEarlyPage extends StatefulWidget { + + static Future navigatorPush(BuildContext context) async { + return Navigator.push( + context, + MaterialPageRoute( + builder: (_) => StartEarlyPage(), + ), + ); + } + + @override + _StartEarlyPageState createState() => _StartEarlyPageState(); +} + +class _StartEarlyPageState extends State with TickerProviderStateMixin { + + late FlutterGifController controller1, controller2, controller3; + + bool grief = false; // ์ด๋ณ„ ์„ ํƒ ์‹œ + bool ui_grief = false; + bool miss = false; // ์ „๋ชป์ง„ ์„ ํƒ ์‹œ + bool ui_miss = false; + + bool no = false; + bool yes = false; + + // ์ดˆ๊ธฐ + bool early = false; + bool memory = false; + bool ui_memory = false; + bool farewell = false; + bool ui_farewell = false; + + // ์ค‘๊ธฐ + bool middle = false; + bool sadness = false; + bool ui_sadness = false; + bool thetruthuntold = false; + bool ui_thetruthuntold = false; + + // ํ›„๊ธฐ + bool late = false; + + // ์ข…๊ฒฐ๊ธฐ + bool end = false; + + + FocusNode _focusNode = FocusNode(); + + // ๋Œ€ํ™” ๋‹จ๊ณ„ ์ €์žฅ + void saveCon(String aToken, String nextcon) async { + // API ์—”๋“œํฌ์ธํŠธ URL + String apiUrl = 'http://3.38.1.125:8080/user/conversation-status'; + + // ์š”์ฒญ ๋ณธ๋ฌธ ๋ฐ์ดํ„ฐ + var data = { + "nextConversationAt": nextcon, + }; + + // ํ—ค๋” ์ •๋ณด ์„ค์ • + Map headers = { + 'Authorization': 'Bearer $aToken', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• + 'Content-Type': 'application/json', // ์˜ˆ: JSON ์š”์ฒญ์ธ ๊ฒฝ์šฐ ํ—ค๋” ์„ค์ • + }; + + // HTTP GET ์š”์ฒญ ๋ณด๋‚ด๊ธฐ + var response = await http.put( + Uri.parse(apiUrl), + body: json.encode(data), + headers: headers, // ํ—ค๋” ์ถ”๊ฐ€ + ); + + ///var jsonResponse = utf8.decode(response.bodyBytes); + // HTTP ์‘๋‹ต ์ƒํƒœ ํ™•์ธ + if (response.statusCode == 200) { + // ์‘๋‹ต ๋ฐ์ดํ„ฐ๋ฅผ JSON ํ˜•์‹์œผ๋กœ ๋””์ฝ”๋”ฉ + print("๋Œ€ํ™” ๋‹จ๊ณ„ ๋„ฃ๊ธฐ ์„ฑ๊ณต"); + setState(() { + }); + + } else { + // ์š”์ฒญ์ด ์‹คํŒจํ•œ ๊ฒฝ์šฐ ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌ + print('HTTP ์š”์ฒญ ์‹คํŒจ?????: ${response.statusCode}'); + } + } + + + @override + void initState() { + super.initState(); + + conversationStage = home.convs; + setState(() { + + }); + + // SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersive, overlays: []); + // ์Œ์› ์ ์šฉ + for(int i= 0 ; i < voice.length; i++){ + _player.setAudioSource(AudioSource.uri( + Uri.parse(voice[i])) + ); + } + controller1 = FlutterGifController(vsync: this); + + _player.setAsset(voice[voiceCount]); + voiceCount++; + _player.play(); + + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + Timer(Duration(milliseconds: 2500), () { + controller1.stop(); + }); + + _callAPI(); + _focusNode.addListener(_onFocusChange); + } + + void _onFocusChange() { + if (_focusNode.hasFocus) { + // ํ‚ค๋ณด๋“œ ์˜ฌ๋ฆฌ๊ธฐ + FocusScope.of(context).requestFocus(_focusNode); + } + } + + @override + void dispose() async { + super.dispose(); + } + + String conversationStage = ""; + + int nextPage = 0; + + List introText =[]; + + int nextQuestion = 0; + int nextYes = 0; + int nextNo = 0; + + bool selectedNextTime = false; + bool chooseTime = false; + int whatTime = 0; + + String sentDate = ""; + + final nextTimeController = TextEditingController(); + + final _player = AudioPlayer(); + int voiceCount = 0; + int voiceNoCount = 0; + int voiceYesCount = 0; + + List voice = [ + "assets/voice/start1.mp3", + "", + ]; + + List voiceYes = [ + "assets/voice/yes.mp3", + ]; + + List voiceNo = [ + "assets/voice/no1.mp3", "", "assets/voice/no2.mp3", "" + ]; + + List question= [ + "${home.user}๋‹˜!\n๊ธฐ๋‹ค๋ฆฌ๊ณ  ์žˆ์—ˆ์–ด์š”!", + "๋Œ€ํ™”๋ฅผ ์‹œ์ž‘ํ•ด๋ณผ๊นŒ์š”?", + ]; + + List yesAns= [ + "์˜ค๋Š˜์€ ์–ด๋–ค ์ฃผ์ œ๋กœ ์–˜๊ธฐํ•ด๋ณผ๊นŒ์š”?", + ]; + + List noAns= [ + "๊ทธ๋Ÿผ ์šฐ๋ฆฌ๋Š” ์–ธ์ œ ๋‹ค์‹œ ๋งŒ๋‚˜๋ฉด ์ข‹์„๊นŒ์š”?", + "๊ทธ๋Ÿผ ์šฐ๋ฆฌ๋Š” ์–ธ์ œ ๋‹ค์‹œ ๋งŒ๋‚˜๋ฉด ์ข‹์„๊นŒ์š”?", + ]; + + void _callAPI() async { + // ์š”์ฒญ ๋ณธ๋ฌธ ๋ฐ์ดํ„ฐ + var data = { + "stage" : "0", + "set" : "0", + "lineId" : "0" + }; + + var url = Uri.parse('http://3.38.1.125:8080/conversation/line'); // ์—”๋“œํฌ์ธํŠธ URL ์„ค์ • + + try { + var response = await http.post( + url, + body: json.encode(data), // ์š”์ฒญ ๋ณธ๋ฌธ์— ๋ฐ์ดํ„ฐ๋ฅผ JSON ํ˜•์‹์œผ๋กœ ์ธ์ฝ”๋”ฉํ•˜์—ฌ ์ „๋‹ฌ + headers: {'Content-Type': 'application/json',}, // ์š”์ฒญ ํ—ค๋”์— Content-Type ์„ค์ • + ); + + if (response.statusCode == 200) { + // ์‘๋‹ต ์„ฑ๊ณต ์‹œ์˜ ์ฒ˜๋ฆฌ + + var jsonResponse = utf8.decode(response.bodyBytes); // ์‘๋‹ต ๋ณธ๋ฌธ์„ JSON ํ˜•์‹์œผ๋กœ ๋””์ฝ”๋”ฉ + // JSON ๊ฐ’์„ ํ™œ์šฉํ•œ ์›ํ•˜๋Š” ๋™์ž‘ ์ˆ˜ํ–‰ + //utf8.decode(jsonResponse); + print(jsonResponse); + + List contentList = []; + + List parsedResponse = json.decode(jsonResponse); + + setState(() { + for (var item in parsedResponse) { + if (item['content'] != null) { + introText.add(item['content']); + } + } + }); + print(introText); + + print('API ํ˜ธ์ถœ ์„ฑ๊ณต: ${response.statusCode}'); + } else { + // ์š”์ฒญ ์‹คํŒจ ์‹œ์˜ ์ฒ˜๋ฆฌ + print('API ํ˜ธ์ถœ ์‹คํŒจ: ${response.statusCode}'); + } + } catch (e) { + // ์˜ˆ์™ธ ๋ฐœ์ƒ ์‹œ์˜ ์ฒ˜๋ฆฌ + print('API ํ˜ธ์ถœ ์ค‘ ์˜ˆ์™ธ ๋ฐœ์ƒ: $e'); + } + } + + bool _visible = true; + + @override + Widget build(BuildContext context) { + MediaQueryData deviceData = MediaQuery.of(context); + Size screenSize = deviceData.size; + return + Container( + color: Color(int.parse('0xff$backColor')), + child: GestureDetector( + onTap: (){ + SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: [SystemUiOverlay.top]); + + if(nextQuestion == 0){ + nextQuestion++; + _player.setAsset(voice[voiceCount]); + voiceCount++; + _player.play(); + + // 2.5์ดˆ ์ ์ • + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + Timer(Duration(milliseconds: 2000), () { + controller1.stop(); + }); + } + else if(nextQuestion == 1 && yes == false && no == false){ + nextQuestion++; // ์ธํŠธ๋กœ ์‹œ์ž‘ ํ›„ count + _player.setAsset(voice[voiceCount]); + voiceCount++; + _player.play(); + // 2.5์ดˆ ์ ์ • + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + Timer(Duration(milliseconds: 2500), () { + controller1.stop(); + }); + } + else if(no && nextNo == 0){ + nextNo++; + voiceNoCount++; + } else if(no && nextNo == 1){ + //์‹œ๊ฐ„ ๋„ฃ๊ธฐ + } else if(no && nextNo == 2){ + nextNo++; + } else if(no && nextNo == 3){ + //์‹œ๊ฐ„ ๋„ฃ๊ธฐ + } + else if (yes && nextYes == 0){ + + } + + setState(() { + }); + }, + child: Scaffold( + backgroundColor: Colors.transparent, + appBar: AppBar( + //title: Text("๊ธฐ์–ตํ• ๊ฐœ", style: TextStyle(fontSize:16, color: Colors.white ),), + //centerTitle: true, + leading: IconButton( + icon: SvgPicture.asset( + 'assets/images/conversation/home_icon.svg', + ), + onPressed: () => Navigator.of(context).pop(), + ), + backgroundColor: Colors.transparent, + elevation: 0.0, + ), + //extendBodyBehindAppBar: true, + body: + SingleChildScrollView( + child: Container( + child: Column( + children: [ + SizedBox(height: 3,), + Container( + width: screenSize.width, + height: 25, + child: Padding( + padding: EdgeInsets.only( left:16, right: 16), + child: Center( + child: FAProgressBar( + currentValue: perc, + size: 5, + backgroundColor: Colors.white, + ) + ), + ), + ), + Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children:[ + SizedBox( + height: 10, + ), + Stack( + children: [ + Container( + height: 157, + width: screenSize.width, + child: + Stack( + children: [ + Center(child: SvgPicture.asset('assets/images/conversation/bubble.svg',fit: BoxFit.fill,),), + Container( + padding: const EdgeInsets.symmetric(horizontal: 32, vertical: 12, ), + child: Center( + child: Column( + children: [ + if(no == false && yes == false)...[ + if(question[nextQuestion].toString().contains("\n"))...[ + SizedBox(height: 28,), + Text( + question[nextQuestion], + textAlign: TextAlign.center, + style: textStyle.bubbletext, + ), + ]else...[ + SizedBox(height: 42,), + Text( + question[nextQuestion], + textAlign: TextAlign.center, + style: textStyle.bubbletext, + ), + ], + ] else if(no)...[ + if(noAns[nextNo].toString().contains("\n"))...[ + SizedBox(height: 28,), + Text( + noAns[nextNo], + textAlign: TextAlign.center, + style: textStyle.bubbletext, + ), + ]else...[ + SizedBox(height: 42,), + Text( + noAns[nextNo], + textAlign: TextAlign.center, + style: textStyle.bubbletext, + ), + ], + + ] else if(yes)...[ + if(yesAns[nextYes].toString().contains("\n"))...[ + SizedBox(height: 28,), + Text( + yesAns[nextYes], + textAlign: TextAlign.center, + style: textStyle.bubbletext, + ), + ]else...[ + SizedBox(height: 42,), + Text( + yesAns[nextYes], + textAlign: TextAlign.center, + style: textStyle.bubbletext, + ), + ], + + ] + + ], + ) + ) + ), + ], + ) + ), + // ๋ฌด์ง€ ์œ„์น˜ + if( (yes == false && no==false && nextQuestion < 2) || (no && nextNo == 0) || (no && nextNo > 1))...[ + Stack( + children: [ + // ์œ ์ € ์œ„์น˜ + Column( + children: [ + SizedBox(height: 420,), + Container( + child: SvgPicture.asset( + 'assets/images/conversation/user7.svg', + height: 282, + width: screenSize.width, + ), + ), + ], + ), + Column( + children: [ + SizedBox(height: 144,), + Container( + width: screenSize.width, + height: 375, + child: + Stack( + children: [ + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child: Image.asset('assets/images/conversation/gif/muji_ear.gif', + fit: BoxFit.cover,),), + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child: Image.asset('assets/images/conversation/gif/muji_base.gif', fit: BoxFit.cover,),), + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child: Image.asset('assets/images/conversation/gif/muji_base_eye.gif', + fit: BoxFit.cover,),), + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child:GifImage( + controller: controller1, + image: const AssetImage("assets/images/conversation/gif/muji_mouth1.gif"), + ), + // Image.asset('assets/images/conversation/gif/muji_mouth1.gif', fit: BoxFit.cover,), + ) + ], + ) + ), + ], + ), + ], + ), + ] + else if(no && nextNo == 1)...[ + Padding( + padding: EdgeInsets.only(top:175, left:45), + child: Container( + width: 275, + height: 120, + child: Column( + children: [ + Row( + children: [ + SizedBox(width: 75,), + Container(width: 25, + child: TextField( + style: textStyle.inputfield, + onTap: (){ + chooseTime = true; + whatTime = int.parse(nextTimeController.text); + setState(() { + }); + }, + onChanged: (text){ + selectedNextTime = true; + whatTime = int.parse(nextTimeController.text); + }, + keyboardType: TextInputType.number, + inputFormatters: [FilteringTextInputFormatter.allow(RegExp('[0-9]'))], + controller: nextTimeController, + decoration: InputDecoration( + hintText: '๋ช‡', + suffixStyle: TextStyle(color: Color(0xff83A8FF), fontSize: 20,), + hintStyle: textStyle.field, + //labelText: '๋ช‡', + ), + ),), + Text("์‹œ๊ฐ„ ํ›„์— ๋งŒ๋‚˜์š”", style: TextStyle( + fontFamily: 'Pretendard', + fontSize: 20, fontWeight: FontWeight.w500, color: Colors.black),), + ],), + SizedBox(height: 15,), + // DateFormat('MM/dd HH:mm').format(DateTime.parse(parsedResponseHR[index]['createdAt'])) + // DateFormat('MM/dd HH:mm').format(DateTime.now().add(Duration(hours: whatTime))) + Text(chooseTime?"${DateFormat('MM์›” dd์ผ HH์‹œ mm๋ถ„').format(DateTime.now().add(Duration(hours: whatTime)))}":"์ตœ์†Œ 1์‹œ๊ฐ„์—์„œ 24์‹œ๊ฐ„ ์‚ฌ์ด๋กœ ์ •ํ•ด์ฃผ์„ธ์š”.", style: TextStyle( + fontFamily: 'Pretendard', + fontSize: 16, fontWeight: FontWeight.w500, color: Color(0xffAAAAAA)),), + + ],), + ), + ), + + ] + else if(yes && nextYes == 0)...[ + Stack( + children: [ + Column( + children: [ + SizedBox(height: 418,), + Container( + height: 280, + width: screenSize.width, + color: Color(0xffFFFFF7), + ) + ], + ), + Column( + children: [ + SizedBox(height: 418,), + SvgPicture.asset( + 'assets/images/conversation/shadow.svg', fit: BoxFit.cover, + ), + ], + ), + + Column( + children: [ + SizedBox(height: 144,), + Container( + width: screenSize.width, + height: 375, + child: + Stack( + children: [ + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child: Image.asset('assets/images/conversation/gif/muji_ear.gif', + fit: BoxFit.cover,),), + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child: Image.asset('assets/images/conversation/gif/muji_base.gif', fit: BoxFit.cover,),), + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child: Image.asset('assets/images/conversation/gif/muji_base_eye.gif', + fit: BoxFit.cover,),), + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child:GifImage( + controller: controller1, + image: const AssetImage("assets/images/conversation/gif/muji_mouth1.gif"), + ), + // Image.asset('assets/images/conversation/gif/muji_mouth1.gif', fit: BoxFit.cover,), + ) + ], + ) + + // SvgPicture.asset( + // 'assets/images/conversation/con_muji.svg', fit: BoxFit.cover, + // ), + ), + ], + ), + + Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SizedBox(height: 444,), + if(early)...[ + if(conversationStage == "1")...[ + Row( + children: [ + SizedBox(width: 16,), + Container( + width: 168, + height: 168, + child: ElevatedButton( + style: ui_memory? buttonChart().bluebtn2_1 : buttonChart().whitebtn_1, + onPressed: () { + //miss = true; + ui_farewell = false; + if(ui_memory == false){ + ui_memory = true; + } else{ + ui_memory = false; + } + // nextQuestion++; + setState(() {}); + }, + child: Container( + padding: EdgeInsets.only(top:8.0,left: 8.0, bottom: 8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox(height: 16,), + Text("${home.puppy}์™€์˜\n๊ธฐ์–ต", style: TextStyle(fontFamily: 'Pretendard',fontSize: 16, color: ui_miss? Color(0xff333333) : Color(0xff4B5396)),), + SizedBox(height: 16,), + Text("ํ•จ๊ป˜ํ•œ ๊ธฐ์–ต์— ๋Œ€ํ•ด\n์ด์•ผ๊ธฐํ•ด์š”.", style: TextStyle(fontFamily: 'Pretendard',fontSize: 12, color: ui_miss? Color(0xff333333) : Color(0xff4B5396)),), + SizedBox(height: 0,), + Row( + children: [ + SizedBox(width: 76,), + SvgPicture.asset('assets/images/conversation/intro/miss.svg') + ], + ) + ], + ), + ) + ), + ), + SizedBox(width: 16,), + Container( + width: 168, + height: 168, + child: ElevatedButton( + style: ui_farewell? buttonChart().bluebtn2_1 : buttonChart().whitebtn_1, + onPressed: () { + ui_memory = false; + if(ui_farewell == false){ + ui_farewell = true; + } else{ + ui_farewell = false; + } + // nextQuestion++; + setState(() {}); + }, + child: Container( + padding: EdgeInsets.only(top:8.0,left: 8.0, bottom: 8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox(height: 16,), + Text("${home.puppy}์™€์˜\n์ด๋ณ„", style: TextStyle(fontFamily: 'Pretendard',fontSize: 16, color: ui_grief? Color(0xff333333) : Color(0xff4B5396)),), + SizedBox(height: 16,), + Text("์ด๋ณ„์˜ ์ˆœ๊ฐ„์„\n์ด์•ผ๊ธฐํ•ด์š”.", style: TextStyle(fontFamily: 'Pretendard',fontSize: 12, color: ui_grief? Color(0xff333333) : Color(0xff4B5396)),), + SizedBox(height: 0,), + Row( + children: [ + SizedBox(width: 76,), + SvgPicture.asset('assets/images/conversation/intro/grief.svg') + ], + ) + ], + ), + ) + ), + ), + ], + ), + ] + else if(conversationStage == "-1")...[ + Row( + children: [ + SizedBox(width: 16,), + Container( + width: 168, + height: 168, + child: ElevatedButton( + style: ui_memory? buttonChart().bluebtn2_1 : buttonChart().whitebtn_1, + onPressed: () { + //miss = true; + ui_farewell = false; + if(ui_memory == false){ + ui_memory = true; + } else{ + ui_memory = false; + } + // nextQuestion++; + setState(() {}); + }, + child: Container( + padding: EdgeInsets.only(top:8.0,left: 8.0, bottom: 8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox(height: 16,), + Text("${home.puppy}์™€์˜\n๊ธฐ์–ต", style: TextStyle(fontFamily: 'Pretendard',fontSize: 16, color: ui_miss? Color(0xff333333) : Color(0xff4B5396)),), + SizedBox(height: 16,), + Text("ํ•จ๊ป˜ํ•œ ๊ธฐ์–ต์— ๋Œ€ํ•ด\n์ด์•ผ๊ธฐํ•ด์š”.", style: TextStyle(fontFamily: 'Pretendard',fontSize: 12, color: ui_miss? Color(0xff333333) : Color(0xff4B5396)),), + SizedBox(height: 0,), + Row( + children: [ + SizedBox(width: 76,), + SvgPicture.asset('assets/images/conversation/intro/miss.svg') + ], + ) + ], + ), + ) + ), + ), + SizedBox(width: 16,), + Container( + width: 168, + height: 168, + child: ElevatedButton( + style: ui_farewell? buttonChart().bluebtn2_1 : buttonChart().whitebtn_1, + onPressed: () { + ui_memory = false; + if(ui_farewell == false){ + ui_farewell = true; + } else{ + ui_farewell = false; + } + // nextQuestion++; + setState(() {}); + }, + child: Container( + padding: EdgeInsets.only(top:8.0,left: 8.0, bottom: 8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox(height: 16,), + Text("${home.puppy}์™€์˜\n์ด๋ณ„", style: TextStyle(fontFamily: 'Pretendard',fontSize: 16, color: ui_grief? Color(0xff333333) : Color(0xff4B5396)),), + SizedBox(height: 16,), + Text("์ด๋ณ„์˜ ์ˆœ๊ฐ„์„\n์ด์•ผ๊ธฐํ•ด์š”.", style: TextStyle(fontFamily: 'Pretendard',fontSize: 12, color: ui_grief? Color(0xff333333) : Color(0xff4B5396)),), + SizedBox(height: 0,), + Row( + children: [ + SizedBox(width: 76,), + SvgPicture.asset('assets/images/conversation/intro/grief.svg') + ], + ) + ], + ), + ) + ), + ), + ], + ), + ] + + else if(conversationStage == "1B")...[ + Row( + children: [ + SizedBox(width: 16,), + Container( + width: 168, + height: 168, + child: ElevatedButton( + style: ui_memory? buttonChart().bluebtn2_1 : buttonChart().whitebtn_1, + onPressed: () { + //miss = true; + ui_farewell = false; + if(ui_memory == false){ + ui_memory = true; + } else{ + ui_memory = false; + } + // nextQuestion++; + setState(() {}); + }, + child: Container( + padding: EdgeInsets.only(top:8.0,left: 8.0, bottom: 8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox(height: 16,), + Text("${home.puppy}์™€์˜\n๊ธฐ์–ต", style: TextStyle(fontFamily: 'Pretendard',fontSize: 16, color: ui_miss? Color(0xff333333) : Color(0xff4B5396)),), + SizedBox(height: 16,), + Text("ํ•จ๊ป˜ํ•œ ๊ธฐ์–ต์— ๋Œ€ํ•ด\n์ด์•ผ๊ธฐํ•ด์š”.", style: TextStyle(fontFamily: 'Pretendard',fontSize: 12, color: ui_miss? Color(0xff333333) : Color(0xff4B5396)),), + SizedBox(height: 0,), + Row( + children: [ + SizedBox(width: 76,), + SvgPicture.asset('assets/images/conversation/intro/miss.svg') + ], + ) + ], + ), + ) + ), + ), + SizedBox(width: 16,), + Stack( + children: [ + Container( + width: 168, + height: 168, + child: ElevatedButton( + style: buttonChart().greybtn_1, + onPressed: () { + + }, + child: Container( + padding: EdgeInsets.only(top:8.0,left: 8.0, bottom: 8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox(height: 16,), + Text("${home.puppy}์™€์˜\n์ด๋ณ„", style: textStyle.grey16semibold), + SizedBox(height: 16,), + Text("์ด๋ณ„์˜ ์ˆœ๊ฐ„์„\n์ด์•ผ๊ธฐํ•ด์š”.", style: textStyle.grey12normal), + SizedBox(height: 0,), + Row( + children: [ + SizedBox(width: 76,), + SvgPicture.asset('assets/images/conversation/done_drop.svg') + ], + ) + ], + ), + ) + ), + ), + ], + ), + ], + ), + ] else if(conversationStage == "1A")...[ + Row( + children: [ + SizedBox(width: 16,), + Container( + width: 168, + height: 168, + child: ElevatedButton( + style: buttonChart().greybtn_1, + onPressed: () { + + }, + child: Container( + padding: EdgeInsets.only(top:8.0,left: 8.0, bottom: 8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox(height: 16,), + Text("${home.puppy}์™€์˜\n๊ธฐ์–ต", style: textStyle.grey16semibold), + SizedBox(height: 16,), + Text("ํ•จ๊ป˜ํ•œ ๊ธฐ์–ต์— ๋Œ€ํ•ด\n์ด์•ผ๊ธฐํ•ด์š”.", style:textStyle.grey12normal), + SizedBox(height: 0,), + Row( + children: [ + SizedBox(width: 76,), + SvgPicture.asset('assets/images/conversation/done_cloud.svg') + ], + ) + ], + ), + ) + ), + ), + SizedBox(width: 16,), + Container( + width: 168, + height: 168, + child: ElevatedButton( + style: ui_farewell? buttonChart().bluebtn2_1 : buttonChart().whitebtn_1, + onPressed: () { + ui_memory = false; + if(ui_farewell == false){ + ui_farewell = true; + } else{ + ui_farewell = false; + } + // nextQuestion++; + setState(() {}); + }, + child: Container( + padding: EdgeInsets.only(top:8.0,left: 8.0, bottom: 8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox(height: 16,), + Text("${home.puppy}์™€์˜\n์ด๋ณ„", style: TextStyle(fontFamily: 'Pretendard',fontSize: 16, color: ui_grief? Color(0xff333333) : Color(0xff4B5396)),), + SizedBox(height: 16,), + Text("์ด๋ณ„์˜ ์ˆœ๊ฐ„์„\n์ด์•ผ๊ธฐํ•ด์š”.", style: TextStyle(fontFamily: 'Pretendard',fontSize: 12, color: ui_grief? Color(0xff333333) : Color(0xff4B5396)),), + SizedBox(height: 0,), + Row( + children: [ + SizedBox(width: 76,), + SvgPicture.asset('assets/images/conversation/intro/grief.svg') + ], + ) + ], + ), + ) + ), + ), + ], + ), + ], + ]else if(middle)...[ + if(conversationStage == "2")...[ + Row( + children: [ + SizedBox(width: 16,), + Container( + width: 168, + height: 168, + child: ElevatedButton( + style: ui_sadness? buttonChart().bluebtn2_1 : buttonChart().whitebtn_1, + onPressed: () { + //miss = true; + ui_thetruthuntold = false; + if(ui_sadness == false){ + ui_sadness = true; + } else{ + ui_sadness = false; + } + // nextQuestion++; + setState(() {}); + }, + child: Container( + padding: EdgeInsets.only(top:8.0,left: 8.0, bottom: 8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox(height: 16,), + Text("์Šฌํ””์˜\n๊ฐ์ •", style: TextStyle(fontFamily: 'Pretendard',fontSize: 16, color: ui_sadness? Color(0xff333333) : Color(0xff4B5396)),), + SizedBox(height: 16,), + Text("์ด๋ณ„๋กœ ์ธํ•œ ์Šฌํ””์„\n์ด์•ผ๊ธฐํ•ด์š”.", style: TextStyle(fontFamily: 'Pretendard',fontSize: 12, color: ui_sadness? Color(0xff333333) : Color(0xff4B5396)),), + SizedBox(height: 0,), + Row( + children: [ + SizedBox(width: 76,), + SvgPicture.asset('assets/images/conversation/intro/grief.svg') + ], + ) + ], + ), + ) + ), + ), + SizedBox(width: 16,), + Container( + width: 168, + height: 168, + child: ElevatedButton( + style: ui_thetruthuntold? buttonChart().bluebtn2_1 : buttonChart().whitebtn_1, + onPressed: () { + // grief = true; + ui_sadness = false; + if(ui_thetruthuntold == false){ + ui_thetruthuntold = true; + } else{ + ui_thetruthuntold = false; + } + // nextQuestion++; + setState(() {}); + }, + child: Container( + padding: EdgeInsets.only(top:8.0,left: 8.0, bottom: 8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox(height: 16,), + Text("์ „ํ•˜์ง€ ๋ชปํ•œ\n์ง„์‹ฌ", style: TextStyle(fontFamily: 'Pretendard',fontSize: 16, color: ui_grief? Color(0xff333333) : Color(0xff4B5396)),), + SizedBox(height: 16,), + Text("์ „ํ•˜๊ณ ํ”ˆ ์ง„์‹ฌ์„\n์ด์•ผ๊ธฐํ•ด์š”.", style: TextStyle(fontFamily: 'Pretendard',fontSize: 12, color: ui_grief? Color(0xff333333) : Color(0xff4B5396)),), + SizedBox(height: 0,), + Row( + children: [ + SizedBox(width: 76,), + SvgPicture.asset('assets/images/conversation/intro/miss.svg') + ], + ) + ], + ), + ) + ), + ), + ], + ), + ] else if(conversationStage == "2B")...[ + Row( + children: [ + SizedBox(width: 16,), + Container( + width: 168, + height: 168, + child: ElevatedButton( + style: ui_sadness? buttonChart().bluebtn2_1 : buttonChart().whitebtn_1, + onPressed: () { + //miss = true; + ui_thetruthuntold = false; + if(ui_sadness == false){ + ui_sadness = true; + } else{ + ui_sadness = false; + } + // nextQuestion++; + setState(() {}); + }, + child: Container( + padding: EdgeInsets.only(top:8.0,left: 8.0, bottom: 8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox(height: 16,), + Text("์Šฌํ””์˜\n๊ฐ์ •", style: TextStyle(fontFamily: 'Pretendard',fontSize: 16, color: ui_miss? Color(0xff333333) : Color(0xff4B5396)),), + SizedBox(height: 16,), + Text("์ด๋ณ„๋กœ ์ธํ•œ ์Šฌํ””์„\n์ด์•ผ๊ธฐํ•ด์š”.", style: TextStyle(fontFamily: 'Pretendard',fontSize: 12, color: ui_miss? Color(0xff333333) : Color(0xff4B5396)),), + SizedBox(height: 0,), + Row( + children: [ + SizedBox(width: 76,), + SvgPicture.asset('assets/images/conversation/intro/grief.svg') + ], + ) + ], + ), + ) + ), + ), + SizedBox(width: 16,), + Container( + width: 168, + height: 168, + child: ElevatedButton( + style: buttonChart().greybtn_1, + onPressed: () { + + }, + child: Container( + padding: EdgeInsets.only(top:8.0,left: 8.0, bottom: 8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox(height: 16,), + Text("์ „ํ•˜์ง€ ๋ชปํ•œ\n์ง„์‹ฌ", style: textStyle.grey16semibold), + SizedBox(height: 16,), + Text("์ „ํ•˜๊ณ ํ”ˆ ์ง„์‹ฌ์„\n์ด์•ผ๊ธฐํ•ด์š”.", style: textStyle.grey12normal), + SizedBox(height: 0,), + Row( + children: [ + SizedBox(width: 76,), + SvgPicture.asset('assets/images/conversation/done_cloud.svg') + ], + ) + ], + ), + ) + ), + ), + ], + ), + ] else if(conversationStage == "2A")...[ + Row( + children: [ + SizedBox(width: 16,), + Container( + width: 168, + height: 168, + child: ElevatedButton( + style: buttonChart().greybtn_1, + onPressed: () { + + }, + child: Container( + padding: EdgeInsets.only(top:8.0,left: 8.0, bottom: 8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox(height: 16,), + Text("์Šฌํ””์˜\n๊ฐ์ •", style: textStyle.grey16semibold), + SizedBox(height: 16,), + Text("์ด๋ณ„๋กœ ์ธํ•œ ์Šฌํ””์„\n์ด์•ผ๊ธฐํ•ด์š”.", style:textStyle.grey12normal), + SizedBox(height: 0,), + Row( + children: [ + SizedBox(width: 76,), + SvgPicture.asset('assets/images/conversation/done_drop.svg') + ], + ) + ], + ), + ) + ), + ), + SizedBox(width: 16,), + Container( + width: 168, + height: 168, + child: ElevatedButton( + style: ui_thetruthuntold? buttonChart().bluebtn2_1 : buttonChart().whitebtn_1, + onPressed: () { + // grief = true; + ui_sadness = false; + if(ui_thetruthuntold == false){ + ui_thetruthuntold = true; + } else{ + ui_thetruthuntold = false; + } + // nextQuestion++; + setState(() {}); + }, + child: Container( + padding: EdgeInsets.only(top:8.0,left: 8.0, bottom: 8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox(height: 16,), + Text("์ „ํ•˜์ง€ ๋ชปํ•œ\n์ง„์‹ฌ", style: TextStyle(fontFamily: 'Pretendard',fontSize: 16, color: ui_grief? Color(0xff333333) : Color(0xff4B5396)),), + SizedBox(height: 16,), + Text("์ „ํ•˜๊ณ ํ”ˆ ์ง„์‹ฌ์„\n์ด์•ผ๊ธฐํ•ด์š”.", style: TextStyle(fontFamily: 'Pretendard',fontSize: 12, color: ui_grief? Color(0xff333333) : Color(0xff4B5396)),), + SizedBox(height: 0,), + Row( + children: [ + SizedBox(width: 76,), + SvgPicture.asset('assets/images/conversation/intro/miss.svg') + ], + ) + ], + ), + ) + ), + ), + ], + ), + ], + ], + + ], + ), + ], + ), + ] + ], + ) + + ], + ), + ], + ), + ), + ), + // ์ž…๋ ฅ ๋ฐ ๋ฆฌ์ŠคํŠธ ์ถ”๊ฐ€ ์ž‘์—… - ๋งค์šฐ ์ค‘์š” + // // nextQuestion ์ด 3๊ณผ 7์ผ๋•Œ ๋“ฑ์žฅ + bottomSheet: Padding( + padding: EdgeInsets.only( + bottom: MediaQuery.of(context).viewInsets.bottom * 0.001), + child: Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + if(nextQuestion == 1 && no == false && yes == false)...[ + Container( + height: 136, + width: screenSize.width, + padding: EdgeInsets.only(bottom: 24, left: 16, right:16), + child: Column( + children: [ + ElevatedButton( + style: buttonChart().purplebtn, + onPressed: () { + if(conversationStage.contains("0")){ + yes = true; + early = true; + setState(() {}); + + _player.setAsset(voiceYes[voiceYesCount]); + voiceCount++; + _player.play(); + + // 2.5์ดˆ ์ ์ • + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + Timer(Duration(milliseconds: 2000), () { + controller1.stop(); + }); + } else if(conversationStage.contains("1")){ + yes = true; + early = true; + setState(() {}); + + _player.setAsset(voiceYes[voiceYesCount]); + voiceCount++; + _player.play(); + + // 2.5์ดˆ ์ ์ • + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + Timer(Duration(milliseconds: 3000), () { + controller1.stop(); + }); + } else if(conversationStage.contains("-1")){ + yes = true; + early = true; + setState(() {}); + + _player.setAsset(voiceYes[voiceYesCount]); + voiceCount++; + _player.play(); + + // 2.5์ดˆ ์ ์ • + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + Timer(Duration(milliseconds: 3000), () { + controller1.stop(); + }); + } + + else if(conversationStage.contains("2")){ + yes = true; + middle = true; + setState(() {}); + _player.setAsset(voiceYes[voiceYesCount]); + voiceCount++; + _player.play(); + + // 2.5์ดˆ ์ ์ • + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + Timer(Duration(milliseconds: 3000), () { + controller1.stop(); + }); + } else if(conversationStage.contains("3")){ + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => LatePage())); + } else if(conversationStage.contains("4")){ + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => EndPage())); + } + }, + child: Text("๋„ค, ์ข‹์•„์š”.", style: textStyle.white16semibold,), + ), + SizedBox(height: 8,), + ElevatedButton( + style: buttonChart().purplebtn3, + onPressed: () { + no = true; + setState(() {}); + + _player.setAsset(voiceNo[voiceNoCount]); + voiceCount++; + _player.play(); + + // 2.5์ดˆ ์ ์ • + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + Timer(Duration(milliseconds: 2000), () { + controller1.stop(); + }); + }, + child: Text("์•„๋‹ˆ์š”, ์•„์ง ์‹œ๊ฐ„์ด ํ•„์š”ํ•ด์š”.", style: textStyle.purple16midium,), + ), + ], + ), + ), + ] + else if(nextNo == 1 && selectedNextTime)...[ + Container( + color: Color(0xffFFFFFF).withOpacity(0.0), + child: Padding( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 24), + child: Container( + + width: screenSize.width, + height: 40, + child: ElevatedButton( + style: buttonChart().bluebtn3, + onPressed: () { + print("์–ผ๋งŒํผ ๋’ค๋กœ?:"+ whatTime.toString()); + noAns.insertAll(2, [ + "๋„ค, ${home.user}๋‹˜.\n${whatTime}์‹œ๊ฐ„ ํ›„์— ๋‹ค์‹œ ๋งŒ๋‚˜์š”!", + "๋„ค, ${home.user}๋‹˜.\n${whatTime}์‹œ๊ฐ„ ํ›„์— ๋‹ค์‹œ ๋งŒ๋‚˜์š”!", + ]); + //decidedType = false; + nextNo++; + // player2.setAsset(endVoice[voiceEndCount]); + // voiceEndCount++; + // player2.play(); + + _player.setAsset(voiceNo[2]); + //voiceNoCount++; + _player.play(); + + // 2.5์ดˆ ์ ์ • + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + Timer(Duration(milliseconds: 3000), () { + controller1.stop(); + }); + setState(() {}); + }, + child: Text("๋‹ค์Œ", style: TextStyle( + fontFamily: 'Pretendard', + fontSize: 16, fontWeight: FontWeight.w500, color: Color(0xffFFFFFF))), + ), + ),), + ), + ] + else if(no && nextNo == 3)...[ + Container( + color: Color(0xffFFFFFF).withOpacity(0.0), + child: Padding( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 24), + child: Container( + width: screenSize.width, + height: 40, + child: ElevatedButton( + style: buttonChart().bluebtn3, + onPressed: () { + //decidedType = false; + //checkSignUp = false; + //checkSignIn = true; + //checkSignUp = false; + var now = DateTime.now().add(Duration(hours: whatTime)); + sentDate = DateFormat('yyyy-MM-dd hh:mm:ss').format(now); + saveCon(sign_in.userAccessToken, sentDate); + setState(() {}); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => MyScreenPage(title: '์Šคํฌ๋ฆฐ ํŽ˜์ด์ง€',))); + }, + child: Text("์™„๋ฃŒ", style: TextStyle( + fontFamily: 'Pretendard', + fontSize: 16, fontWeight: FontWeight.w500, color: Color(0xffFFFFFF))), + ), + ),), + ), + ] + else if(yes && nextYes == 0 && (ui_memory || ui_farewell || ui_sadness || ui_thetruthuntold) )...[ + Container( + color: Color(0xffFFFFFF), + child: Padding( + padding: EdgeInsets.only(bottom: 24, left: 16, right:16), + child: Container( + width: screenSize.width, + height: 40, + child: ElevatedButton( + style: buttonChart().bluebtn3, + onPressed: () { + if(ui_memory){ + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => MemoryPage())); + + } else if (ui_farewell){ + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => FarewellPage())); + } else if (ui_sadness){ + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => SadnessPage())); + } else if (ui_thetruthuntold){ + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => TheTruthUntoldPage())); + } + setState(() {}); + }, + child: Text("๋‹ค์Œ"), + ), + ),), + ), + ] + ], + ), + ) + ), + ) + + ); + + } +} \ No newline at end of file diff --git a/client/lib/conversation/end_period/end.dart b/client/lib/conversation/end_period/end.dart new file mode 100644 index 0000000..ffa7f65 --- /dev/null +++ b/client/lib/conversation/end_period/end.dart @@ -0,0 +1,1124 @@ +import 'dart:async'; +import 'dart:convert'; +import 'dart:io'; +import 'package:flutter/material.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter_svg/svg.dart'; +import 'package:client/conversation/end_period/end_coach_mark.dart'; +import 'package:http/http.dart' as http; +import 'package:client/progressbar/animation_progressbar.dart'; +import 'package:client/style.dart'; +import 'package:just_audio/just_audio.dart'; +import 'package:flutter_gif/flutter_gif.dart'; +import 'package:image_picker/image_picker.dart'; +import 'package:client/main.dart'as main; + +/// ์ข…๊ฒฐ๊ธฐ ๋Œ€ํ™” + + +List endConversation = [ + "๋„ค, ์˜ค๋Š˜์€\n์ƒˆ๋กœ์šด ๋‚˜์— ๋Œ€ํ•ด ์–˜๊ธฐํ•ด๋ณด์•„์š”.", //0 + "์ด์ œ ์•„์ด๊ฐ€\n ๋– ๋‚œ ๋นˆ์ž๋ฆฌ์—", //1 + "์ƒˆ๋กœ์šด ๊ฟˆ๊ณผ ์—ด์ •์„ ์‹ฌ์„ ์ฐจ๋ก€์—์š”.", //2 + "๊ทธ ์˜๊ฐ์„ ๋ฐ›์•„\n ์ž์•„๋ฅผ ํƒ์ƒ‰ํ•˜๊ณ  ๊ฐ•์ ์„ ๋ฐœ๊ฒฌํ•˜๋ฉฐ", //3 + "๋” ํฐ ์˜๋ฏธ์™€ ๋ชฉ์ ์„\n ์ฐพ์•„ ๋‚˜์•„๊ฐ€๋ณผ๊นŒ์š”?", //4 + "์ƒˆ๋กœ์šด ๋‚˜๋ฅผ ๋ฐœ๊ฒฌํ•˜๊ณ \n์„ฑ์žฅํ•˜๋Š” ๊ณผ์ •์—์„œ", //5 + "์šฐ๋ฆฌ์˜ ์ธ์ƒ์€\n ํ’์š”๋กญ๊ณ  ์˜๋ฏธ ์žˆ๋Š” ๊ฒƒ์œผ๋กœ ์ด์–ด์งˆ ๊ฑฐ์˜ˆ์š”.", //6 + "๋ณดํ˜ธ์ž๋‹˜!", //7 + "ํ‰์†Œ ์ž์‹ ์— ๋Œ€ํ•ด \n ํ•œ ๋ฌธ์žฅ์œผ๋กœ ์„ค๋ช…ํ•ด์ฃผ์„ธ์š”!", //8 + "๊ทธ๋ ‡๊ตฐ์š”, ์ด๋ฒˆ์—๋Š”\n โ€˜๋‚˜ ์ž์‹ โ€™์— ๋Œ€ํ•ด ๋” ์•Œ์•„๊ฐ€๊ธฐ ์œ„ํ•ด", //9 + + "์ง€๊ธˆ๊นŒ์ง€์˜ ์ž์‹ ์˜ ๊ฒฝํ—˜๊ณผ\n ๋†“์ณค๋˜ ๊ฐ์ •์„ ๋ฐœ๊ฒฌํ•ด๋ณด์•„์š”.", //10<< ๋ฐ”๋€”์˜ˆ์ • + "์ตœ๊ทผ์— ์–ด๋–ค ๊ฒƒ ๋•Œ๋ฌธ์— ์›ƒ์—ˆ๋‚˜์š”?", //11 + "๊ทธ ์ˆœ๊ฐ„์„ ์‚ฌ์ง„๊ณผ ํ•จ๊ป˜ ์ถ”์–ตํ•˜๋ฉฐ\n ๊ธฐ๋ถ„์„ ํšŒ๋ณตํ•ด๋ณด์•„์š”.", //12 + "๊ทธ ์ˆœ๊ฐ„์„ ์‚ฌ์ง„๊ณผ ํ•จ๊ป˜ ์ถ”์–ตํ•˜๋ฉฐ\n ๊ธฐ๋ถ„์„ ํšŒ๋ณตํ•ด๋ณด์•„์š”.", //13 + "์ข‹์•„์š”. ๊ทธ๋ ‡๋‹ค๋ฉด\n ์•ž์œผ๋กœ 1๋…„ํ›„, 2๋…„ํ›„, 3๋…„ํ›„, 5๋…„ ํ›„", //14 + "๋ณดํ˜ธ์ž๋‹˜์€\n ๋ฌด์—‡์„ ํ•˜๊ณ  ์žˆ์„๊นŒ์š”?", //15 + "๋ฏธ๋ž˜์˜ ๋‚˜์— ๋Œ€ํ•ด ์ƒ๊ฐํ•˜๋Š” ๊ฒƒ์€\n ๋†€๋ผ์šด ๊ฒฝํ—˜์ด์—์š”.", //16 + "์–ด๋–ค ๋ฏธ๋ž˜๋ฅผ ๋งŒ๋“ค๊ณ  ์‹ถ์€์ง€\n ํ•จ๊ป˜ ์ƒ์ƒํ•ด๋ณผ๊นŒ์š”?", //17 + "๋ณดํ˜ธ์ž๋‹˜์€\n ๋ฏธ๋ž˜์— ์–ด๋–ค ์‚ฌ๋žŒ์ด ๋˜์–ด์žˆ์„๊นŒ์š”?", //18 + "๋ฏธ๋ž˜์˜ ๋ณดํ˜ธ์ž๋‹˜์— ๋Œ€ํ•œ\n ๊ณ„ํš์„ ์ƒ์ƒํ•˜๊ณ ", //19 + "๊ตฌ์ฒดํ™”ํ•˜๋Š” ๊ณผ์ •์€\n ํฅ๋ฏธ๋กœ์šด ์—ฌ์ •์ด ๋ ๊ฑฐ์˜ˆ์š”!", //20 + "์ž์‹ ์ด ์„ค์ •ํ•œ ๋ชฉํ‘œ์—\n ์„ค๋ ˜์„ ๋А๋ผ๊ณ  ์„ฑ์ทจํ•˜๋ฉฐ", //21 + "๋ฏธ๋ž˜๋ฅผ ํ–ฅํ•ด ๋‚˜์•„๊ฐ€\n ๋” ํ’์š”๋กœ์šด ์‚ถ์„ ๋งŒ๋“ค์–ด ๋‚˜๊ฐ€๋ณด์•„์š”!", //22 + "์–ด๋ ค์šด ์ˆœ๊ฐ„์„ ๊ฒช์„ ๋•Œ,", //23 + "ํ•จ๊ป˜ํ•˜๋Š” ์‚ฌ๋žŒ๋“ค์˜ ์ง€์ง€์™€ ์ดํ•ด๋Š”\n ํฐ ํž˜์ด ๋ผ์š”.", //24 + "๊ทธ๋Ÿฌ๋‹ˆ, \n ์•„ํ””์„ ํ•จ๊ป˜ ๋‚˜๋ˆ„๊ณ  ๊ทน๋ณตํ•  ์ˆ˜ ์žˆ๋„๋ก", //25 + "๋‹ค๋ฅธ ๋ฐ˜๋ ค์ธ๋“ค์—๊ฒŒ\n ๋„์›€์„ ๋ณด๋‚ด๋ณด๋Š” ๊ฑด ์–ด๋–จ๊นŒ์š”?", //26 + + + // "๋ณดํ˜ธ์ž๋‹˜,", //27 + // "์ด์ œ ๋ชจ๋“  ๋Œ€ํ™”๊ฐ€ ๋์ด๋‚ฌ์–ด์š”!", //28 + // "๊ทธ๋™์•ˆ ํ•จ๊ป˜ํ•œ ๋Œ€ํ™”๋Š”\n ์†Œ์ค‘ํ•˜๊ณ  ์˜๋ฏธ ์žˆ๋Š” ์‹œ๊ฐ„์ด์—ˆ์–ด์š”.", //29 + // "์ด์ œ ๋Œ€ํ™”๋Š” ์ข…๋ฃŒ๋˜์ง€๋งŒ,", //30 + // "๊ทธ๋™์•ˆ์˜ ์ˆœ๊ฐ„๋“ค์€\n ๊ธฐ์–ต ์†์— ๊ฐ„์ง๋˜๊ธธ ๋ฐ”๋ผ์š”.", //31 + // "์ง€๊ธˆ๊นŒ์ง€\n ๋Œ€ํ™”์˜ ์—ฌ์ •์— ํ•จ๊ป˜ ํ•ด์ค˜์„œ ๊ณ ๋งˆ์›Œ์š”!", //32 + // + // "์ด์ œ โ€˜๊ธฐ์–ตํ• ๊ฐœโ€™ ์† ์ƒˆ๋กœ์šด ์ผ์ƒ์ด ๋‹น์‹ ์„ ๊ธฐ๋‹ค๋ฆฌ๊ณ  ์žˆ์–ด์š”.", //33 + // "์ด ๋Œ€ํ™”๋ฅผ ๋‹ซ๊ณ  ๋‚˜๊ฐ€๋Š” ์ˆœ๊ฐ„,", //34 + // "์‚ถ์˜ ๋‹ค์Œ ์žฅ์ด ํŽผ์ณ์ง€๊ธฐ๋ฅผ ๋ฐ”๋ž๋‹ˆ๋‹ค.", //35 +]; + +AudioPlayer player2 = AudioPlayer(); + +late FlutterGifController controller1, controller2, controller3; + +List voice =[ + "assets/voice/end/endp1.mp3", + "assets/voice/end/endp2.mp3", + "assets/voice/end/endp3.mp3", + "assets/voice/end/endp4.mp3", + "assets/voice/end/endp5.mp3", + "assets/voice/end/endp6.mp3", + "assets/voice/end/endp7.mp3", + "assets/voice/end/endp8.mp3", + "assets/voice/end/endp9.mp3", + "assets/voice/end/endp10.mp3", + "assets/voice/end/endp11.mp3", + "assets/voice/end/endp12.mp3", + "assets/voice/end/endp13.mp3", + "", + "assets/voice/end/endp15.mp3", + "assets/voice/end/endp16.mp3", + "assets/voice/end/endp17.mp3", + "assets/voice/end/endp18.mp3", + "assets/voice/end/endp19.mp3", + "assets/voice/end/endp20.mp3", + "assets/voice/end/endp21.mp3", + "assets/voice/end/endp22.mp3", + "assets/voice/end/endp23.mp3", + "assets/voice/end/endp24.mp3", + "assets/voice/end/endp25.mp3", + "assets/voice/end/endp26.mp3", + "assets/voice/end/endp27.mp3", +]; + +class EndPage extends StatefulWidget { + + static Future navigatorPush(BuildContext context) async { + return Navigator.push( + context, + MaterialPageRoute( + builder: (_) => EndPage(), + ), + ); + } + + @override + _EndPageState createState() => _EndPageState(); +} + +class _EndPageState extends State with TickerProviderStateMixin { + + // ํ…์ŠคํŠธ ์—๋””ํŒ… ์ปจํŠธ๋กค๋Ÿฌ๋ฅผ ์ƒ์„ฑํ•˜์—ฌ ํ•„๋“œ์— ํ• ๋‹น + final meController = TextEditingController(); + final memoryController = TextEditingController(); + final futureController = TextEditingController(); + final oneController = TextEditingController(); + final twoController = TextEditingController(); + final threeController = TextEditingController(); + final fiveController = TextEditingController(); + + bool me = false; + bool memory = false; + bool future = false; + bool one = false; + bool two = false; + bool three = false; + bool five = false; + + bool isPicSelected = false; // ์‚ฌ์ง„์ด ๋“ค์–ด๊ฐ€๋Š”์ง€ ํ™•์ธํ•˜๋Š” ์ฝ”๋“œ -> UI ๋ฐ”๋€œ + + XFile? _image; //์ด๋ฏธ์ง€๋ฅผ ๋‹ด์„ ๋ณ€์ˆ˜ ์„ ์–ธ + final ImagePicker picker = ImagePicker(); //ImagePicker ์ดˆ๊ธฐํ™” + bool modiImage = false; + + //์ด๋ฏธ์ง€๋ฅผ ๊ฐ€์ ธ์˜ค๋Š” ํ•จ์ˆ˜ + Future getImage(ImageSource imageSource) async { + //pickedFile์— ImagePicker๋กœ ๊ฐ€์ ธ์˜จ ์ด๋ฏธ์ง€๊ฐ€ ๋‹ด๊ธด๋‹ค. + final XFile? pickedFile = await picker.pickImage(source: imageSource); + if (pickedFile != null) { + setState(() { + modiImage= true; + _image = XFile(pickedFile.path); //๊ฐ€์ ธ์˜จ ์ด๋ฏธ์ง€๋ฅผ _image์— ์ €์žฅ + }); + } + } + + + FocusNode _focusNode = FocusNode(); + + @override + void initState() { + super.initState(); + + main.play = true; + main.player.setAsset(main.musics[4]); + main.player.play(); + + // ์Œ์› ์ ์šฉ + for(int i= 0 ; i < voice.length; i++){ + player2.setAudioSource(AudioSource.uri( + Uri.parse(voice[i])) + ); + } + + controller1 = FlutterGifController(vsync: this); + + player2.setAsset(voice[voiceCount]); + voiceCount++; + player2.play(); + + // 2.5์ดˆ ์ ์ • + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + Timer(Duration(milliseconds: 4000), () { + controller1.stop(); + }); + + _callAPI(); + _focusNode.addListener(_onFocusChange); + } + + void _onFocusChange() { + if (_focusNode.hasFocus) { + // ํ‚ค๋ณด๋“œ ์˜ฌ๋ฆฌ๊ธฐ + FocusScope.of(context).requestFocus(_focusNode); + } + } + + @override + void dispose() async { + super.dispose(); + } + + List introText =[]; + int nextQuestion = 0; + int voiceCount = 0; + + + void _callAPI() async { + // ์š”์ฒญ ๋ณธ๋ฌธ ๋ฐ์ดํ„ฐ + var data = { + "stage" : "0", + "set" : "0", + "lineId" : "0" + }; + + var url = Uri.parse('http://3.38.1.125:8080/conversation/line'); // ์—”๋“œํฌ์ธํŠธ URL ์„ค์ • + + try { + var response = await http.post( + url, + body: json.encode(data), // ์š”์ฒญ ๋ณธ๋ฌธ์— ๋ฐ์ดํ„ฐ๋ฅผ JSON ํ˜•์‹์œผ๋กœ ์ธ์ฝ”๋”ฉํ•˜์—ฌ ์ „๋‹ฌ + headers: {'Content-Type': 'application/json',}, // ์š”์ฒญ ํ—ค๋”์— Content-Type ์„ค์ • + ); + + if (response.statusCode == 200) { + // ์‘๋‹ต ์„ฑ๊ณต ์‹œ์˜ ์ฒ˜๋ฆฌ + + var jsonResponse = utf8.decode(response.bodyBytes); // ์‘๋‹ต ๋ณธ๋ฌธ์„ JSON ํ˜•์‹์œผ๋กœ ๋””์ฝ”๋”ฉ + // JSON ๊ฐ’์„ ํ™œ์šฉํ•œ ์›ํ•˜๋Š” ๋™์ž‘ ์ˆ˜ํ–‰ + //utf8.decode(jsonResponse); + print(jsonResponse); + + List contentList = []; + + List parsedResponse = json.decode(jsonResponse); + + setState(() { + for (var item in parsedResponse) { + if (item['content'] != null) { + introText.add(item['content']); + } + } + }); + + print(introText); + + print('API ํ˜ธ์ถœ ์„ฑ๊ณต: ${response.statusCode}'); + } else { + // ์š”์ฒญ ์‹คํŒจ ์‹œ์˜ ์ฒ˜๋ฆฌ + print('API ํ˜ธ์ถœ ์‹คํŒจ: ${response.statusCode}'); + } + } catch (e) { + // ์˜ˆ์™ธ ๋ฐœ์ƒ ์‹œ์˜ ์ฒ˜๋ฆฌ + print('API ํ˜ธ์ถœ ์ค‘ ์˜ˆ์™ธ ๋ฐœ์ƒ: $e'); + } + } + + + @override + Widget build(BuildContext context) { + MediaQueryData deviceData = MediaQuery.of(context); + Size screenSize = deviceData.size; + return + Container( + color: Color(0xffDDE7FD), + child: GestureDetector( + onTap: (){ + print("์ด๊ฑฐ๋งŒ ์ข€ ํ™•์ธ ๋ถ€ํƒ: " + nextQuestion.toString()); + + if(nextQuestion < 8){ + nextQuestion++; // ์ธํŠธ๋กœ ์‹œ์ž‘ ํ›„ count + player2.setAsset(voice[voiceCount]); + voiceCount++; + player2.play(); + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + if(nextQuestion == 1){ + Timer(Duration(milliseconds: 3000), () { + controller1.stop(); + }); + } else if(nextQuestion == 2){ + Timer(Duration(milliseconds: 3500), () { + controller1.stop(); + }); // ok + } else if(nextQuestion == 3){ + Timer(Duration(milliseconds: 5000), () { + controller1.stop(); + }); + } else if(nextQuestion == 4){ + Timer(Duration(milliseconds: 4500), () { + controller1.stop(); + }); + } + else if(nextQuestion == 5){ + Timer(Duration(milliseconds: 4500), () { + controller1.stop(); + }); + } + else if(nextQuestion == 6){ + Timer(Duration(milliseconds: 5000), () { + controller1.stop(); + }); + } + else if(nextQuestion == 7){ + Timer(Duration(milliseconds: 1500), () { + controller1.stop(); + }); + } + else if(nextQuestion == 8){ + Timer(Duration(milliseconds: 4000), () { + controller1.stop(); + }); + } + } + else if(nextQuestion == 8){ + // ํ‰์†Œ์˜ ๋‚˜ + } + else if(nextQuestion > 8 && nextQuestion < 13){ + nextQuestion++; + player2.setAsset(voice[voiceCount]); + voiceCount++; + player2.play(); + + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + if(nextQuestion == 10){ + Timer(Duration(milliseconds: 5000), () { + controller1.stop(); + }); + } else if(nextQuestion == 11){ + Timer(Duration(milliseconds: 3000), () { + controller1.stop(); + }); // ok + } else if(nextQuestion == 12){ + Timer(Duration(milliseconds: 4500), () { + controller1.stop(); + }); // ok + } + + } + else if(nextQuestion == 13){ + // ์ถ”์–ต ์˜ฌ๋ฆฌ๊ธฐ + } + else if(nextQuestion >13 && nextQuestion <15){ + nextQuestion++; + player2.setAsset(voice[voiceCount]); + voiceCount++; + player2.play(); + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + if(nextQuestion == 15){ + Timer(Duration(milliseconds: 2500), () { + controller1.stop(); + }); + } + } + else if(nextQuestion == 15){ + // ๋ญ˜ํ•˜๊ณ  ์žˆ์„๊นŒ? + + } + else if(nextQuestion >15 && nextQuestion < 18){ + nextQuestion++; + player2.setAsset(voice[voiceCount]); + voiceCount++; + player2.play(); + + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + if(nextQuestion == 17){ + Timer(Duration(milliseconds: 4500), () { + controller1.stop(); + }); + } else if(nextQuestion == 18){ + Timer(Duration(milliseconds: 4500), () { + controller1.stop(); + }); + } + } + else if(nextQuestion == 18){ + // ๋ฏธ๋ž˜์— ์–ด๋–ค ์‚ฌ๋žŒ์ด? + + } + else if(nextQuestion > 18 && nextQuestion < 26){ + nextQuestion++; + player2.setAsset(voice[voiceCount]); + voiceCount++; + player2.play(); + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + if(nextQuestion == 20){ + Timer(Duration(milliseconds: 4500), () { + controller1.stop(); + }); + } else if(nextQuestion == 21){ + Timer(Duration(milliseconds: 4500), () { + controller1.stop(); + }); + } else if(nextQuestion == 22){ + Timer(Duration(milliseconds: 5000), () { + controller1.stop(); + }); + } else if(nextQuestion == 23){ + Timer(Duration(milliseconds: 2500), () { + controller1.stop(); + }); + } else if(nextQuestion == 24){ + Timer(Duration(milliseconds: 4500), () { + controller1.stop(); + }); + } else if(nextQuestion == 25){ + Timer(Duration(milliseconds: 4500), () { + controller1.stop(); + }); + } else if(nextQuestion == 26){ + Timer(Duration(milliseconds: 4500), () { + controller1.stop(); + }); + } + + } + else if(nextQuestion == 26){ + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => EndMarkCoachPage())); + } + + + setState(() { + }); + }, + child: Scaffold( + backgroundColor: Colors.transparent, + appBar: AppBar( + //title: Text("๊ธฐ์–ตํ• ๊ฐœ", style: TextStyle(fontSize:16, color: Colors.white ),), + //centerTitle: true, + leading: IconButton( + icon: SvgPicture.asset( + 'assets/images/conversation/home_icon.svg', + ), + onPressed: () => Navigator.of(context).pop(), + ), + backgroundColor: Colors.transparent, + elevation: 0.0, + ), + //extendBodyBehindAppBar: true, + body: + SingleChildScrollView( + child: Container( + child: Column( + children: [ + SizedBox(height: 3,), + Container( + width: screenSize.width, + height: 25, + child: Padding( + padding: EdgeInsets.only( left:16, right: 16), + child: Center( + child: FAProgressBar( + currentValue: 95, + size: 5, + backgroundColor: Colors.white, + ) + ), + ), + ), + Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children:[ + SizedBox( + height: 10, + ), + Stack( + children: [ + Container( + height: 157, + width: screenSize.width, + child: + Stack( + children: [ + Center(child: SvgPicture.asset('assets/images/conversation/bubble.svg',fit: BoxFit.fill,),), + Container( + padding: const EdgeInsets.symmetric(horizontal: 32, vertical: 12, ), + child: Center( + child: Column( + children: [ + if(endConversation[nextQuestion].toString().contains("\n"))...[ + SizedBox(height: 28,), + Text( + endConversation[nextQuestion], + textAlign: TextAlign.center, + style: textStyle.bubbletext, + ), + ]else...[ + SizedBox(height: 42,), + Text( + endConversation[nextQuestion], + textAlign: TextAlign.center, + style: textStyle.bubbletext, + ), + ], + ], + ) + ) + ), + ], + ) + ), + // ๋ฌด์ง€ ์œ„์น˜ + if(nextQuestion < 13 || (nextQuestion > 13 && nextQuestion < 15) ||(nextQuestion > 15) )...[ + Stack( + children: [ + // ์œ ์ € ์œ„์น˜ + Column( + children: [ + SizedBox(height: 420,), + Container( + child: SvgPicture.asset( + 'assets/images/conversation/user7.svg', + height: 282, + width: screenSize.width, + ), + ), + ], + ), + Column( + children: [ + SizedBox(height: 144,), + Container( + width: screenSize.width, + height: 375, + child: + Stack( + children: [ + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child: Image.asset('assets/images/conversation/gif/muji_ear.gif', + fit: BoxFit.cover,),), + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child: Image.asset('assets/images/conversation/gif/muji_base.gif', fit: BoxFit.cover,),), + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child: Image.asset('assets/images/conversation/gif/muji_base_eye.gif', + fit: BoxFit.cover,),), + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child:GifImage( + controller: controller1, + image: const AssetImage("assets/images/conversation/gif/muji_mouth1.gif"), + ), + // Image.asset('assets/images/conversation/gif/muji_mouth1.gif', fit: BoxFit.cover,), + ) + ], + ) + + // SvgPicture.asset( + // 'assets/images/conversation/con_muji.svg', fit: BoxFit.cover, + // ), + ), + ], + ), + ], + ), + ] + else if(nextQuestion == 13)...[ + Container( + width: screenSize.width, + height: 750, + child: Column( + children: [ + Expanded( + child: Column( + children: [ + Stack( + children: [ + Padding( + padding: EdgeInsets.only(top: 160, left:16), + child: SvgPicture.asset('assets/images/conversation/end/paper.svg', + fit: BoxFit.contain, + height: 452, + width: screenSize.width, + ), + ), + Padding( + padding: EdgeInsets.only(top: 192, left:32), + child: InkWell( + onTap: (){ + getImage(ImageSource.gallery); + }, + child: modiImage? + Container(width: 320, height: 320,child: Image.file(File(_image!.path),fit: BoxFit.cover,),) + : + SvgPicture.asset('assets/images/conversation/end/add_btn.svg', + fit: BoxFit.contain, + height: 320, + width: screenSize.width, + ), + ), + ), + Padding( + padding: EdgeInsets.only(top:528,left: 32, right:32, bottom:16), + child: SizedBox( + width: screenSize.width, + //height: 150, + child: TextField( + style: textStyle.bubbletext, + controller: memoryController, + decoration: InputDecoration( + contentPadding: EdgeInsets.only(top:3, left: 0), + hintStyle: textStyle.bubbletext, + border: InputBorder.none, + focusedBorder: InputBorder.none, + hintText: '์ด๊ณณ์— ๊ทธ๋‚ ์˜ ์ถ”์–ต์„ ์ž‘์„ฑํ•ด์ฃผ์„ธ์š”.(75์ž)', + counterText:'', + ), + maxLines: 2, + maxLength: 75, + onTap: (){ + // ํŽธ์ง€์ง€ ์˜ฌ๋ฆฌ๊ธฐ? + }, + onChanged: (text){ + // ํŽธ์ง€๋ฅผ ์จ์•ผ ๋‹ค์Œ์œผ๋กœ ๋„˜์–ด๊ฐˆ ์ˆ˜ ์žˆ๋„๋ก ์„ค์ • + memory = true; + setState(() {}); + }, + ), + ), + ), + ], + ) + ], + ) + ), + ], + ) + ), + // Stack( + // children: [ + // Padding( + // padding: EdgeInsets.only(top: 160, left:16), + // child: SvgPicture.asset('assets/images/conversation/end/paper.svg', + // fit: BoxFit.contain, + // height: 452, + // width: screenSize.width, + // ), + // ), + // Padding( + // padding: EdgeInsets.only(top: 192, left:32), + // child: InkWell( + // onTap: (){ + // getImage(ImageSource.gallery); + // }, + // child: modiImage? + // Container(width: 320, height: 320,child: Image.file(File(_image!.path),fit: BoxFit.cover,),) + // : + // SvgPicture.asset('assets/images/conversation/end/add_btn.svg', + // fit: BoxFit.contain, + // height: 320, + // width: screenSize.width, + // ), + // ), + // ), + // Padding( + // padding: EdgeInsets.only(top:528,left: 32, right:32, bottom:16), + // child: SizedBox( + // width: screenSize.width, + // //height: 150, + // child: TextField( + // style: textStyle.bubbletext, + // controller: memoryController, + // decoration: InputDecoration( + // contentPadding: EdgeInsets.only(top:3, left: 0), + // hintStyle: textStyle.bubbletext, + // border: InputBorder.none, + // focusedBorder: InputBorder.none, + // hintText: '์ด๊ณณ์— ๊ทธ๋‚ ์˜ ์ถ”์–ต์„ ์ž‘์„ฑํ•ด์ฃผ์„ธ์š”.(75์ž)', + // counterText:'', + // ), + // maxLines: 2, + // maxLength: 75, + // onTap: (){ + // // ํŽธ์ง€์ง€ ์˜ฌ๋ฆฌ๊ธฐ? + // }, + // onChanged: (text){ + // // ํŽธ์ง€๋ฅผ ์จ์•ผ ๋‹ค์Œ์œผ๋กœ ๋„˜์–ด๊ฐˆ ์ˆ˜ ์žˆ๋„๋ก ์„ค์ • + // memory = true; + // setState(() {}); + // }, + // ), + // ), + // ), + // ], + // ) + ] + else if(nextQuestion == 15)...[ + Stack( + children: [ + Column( + children: [ + SizedBox(height: 160,), + Image.asset('assets/images/conversation/end/future.png', + fit: BoxFit.contain, + height: 400, + width: screenSize.width, + ), + // SvgPicture.asset('assets/images/conversation/end/future.png', + // fit: BoxFit.contain, + // height: 400, + // width: screenSize.width, + // ), + ], + ), + Column( + children: [ + SizedBox(height: 182,), + Padding(padding: EdgeInsets.only(left: 29), + child: SvgPicture.asset('assets/images/conversation/end/one.svg', + fit: BoxFit.contain, + height: 28, + ),), + SizedBox(height: 72,), + Padding(padding: EdgeInsets.only(left: 29), + child: SvgPicture.asset('assets/images/conversation/end/two.svg', + fit: BoxFit.contain, + height: 28, + ),), + SizedBox(height: 68,), + Padding(padding: EdgeInsets.only(left: 29), + child: SvgPicture.asset('assets/images/conversation/end/three.svg', + fit: BoxFit.contain, + height: 28, + ),), + SizedBox(height: 68,), + Padding(padding: EdgeInsets.only(left: 29), + child: SvgPicture.asset('assets/images/conversation/end/five.svg', + fit: BoxFit.contain, + height: 28, + ),), + + ], + ), + + Padding(padding: EdgeInsets.only(left: 32, right: 32, top:200), + child: Column( + children: [ + TextField( + style: textStyle.bk16normal, + controller: oneController, + decoration: InputDecoration( + contentPadding: EdgeInsets.only(top:3, left: 0), + hintStyle: textStyle.grey16normal, + border: InputBorder.none, + focusedBorder: InputBorder.none, + hintText: '1๋…„ํ›„์˜ ๋‚˜๋Š”...', + counterText:'', + ), + maxLines: 1, + maxLength: 50, + onTap: (){ + // ํŽธ์ง€์ง€ ์˜ฌ๋ฆฌ๊ธฐ? + }, + onChanged: (text){ + // ํŽธ์ง€๋ฅผ ์จ์•ผ ๋‹ค์Œ์œผ๋กœ ๋„˜์–ด๊ฐˆ ์ˆ˜ ์žˆ๋„๋ก ์„ค์ • + one = true; + setState(() {}); + }, + ), + SizedBox(height: 48,), + TextField( + style: textStyle.bk16normal, + controller: twoController, + decoration: InputDecoration( + contentPadding: EdgeInsets.only(top:3, left: 0), + hintStyle: textStyle.grey16normal, + border: InputBorder.none, + focusedBorder: InputBorder.none, + hintText: '2๋…„ํ›„์˜ ๋‚˜๋Š”...', + counterText:'', + ), + maxLines: 1, + maxLength: 50, + onTap: (){ + // ํŽธ์ง€์ง€ ์˜ฌ๋ฆฌ๊ธฐ? + }, + onChanged: (text){ + // ํŽธ์ง€๋ฅผ ์จ์•ผ ๋‹ค์Œ์œผ๋กœ ๋„˜์–ด๊ฐˆ ์ˆ˜ ์žˆ๋„๋ก ์„ค์ • + two = true; + setState(() {}); + }, + ), + SizedBox(height: 48,), + TextField( + style: textStyle.bk16normal, + controller: threeController, + decoration: InputDecoration( + contentPadding: EdgeInsets.only(top:3, left: 0), + hintStyle: textStyle.grey16normal, + border: InputBorder.none, + focusedBorder: InputBorder.none, + hintText: '3๋…„ํ›„์˜ ๋‚˜๋Š”...', + counterText:'', + ), + maxLines: 1, + maxLength: 50, + onTap: (){ + // ํŽธ์ง€์ง€ ์˜ฌ๋ฆฌ๊ธฐ? + }, + onChanged: (text){ + // ํŽธ์ง€๋ฅผ ์จ์•ผ ๋‹ค์Œ์œผ๋กœ ๋„˜์–ด๊ฐˆ ์ˆ˜ ์žˆ๋„๋ก ์„ค์ • + three = true; + setState(() {}); + }, + ), + SizedBox(height: 48,), + TextField( + style: textStyle.bk16normal, + controller: fiveController, + decoration: InputDecoration( + contentPadding: EdgeInsets.only(top:3, left: 0), + hintStyle: textStyle.grey16normal, + border: InputBorder.none, + focusedBorder: InputBorder.none, + hintText: '5๋…„ํ›„์˜ ๋‚˜๋Š”...', + counterText:'', + ), + maxLines: 1, + maxLength: 50, + onTap: (){ + // ํŽธ์ง€์ง€ ์˜ฌ๋ฆฌ๊ธฐ? + }, + onChanged: (text){ + // ํŽธ์ง€๋ฅผ ์จ์•ผ ๋‹ค์Œ์œผ๋กœ ๋„˜์–ด๊ฐˆ ์ˆ˜ ์žˆ๋„๋ก ์„ค์ • + five = true; + setState(() {}); + }, + ), + SizedBox(height: 48,), + ], + ), + ), + + + ], + ) + + ] + ], + ), + + ], + ), + ], + ), + ), + ), + + // // nextQuestion ์ด 3๊ณผ 7์ผ๋•Œ ๋“ฑ์žฅ + bottomSheet: Padding( + padding: EdgeInsets.only( + bottom: MediaQuery.of(context).viewInsets.bottom * 0.001), + child: Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + if(nextQuestion == 8)...[ + Container( + color: Colors.white, + height: 48, + child: Padding( + padding: const EdgeInsets.only(bottom: 8.0, top: 8.0, left: 16,right: 16), + child: Stack( + children: [ + Container( + width: screenSize.width, + height: 48, + decoration: BoxDecoration( + color: Colors.white, + border: Border.all(color: me? Color(colorChart.blue): Color(0xffC0D2FC)), + borderRadius: BorderRadius.circular(30), + ), + ), + Positioned( + left: 15, + right: 30, + bottom: -4, + child: TextField( + textAlignVertical: TextAlignVertical.center, + maxLines: 1, + controller: meController, + style: textStyle.bk14normal, + decoration: InputDecoration( + hintStyle: textStyle.grey14normal, + border: InputBorder.none, + hintText: 'ํ‰์†Œ์˜ ๋‚˜ ์ž์‹ ์— ๋Œ€ํ•ด ์„ค๋ช…ํ•˜์ž๋ฉด...'), + onChanged: (s) { + //text = s; + me = true; + setState(() { + + }); + }, + onTap: () {}, + ), + ), + Positioned( + left: screenSize.width - 81, + //right: 30, + bottom: 3, + top: 3, + child: ElevatedButton( + onPressed: () { + if(me){ + player2.setAsset(voice[voiceCount]); + voiceCount++; + player2.play(); + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + + Timer(Duration(milliseconds: 4000), () { + controller1.stop(); + }); + + nextQuestion++; + setState(() { + + }); + } + + }, + style: ElevatedButton.styleFrom( + backgroundColor: me?Color(colorChart.blue):Color(0xffDDE7FD), + fixedSize: const Size(23, 23), + shape: const CircleBorder(), + ), + child: Icon( + Icons.arrow_upward, + color: Colors.white, + size: 16, + )), + ), + ], + ), + ), + ), + ] + else if(nextQuestion == 13 && memory)...[ + Container( + color: Color(0xffFFFFFF).withOpacity(0), + child: Padding( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 24), + child: Container( + width: screenSize.width, + height: 40, + child: ElevatedButton( + style: buttonChart().bluebtn3, + onPressed: () { + //decidedType = false; + nextQuestion++; + player2.setAsset(voice[voiceCount]); + voiceCount++; + player2.play(); + // 2.5์ดˆ ์ ์ • + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + Timer(Duration(milliseconds: 8000), () { + controller1.stop(); + }); + setState(() {}); + }, + child: Text("์™„๋ฃŒ", style: TextStyle( + fontFamily: 'Pretendard', + fontSize: 16, fontWeight: FontWeight.w500, color: Color(0xffFFFFFF))), + ), + ),), + ), + ] + else if(nextQuestion == 15 && one && two && three && five)...[ + Container( + color: Color(0xffFFFFFF).withOpacity(0), + child: Padding( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 24), + child: Container( + width: screenSize.width, + height: 40, + child: ElevatedButton( + style: buttonChart().bluebtn3, + onPressed: () { + //decidedType = false; + nextQuestion++; + player2.setAsset(voice[voiceCount]); + voiceCount++; + player2.play(); + // 2.5์ดˆ ์ ์ • + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + Timer(Duration(milliseconds: 4000), () { + controller1.stop(); + }); + setState(() {}); + }, + child: Text("์™„๋ฃŒ", style: TextStyle( + fontFamily: 'Pretendard', + fontSize: 16, fontWeight: FontWeight.w500, color: Color(0xffFFFFFF))), + ), + ),), + ), + ] + else if(nextQuestion == 18)...[ + Container( + color: Colors.white, + width: screenSize.width, + height: 48, + child: Padding( + padding: const EdgeInsets.only(bottom: 8.0, top: 8.0, left: 16,right: 16), + child: Stack( + children: [ + Container( + width: screenSize.width, + height: 48, + decoration: BoxDecoration( + color: Colors.white, + border: Border.all(color: future? Color(colorChart.blue):Color(0xffC0D2FC)), + borderRadius: BorderRadius.circular(30), + ), + ), + Positioned( + left: 15, + right: 30, + bottom:-4, + child: TextField( + textAlignVertical: TextAlignVertical.center, + maxLines: 1, + controller: futureController, + style: textStyle.bk14normal, + decoration: InputDecoration( + hintStyle: textStyle.grey14normal, + border: InputBorder.none, + hintText: '๋‚˜๋Š” ๋ฏธ๋ž˜์—...'), + onChanged: (s) { + //text = s; + future = true; + setState(() { + + }); + }, + onTap: () {}, + ), + ), + Positioned( + left: screenSize.width - 81, + //right: 30, + bottom: 3, + top: 3, + child: ElevatedButton( + onPressed: () { + if(future){ + player2.setAsset(voice[voiceCount]); + voiceCount++; + player2.play(); + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + + Timer(Duration(milliseconds: 3500), () { + controller1.stop(); + }); + + nextQuestion++; + setState(() { + + }); + } + + }, + style: ElevatedButton.styleFrom( + backgroundColor: future? Color(colorChart.blue):Color(0xffC0D2FC), + fixedSize: const Size(23, 23), + shape: const CircleBorder(), + ), + child: Icon( + Icons.arrow_upward, + color: Colors.white, + size: 16, + )), + ), + ], + ), + ), + ), + ] + + ], + ), + )), + ) + + ); + + } +} + + diff --git a/client/lib/conversation/end_period/end2.dart b/client/lib/conversation/end_period/end2.dart new file mode 100644 index 0000000..30f2b5f --- /dev/null +++ b/client/lib/conversation/end_period/end2.dart @@ -0,0 +1,480 @@ +import 'dart:async'; +import 'dart:convert'; +import 'package:flutter/material.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter_svg/svg.dart'; +import 'package:client/screen.dart'; +import 'package:http/http.dart' as http; +import 'package:client/progressbar/animation_progressbar.dart'; +import 'package:client/style.dart'; +import 'package:intl/intl.dart'; +import 'package:just_audio/just_audio.dart'; +import 'package:flutter_gif/flutter_gif.dart'; +import 'package:client/sign/sign_in.dart' as sign_in; +import 'package:client/main.dart'as main; + +/// ์ข…๊ฒฐ๊ธฐ ๋Œ€ํ™” + +List endConversation = [ + "๋ณดํ˜ธ์ž๋‹˜,", //27 + "์ด์ œ ๋ชจ๋“  ๋Œ€ํ™”๊ฐ€ ๋์ด ๋‚ฌ์–ด์š”!", //28 + "๊ทธ๋™์•ˆ ํ•จ๊ป˜ํ•œ ๋Œ€ํ™”๋Š”\n ์†Œ์ค‘ํ•˜๊ณ  ์˜๋ฏธ ์žˆ๋Š” ์‹œ๊ฐ„์ด์—ˆ์–ด์š”.", //29 + "์ด์ œ ๋Œ€ํ™”๋Š” ์ข…๋ฃŒ๋˜์ง€๋งŒ,", //30 + "๊ทธ๋™์•ˆ์˜ ์ˆœ๊ฐ„๋“ค์€\n ๊ธฐ์–ต ์†์— ๊ฐ„์ง๋˜๊ธฐ๋ฅผ ๋ฐ”๋ผ์š”.", //31 + "์ง€๊ธˆ๊นŒ์ง€\n ๋Œ€ํ™”์˜ ์—ฌ์ •์— ํ•จ๊ป˜ ํ•ด์ค˜์„œ ๊ณ ๋งˆ์›Œ์š”!", //32 + + "์ด์ œ โ€˜๊ธฐ์–ตํ• ๊ฐœโ€™ ์†\n์ƒˆ๋กœ์šด ์ผ์ƒ์ด ๋‹น์‹ ์„ ๊ธฐ๋‹ค๋ฆฌ๊ณ  ์žˆ์–ด์š”.", //33 + " ์ด ๋Œ€ํ™”๋ฅผ ๋‹ซ๊ณ  ๋‚˜๊ฐ€๋Š” ์ˆœ๊ฐ„,", //34 + "์‚ถ์˜ ๋‹ค์Œ ์žฅ์ด ํŽผ์ณ์ง€๊ธฐ๋ฅผ ๋ฐ”๋ž๋‹ˆ๋‹ค.", //35 +]; + +AudioPlayer player2 = AudioPlayer(); + +late FlutterGifController controller1, controller2, controller3; + +List voice =[ + "assets/voice/end/endp2_1.mp3", + "assets/voice/end/endp2_2.mp3", + "assets/voice/end/endp2_3.mp3", + "assets/voice/end/endp2_4.mp3", + "assets/voice/end/endp2_5.mp3", + "assets/voice/end/the_end.mp3", + "","" +]; + +class End2Page extends StatefulWidget { + + static Future navigatorPush(BuildContext context) async { + return Navigator.push( + context, + MaterialPageRoute( + builder: (_) => End2Page(), + ), + ); + } + + @override + _End2PageState createState() => _End2PageState(); +} + +class _End2PageState extends State with TickerProviderStateMixin { + + + // ํ…์ŠคํŠธ ์—๋””ํŒ… ์ปจํŠธ๋กค๋Ÿฌ๋ฅผ ์ƒ์„ฑํ•˜์—ฌ ํ•„๋“œ์— ํ• ๋‹น + final meController = TextEditingController(); + final memoryController = TextEditingController(); + final futureController = TextEditingController(); + final oneController = TextEditingController(); + final twoController = TextEditingController(); + final threeController = TextEditingController(); + final fiveController = TextEditingController(); + + bool me = false; + bool memory = false; + bool future = false; + bool one = false; + bool two = false; + bool three = false; + bool five = false; + + + FocusNode _focusNode = FocusNode(); + + @override + void initState() { + super.initState(); + // ์Œ์› ์ ์šฉ + for(int i= 0 ; i < voice.length; i++){ + player2.setAudioSource(AudioSource.uri( + Uri.parse(voice[i])) + ); + } + + controller1 = FlutterGifController(vsync: this); + + player2.setAsset(voice[voiceCount]); + voiceCount++; + player2.play(); + + // 2.5์ดˆ ์ ์ • + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + Timer(Duration(milliseconds: 1000), () { + controller1.stop(); + }); + + _focusNode.addListener(_onFocusChange); + } + + void _onFocusChange() { + if (_focusNode.hasFocus) { + // ํ‚ค๋ณด๋“œ ์˜ฌ๋ฆฌ๊ธฐ + FocusScope.of(context).requestFocus(_focusNode); + } + } + + @override + void dispose() async { + super.dispose(); + } + + List introText =[]; + int nextQuestion = 0; + int voiceCount = 0; + + // ${home.user} + + String sentDate = ""; + // ๋Œ€ํ™” ๋‹จ๊ณ„ ์ €์žฅ + void saveCon(String aToken, String con, String nextcon) async { + // API ์—”๋“œํฌ์ธํŠธ URL + String apiUrl = 'http://3.38.1.125:8080/user/conversation-status'; + + // ์š”์ฒญ ๋ณธ๋ฌธ ๋ฐ์ดํ„ฐ + var data = { + "conversationStatus": con, + "nextConversationAt": nextcon, + }; + + // ํ—ค๋” ์ •๋ณด ์„ค์ • + Map headers = { + 'Authorization': 'Bearer $aToken', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• + 'Content-Type': 'application/json', // ์˜ˆ: JSON ์š”์ฒญ์ธ ๊ฒฝ์šฐ ํ—ค๋” ์„ค์ • + }; + + // HTTP GET ์š”์ฒญ ๋ณด๋‚ด๊ธฐ + var response = await http.put( + Uri.parse(apiUrl), + body: json.encode(data), + headers: headers, // ํ—ค๋” ์ถ”๊ฐ€ + ); + + ///var jsonResponse = utf8.decode(response.bodyBytes); + // HTTP ์‘๋‹ต ์ƒํƒœ ํ™•์ธ + if (response.statusCode == 200) { + // ์‘๋‹ต ๋ฐ์ดํ„ฐ๋ฅผ JSON ํ˜•์‹์œผ๋กœ ๋””์ฝ”๋”ฉ + print("๋Œ€ํ™” ๋‹จ๊ณ„ ๋„ฃ๊ธฐ ์„ฑ๊ณต"); + setState(() { + }); + + } else { + // ์š”์ฒญ์ด ์‹คํŒจํ•œ ๊ฒฝ์šฐ ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌ + print('HTTP ์š”์ฒญ ์‹คํŒจ: ${response.statusCode}'); + } + } + + + @override + Widget build(BuildContext context) { + MediaQueryData deviceData = MediaQuery.of(context); + Size screenSize = deviceData.size; + return + Container( + decoration: (nextQuestion > 5) ? + BoxDecoration( + gradient: LinearGradient( + begin: Alignment.topRight, + end: Alignment.bottomLeft, + colors: [ + Color(0xffE4ECFF), + Color(0xffA2BEFF), + ], + ) + ) : + BoxDecoration( + gradient: LinearGradient( + begin: Alignment.topRight, + end: Alignment.bottomLeft, + colors: [ + Color(0xffDDE7FD), + Color(0xffDDE7FD), + ], + ) + ), + child: GestureDetector( + onTap: (){ + print("ํ™•์ธ: " + nextQuestion.toString()); + + if(nextQuestion < 8){ + nextQuestion++; // ์ธํŠธ๋กœ ์‹œ์ž‘ ํ›„ count + player2.setAsset(voice[voiceCount]); + voiceCount++; + player2.play(); + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + if(nextQuestion == 1){ + Timer(Duration(milliseconds: 3000), () { + controller1.stop(); + }); + } else if(nextQuestion == 2){ + Timer(Duration(milliseconds: 4500), () { + controller1.stop(); + }); // ok + } else if(nextQuestion == 3){ + Timer(Duration(milliseconds: 2500), () { + controller1.stop(); + }); + } else if(nextQuestion == 4){ + Timer(Duration(milliseconds: 4000), () { + controller1.stop(); + }); + } + else if(nextQuestion == 5){ + Timer(Duration(milliseconds: 4000), () { + controller1.stop(); + }); + } + else if(nextQuestion == 6){ + Timer(Duration(milliseconds: 3000), () { + controller1.stop(); + }); + } + else if(nextQuestion == 7){ + Timer(Duration(milliseconds: 2000), () { + controller1.stop(); + }); + } + else if(nextQuestion == 8){ + // ํ•„์š”์—†์Œ + // Timer(Duration(milliseconds: 3000), () { + // controller1.stop(); + // }); + } + } + else if(nextQuestion == 8){ + } + + setState(() { + }); + }, + child: Scaffold( + backgroundColor: Colors.transparent, + appBar: AppBar( + //title: Text("๊ธฐ์–ตํ• ๊ฐœ", style: TextStyle(fontSize:16, color: Colors.white ),), + //centerTitle: true, + leading: IconButton( + icon: SvgPicture.asset( + 'assets/images/conversation/home_icon.svg', + ), + onPressed: () => Navigator.of(context).pop(), + ), + backgroundColor: Colors.transparent, + elevation: 0.0, + ), + //extendBodyBehindAppBar: true, + body: + SingleChildScrollView( + child: Container( + child: Column( + children: [ + SizedBox(height: 3,), + Container( + width: screenSize.width, + height: 25, + child: Padding( + padding: EdgeInsets.only( left:16, right: 16), + child: Center( + child: FAProgressBar( + currentValue: 100, + size: 5, + backgroundColor: Colors.white, + ) + ), + ), + ), + if(nextQuestion > 5)...[ + Container( + width: screenSize.width, + height: screenSize.height, + child: Column( + //mainAxisAlignment: MainAxisAlignment.center, + children: [ + SizedBox(height: 64,), + SvgPicture.asset('assets/images/conversation/intro/intro_star.svg',fit: BoxFit.fill,), + SizedBox(height: 64,), + Stack( + children: [ + SvgPicture.asset('assets/images/conversation/intro/intro_bubble.svg',fit: BoxFit.fill,), + Padding(padding:nextQuestion >6? EdgeInsets.only(left:61, top:64) : EdgeInsets.only(left:52, top:48), + child: Text( + endConversation[nextQuestion], + textAlign: TextAlign.center, + style: textStyle.introbubbletext + ), + ), + + ], + ), + SizedBox(height: 96,), + Container(width: screenSize.width, + child: SvgPicture.asset('assets/images/conversation/intro/intro_cloud.svg',fit: BoxFit.fill,), + ), + ], + ), + ), + ] else...[ + Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children:[ + SizedBox( + height: 10, + ), + Stack( + children: [ + Container( + height: 157, + width: screenSize.width, + child: + Stack( + children: [ + Center(child: SvgPicture.asset('assets/images/conversation/bubble.svg',fit: BoxFit.fill,),), + Container( + padding: const EdgeInsets.symmetric(horizontal: 32, vertical: 12, ), + child: Center( + child: Column( + children: [ + if(endConversation[nextQuestion].toString().contains("\n"))...[ + SizedBox(height: 28,), + Text( + endConversation[nextQuestion], + textAlign: TextAlign.center, + style: textStyle.bubbletext, + ), + ]else...[ + SizedBox(height: 42,), + Text( + endConversation[nextQuestion], + textAlign: TextAlign.center, + style: textStyle.bubbletext, + ), + ], + ], + ) + ) + ), + ], + ) + ), + // ๋ฌด์ง€ ์œ„์น˜ + if(nextQuestion < 6)...[ + Stack( + children: [ + // ์œ ์ € ์œ„์น˜ + Column( + children: [ + SizedBox(height: 420,), + Container( + child: SvgPicture.asset( + 'assets/images/conversation/user7.svg', + height: 282, + width: screenSize.width, + ), + ), + ], + ), + Column( + children: [ + SizedBox(height: 144,), + Container( + width: screenSize.width, + height: 375, + child: + Stack( + children: [ + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child: Image.asset('assets/images/conversation/gif/muji_ear.gif', + fit: BoxFit.cover,),), + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child: Image.asset('assets/images/conversation/gif/muji_base.gif', fit: BoxFit.cover,),), + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child: Image.asset('assets/images/conversation/gif/muji_base_eye.gif', + fit: BoxFit.cover,),), + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child:GifImage( + controller: controller1, + image: const AssetImage("assets/images/conversation/gif/muji_mouth1.gif"), + ), + // Image.asset('assets/images/conversation/gif/muji_mouth1.gif', fit: BoxFit.cover,), + ) + ], + ) + + // SvgPicture.asset( + // 'assets/images/conversation/con_muji.svg', fit: BoxFit.cover, + // ), + ), + ], + ), + ], + ), + ] + else if(nextQuestion >= 6)...[ + ] + ], + ), + ], + ), + ], + + ], + ), + ), + ), + + // // nextQuestion ์ด 3๊ณผ 7์ผ๋•Œ ๋“ฑ์žฅ + bottomSheet: Padding( + padding: EdgeInsets.only( + bottom: MediaQuery.of(context).viewInsets.bottom * 0.001), + child: Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + if(nextQuestion == 8)...[ + Container( + color: Color(0xffFFFFFF).withOpacity(0), + child: Padding( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 24), + child: Container( + width: screenSize.width, + height: 40, + child: ElevatedButton( + style: buttonChart().bluebtn3, + onPressed: () { + var now = DateTime.now(); + sentDate = DateFormat('yyyy-MM-dd hh:mm:ss').format(now.toLocal()); + saveCon(sign_in.userAccessToken, "4", sentDate); + + main.player.stop(); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => MyScreenPage(title: '์Šคํฌ๋ฆฐ ํŽ˜์ด์ง€',))); + setState(() {}); + }, + child: Text("์™„๋ฃŒ", style: TextStyle( + fontFamily: 'Pretendard', + fontSize: 16, fontWeight: FontWeight.w500, color: Color(0xffFFFFFF))), + ), + ),), + ), + ] + ], + ), + )), + ) + + ); + + } +} + diff --git a/client/lib/conversation/end_period/end_coach_mark.dart b/client/lib/conversation/end_period/end_coach_mark.dart new file mode 100644 index 0000000..8eba59d --- /dev/null +++ b/client/lib/conversation/end_period/end_coach_mark.dart @@ -0,0 +1,236 @@ +import 'dart:async'; +import 'dart:convert'; +import 'package:flutter/material.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/services.dart'; +import 'package:http/http.dart' as http; +import 'package:client/conversation/end_period/end2.dart'; +import 'package:client/style.dart'; + +/// ์ข…๊ฒฐ๊ธฐ_์ฝ”์น˜๋งˆํฌ +class EndMarkCoachPage extends StatefulWidget { + + static Future navigatorPush(BuildContext context) async { + return Navigator.push( + context, + MaterialPageRoute( + builder: (_) => EndMarkCoachPage(), + ), + ); + } + + @override + _EndMarkCoachPageState createState() => _EndMarkCoachPageState(); +} + +class _EndMarkCoachPageState extends State { + + FocusNode _focusNode = FocusNode(); + + @override + void initState() { + super.initState(); + _callAPI(); + _focusNode.addListener(_onFocusChange); + } + + void _onFocusChange() { + if (_focusNode.hasFocus) { + // ํ‚ค๋ณด๋“œ ์˜ฌ๋ฆฌ๊ธฐ + FocusScope.of(context).requestFocus(_focusNode); + } + } + + @override + void dispose() async { + super.dispose(); + } + + int nextPage = 0; + + List questions0 =[ + "๋„์›€ ๋‚ด์—ญ ์ฝ”์น˜ ๋งˆํฌ1:\n\n๋‹ค๋ฅธ ๋ฐ˜๋ ค์ธ๋“ค์ด ๋‚˜์—๊ฒŒ ์š”์ฒญํ•œ\n๋„์›€์„ ํ™•์ธํ•ด๋ณด์„ธ์š”.", + "๋„์›€ ๋‚ด์—ญ ์ฝ”์น˜ ๋งˆํฌ2:\n\n์„œ๋กœ๋ฅผ ์ง€์ง€ํ•˜๋Š” ๋งˆ์Œ์œผ๋กœ\n๋„์›€์„ ๋ณด๋‚ผ์ˆ˜ ์žˆ์–ด์š”.", + ]; + + int nextQuestion = 0; + + + void _callAPI() async { + // ์š”์ฒญ ๋ณธ๋ฌธ ๋ฐ์ดํ„ฐ + var data = { + "stage" : "0", + "set" : "0", + "lineId" : "0" + }; + + var url = Uri.parse('http://3.38.1.125:8080/conversation/line'); // ์—”๋“œํฌ์ธํŠธ URL ์„ค์ • + + try { + var response = await http.post( + url, + body: json.encode(data), // ์š”์ฒญ ๋ณธ๋ฌธ์— ๋ฐ์ดํ„ฐ๋ฅผ JSON ํ˜•์‹์œผ๋กœ ์ธ์ฝ”๋”ฉํ•˜์—ฌ ์ „๋‹ฌ + headers: {'Content-Type': 'application/json',}, // ์š”์ฒญ ํ—ค๋”์— Content-Type ์„ค์ • + ); + + if (response.statusCode == 200) { + // ์‘๋‹ต ์„ฑ๊ณต ์‹œ์˜ ์ฒ˜๋ฆฌ + + var jsonResponse = utf8.decode(response.bodyBytes); // ์‘๋‹ต ๋ณธ๋ฌธ์„ JSON ํ˜•์‹์œผ๋กœ ๋””์ฝ”๋”ฉ + // JSON ๊ฐ’์„ ํ™œ์šฉํ•œ ์›ํ•˜๋Š” ๋™์ž‘ ์ˆ˜ํ–‰ + //utf8.decode(jsonResponse); + print(jsonResponse); + + List contentList = []; + + List parsedResponse = json.decode(jsonResponse); + + + print('API ํ˜ธ์ถœ ์„ฑ๊ณต: ${response.statusCode}'); + } else { + // ์š”์ฒญ ์‹คํŒจ ์‹œ์˜ ์ฒ˜๋ฆฌ + print('API ํ˜ธ์ถœ ์‹คํŒจ: ${response.statusCode}'); + } + } catch (e) { + // ์˜ˆ์™ธ ๋ฐœ์ƒ ์‹œ์˜ ์ฒ˜๋ฆฌ + print('API ํ˜ธ์ถœ ์ค‘ ์˜ˆ์™ธ ๋ฐœ์ƒ: $e'); + } + } + + + @override + Widget build(BuildContext context) { + MediaQueryData deviceData = MediaQuery.of(context); + Size screenSize = deviceData.size; + return + Container( + decoration: BoxDecoration( + gradient: LinearGradient( + begin: Alignment.topRight, + end: Alignment.bottomLeft, + colors: [ + Color(0xffE4ECFF), + Color(0xffA2BEFF), + ], + ) + ), + child: GestureDetector( + onTap: (){ + print(nextQuestion); + if(nextPage == 1){ + // Navigator.pop(context); // early2๋กœ ๊ฐ€๊ธฐ + // intro2.player2.setAsset(intro2.voice[2]); + // intro2.player2.play(); + } else if(nextPage < 1){ + nextPage++; + } + + setState(() { + }); + }, + child: Scaffold( + backgroundColor: Colors.transparent, + appBar: AppBar( + //title: Text("๊ธฐ์–ตํ• ๊ฐœ", style: TextStyle(fontSize:16, color: Colors.white ),), + //centerTitle: true, + backgroundColor: Colors.transparent, + elevation: 0.0, + automaticallyImplyLeading: false, + ),extendBodyBehindAppBar: true, + body: + Container( + child: Column( + children: [ + Stack( + children: [ + // Padding(padding: EdgeInsets.only(left: 12, top: 125), + // child: SvgPicture.asset('assets/images/conversation/intro/coach01.svg', + // height: 624, + // width: 380, fit: BoxFit.fill,), + // ), + + if(nextPage == 0)...[ + Padding(padding: EdgeInsets.only(left: 60, top: 145), + child: Container( + width: 260, + height: 575, + child: ClipRRect( + borderRadius: BorderRadius.circular(24.0), + child: Image.asset('assets/images/conversation/end/sc1.png', + fit: BoxFit.fill,) + ), + ), + ), + ] else if(nextPage == 1)...[ + Padding(padding: EdgeInsets.only(left: 60, top: 145), + child: Container( + width: 260, + height: 575, + child: ClipRRect( + borderRadius: BorderRadius.circular(24.0), + child: Image.asset('assets/images/conversation/end/sc2.png', + fit: BoxFit.fill,) + ), + ), + ), + ], + Padding(padding: EdgeInsets.only(left: 170, top: 706), + child: Container( + width: 40, + height: 2, + child: Container( + width: 40, height: 2, + color: Colors.white, + ) + ), + ), + ], + ) + ], + ), + ), + + bottomSheet: Padding( + padding: EdgeInsets.only( + bottom: MediaQuery.of(context).viewInsets.bottom * 0.001), + child: Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + if(nextPage == 1)...[ + Container( + color: Color(0xffFFFFFF).withOpacity(0), + child: Padding( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 24), + child: Container( + + width: screenSize.width, + height: 40, + child: ElevatedButton( + style: buttonChart().bluebtn3, + onPressed: () { + // ์ดˆ๊ธฐ2๋กœ ์ด๋™ + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => End2Page())); + }, + child: Text("๋‹ค์Œ", style: TextStyle( + fontFamily: 'Pretendard', + fontSize: 16, fontWeight: FontWeight.w500, color: Color(0xffFFFFFF))), + ), + ),), + ), + ] + ], + ), + ), + + ), + ) + + ); + + } +} diff --git a/client/lib/conversation/helpme.dart b/client/lib/conversation/helpme.dart new file mode 100644 index 0000000..65bbe17 --- /dev/null +++ b/client/lib/conversation/helpme.dart @@ -0,0 +1,620 @@ +"${intro.userName_}๋‹˜!\n ๊ธฐ์–ตํ• ๊ฐœ๊ฐ€ ์™„์„ฑ๋˜์—ˆ์–ด์š”.", // 0 +"๊ธฐ์–ตํ• ๊ฐœ๋ฅผ ํ™•์ธํ•ด๋ณด์„ธ์š”!", //1 +"${intro.userName_}๋‹˜!", //2 +"์˜ค๋Š˜์€ ${intro.userName_}๋‹˜๊ณผ์˜ \n์ฒซ๋งŒ๋‚จ์ด์—ˆ์ง€๋งŒ", //3 +"${intro.dogName_}๊ฐ€ ์–ผ๋งˆ๋‚˜ ๋งŽ์€ ์‚ฌ๋ž‘์„ \n๋ฐ›์•˜๋Š”์ง€ ๋А๋‚„ ์ˆ˜ ์žˆ์—ˆ์–ด์š”.", //4 +"์•ž์œผ๋กœ ์ €์™€ ํ•จ๊ป˜ \n${intro.dogName_}์™€์˜ ์ˆœ๊ฐ„๋“ค์„ ๊ธฐ์–ตํ•˜๋ฉฐ,", //5 +"${intro.dogName_}๋‹˜์˜ ๋งˆ์Œ ์† ์•ˆ์ •์„ \n์ฐพ์•„๊ฐ€๊ธธ ๋ฐ”๋ผ์š”.", //6 +"์ด์ œ ์šฐ๋ฆฌ๊ฐ€ ๋‹ค์‹œ ๋งŒ๋‚˜๊ฒŒ ๋  \n์‹œ๊ฐ„์„ ์•Œ๋ ค์ฃผ์„ธ์š”.", //7 +"๋„ค, ${intro.userName_}๋‹˜. ๊ทธ๋•Œ ๋‹ค์‹œ ๋งŒ๋‚˜์š”!" //8 + + +Timer(Duration(seconds: 2), () { +controller2.stop(); +}); + +controller2.repeat( +min: 0, +max: 30, +period: const Duration(milliseconds: 4000) +); + +์Šฌํ”ˆํ‘œ์ •~ +controller2.repeat( +min: 0, +max: 32, +period: const Duration(milliseconds: 3500) +); +Timer(Duration(seconds: 3), () { +controller2.stop(); +}); + + + +-๋Œ€ํ™” ์‹œ์ž‘- + +"์•ˆ๋…•ํ•˜์„ธ์š”.", //0 +"์ €๋Š” ๋ฐ˜๋ ค๊ฒฌ๊ณผ์˜ ์ด๋ณ„์„ ๋„์™€์ค„\n์ด๋ณ„ ๋„์šฐ๋ฏธ ๋ฌด์ง€์—์š”!", //1 +"์•ž์œผ๋กœ ์ €์™€ ๋Œ€ํ™”๋ฅผ ๋‹ค๋ˆ„๋ฉด์„œ", //2 +"๋ฐ˜๋ ค๊ฒฌ์„ ๊ธฐ์–ตํ•˜๊ณ \n์• ๋„ํ•  ์ˆ˜ ์žˆ๊ฒŒ ๋„์™€๋“œ๋ฆด๊ฒŒ์š”.", //3 +"์ €๋Š” ๋‹น์‹ ์„ ๋ญ๋ผ๊ณ  ๋ถ€๋ฅด๋ฉด ์ข‹์„๊นŒ์š”?", //4 + +// ํ†ต์œผ๋กœ ์ถ”๊ฐ€ +// "์ข‹์•„์š”. ๋ณดํ˜ธ์ž๋‹˜.", // this is modifi //5 +// "์ œ๊ฐ€ ๋ณดํ˜ธ์ž๋‹˜๊ณผ์˜ ๋Œ€ํ™”๋ฅผ ์‹œ์ž‘ํ•˜๊ธฐ ์œ„ํ•ด", //6 +// "๋ณดํ˜ธ์ž๋‹˜์— ๋Œ€ํ•ด์„œ\n๋” ์•Œ์•„๊ฐ€๋ ค๊ณ  ํ•ด์š”.", //7 +// "๋‹ค์Œ ์งˆ๋ฌธ์— ๋‹ตํ•ด์ฃผ์„ธ์š”!", // 8 +// "๋ฐ˜๋ ค๊ฒฌ์˜ ์ด๋ฆ„์€ ๋ฌด์—‡์ด์—ˆ์„๊นŒ์š”?", // this is modifi //9 +// +// // ํ†ต์œผ๋กœ ์ถ”๊ฐ€ +// "์•„์ด์˜ ๋ชจ์Šต์€ ์–ด๋• ๋‚˜์š”? \n๋นˆ์นธ์„ ์ฑ„์›Œ ์•Œ๋ ค์ฃผ์„ธ์š”.", // this is modifi //10 +// "์•„์ด์˜ ๋ชจ์Šต์€ ์–ด๋• ๋‚˜์š”? \n๋นˆ์นธ์„ ์ฑ„์›Œ ์•Œ๋ ค์ฃผ์„ธ์š”.", // this is modifi //11 +// "์ข‹์•„์š”, ๋ณดํ˜ธ์ž๋‹˜!", // 12 +// "์งˆ๋ฌธ์— ๋‹ตํ•˜๋ฉฐ,\n์ž ๊น์ด๋‚˜๋งˆ", //13 +// "์•„์ด์— ๋Œ€ํ•ด์„œ ๋– ์˜ฌ๋ ค๋ดค๋˜ ๊ฒƒ ๊ฐ™์•„์š”.", //14 +// "์•„์ด์— ๋Œ€ํ•ด์„œ ์ƒ๊ฐํ•˜๋‹ˆ", //15 +// "๋ณดํ˜ธ์ž๋‹˜์€ ์–ด๋–ค ๋งˆ์Œ์ด ๋“ค์—ˆ๋‚˜์š”?", //16 +]; + +// ๊ทธ๋ฆฌ์›€ ์•„์˜ˆ ํ†ต์œผ๋กœ ์ถ”๊ฐ€ํ•˜์„ธ์š” +List questions1_2 =[ +// ์ด์ œ๋Š” ์•„์ด์˜\n๋ชจ์Šต์„ ๋ณด๊ฑฐ๋‚˜ ๋งŒ์งˆ ์ˆ˜ ์—†์ง€๋งŒ, +// ์•„์ด๋ฅผ ์ƒ๊ฐํ•˜๋ฉฐ\n๊ทธ๋ฆฌ์›€์„ ์ฑ„์›Œ๊ฐˆ ์ˆ˜ ์žˆ์„ ๊ฒƒ ๊ฐ™์•„์š”. +// ์•„์ด์™€์˜ ๊ธฐ์–ต์„\n์ฒ˜์Œ๋ถ€ํ„ฐ ๋– ์˜ฌ๋ ค๋ณผ๊นŒ์š”? +// ์•„์ด์™€์˜ ๊ธฐ์–ต์ด ์‹œ์ž‘๋˜๋Š”\n๊ทธ๋‚ ์˜ ์‚ฌ์ง„๊ณผ ์ด์•ผ๊ธฐ๋ฅผ ๊ธฐ๋กํ•ด๋ด…์‹œ๋‹ค! +]; + +// ์Šฌํ”” ์•„์˜ˆ ํ†ต์œผ๋กœ ์ถ”๊ฐ€ํ•˜์„ธ์š” +List questions1_3 =[ +// "์•„์ด๊ฐ€ ๊ณ์— ์—†๋Š” ์ง€๊ธˆโ€ฆ", +// "๋ณดํ˜ธ์ž๋‹˜์˜\n์Šฌํ”ˆ ๋งˆ์Œ์ด ์ œ๊ฒŒ๋„ ๋А๊ปด์ ธ์š”.", +// "ใ…ใ…์™€์˜\n๊ธฐ์–ต์„ ํ•˜๋‚˜์”ฉ ๋˜๋Œ์•„๋ณด๋ฉด", +// "์Šฌํ”ˆ ๋งˆ์Œ์„ ๋œ๊ธฐ์— ๋„์›€์ด ๋ ๊ฑฐ์—์š”.", +// "์•„์ด์™€์˜ ๊ธฐ์–ต์ด ์‹œ์ž‘๋˜๋Š”\n๊ทธ๋‚ ์˜ ์‚ฌ์ง„๊ณผ ์ด์•ผ๊ธฐ๋ฅผ ๊ธฐ๋กํ•ด๋ด…์‹œ๋‹ค!", +]; + + + + + +------ +List question= [ + "๋‹˜!\n๊ธฐ๋‹ค๋ฆฌ๊ณ  ์žˆ์—ˆ์–ด์š”!", + "๋Œ€ํ™”๋ฅผ ์‹œ์ž‘ํ•ด๋ณผ๊นŒ์š”?", +]; + +List yesAns= [ + "์˜ค๋Š˜์€ ์–ด๋–ค ์ฃผ์ œ๋กœ ์–˜๊ธฐํ•ด๋ณผ๊นŒ์š”?", +]; + +List noAns= [ + "๊ทธ๋Ÿผ ์šฐ๋ฆฌ๋Š” ์–ธ์ œ ๋‹ค์‹œ ๋งŒ๋‚˜๋ฉด ์ข‹์„๊นŒ์š”?", +"๊ทธ๋Ÿผ ์šฐ๋ฆฌ๋Š” ์–ธ์ œ ๋‹ค์‹œ ๋งŒ๋‚˜๋ฉด ์ข‹์„๊นŒ์š”?", + "๋„ค,()๋‹˜ 12์‹œ๊ฐ„ ๋’ค์— ๋‹ค์‹œ ๋Œ€ํ™”ํ•ด์š”.", +"๋„ค,()๋‹˜ 12์‹œ๊ฐ„ ๋’ค์— ๋‹ค์‹œ ๋Œ€ํ™”ํ•ด์š”.", +]; + + +/// + +List questions0 =[ + "์ข‹์•„์š”, ๋ณดํ˜ธ์ž๋‹˜.", //0 2์ดˆ + "์˜ค๋Š˜์€ ์•„์ด์™€์˜\n์ด๋ณ„์— ๋Œ€ํ•ด์„œ ์–˜๊ธฐํ•ด๋ณด๋„๋ก ํ•ด์š”.", //1 4์ดˆ + "๋งŒ๋‚จ์ด ์žˆ์œผ๋ฉด ์ด๋ณ„์ด ์žˆ๋“ฏ์ด\n์ด๋ณ„์˜ ์ˆœ๊ฐ„์€ ๊ฒฐ๊ตญ ์ฐพ์•„์™€์š”. ", //2 5์ดˆ + "์กฐ๊ธˆ ํž˜๋“ค๋”๋ผ๋„\n์ด๋ณ„์˜ ์ˆœ๊ฐ„์„ ๋– ์˜ฌ๋ฆฌ๋ฉฐ", //3 4์ดˆ + "๋ณดํ˜ธ์ž๋‹˜์˜ ๊ฐ์ •๋“ค์„\n๊ฐ™์ด ์ •๋ฆฌํ•ด๋ณด์•„์š”.", //4 4์ดˆ + "์ด๋ณ„์˜ ์ˆœ๊ฐ„,\n๊ทธ๋‚ ์˜ ๋‚ ์”จ๋Š” ์–ด๋• ๋‚˜์š”?", //5 4์ดˆ + "์ด๋ณ„์˜ ์ˆœ๊ฐ„,\n๊ทธ๋‚ ์˜ ๋‚ ์”จ๋Š” ์–ด๋• ๋‚˜์š”?", //6 4์ดˆ + + // "์•„์ด์™€์˜ ์ด๋ณ„์˜ ์ˆœ๊ฐ„์€\n() ๋‚ ์ด์—ˆ๊ตฐ์š”.", //7 4์ดˆ + // + // "์šฐ๋ฆฌ ๋ณดํ˜ธ์ž๋‹˜๊ณผ\n์•„์ด๋Š”", //8 3์ดˆ + // "์–ด๋–ค ์žฅ์†Œ์— ์žˆ์—ˆ๋‚˜์š”? ", //9 3์ดˆ + // "์–ด๋–ค ์žฅ์†Œ์— ์žˆ์—ˆ๋‚˜์š”? ", //10 3์ดˆ + // + // "๊ทธ๋ ‡๊ตฐ์š”", //11 2์ดˆ + // "()์—์„œ", //12 2์ดˆ + // + // "์•„์ด์™€ ์ด๋ณ„ํ•˜๋Š”\n์ˆœ๊ฐ„์„ ๋– ์˜ฌ๋ฆฌ๋ฉฐ ํ›„ํšŒ๋˜๋Š” ๋ถ€๋ถ„์ด ์žˆ๋‚˜์š”?", //13 5์ดˆ +]; +// ๋„ค ์„ ํƒ์‹œ +List question1_0= [ + /// "์–ด๋–ค ๋ถ€๋ถ„์ด ํ›„ํšŒ๊ฐ€ ๋˜๋‚˜์š”?", + // "๋ณดํ˜ธ์ž๋‹˜์˜ ์–˜๊ธฐ๋ฅผ ๋“ค์–ด๋ณด๋‹ˆ", // 1 3์ดˆ + // "์•„์ด๋ฅผ ํ–ฅํ•œ ๊ทธ๋ฆฌ์›€, ํ›„ํšŒโ€ฆ", // 2 3์ดˆ + // "๊ทธ ์™ธ์—๋„\n๋‹ค์–‘ํ•œ ๊ฐ์ •๋“ค์ด ๋А๊ปด์ง€๋Š” ๊ฒƒ ๊ฐ™์•„์š”.", // 3 4์ดˆ + // "์ด๋ณ„์˜ ์ˆœ๊ฐ„์€ ์ง€๋‚˜๊ฐ€๋”๋ผ๋„", // 4 3์ดˆ + // "์•„์ด๋ฅผ ๊ทธ๋ฆฌ์›Œํ•˜๋Š” ๋งˆ์Œ์€\n์ปค์ ธ๋งŒ ๊ฐ€๋‹ˆ ๊ทธ๋Ÿฐ ๊ฒƒ ๊ฐ™์•„์š”.", //5 5์ดˆ + // "๊ทธ๋ž˜๋„ ๋ณดํ˜ธ์ž๋‹˜์ด\n์•„์ด๋ฅผ ์ถ”์–ตํ•  ์ˆ˜ ์žˆ๊ฒŒ", //6 4์ดˆ + // "โ€˜๊ธฐ์–ตํ• ๊ฐœโ€™์—์„œ ์•„์ด์™€์˜\n์ถ”์–ต์„ ์ €์žฅํ•ด๋ณด๋Š” ๊ฒƒ๋„", //7 4์ดˆ + // "๊ทธ๋ฆฌ์šด ๋งˆ์Œ์„ ๋‹ฌ๋ž˜๋Š”๋ฐ\n๋„์›€์ด ๋  ๊ฒƒ ๊ฐ™์•„์š”.", //8 4์ดˆ +]; + +// ์•„๋‹ˆ์˜ค ์„ ํƒ์‹œ +List questions1_1 =[ + /// "๊ทธ๋ ‡๋‹ค๋ฉด, ๋‹คํ–‰์ด์—์š”.", //0 + // "์ด๋ณ„์˜ ์ˆœ๊ฐ„์ด ์ง€๋‚˜๊ณ \nํ›„ํšŒ๊ฐ€ ๋‚จ์„ ์ˆ˜ ์žˆ์ง€๋งŒ,", //1 + // "ํ›„ํšŒ๊ฐ€ ๋‚จ์ง€ ์•Š์•˜๋‹ค๋ฉด\n๊ทธ๊ฒƒ๋„ ์ •๋ง ๋Œ€๋‹จํ•œ ์ผ์ด๋ผ๊ณ  ์ƒ๊ฐํ•ด์š”.", //2 + // "๋ณดํ˜ธ์ž๋‹˜.\n๋งŒ์•ฝ ์•„์ด์™€์˜", //3 + // "์ด๋ณ„์˜ ์ˆœ๊ฐ„์œผ๋กœ ๋‹ค์‹œ ๋Œ์•„๊ฐ„๋‹ค๋ฉด\nํ•˜๊ณ  ์‹ถ์€ ๊ฒƒ๋“ค์ด ์žˆ์„๊นŒ์š”?",//4 /// ์ฒดํฌ~~~~~~~ + // "๋ณดํ˜ธ์ž๋‹˜์€\n์ด๋ณ„์˜ ์ˆœ๊ฐ„์„ ์ž˜ ๋ณด๋‚ด์‹  ๊ฒƒ ๊ฐ™์•„์š”.", //5 + // "๊ทธ ์ˆœ๊ฐ„์— ์•„์ด๋„", //6 + // "๋ณดํ˜ธ์ž๋‹˜์˜ ๋งˆ์Œ์„\n์˜จ์ „ํžˆ ๋А๊ผˆ์„๊ฑฐ์˜ˆ์š”.", //7 + // "๊ทธ๋Ÿผ์—๋„ ์•„์ด๋ฅผ ํ–ฅํ•œ\n๊ทธ๋ฆฌ์šด ๋งˆ์Œ์€", //8 + // "์—ฌ์ „ํ•˜๊ฒŒ ๋‚จ์•„์žˆ์ง€ ์•Š์„๊นŒ ์‹ถ์–ด์š”.", //9 + // "โ€˜๊ธฐ์–ตํ• ๊ฐœโ€™์—์„œ ์•„์ด์™€์˜\n์ถ”์–ต์„ ์ •๋ฆฌํ•ด๋ณด๋ฉด", //10 + // "๊ทธ๋ฆฌ์šด ๋งˆ์Œ์„ ๋‹ฌ๋ž˜๋Š”๋ฐ\n ํฐ ๋„์›€์ด ๋  ๊ฒƒ ๊ฐ™์•„์š”.", //11 /// ์ฒดํฌ~~~ + +]; + + +List questionsEnd =[ + "${home.user}๋‹˜,\n์ œ๊ฐ€ ์ค€๋น„ํ•œ ๋Œ€ํ™”๋Š” ์—ฌ๊ธฐ๊นŒ์ง€์—์š”. ", + "${home.puppy}์™€\n์ด๋ณ„์˜ ์ˆœ๊ฐ„์„ ๊ธฐ์–ตํ•˜๋ฉฐ ", + "ํ’€์ง€ ๋ชปํ•œ ${home.user}๋‹˜์˜\n๊ฐ์ •๋“ค์ด ํ’€์–ด์กŒ์œผ๋ฉด ํ•˜๋Š” ๋ฐ”๋žŒ์ด์—์š”.", + "์ž, ์ด์ œ ์šฐ๋ฆฌ๊ฐ€ ๋‹ค์‹œ\n๋งŒ๋‚˜๊ฒŒ ๋  ์‹œ๊ฐ„์„ ์•Œ๋ ค์ฃผ์„ธ์š”.", + "์ž, ์ด์ œ ์šฐ๋ฆฌ๊ฐ€ ๋‹ค์‹œ\n๋งŒ๋‚˜๊ฒŒ ๋  ์‹œ๊ฐ„์„ ์•Œ๋ ค์ฃผ์„ธ์š”.", + // "๋„ค, ${home.user}๋‹˜.\n()์‹œ๊ฐ„ ํ›„์— ๋‹ค์‹œ ๋งŒ๋‚˜์š”!", + // "๋„ค, ${home.user}๋‹˜.\n()์‹œ๊ฐ„ ํ›„์— ๋‹ค์‹œ ๋งŒ๋‚˜์š”!", +]; + + + + +//// + +List questions0 =[ + "์ข‹์•„์š”, ๋ณดํ˜ธ์ž๋‹˜.", // 0 + "์‚ฌ์‹ค...\n๋ณดํ˜ธ์ž๋‹˜์˜ ๋งˆ์Œ์—", // 1 ok + "์•„์ด๋ฅผ ํ–ฅํ•œ\n๊ทธ๋ฆฌ์›€์ด ๊ฐ€๋“ํ•ด ๋ณด์—ฌ์š”.", // 2 ok + "์•„์ด์™€์˜ ๊ธฐ์–ต์„\n๋– ์˜ฌ๋ฆฌ๋ฉด", // 3 + "๋ณดํ˜ธ์ž๋‹˜์˜\n๊ทธ๋ฆฌ์šด ๋งˆ์Œ์„ ๋‹ฌ๋ž  ์ˆ˜ ์žˆ์ง€ ์•Š์„๊นŒ์š”?", // 4 + "์˜ค๋Š˜์€ ์•„์ด์™€์˜\n๊ธฐ์–ต์— ๋Œ€ํ•ด ์–˜๊ธฐํ•ด๋ด์š”.", // 5 + "์•„์ด์™€ ํ•จ๊ป˜ํ•œ\nํ•œ ๊ฐ€์ง€ ๊ธฐ์–ต์„ ๋– ์˜ฌ๋ ค์ฃผ์„ธ์š”.", // 6 + "๊ทธ๋‚ ์€ ์–ด๋–ค ๋‚ ์”จ์˜€๋‚˜์š”?", // 7 + "๊ทธ๋‚ ์€ ์–ด๋–ค ๋‚ ์”จ์˜€๋‚˜์š”?", // 8 + + // "๊ทธ๋ ‡๊ตฐ์š”. ()ํ•œ ๋‚ ์”จ์—\n์•„์ด์™€ ์–ด๋””์— ์žˆ์—ˆ๋‚˜์š”?", // 9 + // "๊ทธ๋ ‡๊ตฐ์š”. ()ํ•œ ๋‚ ์”จ์—\n์•„์ด์™€ ์–ด๋””์— ์žˆ์—ˆ๋‚˜์š”?", // 10 + // + // "()ํ•œ ๋‚ ์”จ์—\n()์—์„œ ์žˆ์—ˆ๊ตฐ์š”!", // 11 + // "๋ณดํ˜ธ์ž๋‹˜๊ณผ\n์•„์ด๋Š” ๋ญ˜ ํ•˜๊ณ  ์žˆ์—ˆ์„๊นŒ์š”?", // 12 + // "๋ณดํ˜ธ์ž๋‹˜๊ณผ\n์•„์ด๋Š” ๋ญ˜ ํ•˜๊ณ  ์žˆ์—ˆ์„๊นŒ์š”?", // 13 ๋…ธ + // + // "๊ทธ๋ ‡๋‹ค๋ฉด ๋ณดํ˜ธ์ž๋‹˜๊ณผ\n์•„์ด๋Š” ์–ด๋–ค ๋ชจ์Šต์œผ๋กœ ๋ณด์ด๋‚˜์š”?", // 14 13 + // "๊ทธ๋ ‡๋‹ค๋ฉด ๋ณดํ˜ธ์ž๋‹˜๊ณผ\n์•„์ด๋Š” ์–ด๋–ค ๋ชจ์Šต์œผ๋กœ ๋ณด์ด๋‚˜์š”?", // 15 14 + // + // "์šฐ๋ฆฌ ์•„์ด์™€\n๋ณดํ˜ธ์ž๋‹˜์˜", // 16 15 + // "()ํ•œ ๋ชจ์Šต์„\n๋– ์˜ฌ๋ ค๋ณด๋ฉด", // 17 16 + // "๋ณดํ˜ธ์ž๋‹˜์˜ ๋งˆ์Œ์€\n์–ด๋–ค ๊ฒƒ ๊ฐ™๋‚˜์š”?", // 18 17 + // "๊ณ ๋ฏผ์ค‘" // 19 18 +]; + +// ์Šฌํ”” ์„ ํƒ์‹œ +List question1_0= [ + "${home.user}๋‹˜!", + "์ง€๊ธˆ ${home.puppy}์™€์˜\n๊ธฐ์–ต์„ ์ƒ๊ฐํ•˜๋ฉฐ ๋А๋ผ๋Š” ๊ฐ์ •์€", + "๋„ˆ๋ฌด๋‚˜ ๋‹น์—ฐํ•œ ๊ฒƒ์ด์—์š”.", + "๊ทธ๋ฆฌ๊ณ  ์ด ๊ฐ์ •์„\n์ถฉ๋ถ„ํžˆ ๋А๋ผ๋Š” ๊ฒƒ๋„ ์ •๋ง ์ค‘์š”ํ•ด์š”.", + "ํ•˜์ง€๋งŒ\n์ €์˜ ๋„์›€๋งŒ์œผ๋กœ ๋ถ€์กฑํ•  ์ˆ˜ ์žˆ๊ธฐ์—", + "โ€˜ํ•จ๊ป˜ํ• ๊ฐœโ€™์—์„œ\n๋‹ค๋ฅธ ์‚ฌ๋žŒ๋“ค์˜ ์ด์•ผ๊ธฐ๋ฅผ ๋“ฃ๊ณ ", + "๋„์›€์„ ์š”์ฒญํ•ด ๋ณด๋Š” ๊ฒƒ์„ ์ถ”์ฒœ๋“œ๋ ค์š”!", +]; + +// ํ–‰๋ณต ์„ ํƒ์‹œ +List questions1_1 =[ + "${home.user}๋‹˜!", + "${home.puppy}์™€์˜\n๊ธฐ์–ต์„ ๋– ์˜ฌ๋ ค๋ณด๋ฉด", + "๋งˆ๋ƒฅ ์Šฌํ”„๊ธฐ๋งŒ ํ•˜์ง€๋Š”\n์•Š์€ ๊ฒƒ ๊ฐ™์•„์š”!", + "${home.user}๋‹˜์˜ ๋งˆ์Œ์ด\n์ž ์‹œ๋™์•ˆ์€ ํ–‰๋ณตํ–ˆ๊ธธ ๋ฐ”๋ผ์š”.", + "์ดํ›„์—๋„ ${home.user}๋‹˜์€\n${home.puppy}๋ฅผ ์ƒ๊ฐํ•˜๋‹ค๋ณด๋ฉด", + "๋ถ„๋ช… ์Šฌํ”ˆ ๊ฐ์ •์ด ์ƒ๊ฒจ๋‚  ์ˆ˜ ์žˆ์–ด์š”.", + "๊ทธ๋Ÿด๋•Œ๋Š” โ€˜ํ•จ๊ป˜ํ• ๊ฐœโ€™์—์„œ\n๋‹ค๋ฅธ ์‚ฌ๋žŒ๋“ค์˜ ์ด์•ผ๊ธฐ๋ฅผ ๋“ฃ๊ณ ", + "๋„์›€์„ ์š”์ฒญํ•ด ๋ณด๋Š” ๊ฒƒ์„ ์ถ”์ฒœ๋“œ๋ ค์š”!", + +]; + +List questions1_4 =[ + "${home.user}๋‹˜โ€ฆ", + "๋‹ค๋ฅธ ์‚ฌ๋žŒ๋“ค๊ณผ ํ•จ๊ป˜\n๋„์›€์„ ์ฃผ๊ณ  ๋ฐ›์œผ๋ฉด์„œ", + "์•ž์œผ๋กœ ๋ณดํ˜ธ์ž๋‹˜์˜ ๋งˆ์Œ์—\n์•ˆ์ •์ด ์ฐพ์•„์˜ค๊ธฐ๊นŒ์ง€", + "๋„์›€์ด ๋˜์—ˆ์œผ๋ฉด\nํ•˜๋Š” ๋ฐ”๋žŒ์ด์—์š”.", + "์ด์ œ ์šฐ๋ฆฌ๊ฐ€ ๋‹ค์‹œ\n๋งŒ๋‚˜๊ฒŒ ๋  ์‹œ๊ฐ„์„ ์•Œ๋ ค์ฃผ์„ธ์š”.", + "์ด์ œ ์šฐ๋ฆฌ๊ฐ€ ๋‹ค์‹œ\n๋งŒ๋‚˜๊ฒŒ ๋  ์‹œ๊ฐ„์„ ์•Œ๋ ค์ฃผ์„ธ์š”.", +]; + +padding: EdgeInsets.only(bottom:16), +contentPadding: EdgeInsets.only(top: 16), +8 + + +-------- + +// farewell + +List questions0 =[ + "์ข‹์•„์š”, ๋ณดํ˜ธ์ž๋‹˜.", //0 + "์˜ค๋Š˜์€ ์•„์ด์™€์˜\n์ด๋ณ„์— ๋Œ€ํ•ด์„œ ์–˜๊ธฐํ•ด๋ณด๋„๋ก ํ•ด์š”.", //1 + "๋งŒ๋‚จ์ด ์žˆ์œผ๋ฉด ์ด๋ณ„์ด ์žˆ๋“ฏ์ด\n์ด๋ณ„์˜ ์ˆœ๊ฐ„์€ ๊ฒฐ๊ตญ ์ฐพ์•„์™€์š”. ", //2 + "์กฐ๊ธˆ ํž˜๋“ค๋”๋ผ๋„\n์ด๋ณ„์˜ ์ˆœ๊ฐ„์„ ๋– ์˜ฌ๋ฆฌ๋ฉฐ", //3 + "๋ณดํ˜ธ์ž๋‹˜์˜ ๊ฐ์ •๋“ค์„\n๊ฐ™์ด ์ •๋ฆฌํ•ด๋ณด์•„์š”.", //4 + "์ด๋ณ„์˜ ์ˆœ๊ฐ„,\n๊ทธ๋‚ ์˜ ๋‚ ์”จ๋Š” ์–ด๋• ๋‚˜์š”?", //5 + "์ด๋ณ„์˜ ์ˆœ๊ฐ„,\n๊ทธ๋‚ ์˜ ๋‚ ์”จ๋Š” ์–ด๋• ๋‚˜์š”?", //6 + + // "์•„์ด์™€์˜ ์ด๋ณ„์˜ ์ˆœ๊ฐ„์€\n() ๋‚ ์ด์—ˆ๊ตฐ์š”.", //7 + // + // "์šฐ๋ฆฌ ๋ณดํ˜ธ์ž๋‹˜๊ณผ\n์•„์ด๋Š”", //8 + // "์–ด๋–ค ์žฅ์†Œ์— ์žˆ์—ˆ๋‚˜์š”? ", //9 + // "์–ด๋–ค ์žฅ์†Œ์— ์žˆ์—ˆ๋‚˜์š”? ", //10 + // + // "๊ทธ๋ ‡๊ตฐ์š”", //11 + // "()์—์„œ", //12 + // + // "์•„์ด์™€ ์ด๋ณ„ํ•˜๋Š”\n์ˆœ๊ฐ„์„ ๋– ์˜ฌ๋ฆฌ๋ฉฐ ํ›„ํšŒ๋˜๋Š” ๋ถ€๋ถ„์ด ์žˆ๋‚˜์š”?", //13 +]; +// ๋„ค ์„ ํƒ์‹œ +List questionYes= [ + "์–ด๋–ค ๋ถ€๋ถ„์ด ํ›„ํšŒ๊ฐ€ ๋˜๋‚˜์š”?", + "๋ณดํ˜ธ์ž๋‹˜์˜ ์–˜๊ธฐ๋ฅผ ๋“ค์–ด๋ณด๋‹ˆ", + "์•„์ด๋ฅผ ํ–ฅํ•œ ๊ทธ๋ฆฌ์›€, ํ›„ํšŒโ€ฆ", + "๊ทธ ์™ธ์—๋„\n๋‹ค์–‘ํ•œ ๊ฐ์ •๋“ค์ด ๋А๊ปด์ง€๋Š” ๊ฒƒ ๊ฐ™์•„์š”.", + "์ด๋ณ„์˜ ์ˆœ๊ฐ„์€ ์ง€๋‚˜๊ฐ€๋”๋ผ๋„", + "์•„์ด๋ฅผ ๊ทธ๋ฆฌ์›Œํ•˜๋Š” ๋งˆ์Œ์€\n์ปค์ ธ๋งŒ ๊ฐ€๋‹ˆ ๊ทธ๋Ÿฐ ๊ฒƒ ๊ฐ™์•„์š”.", + "๊ทธ๋ž˜๋„ ๋ณดํ˜ธ์ž๋‹˜์ด\n์•„์ด๋ฅผ ์ถ”์–ตํ•  ์ˆ˜ ์žˆ๊ฒŒ", + "โ€˜๊ธฐ์–ตํ• ๊ฐœโ€™์—์„œ ์•„์ด์™€์˜\n์ถ”์–ต์„ ์ €์žฅํ•ด๋ณด๋Š” ๊ฒƒ๋„", + "๊ทธ๋ฆฌ์šด ๋งˆ์Œ์„ ๋‹ฌ๋ž˜๋Š”๋ฐ\n๋„์›€์ด ๋  ๊ฒƒ ๊ฐ™์•„์š”.", +]; + +// ์•„๋‹ˆ์˜ค ์„ ํƒ์‹œ +List questionNo =[ + "๊ทธ๋ ‡๋‹ค๋ฉด, ๋‹คํ–‰์ด์—์š”.", + "์ด๋ณ„์˜ ์ˆœ๊ฐ„์ด ์ง€๋‚˜๊ณ \nํ›„ํšŒ๊ฐ€ ๋‚จ์„ ์ˆ˜ ์žˆ์ง€๋งŒ,", + "ํ›„ํšŒ๊ฐ€ ๋‚จ์ง€ ์•Š์•˜๋‹ค๋ฉด\n๊ทธ๊ฒƒ๋„ ์ •๋ง ๋Œ€๋‹จํ•œ ์ผ์ด๋ผ๊ณ  ์ƒ๊ฐํ•ด์š”.", + "๋ณดํ˜ธ์ž๋‹˜.\n๋งŒ์•ฝ ์•„์ด์™€์˜", + "์ด๋ณ„์˜ ์ˆœ๊ฐ„์œผ๋กœ ๋‹ค์‹œ ๋Œ์•„๊ฐ„๋‹ค๋ฉด\nํ•˜๊ณ  ์‹ถ์€ ๊ฒƒ๋“ค์ด ์žˆ์„๊นŒ์š”?", + "๋ณดํ˜ธ์ž๋‹˜์€\n์ด๋ณ„์˜ ์ˆœ๊ฐ„์„ ์ž˜ ๋ณด๋‚ด์‹  ๊ฒƒ ๊ฐ™์•„์š”.", + "๊ทธ ์ˆœ๊ฐ„์— ์•„์ด๋„", + "๋ณดํ˜ธ์ž๋‹˜์˜ ๋งˆ์Œ์„\n์˜จ์ „ํžˆ ๋А๊ผˆ์„๊ฑฐ์˜ˆ์š”.", + "๊ทธ๋Ÿผ์—๋„ ์•„์ด๋ฅผ ํ–ฅํ•œ\n๊ทธ๋ฆฌ์šด ๋งˆ์Œ์€", + "์—ฌ์ „ํ•˜๊ฒŒ ๋‚จ์•„์žˆ์ง€ ์•Š์„๊นŒ ์‹ถ์–ด์š”.", + "โ€˜๊ธฐ์–ตํ• ๊ฐœโ€™์—์„œ ์•„์ด์™€์˜\n์ถ”์–ต์„ ์ •๋ฆฌํ•ด๋ณด๋ฉด", + "๊ทธ๋ฆฌ์šด ๋งˆ์Œ์„ ๋‹ฌ๋ž˜๋Š”๋ฐ\n ํฐ ๋„์›€์ด ๋  ๊ฒƒ ๊ฐ™์•„์š”.", + +]; + + +List questionsEnd =[ + "๋ณดํ˜ธ์ž๋‹˜,\n์ œ๊ฐ€ ์ค€๋น„ํ•œ ๋Œ€ํ™”๋Š” ์—ฌ๊ธฐ๊นŒ์ง€์—์š”. ", + "์•„์ด์™€\n์ด๋ณ„์˜ ์ˆœ๊ฐ„์„ ๊ธฐ์–ตํ•˜๋ฉฐ ", + "ํ’€์ง€ ๋ชปํ•œ ๋ณดํ˜ธ์ž๋‹˜์˜\n๊ฐ์ •๋“ค์ด ํ’€์–ด์กŒ์œผ๋ฉด ํ•˜๋Š” ๋ฐ”๋žŒ์ด์—์š”.", + "์ž, ์ด์ œ ์šฐ๋ฆฌ๊ฐ€ ๋‹ค์‹œ\n๋งŒ๋‚˜๊ฒŒ ๋  ์‹œ๊ฐ„์„ ์•Œ๋ ค์ฃผ์„ธ์š”.", + "์ž, ์ด์ œ ์šฐ๋ฆฌ๊ฐ€ ๋‹ค์‹œ\n๋งŒ๋‚˜๊ฒŒ ๋  ์‹œ๊ฐ„์„ ์•Œ๋ ค์ฃผ์„ธ์š”.", + "๋„ค, ๋ณดํ˜ธ์ž๋‹˜.\n()์‹œ๊ฐ„ ํ›„์— ๋‹ค์‹œ ๋งŒ๋‚˜์š”!", + "๋„ค, ๋ณดํ˜ธ์ž๋‹˜.\n()์‹œ๊ฐ„ ํ›„์— ๋‹ค์‹œ ๋งŒ๋‚˜์š”!", +]; + +---- ์ค‘๊ธฐ --- + +// ์‹œ์ž‘ +List startQuestions =[ + "์ข‹์•„์š”, ${home.user}๋‹˜", //0 + "${home.puppy}์™€์˜\n์ด๋ณ„๋กœ ๊ฒช์€ ์Šฌํ”ˆ ๊ฐ์ •๋“ค์€", //1 + "${home.user}๋‹˜์˜ ์‚ถ์—\n๋ณ€ํ™”๋ฅผ ๊ฐ€์ ธ์™”์„ ๊ฑฐ์˜ˆ์š”.", //2 + "์š”์ฆ˜ ${home.user}๋‹˜์€", //3 + "์–ด๋–ป๊ฒŒ ์ง€๋‚ด๊ณ  ์žˆ๋Š”์ง€ ๊ถ๊ธˆํ•ด์š”.", //4 + "ํ˜„์žฌ ${home.user}๋‹˜์˜\n๊ฑด๊ฐ• ์ƒํƒœ๋Š” ์–ด๋–ค๊ฐ€์š”?", //5 + "๊ฑด๊ฐ• ์ƒํƒœ์˜ ์ •๋„๋ฅผ ์•Œ๋ ค์ฃผ์„ธ์š”.", //6 + +]; + +// ์ข‹์•„์š” +List good= [ + "${home.user}๋‹˜์€ ์Šฌํ””์„", + "๊ฑด๊ฐ•ํ•˜๊ฒŒ ๊ทน๋ณตํ•˜๊ณ  ๊ณ„์‹œ๋„ค์š”.", + "์•ž์œผ๋กœ๋„ ${home.user}๋‹˜์˜\n์ผ์ƒ์„ ์œ ์ง€ํ•˜๋ฉด์„œ.", + "์ฐจ์ฐจ ์ด๋ณ„์„ ๊ทน๋ณตํ•ด๊ฐ€๋ฉด ๋œ๋‹ต๋‹ˆ๋‹ค!", +]; + +// ์กฐ๊ธˆ ์•„ํŒŒ์š” +List little =[ + "์ด๋ณ„์€ ๋ˆ„๊ตฌ์—๊ฒŒ๋‚˜\nํฐ ํ›„์œ ์ฆ์„ ๋‚จ๊ธฐ์ฃ .", + "ํ•˜์ง€๋งŒ,\n์ด๋ณ„์„ ์ž˜ ๋ณด๋‚ด๊ธฐ ์œ„ํ•ด์„œ๋Š”", + "๊ฑด๊ฐ•ํ•œ ๋ชธ๋„ ์ •๋ง ์ค‘์š”ํ•˜๋‹ต๋‹ˆ๋‹ค.", + "์‚ฌ์†Œํ•œ ์ผ์ƒ์„ ์ง€ํ‚ค๋ฉฐ\n์ด๋ณ„์„ ๊ฐ™์ด ๊ทน๋ณตํ•ด๋ด์š”!", +]; + +// ์•„ํŒŒ์š” +List hard =[ + "์ด๋ณ„์„ ๊ฒช์œผ๋ฉด ๋งˆ์Œ์„ ๋”ฐ๋ผ\n๋ชธ๋„ ๋„ˆ๋ฌด๋‚˜ ์•„ํŒŒ์˜ค์ฃ .", + "๋“ ๋“ ํ•œ ๋ฐฅ์„ ๋จน๊ณ \n๊ฐ„๋‹จํ•œ ์•ผ์™ธํ™œ๋™์„ ํ•˜๋ฉด์„œ", + "์šฐ๋ฆฌ ์‚ฌ์†Œํ•œ ๊ฒƒ๋ถ€ํ„ฐ ์‹œ์ž‘ํ•ด๋ณด์•„์š”!", +]; + +// ๋‹ค์Œ ์งˆ๋ฌธ +List nextQuestions =[ + "๋‹ค์Œ ์งˆ๋ฌธ์ด์—์š”.", + "${home.user}๋‹˜,\nํ˜„์žฌ ๋งˆ์Œ์˜ ์Šฌํ””์€", + "์–ด๋А ์ •๋„์ธ๊ฐ€์š”?", + "์Šฌํ””์˜ ์ •๋„๋ฅผ ์•Œ๋ ค์ฃผ์„ธ์š”.", // ๋„ˆ๋ฌด ๊ธบ +]; + +// ๊ณ ํ†ต, ์Šฌํผ์š” +List sad =[ + "${home.user}๋‹˜์˜\n์•„ํ”ˆ ๋งˆ์Œ์ด ์ œ๊ฒŒ๋„ ๋А๊ปด์ ธ์š”.", + "์Šฌํ”„๊ณ  ๊ณ ํ†ต์Šค๋Ÿฌ์šด ๋งˆ์Œ์„\n์ €์—๊ฒŒ ํ„ธ์–ด๋†“์œผ๋ฉด์„œ", + "์กฐ๊ธˆ์ด๋‚˜๋งˆ ๋œ์–ด์ง€๊ธธ\n๋ฐ”๋ผ๋Š” ๋งˆ์Œ์ด๋ž๋‹ˆ๋‹ค.", +]; + +// ๊ฒฌ๋”œ ์ˆ˜ ์žˆ์–ด์š” +List endure =[ + "${home.user}๋‹˜,", + "์Šฌํ””์„ ์žˆ๋Š” ๊ทธ๋Œ€๋กœ ํ‘œํ˜„ํ•˜๋Š” ๊ณผ์ •์€\n๋งค์šฐ ์ค‘์š”ํ•˜๋‹ต๋‹ˆ๋‹ค.", + "๊ทธ๋ž˜๋„ ${home.user}๋‹˜์€\n์Šฌํ””์œผ๋กœ ์ธํ•œ ๊ฐ์ •์„", + "์ž˜ ํ’€์–ด๋‚˜๊ฐ€๊ณ  ์žˆ๋Š” ๊ฒƒ ๊ฐ™์•„์š”.", + "์•ž์œผ๋กœ๋„ ์ง€๊ธˆ์ฒ˜๋Ÿผ๋งŒ\n${home.user}๋‹˜์˜ ์Šฌํ””์„", + "์žˆ๋Š” ๊ทธ๋Œ€๋กœ ํ‘œํ˜„ํ•ด ๋ณด์•„์š”.", +]; + +List lastQuestion =[ + "${home.user}๋‹˜", // 0 + "${home.puppy}์™€์˜\n์ด๋ณ„๋กœ ๊ฒช์€ ์Šฌํ”ˆ ๊ฐ์ •๋“ค์ด", //1 + "๋ชธ๊ณผ ๋งˆ์Œ์—\n์—ฌ๋Ÿฌ๊ฐ€์ง€ ๋ณ€ํ™”๋ฅผ ๊ฐ€์ ธ์˜จ ๊ฒƒ ๊ฐ™์•„์š”.", //2 + "๋งˆ์ง€๋ง‰์œผ๋กœ\n${home.puppy}์™€์˜ ์ด๋ณ„์ด", //3 + "์–ด๋–ค ๋ณ€ํ™”๋“ค์„ ๊ฐ€์ ธ์™”๋Š”์ง€\n๊ตฌ์ฒด์ ์œผ๋กœ ์–˜๊ธฐํ•ด๋ณด๋ ค๊ณ  ํ•ด์š”.", //4 + "๊ตฌ์ฒด์ ์œผ๋กœ ${home.user}๋‹˜์€\n์–ด๋–ค ์ƒํ™ฉ์ธ๊ฐ€์š”?", //5 + + "์ด๋ณ„์€ ๋ฌด๊ธฐ๋ ฅํ•˜๊ฒŒ\n๋•Œ๋กœ๋Š” ํ•˜์—ผ์—†์ด ์Šฌํ”„๊ฒŒ ๋งŒ๋“ค๊ธฐ๋„ ํ•ด์š”.", //6 + "์•„์ฃผ ๊ณ ํ†ต์Šค๋Ÿฝ๊ฒŒ ๋งŒ๋“ค๊ธฐ๋„ ํ•˜์ฃ .", //7 + "${home.user}๋‹˜ ํ˜ผ์ž\n์ด ๊ฐ์ •๋“ค์„ ๊ฐ๋‹นํ•˜๊ธฐ์—", //8 + "์–ด๋ ค์›€์ด ์žˆ์–ด ๋ณด์—ฌ์š”.", //9 + "๊ฐ™์€ ์ƒํ™ฉ์„ ๊ฒฝํ—˜ํ•œ\nํ˜น์€ ๊ฒฝํ—˜์ค‘์ธ", //10 + "๋งŽ์€ ๋ฐ˜๋ ค์ธ๋“ค์˜ ์–˜๊ธฐ๋ฅผ\n๋“ค์–ด๋ณด๋Š” ๊ฑด ์–ด๋–จ๊นŒ์š”?", //11 + "${home.user}๋‹˜์—๊ฒŒ\nโ€˜๋„์›€ ์š”์ฒญํ•˜๊ธฐโ€™๋ฅผ ์ถ”์ฒœํ•ด๋“œ๋ฆด๊ฒŒ์š”!", //12 + //"๋„์›€์„ ์š”์ฒญํ•˜๋Ÿฌ ์ด๋™ํ•˜์‹œ๊ฒ ์Šต๋‹ˆ๊นŒ?", ์—†์• ๊ธฐ +]; + +List questionsEnd =[ + "${home.user}๋‹˜,", + "์˜ค๋Š˜ ์ œ๊ฐ€ ์ค€๋น„ํ•œ ๋Œ€ํ™”๋Š”\n์—ฌ๊ธฐ๊นŒ์ง€์˜ˆ์š”.", + "${home.user}๋‹˜์˜\n์Šฌํ”ˆ ๊ฐ์ •๋“ค์„ ์–˜๊ธฐํ•˜๊ณ ", + "์Šค์Šค๋กœ๋ฅผ ๋‹ค๋…์ผ ์ˆ˜ ์žˆ๊ธฐ๋ฅผ ๋ฐ”๋ผ์š”!", + "์ž, ์ด์ œ ์šฐ๋ฆฌ๊ฐ€ ๋‹ค์‹œ\n๋งŒ๋‚˜๊ฒŒ ๋  ์‹œ๊ฐ„์„ ์•Œ๋ ค์ฃผ์„ธ์š”.", + "์ž, ์ด์ œ ์šฐ๋ฆฌ๊ฐ€ ๋‹ค์‹œ\n๋งŒ๋‚˜๊ฒŒ ๋  ์‹œ๊ฐ„์„ ์•Œ๋ ค์ฃผ์„ธ์š”.", + "๋„ค, ${home.user}๋‹˜.\n()์‹œ๊ฐ„ ํ›„์— ๋‹ค์‹œ ๋งŒ๋‚˜์š”!", + "๋„ค, ${home.user}๋‹˜.\n()์‹œ๊ฐ„ ํ›„์— ๋‹ค์‹œ ๋งŒ๋‚˜์š”!", +]; + +/// ์ „๋ชป์ง„ +List questions0 =[ + "์•„์ด๋Š” ์ง€๊ธˆ", //0 + "๋ฌด์ง€๊ฐœ๋‹ค๋ฆฌ ๋„ˆ๋จธ์—\n์ž˜ ๋„์ฐฉํ–ˆ์„ ๊ฑฐ์˜ˆ์š”.", //1 + "๋ถ„๋ช… ์ž˜ ์ง€๋‚ด๊ณ  ์žˆ์„ ๊ฒƒ์„ ์•Œ์•„๋„", //2 + "์—ฌ์ „ํžˆ\n๋ณดํ˜ธ์ž๋‹˜์—๊ฒŒ๋Š”", //3 + "์•„์ด์—๊ฒŒ\nํ•ด์ฃผ๊ณ  ์‹ถ์€ ๋ง์ด ๋‚จ์•„์žˆ๊ฒ ์ฃ .", //4 + "์˜ค๋Š˜์€ ์•„์ด์—๊ฒŒ\n์ „ํ•˜์ง€ ๋ชปํ•œ", //5 + "๋ณดํ˜ธ์ž๋‹˜์˜\n์ง„์‹ฌ์„ ๋‹ด์•„", //6 + "๋ฌด์ง€๊ฐœ ๋„ˆ๋จธ๋กœ ํŽธ์ง€๋ฅผ ๋ณด๋‚ผ๊ฑฐ์˜ˆ์š”.", //7 + "ํŽธ์ง€๋ฅผ ์“ฐ๊ธฐ ์ „์—,\n๋จผ์ € ํŽธ์ง€๋ฅผ ๊พธ๋ฉฐ๋ณผ๊ฒŒ์š”.", //8 + "์•„์ด๋Š”\n์–ด๋–ค ๋‚ ์”จ๋ฅผ ์ข‹์•„ํ–ˆ๋‚˜์š”?", //9 + + "์•„์ด์—๊ฒŒ ๋ณด๋‚ผ\nํŽธ์ง€์ง€๊ฐ€ ์™„์„ฑ๋˜์—ˆ์–ด์š”!", // 10 + "์•„์ด์—๊ฒŒ ๋ณด๋‚ผ\nํŽธ์ง€์ง€๊ฐ€ ์™„์„ฑ๋˜์—ˆ์–ด์š”!", // 11 + "์™„์„ฑ๋œ ํŽธ์ง€์ง€์—", // 12 ์™œ ๋ง์„ ๋ชฌํ•ด + "์•„์ด์—๊ฒŒ\n์ „ํ•˜๊ณ  ์‹ถ์—ˆ๋˜ ์ง„์‹ฌ์„ ๋‹ด์•„", //13 + "ํŽธ์ง€๋ฅผ ์ž‘์„ฑํ•ด์ฃผ์„ธ์š”", // 14 + "", // ์ž‘์„ฑ์ค‘ 15 + + "๋ณดํ˜ธ์ž๋‹˜,", // 16 + "ํŽธ์ง€์— ์•„์ด๋ฅผ ํ–ฅํ•œ ์ง„์‹ฌ์„", //17 + "์ž˜ ์ ์–ด๋ณด์•˜๋‚˜์š”?", //18 + "๋ณดํ˜ธ์ž๋‹˜์˜\n์†Œ์ค‘ํ•œ ๋งˆ์Œ์„ ๋‹ด์•„", // 19 + "์•„์ด์—๊ฒŒ\n์ง์ ‘ ํŽธ์ง€๋ฅผ ์ „๋‹ฌํ•ด๋“œ๋ฆด๊ฒŒ์š”!", //20 + + "๋ฌด์ง€๊ฐœ ๋‹ค๋ฆฌ ๋„ˆ๋จธ ์•„์ด์—๊ฒŒ\nํŽธ์ง€๊ฐ€ ์ „๋‹ฌ๋˜๋Š” ์ค‘...", //21 + "์•„์ด์—๊ฒŒ\nํŽธ์ง€๊ฐ€ ์ „๋‹ฌ๋˜์—ˆ์Šต๋‹ˆ๋‹ค!", //22 + + "๋ณดํ˜ธ์ž๋‹˜์˜ ํŽธ์ง€๊ฐ€\n์•„์ด์—๊ฒŒ ์ „๋‹ฌ๋˜์—ˆ์–ด์š”.", //23 ์™œ ๋ง ์•ˆ ํ•ด + "์•„์ด๊ฐ€\n๋ณดํ˜ธ์ž๋‹˜์˜ ํŽธ์ง€๋ฅผ ๋ฐ›๊ณ ", //24 + "์ด ๋ง์„ ๊ผญ ์ „ํ•ด๋‹ฌ๋ผ๊ณ  ํ–ˆ์–ด์š”.", //25 + "์•„์ด๋Š”\n๋ณดํ˜ธ์ž๋‹˜์„", //26 + "์ •๋ง ๋งŽ์ด ์‚ฌ๋ž‘ํ•œ๋‹ต๋‹ˆ๋‹ค.", //27 + "๋ณดํ˜ธ์ž๋‹˜๊ณผ\n๋‹ค์‹œ ๋งŒ๋‚˜๋Š” ๊ทธ๋‚ ๊นŒ์ง€", //28 + "์นœ๊ตฌ๋“ค๊ณผ ๊ธฐ๋‹ค๋ฆฌ๊ณ  ์žˆ์„๊ฑฐ๋ผ๊ณ  ํ–ˆ์–ด์š”!", //29 + "๋ณดํ˜ธ์ž๋‹˜์˜\n์†Œ์ค‘ํ•œ ๋งˆ์Œ์ด", //30 + "์•„์ด์—๊ฒŒ๋„\n์ž˜ ์ „๋‹ฌ๋œ ๊ฒƒ ๊ฐ™์•„์š”!", //31 + "ํŽธ์ง€๋ฅผ ํ†ตํ•ด\n๋ณดํ˜ธ์ž๋‹˜์˜ ๋งˆ์Œ ์†", //32 + "์ „ํ•˜์ง€ ๋ชปํ–ˆ๋˜ ์ง„์‹ฌ๋“ค์ด", //33 2.5์ดˆ + "์กฐ๊ธˆ์€ ๊ฐ€๋ฒผ์›Œ์กŒ๊ธฐ๋ฅผ ๋ฐ”๋ผ์š”.", // 34 2.5์ดˆ +]; + +List questionsEnd =[ + "์ž, ์ด์ œ ์šฐ๋ฆฌ๊ฐ€ ๋‹ค์‹œ\n๋งŒ๋‚˜๊ฒŒ ๋  ์‹œ๊ฐ„์„ ์•Œ๋ ค์ฃผ์„ธ์š”.", + "์ž, ์ด์ œ ์šฐ๋ฆฌ๊ฐ€ ๋‹ค์‹œ\n๋งŒ๋‚˜๊ฒŒ ๋  ์‹œ๊ฐ„์„ ์•Œ๋ ค์ฃผ์„ธ์š”.", + "๋„ค, ๋ณดํ˜ธ์ž๋‹˜.\n()์‹œ๊ฐ„ ํ›„์— ๋‹ค์‹œ ๋งŒ๋‚˜์š”!", + "๋„ค, ๋ณดํ˜ธ์ž๋‹˜.\n()์‹œ๊ฐ„ ํ›„์— ๋‹ค์‹œ ๋งŒ๋‚˜์š”!", +]; + +/// ํ›„๊ธฐ +List lateConversation =[ +"๋„ค, ์˜ค๋Š˜์€ ", //0 +"์•„์ด์˜ ๋นˆ์ž๋ฆฌ์— ๋Œ€ํ•ด ์–˜๊ธฐํ•ด ๋ณด์•„์š”.", //1 +"์•„์ด๊ฐ€ ๊ณ์„ ๋– ๋‚œ ์ˆœ๊ฐ„,", //2 2.5์ดˆ +"๊ฐ์ •์ ์ธ ๊ณต๋ฐฑ์€ ์–ด๋”˜ ๊ฐ€์— ๊นŠ์ด ๋‚จ์•„์žˆ์„ ๊ฑฐ์˜ˆ์š”.", //3 4.5์ดˆ +"ํ•˜์ง€๋งŒ ๊ทธ ๊ฐ์ •์„ ๋‹ค๋ฅด๊ฒŒ ๋ฐ›์•„๋“ค์ด๊ณ ,", //4 +"์•„์ด์™€ ํ•จ๊ป˜ํ•œ ์ˆœ๊ฐ„๋“ค์„ ์ƒ๊ฐํ•ด๋ณธ๋‹ค๋ฉด", //5 +"๊ฐ์ •์ ์ธ ๊ณต๋ฐฑ์ด ์ฑ„์›Œ์งˆ ๊ฑฐ์˜ˆ์š”.", //6 +"์•„์ด๊ฐ€ ์—†๋Š” ์‚ถ์—์„œ", //7 +"๋ณดํ˜ธ์ž๋‹˜์€ ์–ด๋–ค ๊ฒฝํ—˜์„ ํ–ˆ๋‚˜์š”? ", //8 <<<< +"๋„ค ๊ทธ๋ ‡๊ตฐ์š”. ", //9 +"์•ž์„  ๊ฒฝํ—˜์„ ํ†ตํ•ด์„œ ๋ณดํ˜ธ์ž๋‹˜์—๊ฒŒ", // 10 +"์–ด๋–ค ๋ณ€ํ™”๊ฐ€ ์ƒ๊ฒผ์„๊นŒ์š”?", //11 <<<< +"๋ณดํ˜ธ์ž๋‹˜์—๊ฒŒ ๊ทธ๋Ÿฐ ๋ณ€ํ™”๊ฐ€ ์žˆ์—ˆ๊ตฐ์š”.", //12 +"๊ทธ๋ ‡๋‹ค๋ฉด ๊ทธ๋Ÿฐ ๋ณ€ํ™”๋“ค์„ ๋งˆ์ฃผํ•˜๊ณ ", //13 +"์ฆ๊ฑฐ์› ๋˜ ์ˆœ๊ฐ„๋“ค์ด ์žˆ๋‚˜์š”?", //14 <<<< +"์ผ์ƒ ์†์—์„œ ๋ณดํ˜ธ์ž๋‹˜์„ ๊ดด๋กญํžˆ๋Š”", //15 +"๋ณต์žกํ•œ ์ƒ๊ฐ๋“ค์„ ์ •๋ฆฌํ•˜๊ธฐ ์œ„ํ•ด์„œ ์–ด๋–ค ํ–‰๋™์„ ํ•˜๋Š”์ง€", //16 +"๊ณต๊ฐ„, ์‹œ๊ฐ„, ํ–‰๋™, ๊ด€๊ณ„๋กœ ๋‚˜๋ˆ„์–ด ์ƒ๊ฐํ•ด๋ณด์•„์š”.", //17 +"์–ด๋А ๊ณณ์—์„œ ์ƒ๊ฐ์„ ์ •๋ฆฌํ–ˆ๋‚˜์š”?", //18 <<<< +"์ฃผ๋กœ ์–ธ์ œ ์ƒ๊ฐ์„ ์ •๋ฆฌํ–ˆ๋‚˜์š”?", //19 <<<< +"๋ฌด์—‡์„ ํ•˜๋ฉฐ ์ƒ๊ฐ์„ ์ •๋ฆฌํ–ˆ๋‚˜์š”?", //20 <<<< +"๋ˆ„๊ตฌ์™€ ์ƒ๊ฐ์„ ์ •๋ฆฌํ–ˆ๋‚˜์š”?", //21 <<<< +"๊ทธ๋ ‡๊ตฐ์š”.", //22 +"ํž˜๋“  ์ƒํ™ฉ์—์„œ ์‚ฌ๋žŒ๋“ค๊ณผ ์†Œํ†ตํ•˜๊ณ  ๊ต๋ฅ˜ํ•˜๋Š” ๊ฑด ์ค‘์š”ํ•ด์š”.", //23 +"์–ธ์ œ๋‚˜ ๋ณดํ˜ธ์ž๋‹˜ ๊ณ์— ์นœ๊ตฌ์™€ ๊ฐ€์กฑ์ด ์žˆ๊ณ ,", //24 +"๊ทธ๋ถ„๋“ค์€ ๋ณดํ˜ธ์ž๋‹˜์„ ์ง€์ง€ํ•˜๊ณ  ๊ธฐ๋‹ค๋ฆฌ๊ณ  ์žˆ์–ด์š”.", //25 +"โ€˜ํ•จ๊ป˜ํ• ๊ฒŒโ€™์—์„œ ์œ„๋กœ์˜ ๋ง์„ ์ฃผ๊ณ  ๋ฐ›์œผ๋ฉฐ", //26 +"ํ•จ๊ป˜ ๊ฐ์ •์„ ๋‚˜๋ˆ ๋ณด์•„์š”.", // 27 <<<<<<<<<<<<<<<<<<<<<<<<<<< +"๋ณดํ˜ธ์ž๋‹˜. ์•„์ด์™€ ํ•จ๊ป˜ํ•œ ์ˆœ๊ฐ„๋“ค์€", //28 +"๋” ์—†์ด ํŠน๋ณ„ํ•˜๊ณ  ๊ฐ’์ง„ ๊ฒฝํ—˜์ด์ง€๋งŒ,", //29 +"์•„์ด๊ฐ€ ์—†๋Š” ์‚ถ์—์„œ๋„", //30 +"์ƒˆ๋กœ์šด ๊ฒฝํ—˜์„ ์ฐพ์•„๋‚˜๊ฐ€๋ฉฐ ํ–‰๋ณต์„ ๋งŒ๋“ค์–ด๊ฐˆ ์ˆ˜ ์žˆ์–ด์š”.", //31 +"๊ทธ๋ฆฌ๊ณ  ์ด ๊ณผ์ •์—์„œ ๋”์šฑ ๋” ๋‚˜ ์ž์‹ ์„ ์ดํ•ดํ•˜๊ณ ", //32 +"๋ฐœ์ „์‹œํ‚ฌ ์ˆ˜ ์žˆ๋‹ค๋Š” ๊ฒƒ๋„ ์•Œ๊ฒŒ ๋˜์—ˆ์œผ๋ฉด ์ข‹๊ฒ ์–ด์š”.", //33 +]; + + + +----------------------------------------- + + + +List endConversation = [ +"๋„ค, ์˜ค๋Š˜์€\n์ƒˆ๋กœ์šด ๋‚˜์— ๋Œ€ํ•ด ์–˜๊ธฐํ•ด๋ณด์•„์š”.", //0 4ch +"์ด์ œ ์•„์ด๊ฐ€\n ๋– ๋‚œ ๋นˆ์ž๋ฆฌ์—", //1 +"์ƒˆ๋กœ์šด ๊ฟˆ๊ณผ ์—ด์ •์„ ์‹ฌ์„ ์ฐจ๋ก€์—์š”.", //2 +"๊ทธ ์˜๊ฐ์„ ๋ฐ›์•„\n ์ž์•„๋ฅผ ํƒ์ƒ‰ํ•˜๊ณ  ๊ฐ•์ ์„ ๋ฐœ๊ฒฌํ•˜๋ฉฐ", //3 +"๋” ํฐ ์˜๋ฏธ์™€ ๋ชฉ์ ์„\n ์ฐพ์•„ ๋‚˜์•„๊ฐ€๋ณผ๊นŒ์š”?", //4 +"์ƒˆ๋กœ์šด ๋‚˜๋ฅผ ๋ฐœ๊ฒฌํ•˜๊ณ \n์„ฑ์žฅํ•˜๋Š” ๊ณผ์ •์—์„œ", //5 +"์šฐ๋ฆฌ์˜ ์ธ์ƒ์€\n ํ’์š”๋กญ๊ณ  ์˜๋ฏธ ์žˆ๋Š” ๊ฒƒ์œผ๋กœ ์ด์–ด์งˆ ๊ฑฐ์˜ˆ์š”.", //6 +"๋ณดํ˜ธ์ž๋‹˜!", //7 +"ํ‰์†Œ ์ž์‹ ์— ๋Œ€ํ•ด \n ํ•œ ๋ฌธ์žฅ์œผ๋กœ ์„ค๋ช…ํ•ด์ฃผ์„ธ์š”!", //8 +"๊ทธ๋ ‡๊ตฐ์š”, ์ด๋ฒˆ์—๋Š”\n โ€˜๋‚˜ ์ž์‹ โ€™์— ๋Œ€ํ•ด ๋” ์•Œ์•„๊ฐ€๊ธฐ ์œ„ํ•ด", //9 +"์ง€๊ธˆ๊นŒ์ง€์˜ ์ž์‹ ์˜ ๊ฒฝํ—˜๊ณผ\n ๋†“์ณค๋˜ ๊ฐ์ •์„ ๋ฐœ๊ฒฌํ•ด๋ณด์•„์š”.", //10 +"์ตœ๊ทผ์— ์–ด๋–ค ๊ฒƒ ๋•Œ๋ฌธ์— ์›ƒ์—ˆ๋‚˜์š”?", //11 +"๊ทธ ์ˆœ๊ฐ„์„ ์‚ฌ์ง„๊ณผ ํ•จ๊ป˜ ์ถ”์–ตํ•˜๋ฉฐ\n ๊ธฐ๋ถ„์„ ํšŒ๋ณตํ•ด๋ณด์•„์š”.", //12 +"๊ทธ ์ˆœ๊ฐ„์„ ์‚ฌ์ง„๊ณผ ํ•จ๊ป˜ ์ถ”์–ตํ•˜๋ฉฐ\n ๊ธฐ๋ถ„์„ ํšŒ๋ณตํ•ด๋ณด์•„์š”.", //13 +"์ข‹์•„์š”. ๊ทธ๋ ‡๋‹ค๋ฉด\n ์•ž์œผ๋กœ 1๋…„ํ›„, 2๋…„ํ›„, 3๋…„ํ›„, 5๋…„ ํ›„", //14 +"๋ณดํ˜ธ์ž๋‹˜์€\n ๋ฌด์—‡์„ ํ•˜๊ณ  ์žˆ์„๊นŒ์š”?", //15 +"๋ฏธ๋ž˜์˜ ๋‚˜์— ๋Œ€ํ•ด ์ƒ๊ฐํ•˜๋Š” ๊ฒƒ์€\n ๋†€๋ผ์šด ๊ฒฝํ—˜์ด์—์š”.", //16 +"์–ด๋–ค ๋ฏธ๋ž˜๋ฅผ ๋งŒ๋“ค๊ณ  ์‹ถ์€์ง€\n ํ•จ๊ป˜ ์ƒ์ƒํ•ด๋ณผ๊นŒ์š”?", //17 +"๋ณดํ˜ธ์ž๋‹˜์€\n ๋ฏธ๋ž˜์— ์–ด๋–ค ์‚ฌ๋žŒ์ด ๋˜์–ด์žˆ์„๊นŒ์š”?", //18 +"๋ฏธ๋ž˜์˜ ๋ณดํ˜ธ์ž๋‹˜์— ๋Œ€ํ•œ\n ๊ณ„ํš์„ ์ƒ์ƒํ•˜๊ณ ", //19 +"๊ตฌ์ฒดํ™”ํ•˜๋Š” ๊ณผ์ •์€\n ํฅ๋ฏธ๋กœ์šด ์—ฌ์ •์ด ๋ ๊ฑฐ์˜ˆ์š”!", //20 +"์ž์‹ ์ด ์„ค์ •ํ•œ ๋ชฉํ‘œ์—\n ์„ค๋ ˜์„ ๋А๋ผ๊ณ  ์„ฑ์ทจํ•˜๋ฉฐ", //21 +"๋ฏธ๋ž˜๋ฅผ ํ–ฅํ•ด ๋‚˜์•„๊ฐ€\n ๋” ํ’์š”๋กœ์šด ์‚ถ์„ ๋งŒ๋“ค์–ด ๋‚˜๊ฐ€๋ณด์•„์š”!", //22 +"์–ด๋ ค์šด ์ˆœ๊ฐ„์„ ๊ฒช์„ ๋•Œ,", //23 +"ํ•จ๊ป˜ํ•˜๋Š” ์‚ฌ๋žŒ๋“ค์˜ ์ง€์ง€์™€ ์ดํ•ด๋Š”\n ํฐ ํž˜์ด ๋ผ์š”.", //24 +"๊ทธ๋Ÿฌ๋‹ˆ, \n ์•„ํ””์„ ํ•จ๊ป˜ ๋‚˜๋ˆ„๊ณ  ๊ทน๋ณตํ•  ์ˆ˜ ์žˆ๋„๋ก", //25 +"๋‹ค๋ฅธ ๋ฐ˜๋ ค์ธ๋“ค์—๊ฒŒ\n ๋„์›€์„ ๋ณด๋‚ด๋ณด๋Š” ๊ฑด ์–ด๋–จ๊นŒ์š”?", //26 + + +"๋ณดํ˜ธ์ž๋‹˜,", //27 +"์ด์ œ ๋ชจ๋“  ๋Œ€ํ™”๊ฐ€ ๋์ด๋‚ฌ์–ด์š”!", //28 +"๊ทธ๋™์•ˆ ํ•จ๊ป˜ํ•œ ๋Œ€ํ™”๋Š”\n ์†Œ์ค‘ํ•˜๊ณ  ์˜๋ฏธ ์žˆ๋Š” ์‹œ๊ฐ„์ด์—ˆ์–ด์š”.", //29 +"์ด์ œ ๋Œ€ํ™”๋Š” ์ข…๋ฃŒ๋˜์ง€๋งŒ,", //30 +"๊ทธ๋™์•ˆ์˜ ์ˆœ๊ฐ„๋“ค์€\n ๊ธฐ์–ต ์†์— ๊ฐ„์ง๋˜๊ธธ ๋ฐ”๋ผ์š”.", //31 +"์ง€๊ธˆ๊นŒ์ง€\n ๋Œ€ํ™”์˜ ์—ฌ์ •์— ํ•จ๊ป˜ ํ•ด์ค˜์„œ ๊ณ ๋งˆ์›Œ์š”!", //32 + +"์ด์ œ โ€˜๊ธฐ์–ตํ• ๊ฐœโ€™ ์† ์ƒˆ๋กœ์šด ์ผ์ƒ์ด ๋‹น์‹ ์„ ๊ธฐ๋‹ค๋ฆฌ๊ณ  ์žˆ์–ด์š”.", //33 +"์ด ๋Œ€ํ™”๋ฅผ ๋‹ซ๊ณ  ๋‚˜๊ฐ€๋Š” ์ˆœ๊ฐ„,", //34 +"์‚ถ์˜ ๋‹ค์Œ ์žฅ์ด ํŽผ์ณ์ง€๊ธฐ๋ฅผ ๋ฐ”๋ž๋‹ˆ๋‹ค.", //35 +]; + +setedUserName = parsedResponseUser['nickname']; +setedDogName = parsedResponseUser['puppyName']; +setedDogAge = parsedResponseUser['puppyAge']; +setedDogType = parsedResponseUser['puppyType']; +setedDogImage = parsedResponseUser['profileImage']; + + + + + + +Container( +color: Colors.white, +height: 48, +child: Padding( +padding: const EdgeInsets.only(bottom: 8.0, top: 8.0, left: 16,right: 16), +child: Stack( +children: [ +Container( +width: screenSize.width, +height: 32, +decoration: BoxDecoration( +color: Colors.white, +border: Border.all(color: setUserName? Color(colorChart.blue):Color(0xffC0D2FC)), +borderRadius: BorderRadius.circular(30), +), +), +Positioned( +left: 15, +right: 30, +bottom: 23, +top: 0, +child: TextField( +controller: userNameController, +style: textStyle.bk14normal, +decoration: InputDecoration( +hintStyle: textStyle.grey14normal, +border: InputBorder.none, +hintText: '์ด๋ ‡๊ฒŒ ๋ถˆ๋Ÿฌ์ฃผ์„ธ์š”.'), +onChanged: (s) { +setUserName = true; +setState(() { + +}); +//text = s; +}, +onTap: () {}, +), +), +Positioned( +left: screenSize.width - 80, +//right: 30, +bottom: 28, +top: 3, +child: ElevatedButton( +onPressed: () { + +if(setUserName){ +nextQuestion++; +_player.setAsset(voice[voiceCount]); +voiceCount++; +_player.play(); +controller1.repeat( +min: 0, +max: 53, +period: const Duration(milliseconds: 1000) +); + +Timer(Duration(milliseconds: 1500), () { +controller1.stop(); +}); + +// setUserName = true; +userName = userNameController.text; +userName_ = userName; +setState(() { + +}); +} + +}, +style: ElevatedButton.styleFrom( +backgroundColor: setUserName? Color(colorChart.blue):Color(0xffDDE7FD), +fixedSize: const Size(3, 3), +shape: const CircleBorder(), +), +child: Icon( +Icons.arrow_upward, +color: Colors.white, +size: 16, +)), +), +], +), +), +), + +------------- \ No newline at end of file diff --git a/client/lib/conversation/intro/intro.dart b/client/lib/conversation/intro/intro.dart new file mode 100644 index 0000000..d441db0 --- /dev/null +++ b/client/lib/conversation/intro/intro.dart @@ -0,0 +1,1604 @@ +import 'dart:async'; +import 'dart:convert'; +import 'package:flutter/material.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter_svg/svg.dart'; +import 'package:fluttertoast/fluttertoast.dart'; +import 'package:http/http.dart' as http; +import 'package:client/progressbar/animation_progressbar.dart'; +import 'package:client/style.dart'; +import 'intro_memorial.dart'; +import 'package:client/main.dart'as main; +import 'package:client/sign/sign_in.dart' as sign_in; +import 'package:just_audio/just_audio.dart'; +import 'package:flutter_gif/flutter_gif.dart'; + +/// ์ธํŠธ๋กœ +String userName_ = ""; +String dogName_ =""; + +class IntroPage extends StatefulWidget { + + static Future navigatorPush(BuildContext context) async { + return Navigator.push( + context, + MaterialPageRoute( + builder: (_) => IntroPage(), + ), + ); + } + + @override + _IntroPageState createState() => _IntroPageState(); +} + +class _IntroPageState extends State with TickerProviderStateMixin { + + late FlutterGifController controller1, controller2, controller3; + + bool startIntro = false; + bool setUserName = false; + bool setDogName = false; + bool setDogAge = false; + bool setDogType = false; + + bool isVisible = false; + void toggleVisibility() { + setState(() { + isVisible = !isVisible; + }); + } + + bool dogTypeinput = false; // ๊ฐ•์•„์ง€์ข…์„ ์‚ฌ์šฉ์ž๊ฐ€ ์ง์ ‘ ์ž…๋ ฅํ•˜๋Š”๊ฐ€ + + String userDogType = ""; + + bool decidedAge = false; + bool selectAT = false; // ์˜ค๋ฅ˜ ๋ง‰๊ธฐ + bool chooseType = false; // ๊ฒฌ์ข…์„ ์„ ํƒํ•˜๋Š” ์ฐฝ์ด ๋œจ๋„๋ก + bool decidedType = false; // ๊ฒฌ์ข…์„ ์„ ํƒํ•˜์˜€๋‹ค๋ฉด ๋‹ค์Œ ํŽ˜์ด์ง€๋กœ ๋„˜์–ด๊ฐˆ ์ˆ˜ ์žˆ๋„๋ก ํ•จ + + bool grief = false; // ์Šฌํ”” ์„ ํƒ ์‹œ + bool ui_grief = false; + bool miss = false; // ๊ทธ๋ฆฌ์›€ ์„ ํƒ ์‹œ + bool ui_miss = false; + + bool finish = false; // ๋ฉ”๋ชจ๋ฆฌ์–ผ ๋ฐ ๋งˆ๋ฌด๋ฆฌ + + // ํ…์ŠคํŠธ ์—๋””ํŒ… ์ปจํŠธ๋กค๋Ÿฌ๋ฅผ ์ƒ์„ฑํ•˜์—ฌ ํ•„๋“œ์— ํ• ๋‹น + final userNameController = TextEditingController(); // nextQuestion = 3์ผ๋•Œ + final dogNameController = TextEditingController(); // nextQuestion = 7์ผ๋•Œ + final dogAgeController = TextEditingController(); // nextQuestion = 10์ผ๋•Œ + final dogTypeController = TextEditingController(); // nextQuestion = 10์ผ๋•Œ + + String userName = ""; + String dogName = ""; + int dogAge = 0; + String dogType = ""; + + // โ€œ๋น„์ˆ‘ ํ”„๋ฆฌ์ œโ€, โ€œํฌ๋ฉ”๋ผ๋‹ˆ์•ˆโ€, โ€œํ”„๋ Œ์น˜ ๋ถˆ๋…โ€, โ€œ์น˜์™€์™€โ€, โ€œ๋ชฐํ‹ฐ์ฆˆโ€, โ€œํ† ์ด ํ‘ธ๋“คโ€, โ€œ๋ผ๋ธŒ๋ผ๋„ ๋ฆฌํŠธ๋ฆฌ๋ฒ„โ€, โ€œ์ง„๋—๊ฐœโ€, โ€œ์ดํƒˆ๋ฆฌ์•ˆ ๊ทธ๋ ˆ์ดํ•˜์šด๋“œโ€, โ€œํŽจ๋ธŒ๋ก ์›ฐ์‹œ ์ฝ”๊ธฐโ€, โ€œ๋ถˆ๋…โ€, โ€œ์…”ํ‹€๋žœ๋“œ ์‰ฝ๋…โ€, + // โ€œ์‹œ๋ฐ”๊ฒฌโ€, โ€œ๊ณจ๋“  ๋ฆฌํŠธ๋ฆฌ๋ฒ„โ€, โ€œ๋กœํŠธ์™€์ผ๋Ÿฌโ€, โ€œ์ผ€์ธ ์ฝ”๋ฅด์†Œโ€, โ€œํผ๊ทธโ€, โ€œ๋ฒ ๋“ค๋งํ„ด ํ…Œ๋ฆฌ์–ดโ€, โ€œ์ €๋จผ ์…ฐํผ๋“œโ€, โ€œ๋ฏธ๋‹ˆ์–ด์ฒ˜ ๋‹ฅ์Šคํ›ˆํŠธโ€, โ€œ์ฐจ์šฐ์ฐจ์šฐโ€, โ€œ๋„๋ฒ ๋ฅด๋งŒโ€, โ€œ์•„๋ฉ”๋ฆฌ์นธ ์ฝ”์นด ์ŠคํŒŒ๋‹ˆ์—˜โ€, โ€œ์นด๋ฐ”๋ฆฌ์— ํ‚น ์ฐฐ์Šค ์ŠคํŒŒ๋‹ˆ์—˜โ€œ, + // โ€œํŽ˜ํ‚ค๋‹ˆ์ฆˆโ€œ, โ€œ์ฝ”์นด์‹œ์•ˆ ์˜ค๋ธŒ์ฐจ์นดโ€œ, โ€œ์Šคํƒ ๋‹ค๋“œ ํ‘ธ๋“คโ€œ, โ€œ์š”ํฌ์…” ํ…Œ๋ฆฌ์–ดโ€œ, โ€œ์‚ฌ๋ชจ์˜ˆ๋“œโ€œ, โ€œ์„ผํŠธ๋Ÿด ์•„์‹œ์•ˆ ์˜ค๋ธŒ์ฐจ์นดโ€œ, โ€œ์‹œ๋ฒ ๋ฆฌ์•ˆ ํ—ˆ์Šคํ‚คโ€œ, โ€œํœ˜ํ•โ€œ, โ€œ์•„๋ฉ”๋ฆฌ์นธ ์•„ํ‚คํƒ€โ€œ, โ€œ๋น ๋น„์šฉโ€œ, โ€œ๋ณด๋”์ฝœ๋ฆฌโ€œ, โ€œ๊ผฌ๋™ ๋“œ ํˆด๋ ˆ์•„โ€œ, + // โ€œ๋ฏธ๋‹ˆ์–ด์ฒ˜ ๋ณผ ํ…Œ๋ฆฌ์–ดโ€œ, โ€œ๋ฏธ๋‹ˆ์–ด์ฒ˜ ์Šˆ๋‚˜์šฐ์ €โ€œ, โ€œ์•„ํ”„๊ฐ„ ํ•˜์šด๋“œโ€œ, โ€œ๋„๊ณ ์•„๋ฅดํ—จํ‹ฐ๋…ธโ€œ, โ€œํ‹ฐ๋ฒ ํƒ„ ๋งˆ์Šคํ‹ฐํ”„โ€œ, โ€œ๋ฒจ์ง€์•ˆ ์…ฐํผ๋“œโ€œ, โ€œ์žญ ๋Ÿฌ์ŽŒ ํ…Œ๋ฆฌ์–ดโ€œ, โ€œ๋ฏธ๋‹ˆ์–ด์ฒ˜ ํ‘ธ๋“คโ€œ, โ€œ๋ฏธ๋””์—„ ํ‘ธ๋“คโ€œ, โ€œ์‹œ์ธ„โ€, โ€œ๋ž˜๋น— ๋‹ฅ์Šคํ›ˆํŠธโ€, โ€œ๋น„๊ธ€โ€, โ€œ๊ธฐํƒ€(์‚ฌ์šฉ์ž ์ง์ ‘ ์ž…๋ ฅ)โ€ + + List dogType_ = [ + "๋น„์ˆ‘ ํ”„๋ฆฌ์ œ", "ํฌ๋ฉ”๋ผ๋‹ˆ์•ˆ", "ํ”„๋ Œ์น˜ ๋ถˆ๋…","์น˜์™€์™€", "๋ชฐํ‹ฐ์ฆˆ","ํ† ์ด ํ‘ธ๋“ค","๋ผ๋ธŒ๋ผ๋„ ๋ฆฌํŠธ๋ฆฌ๋ฒ„","์ง„๋—๊ฐœ","์ดํƒˆ๋ฆฌ์•ˆ ๊ทธ๋ ˆ์ดํ•˜์šด๋“œ","์›ฐ์‹œ์ฝ”๊ธฐ","๋ถˆ๋…","์…”ํ‹€๋žœ๋“œ ์‰ฝ๋…", + "์‹œ๋ฐ”๊ฒฌ", "๊ณจ๋“  ๋ฆฌํŠธ๋ฆฌ๋ฒ„", "๋กœํŠธ์™€์ผ๋Ÿฌ", "์ผ€์ธ ์ฝ”๋ฅด์†Œ", "ํผ๊ทธ", "๋ฒ ๋“ค๋งํ„ด ํ…Œ๋ฆฌ์–ด", "์ €๋จผ ์…ฐํผ๋“œ", "๋ฏธ๋‹ˆ์–ด์ฒ˜ ๋‹ฅ์Šคํ›ˆํŠธ", "์ฐจ์šฐ์ฐจ์šฐ", "๋„๋ฒ ๋ฅด๋งŒ", "์•„๋ฉ”๋ฆฌ์นธ ์ฝ”์นด ์ŠคํŒŒ๋‹ˆ์—˜", "์นด๋ฐ”๋ฆฌ์— ํ‚น์ฐฐ์Šค ์ŠคํŒŒ๋‹ˆ์—˜", + "ํŽ˜ํ‚ค๋‹ˆ์ฆˆ", "์ฝ”์นด์‹œ์•ˆ ์˜ค๋ธŒ์ฐจ์นด", "์Šคํƒ ๋‹ค๋“œ ํ‘ธ๋“ค","์š”ํฌ์…” ํ…Œ๋ฆฌ์–ด", "์‚ฌ๋ชจ์˜ˆ๋“œ", "์„ผํŠธ๋Ÿด ์•„์‹œ์•ˆ ์˜ค๋ธŒ์ฐจ์นด", "์‹œ๋ฒ ๋ฆฌ์•ˆ ํ—ˆ์Šคํ‚ค", "ํœ˜ํ•", "์•„๋ฉ”๋ฆฌ์นธ ์•„ํ‚คํƒ€", "๋น ๋น„์šฉ", "๋ณด๋”์ฝœ๋ฆฌ", "๊ผฌ๋™ ๋“œ ํˆด๋ ˆ์•„", + "๋ฏธ๋‹ˆ์–ด์ฒ˜ ๋ณผ ํ…Œ๋ฆฌ์–ด", "๋ฏธ๋‹ˆ์–ด์ฒ˜ ์Šˆ๋‚˜์šฐ์ €", "์•„ํ”„๊ฐ„ ํ•˜์šด๋“œ","๋„๊ณ ์•„๋ฅดํ—จํ‹ฐ๋…ธ", "ํ‹ฐ๋ฒ ํƒ„ ๋งˆ์Šคํ‹ฐํ”„","๋ฒจ์ง€์•ˆ ์…ฐํผ๋“œ","์žญ ๋Ÿฌ์ŽŒ ํ…Œ๋ฆฌ์–ด","๋ฏธ๋‹ˆ์–ด์ฒ˜ ํ‘ธ๋“ค","๋ฏธ๋””์—„ ํ‘ธ๋“ค","์‹œ์ธ„","๋ž˜๋น— ๋‹ฅ์Šคํ›ˆํŠธ","๋น„๊ธ€", "์ง์ ‘ ์ž…๋ ฅ" + ]; + + void showToast(){ + Fluttertoast.showToast( + msg: 'ํ™”๋ฉด์„ ํƒญํ•˜๋ฉด ๋‹ค์Œ์œผ๋กœ ๋„˜์–ด๊ฐ€์š”', + gravity: ToastGravity.BOTTOM, + textColor: Color(0xff4B5396), + backgroundColor: Colors.white.withOpacity(0.5), + toastLength: Toast.LENGTH_SHORT + ); + } + + FocusNode _focusNode = FocusNode(); + + @override + void initState() { + super.initState(); + // SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersive, overlays: []); + main.play = true; + main.player.setAsset(main.musics[0]); + main.player.play(); + // ์Œ์› ์ ์šฉ + for(int i= 0 ; i < voice.length; i++){ + _player.setAudioSource(AudioSource.uri( + Uri.parse(voice[i])) + ); + } + + controller1 = FlutterGifController(vsync: this); + controller2 = FlutterGifController(vsync: this); + controller3 = FlutterGifController(vsync: this); + + _focusNode.addListener(_onFocusChange); + showToast(); + } + + void _onFocusChange() { + if (_focusNode.hasFocus) { + // ํ‚ค๋ณด๋“œ ์˜ฌ๋ฆฌ๊ธฐ + FocusScope.of(context).requestFocus(_focusNode); + } + } + + @override + void dispose() async { + super.dispose(); + } + + int nextPage = 0; + + List introText =[]; + + int nextQuestion = 0; + int nextQuestionGrief = 0; + int nextQuestionMiss = 0; + + // ์ธํŠธ๋กœ ์‚ฌ์šฉ์ž ์ •๋ณด ์ €์žฅํ•˜๊ธฐ (POST) + void saveUserInfo(String aToken, String nickname, String puppyName, int puppyAge, String puppyType) async { + + // ์š”์ฒญ ๋ณธ๋ฌธ ๋ฐ์ดํ„ฐ + var data = { + "nickname": nickname, + "puppyName": puppyName, + "puppyAge" : puppyAge, + "puppyType" : puppyType, + "profile-image" : "null" + }; + + // ํ—ค๋” ์ •๋ณด ์„ค์ • + Map headers = { + 'Authorization': 'Bearer $aToken', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• + 'Content-Type': 'application/json', // ์˜ˆ: JSON ์š”์ฒญ์ธ ๊ฒฝ์šฐ ํ—ค๋” ์„ค์ • + }; + + var url = Uri.parse('http://3.38.1.125:8080/conversation/intro/info'); // ์—”๋“œํฌ์ธํŠธ URL ์„ค์ • + + try { + var response = await http.post( + url, + body: json.encode(data), // ์š”์ฒญ ๋ณธ๋ฌธ์— ๋ฐ์ดํ„ฐ๋ฅผ JSON ํ˜•์‹์œผ๋กœ ์ธ์ฝ”๋”ฉํ•˜์—ฌ ์ „๋‹ฌ + headers: headers, // ํ—ค๋” ์ถ”๊ฐ€ + ); + + if (response.statusCode == 200) { + // ์‘๋‹ต ์„ฑ๊ณต ์‹œ์˜ ์ฒ˜๋ฆฌ + + var jsonResponse = utf8.decode(response.bodyBytes); // ์‘๋‹ต ๋ณธ๋ฌธ์„ JSON ํ˜•์‹์œผ๋กœ ๋””์ฝ”๋”ฉ + // JSON ๊ฐ’์„ ํ™œ์šฉํ•œ ์›ํ•˜๋Š” ๋™์ž‘ ์ˆ˜ํ–‰ + //utf8.decode(jsonResponse); + print(jsonResponse); + + List contentList = []; + + List parsedResponse = json.decode(jsonResponse); + + setState(() { + }); + + + print('API ํ˜ธ์ถœ ์„ฑ๊ณต!!: ${response.statusCode}'); + } else { + // ์š”์ฒญ ์‹คํŒจ ์‹œ์˜ ์ฒ˜๋ฆฌ + print('API ํ˜ธ์ถœ ์‹คํŒจ!!: ${response.statusCode}'); + } + } catch (e) { + // ์˜ˆ์™ธ ๋ฐœ์ƒ ์‹œ์˜ ์ฒ˜๋ฆฌ + print('API ํ˜ธ์ถœ ์ค‘ ์˜ˆ์™ธ ๋ฐœ์ƒ: $e'); + } + } + + final _player = AudioPlayer(); + int voiceCount = 0; + + List voice =[ + "assets/voice/intro/intro1.mp3", "assets/voice/intro/intro2.mp3", "assets/voice/intro/intro3.mp3", + "assets/voice/intro/intro4.mp3", "assets/voice/intro/intro5.mp3", "assets/voice/intro/intro6.mp3", + "assets/voice/intro/intro7.mp3", "assets/voice/intro/intro8.mp3", "assets/voice/intro/intro9.mp3", + "assets/voice/intro/intro10.mp3", "assets/voice/intro/intro11.mp3", "assets/voice/intro/intro12.mp3", + "assets/voice/intro/intro13.mp3", "assets/voice/intro/intro14.mp3", "assets/voice/intro/intro15.mp3", + "assets/voice/intro/intro16.mp3", "assets/voice/intro/intro17.mp3", + ]; + + List questions0 =[ + "๋‚˜๋ฅผ ๊ฐ€์žฅ ์ž˜ ์•„๋Š” ์นœ๊ตฌ์ด์ž,\n๋‚˜์™€ ํ•จ๊ป˜ ์ž๋ž€ ๊ฐ€์กฑ๊ฐ™์€ ๋ฐ˜๋ ค๊ฒฌ.", + "๋ฐ˜๋ ค๊ฒฌ๊ณผ์˜ ์ด๋ณ„์€\n๊ทธ ๋ฌด์—‡๋ณด๋‹ค ํฐ ์Šฌํ””์ž…๋‹ˆ๋‹ค.", + "๋ชจ๋“  ๋ฐ˜๋ ค์ธ์—๊ฒŒ๋Š” ์ถฉ๋ถ„ํ•˜๊ฒŒ \n์• ๋„ํ•˜๊ณ  ์Šฌํผํ•  ์‹œ๊ฐ„์ด ํ•„์š”ํ•˜๋‹ต๋‹ˆ๋‹ค.", + "๊ทธ๋Ÿฌ๊ธฐ ์œ„ํ•ด์„œ ๋ฐ˜๋ ค๊ฒฌ์— ๋Œ€ํ•ด\n๊ธฐ์–ตํ•˜๋Š” ๊ฒƒ์€ ๋งค์šฐ ์ค‘์š”ํ•œ ๊ณผ์ •์ด์—์š”.", + // "์ด๋ณ„ ๋„์šฐ๋ฏธ ๋ฌด์ง€์™€ ํ•จ๊ป˜\n๋ฐ˜๋ ค๊ฒฌ์„ ๊ธฐ์–ตํ•ด๋ณด์„ธ์š”.", + ]; + + List question1_0= [ + "์•ˆ๋…•ํ•˜์„ธ์š”.", //0 + "์ €๋Š” ๋ฐ˜๋ ค๊ฒฌ๊ณผ์˜ ์ด๋ณ„์„ ๋„์™€์ค„\n์ด๋ณ„ ๋„์šฐ๋ฏธ ๋ฌด์ง€์—์š”!", //1 + "์•ž์œผ๋กœ ์ €์™€ ๋Œ€ํ™”๋ฅผ ๋‹ค๋ˆ„๋ฉด์„œ", //2 + "๋ฐ˜๋ ค๊ฒฌ์„ ๊ธฐ์–ตํ•˜๊ณ \n์• ๋„ํ•  ์ˆ˜ ์žˆ๊ฒŒ ๋„์™€๋“œ๋ฆด๊ฒŒ์š”.", //3 + "์ €๋Š” ๋‹น์‹ ์„ ๋ญ๋ผ๊ณ  ๋ถ€๋ฅด๋ฉด ์ข‹์„๊นŒ์š”?", //4 + + // ํ†ต์œผ๋กœ ์ถ”๊ฐ€ + // "์ข‹์•„์š”. ๋ณดํ˜ธ์ž๋‹˜.", // this is modifi //5 + // "์ œ๊ฐ€ ๋ณดํ˜ธ์ž๋‹˜๊ณผ์˜ ๋Œ€ํ™”๋ฅผ ์‹œ์ž‘ํ•˜๊ธฐ ์œ„ํ•ด", //6 + // "๋ณดํ˜ธ์ž๋‹˜์— ๋Œ€ํ•ด์„œ\n๋” ์•Œ์•„๊ฐ€๋ ค๊ณ  ํ•ด์š”.", //7 + // "๋‹ค์Œ ์งˆ๋ฌธ์— ๋‹ตํ•ด์ฃผ์„ธ์š”!", // 8 + // "๋ฐ˜๋ ค๊ฒฌ์˜ ์ด๋ฆ„์€ ๋ฌด์—‡์ด์—ˆ์„๊นŒ์š”?", // this is modifi //9 + // + // // ํ†ต์œผ๋กœ ์ถ”๊ฐ€ + // "์•„์ด์˜ ๋ชจ์Šต์€ ์–ด๋• ๋‚˜์š”? \n๋นˆ์นธ์„ ์ฑ„์›Œ ์•Œ๋ ค์ฃผ์„ธ์š”.", // this is modifi //10 + // "์•„์ด์˜ ๋ชจ์Šต์€ ์–ด๋• ๋‚˜์š”? \n๋นˆ์นธ์„ ์ฑ„์›Œ ์•Œ๋ ค์ฃผ์„ธ์š”.", // this is modifi //11 + // "์ข‹์•„์š”, ๋ณดํ˜ธ์ž๋‹˜!", // 12 + // "์งˆ๋ฌธ์— ๋‹ตํ•˜๋ฉฐ,\n์ž ๊น์ด๋‚˜๋งˆ", //13 + // "์•„์ด์— ๋Œ€ํ•ด์„œ ๋– ์˜ฌ๋ ค๋ดค๋˜ ๊ฒƒ ๊ฐ™์•„์š”.", //14 + // "์•„์ด์— ๋Œ€ํ•ด์„œ ์ƒ๊ฐํ•˜๋‹ˆ", //15 + // "๋ณดํ˜ธ์ž๋‹˜์€ ์–ด๋–ค ๋งˆ์Œ์ด ๋“ค์—ˆ๋‚˜์š”?", //16 + ]; + + // ๊ทธ๋ฆฌ์›€ ์•„์˜ˆ ํ†ต์œผ๋กœ ์ถ”๊ฐ€ํ•˜์„ธ์š” + List questions1_2 =[ + // ์ด์ œ๋Š” ์•„์ด์˜\n๋ชจ์Šต์„ ๋ณด๊ฑฐ๋‚˜ ๋งŒ์งˆ ์ˆ˜ ์—†์ง€๋งŒ, + // ์•„์ด๋ฅผ ์ƒ๊ฐํ•˜๋ฉฐ\n๊ทธ๋ฆฌ์›€์„ ์ฑ„์›Œ๊ฐˆ ์ˆ˜ ์žˆ์„ ๊ฒƒ ๊ฐ™์•„์š”. + // ์•„์ด์™€์˜ ๊ธฐ์–ต์„\n์ฒ˜์Œ๋ถ€ํ„ฐ ๋– ์˜ฌ๋ ค๋ณผ๊นŒ์š”? + // ์•„์ด์™€์˜ ๊ธฐ์–ต์ด ์‹œ์ž‘๋˜๋Š”\n๊ทธ๋‚ ์˜ ์‚ฌ์ง„๊ณผ ์ด์•ผ๊ธฐ๋ฅผ ๊ธฐ๋กํ•ด๋ด…์‹œ๋‹ค! + ]; + + // ์Šฌํ”” ์•„์˜ˆ ํ†ต์œผ๋กœ ์ถ”๊ฐ€ํ•˜์„ธ์š” + List questions1_3 =[ + // "์•„์ด๊ฐ€ ๊ณ์— ์—†๋Š” ์ง€๊ธˆโ€ฆ", + // "๋ณดํ˜ธ์ž๋‹˜์˜\n์Šฌํ”ˆ ๋งˆ์Œ์ด ์ œ๊ฒŒ๋„ ๋А๊ปด์ ธ์š”.", + // "ใ…ใ…์™€์˜\n๊ธฐ์–ต์„ ํ•˜๋‚˜์”ฉ ๋˜๋Œ์•„๋ณด๋ฉด", + // "์Šฌํ”ˆ ๋งˆ์Œ์„ ๋œ๊ธฐ์— ๋„์›€์ด ๋ ๊ฑฐ์—์š”.", + // "์•„์ด์™€์˜ ๊ธฐ์–ต์ด ์‹œ์ž‘๋˜๋Š”\n๊ทธ๋‚ ์˜ ์‚ฌ์ง„๊ณผ ์ด์•ผ๊ธฐ๋ฅผ ๊ธฐ๋กํ•ด๋ด…์‹œ๋‹ค!", + ]; + + // ์•„์˜ˆ ํ†ต์œผ๋กœ ์ถ”๊ฐ€ํ•˜์„ธ์š” + List questions1_4 =[ + /// ๋ณดํ˜ธ์ž๋‹˜! \n๊ธฐ์–ตํ• ๊ฐœ๊ฐ€ ์™„์„ฑ๋˜์—ˆ์–ด์š”. + // ๊ธฐ์–ตํ• ๊ฐœ๋ฅผ ํ™•์ธํ•ด ๋ณด์„ธ์š”! + // ๋ณดํ˜ธ์ž๋‹˜! + // ์˜ค๋Š˜์€ ๋ณดํ˜ธ์ž๋‹˜๊ณผ์˜ ์ฒซ๋งŒ๋‚จ์ด์—ˆ์ง€๋งŒ, + // ์•„์ด๊ฐ€ ์–ผ๋งˆ๋‚˜ ๋งŽ์€\n์‚ฌ๋ž‘์„ ๋ฐ›์•˜๋Š”์ง€ ๋А๋‚„ ์ˆ˜ ์žˆ์—ˆ์–ด์š”. + // ์•ž์œผ๋กœ ์ €์™€ ํ•จ๊ป˜\n์•„์ด์™€์˜ ์ˆœ๊ฐ„๋“ค์„ ๊ธฐ์–ตํ•˜๋ฉฐ, + // ๋ณดํ˜ธ์ž๋‹˜์˜\n๋งˆ์Œ ์† ์•ˆ์ •์„ ์ฐพ์•„๊ฐ€๊ธธ ๋ฐ”๋ผ์š”. + // ์ด์ œ ์šฐ๋ฆฌ๊ฐ€ ๋‹ค์‹œ ๋งŒ๋‚˜๊ฒŒ ๋ \n์‹œ๊ฐ„์„ ์•Œ๋ ค์ฃผ์„ธ์š”. + // ๋„ค, ๋ณดํ˜ธ์ž๋‹˜. \n๊ทธ๋•Œ ๋‹ค์‹œ ๋งŒ๋‚˜์š”! + + "๋‹‰๋„ค์ž„๋‹˜!\n ๊ธฐ์–ตํ• ๊ฐœ๊ฐ€ ์™„์„ฑ๋˜์—ˆ์–ด์š”.", + "๊ธฐ์–ตํ• ๊ฐœ๋ฅผ ํ™•์ธํ•ด๋ณด์„ธ์š”!", + "๋‹‰๋„ค์ž„๋‹˜!", + "์˜ค๋Š˜์€ ๋‹‰๋„ค์ž„๋‹˜๊ณผ์˜ \n์ฒซ๋งŒ๋‚จ์ด์—ˆ์ง€๋งŒ", + "๋ฐ˜๋ ค๊ฒฌ์ด ์–ผ๋งˆ๋‚˜ ๋งŽ์€ ์‚ฌ๋ž‘์„ \n๋ฐ›์•˜๋Š”์ง€ ๋А๋‚„ ์ˆ˜ ์žˆ์—ˆ์–ด์š”.", + "์•ž์œผ๋กœ ์ €์™€ ํ•จ๊ป˜ \n๋ฐ˜๋ ค๊ฒฌ๊ณผ์˜ ์ˆœ๊ฐ„๋“ค์„ ๊ธฐ์–ตํ•˜๋ฉฐ,", + "๋‹‰๋„ค์ž„๋‹˜์˜ ๋งˆ์Œ ์† ์•ˆ์ •์„ \n์ฐพ์•„๊ฐ€๊ธธ ๋ฐ”๋ผ์š”.", + "์ด์ œ ์šฐ๋ฆฌ๊ฐ€ ๋‹ค์‹œ ๋งŒ๋‚˜๊ฒŒ ๋  \n์‹œ๊ฐ„์„ ์•Œ๋ ค์ฃผ์„ธ์š”", + ]; + + bool _visible = true; + bool _visible2 = true; + + @override + Widget build(BuildContext context) { + MediaQueryData deviceData = MediaQuery.of(context); + Size screenSize = deviceData.size; + return + Container( + decoration: startIntro ? + BoxDecoration( + gradient: LinearGradient( + begin: Alignment.topRight, + end: Alignment.bottomLeft, + colors: [ + Color(0xffDDE7FD), + Color(0xffDDE7FD), + ], + ) + ) : + BoxDecoration( + gradient: LinearGradient( + begin: Alignment.topRight, + end: Alignment.bottomLeft, + colors: [ + Color(0xffE4ECFF), + Color(0xffA2BEFF), + ], + ) + ), + //color: startIntro? Color(0xffDDE7FD): Color(0xffC0D2FC), + child: GestureDetector( + onTap: (){ + SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: [SystemUiOverlay.top]); + print("ํ™•์ธ์ˆ˜" + nextPage.toString()); + // _player.setAsset(voice[voiceCount]); + + toggleVisibility(); + if(_visible){ + _visible = false; + } else if(_visible == false && nextPage <3){ + nextPage++; + _visible = true; + } + if(nextPage == 3){ + nextPage++; + startIntro = true; + _player.setAsset(voice[voiceCount]); + voiceCount++; + _player.play(); + // 2.5์ดˆ ์ ์ • + controller1.repeat( + min: 0, + max: 20, + period: const Duration(milliseconds: 1000) + ); + + controller3.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 2000) + ); + + Timer(Duration(milliseconds: 1500), () { + controller1.stop(); + }); + Timer(Duration(milliseconds: 1000), () { + controller3.stop(); + }); + // nextQuestion++; + //Navigator.push(context, MaterialPageRoute(builder: (context) => Con01Page())); + } + // else if(nextPage == 3 && startIntro == true){ + // nextPage++; + // //Navigator.push(context, MaterialPageRoute(builder: (context) => Con01Page())); + // } + + else if(nextPage >3 && nextQuestion <4){ + nextQuestion++; // ์ธํŠธ๋กœ ์‹œ์ž‘ ํ›„ count + _player.setAsset(voice[voiceCount]); + voiceCount++; + _player.play(); + + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + + if(nextQuestion == 1){ + Timer(Duration(seconds: 5), () { + controller1.stop(); + }); + + } else if(nextQuestion == 2){ + Timer(Duration(seconds: 2), () { + controller1.stop(); + }); + } else if(nextQuestion == 3){ + Timer(Duration(seconds: 4), () { + controller1.stop(); + }); + } else if(nextQuestion == 4){ + Timer(Duration(seconds: 3), () { + controller1.stop(); + }); + } + + } + else if(nextQuestion == 4 && setUserName == true){ + //nextQuestion++; ์ด๋ฆ„ ์„ค์ • + // voiceCount++; + // _player.play(); + } + else if(nextQuestion >4 && nextQuestion< 9){ + nextQuestion++; + _player.setAsset(voice[voiceCount]); + voiceCount++; + _player.play(); + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + + controller3.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 2000) + ); + + Timer(Duration(milliseconds: 1500), () { + controller1.stop(); + }); + if(nextQuestion == 6){ + Timer(Duration(seconds: 3), () { + controller1.stop(); + }); + } + else if(nextQuestion == 7){ + Timer(Duration(seconds: 3), () { + controller1.stop(); + }); + } + // ๋‹ค์Œ ์งˆ๋ฌธ์— ๋‹ตํ•ด์ฃผ์„ธ์š” + else if(nextQuestion == 8){ + Timer(Duration(seconds: 2), () { + controller1.stop(); + }); + Timer(Duration(seconds: 1), () { + controller3.stop(); + }); + } + // ๋ฐ˜๋ ค๊ฒฌ์˜ ์ด๋ฆ„์€ ๋ฌด์—‡์ด์—ˆ์„๊นŒ์š” + else if(nextQuestion == 9){ + Timer(Duration(seconds: 3), () { + controller1.stop(); + }); + } + } + else if(nextQuestion == 9 && setDogName == true){ + //nextQuestion++; ๊ฐ•์•„์ง€ ์ด๋ฆ„ ์„ค์ • + // voiceCount++; + // _player.play(); + } + // ๋นˆ์นธ์„ ์ฑ„์›Œ์•Œ๋ ค์ฃผ์„ธ์š” + else if(nextQuestion == 10){ + nextQuestion++; + _player.setAsset(voice[voiceCount]); + voiceCount++; + } + + // ๋นˆ์นธ์„ ์ฑ„์›Œ ์•Œ๋ ค์ฃผ์„ธ์š” + else if(nextQuestion == 11){ + chooseType = false; + // _player.setAsset(voice[voiceCount]); + // voiceCount++; + // _player.play(); + setState(() { + }); + } + else if(nextQuestion > 11 && nextQuestion < 16){ + nextQuestion++; + _player.setAsset(voice[voiceCount]); + voiceCount++; + _player.play(); + //_player.play(); + // controller1.stop(); + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + if(nextQuestion == 13){ + Timer(Duration(seconds: 2), () { + controller1.stop(); + }); + } else if(nextQuestion == 14){ + Timer(Duration(seconds: 3), () { + controller1.stop(); + }); + } else if(nextQuestion == 15){ + Timer(Duration(seconds: 2), () { + controller1.stop(); + }); + } else if(nextQuestion == 16){ + Timer(Duration(seconds: 3), () { + controller1.stop(); + }); + } + } + // ์—ฌ๊ธฐ์„œ ๋ถ€ํ„ฐ๋Š” ๊ฐ์ • ์„ ํƒ + else if(miss && nextQuestionMiss<3){ + nextQuestionMiss++; + _player.setAsset(voice[voiceCount]); + voiceCount++; + _player.play(); + controller2.repeat( + min: 0, + max: 32, + period: const Duration(milliseconds: 3500) + ); + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 800) + ); + if(nextQuestionMiss == 1){ + Timer(Duration(seconds: 4), () { + controller1.stop(); + }); + Timer(Duration(seconds: 3), () { + controller2.stop(); + }); + } + else if(nextQuestionMiss == 2){ + Timer(Duration(seconds: 3), () { + controller1.stop(); + }); + } + else if(nextQuestionMiss == 3){ + Timer(Duration(seconds: 5), () { + controller1.stop(); + }); + } + } + else if(grief && nextQuestionGrief<4){ + nextQuestionGrief++; + _player.setAsset(voice[voiceCount]); + voiceCount++; + _player.play(); + + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + controller2.repeat( + min: 0, + max: 32, + period: const Duration(milliseconds: 3500) + ); + + + if(nextQuestionGrief == 1){ + Timer(Duration(milliseconds: 2000), () { + controller2.stop(); + }); + Timer(Duration(seconds: 4), () { + controller1.stop(); + }); + } + else if(nextQuestionGrief == 2){ + Timer(Duration(seconds: 3), () { + controller1.stop(); + }); + } + else if(nextQuestionGrief == 3){ + Timer(Duration(seconds: 4), () { + controller1.stop(); + }); + } + else if(nextQuestionGrief == 4){ + Timer(Duration(seconds: 6), () { + controller1.stop(); + }); + } + } + else if(nextQuestionGrief == 4 || nextQuestionMiss == 3 ){ + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => IntroMemorialPage())); + } + setState(() { + }); + }, + child: Scaffold( + backgroundColor: Colors.transparent, + appBar: AppBar( + //title: Text("๊ธฐ์–ตํ• ๊ฐœ", style: TextStyle(fontSize:16, color: Colors.white ),), + //centerTitle: true, + leading: IconButton( + icon: SvgPicture.asset( + 'assets/images/conversation/home_icon.svg', + ), + onPressed: () => Navigator.of(context).pop(), + ), + backgroundColor: Colors.transparent, + elevation: 0.0, + ), + //extendBodyBehindAppBar: true, + body: + SingleChildScrollView( + child: Container( + child: Column( + children: [ + SizedBox(height: 3,), + Container( + width: screenSize.width, + height: 25, + child: Padding( + padding: EdgeInsets.only( left:16, right: 16), + child: Center( + child: FAProgressBar( + currentValue: 15, + size: 5, + backgroundColor: Colors.white, + ) + ), + ), + ), + if(startIntro == false)...[ + Container( + width: screenSize.width, + height: screenSize.height, + child: Column( + //mainAxisAlignment: MainAxisAlignment.center, + children: [ + SizedBox(height: 64,), + SvgPicture.asset('assets/images/conversation/intro/intro_star.svg',fit: BoxFit.fill,), + SizedBox(height: 64,), + Stack( + children: [ + SvgPicture.asset('assets/images/conversation/intro/intro_bubble.svg',fit: BoxFit.fill,), + Padding(padding:nextPage ==1? EdgeInsets.only(left:86, top:48):EdgeInsets.only(left:62, top:48), + child: AnimatedOpacity(opacity: _visible? 1.0:0.0, + duration:Duration(milliseconds: 500), + child: Text( + questions0[nextPage], + textAlign: TextAlign.center, + style: textStyle.introbubbletext + ), + ), + ), + ], + ), + SizedBox(height: 96,), + Container(width: screenSize.width, + child: SvgPicture.asset('assets/images/conversation/intro/intro_cloud.svg',fit: BoxFit.fill,), + ), + ], + ), + ), + ] + // ๋ฌด์ง€ ๋“ฑ์žฅ ํ›„ ๋Œ€ํ™” + else...[ + Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children:[ + SizedBox( + height: 14, + ), + Stack( + children: [ + Container( + height: 157, + width: screenSize.width, + child: + Stack( + children: [ + Center(child: SvgPicture.asset('assets/images/conversation/bubble.svg',fit: BoxFit.fill,),), + Container( + padding: const EdgeInsets.symmetric(horizontal: 32, vertical: 12, ), + child: Center( + child: Column( + children: [ + // ๋Œ€ํ™”์ „ ์„ ํƒ ๋‚ด์šฉ + if(grief == false && miss == false)...[ + if(question1_0[nextQuestion].toString().contains("\n"))...[ + SizedBox(height: 28,), + Text( + question1_0[nextQuestion], + textAlign: TextAlign.center, + style: textStyle.bubbletext, + ), + ]else...[ + SizedBox(height: 42,), + Text( + question1_0[nextQuestion], + textAlign: TextAlign.center, + style: textStyle.bubbletext, + ), + ], + ] + // ๊ทธ๋ฆฌ์›€ ์„ ํƒ ์‹œ + else if (miss) ...[ + if(questions1_2[nextQuestionMiss].toString().contains("\n"))...[ + SizedBox(height: 28,), + Text( + questions1_2[nextQuestionMiss], + textAlign: TextAlign.center, + style: textStyle.bubbletext, + ), + ]else...[ + SizedBox(height: 42,), + Text( + questions1_2[nextQuestionMiss], + textAlign: TextAlign.center, + style: textStyle.bubbletext, + ), + ], + // ์Šฌํ”” ์„ ํƒ ์‹œ + ] else if (grief) ...[ + if(questions1_3[nextQuestionGrief].toString().contains("\n"))...[ + SizedBox(height: 28,), + Text( + questions1_3[nextQuestionGrief], + textAlign: TextAlign.center, + style: textStyle.bubbletext, + ), + ]else...[ + SizedBox(height: 42,), + Text( + questions1_3[nextQuestionGrief], + textAlign: TextAlign.center, + style: textStyle.bubbletext, + ), + ], + ] + ], + ) + ) + ), + ], + ) + ), + // ๋ฌด์ง€ ์œ„์น˜ + if(nextQuestion < 11)...[ + Stack( + children: [ + // ์œ ์ € ์œ„์น˜ + Column( + children: [ + SizedBox(height: 420,), + Container( + child: SvgPicture.asset( + 'assets/images/conversation/user7.svg', + height: 282, + width: screenSize.width, + ), + ), + ], + ), + Column( + children: [ + SizedBox(height: 144,), + Container( + width: screenSize.width, + height: 375, + child: + Stack( + children: [ + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child: Image.asset('assets/images/conversation/gif/muji_ear.gif', + fit: BoxFit.cover,),), + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child: Image.asset('assets/images/conversation/gif/muji_base.gif', fit: BoxFit.cover,),), + + if(nextQuestion == 0 || nextQuestion == 12)...[ + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child: GifImage( + controller: controller3, + image: const AssetImage("assets/images/conversation/gif/smile_muji.gif"), + ), + ), + ] else if(nextQuestion == 2)...[ + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child: GifImage( + controller: controller2, + image: const AssetImage("assets/images/conversation/gif/sad_muji.gif"), + ), + ), + ] + else...[ + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child: Image.asset('assets/images/conversation/gif/muji_base_eye.gif', + fit: BoxFit.cover,),), + ], + // Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + // child: Image.asset('assets/images/conversation/gif/muji_base_eye.gif', + // fit: BoxFit.cover,),), + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child:GifImage( + controller: controller1, + image: const AssetImage("assets/images/conversation/gif/muji_mouth1.gif"), + ), + // Image.asset('assets/images/conversation/gif/muji_mouth1.gif', fit: BoxFit.cover,), + ) + ], + ) + + + // SvgPicture.asset( + // 'assets/images/conversation/con_muji.svg', fit: BoxFit.cover, + // ), + ), + ], + ), + ], + ), + ] + else if(nextQuestion == 11)...[ + Padding( + padding:EdgeInsets.only(top:175, left:90), + child: + Container( + width: 250, + //height: 120, + child: Column(children: [ + SizedBox(height: 28,), + Stack(children: [ + Row(children: [ + Text("${dogName}์˜ ๋‚˜์ด๋Š” ", style: TextStyle( + fontFamily: 'Pretendard', + fontSize: 20, fontWeight: FontWeight.w500, color: Colors.black),), + Container(width: 25, + padding: EdgeInsets.only(bottom:16), + child: TextField( + style:textStyle.inputfield, + onTap: (){ + chooseType = false; + setState(() { + + }); + }, + onChanged: (text){ + decidedAge = true; + if(decidedType){ + selectAT = true; + } + }, + keyboardType: TextInputType.number, + inputFormatters: [FilteringTextInputFormatter.allow(RegExp('[0-9]'))], + controller: dogAgeController, + decoration: InputDecoration( + focusedBorder: InputBorder.none, + hintText: '๋ช‡', + contentPadding: EdgeInsets.only(top: 16), + suffixStyle: TextStyle(color: Color(0xff83A8FF), fontSize: 20,), + hintStyle: textStyle.field, + + ), + ),), + Text("์‚ด์ด๊ณ ,", style: TextStyle( + fontFamily: 'Pretendard', + fontSize: 20, fontWeight: FontWeight.w500, color: Colors.black),), + ],), + Column( + children: [ + SizedBox(height: 48,), + Row( + children: [ + Text(" ๊ฒฌ์ข…์€", style: TextStyle( + fontFamily: 'Pretendard', + fontSize: 20, fontWeight: FontWeight.w500, color: Colors.black),), + + if(dogTypeinput)...[ + Container(width: 56, + padding: EdgeInsets.only(bottom:16), + child: TextField( + style: textStyle.inputfield, + onChanged: (text){ + chooseType = true; + decidedType = true; + setState(() { + }); + }, + onTap: (){ + chooseType = true; + //decidedType = true; + setState(() { + }); + }, + // inputFormatters: [FilteringTextInputFormatter.allow(RegExp('[0-9]'))], + controller: dogTypeController, + decoration: InputDecoration( + border: InputBorder.none, + focusedBorder: InputBorder.none, + hintText: '๋ฌด์Šจ', + contentPadding: EdgeInsets.only(top: 16), + suffixStyle: TextStyle(color: Color(0xff83A8FF), fontSize: 20,), + hintStyle: textStyle.field, + ), + ), + ), + ]else...[ + TextButton( + child: Text(decidedType?"${userDogType}" :"๋ฌด์—‡", style: decidedType?textStyle.inputfield : textStyle.field), + onPressed: (){ + chooseType = true; + if(decidedAge){ + selectAT = true; + } + setState(() {}); + }, + ), + + ], + Text("์ž…๋‹ˆ๋‹ค.", style: TextStyle( + fontFamily: 'Pretendard', + fontSize: 20, fontWeight: FontWeight.w500, color: Colors.black),), + ],) + ], + ), + + ],) + + ],), + ), + ), + + + ] else if(nextQuestion > 11 && nextQuestion <16)...[ + Stack( + children: [ + // ์œ ์ € ์œ„์น˜ + Column( + children: [ + SizedBox(height: 420,), + Container( + child: SvgPicture.asset( + 'assets/images/conversation/user7.svg', + height: 282, + width: screenSize.width, + ), + ), + ], + ), + Column( + children: [ + SizedBox(height: 144,), + Container( + width: screenSize.width, + height: 375, + child: + Stack( + children: [ + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child: Image.asset('assets/images/conversation/gif/muji_ear.gif', + fit: BoxFit.cover,),), + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child: Image.asset('assets/images/conversation/gif/muji_base.gif', fit: BoxFit.cover,),), + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child: Image.asset('assets/images/conversation/gif/muji_base_eye.gif', + fit: BoxFit.cover,),), + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child:GifImage( + controller: controller1, + image: const AssetImage("assets/images/conversation/gif/muji_mouth1.gif"), + ), + // Image.asset('assets/images/conversation/gif/muji_mouth1.gif', fit: BoxFit.cover,), + ) + ], + ) + + + // SvgPicture.asset( + // 'assets/images/conversation/con_muji.svg', fit: BoxFit.cover, + // ), + ), + ], + ), + + ], + ), + + ] else if(nextQuestion == 16)...[ + Stack( + children: [ + + Column( + children: [ + SizedBox(height: 418,), + Container( + height: 284, + width: screenSize.width, + color: Color(0xffFFFFF7), + ) + ], + ), + Column( + children: [ + SizedBox(height: 418,), + SvgPicture.asset( + 'assets/images/conversation/shadow.svg', fit: BoxFit.cover, + ), + ], + ), + + Column( + children: [ + SizedBox(height: 144,), + Container( + width: screenSize.width, + height: 375, + child: + Stack( + children: [ + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child: Image.asset('assets/images/conversation/gif/muji_ear.gif', + fit: BoxFit.cover,),), + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child: Image.asset('assets/images/conversation/gif/muji_base.gif', fit: BoxFit.cover,),), + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child: Image.asset('assets/images/conversation/gif/muji_base_eye.gif', + fit: BoxFit.cover,),), + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child:GifImage( + controller: controller1, + image: const AssetImage("assets/images/conversation/gif/muji_mouth1.gif"), + ), + // Image.asset('assets/images/conversation/gif/muji_mouth1.gif', fit: BoxFit.cover,), + ) + ], + ) + + // SvgPicture.asset( + // 'assets/images/conversation/con_muji.svg', fit: BoxFit.cover, + // ), + ), + ], + ), + // Container( + // width: screenSize.width, + // height: 258, + // child: SvgPicture.asset( + // 'assets/images/conversation/con_muji.svg', fit: BoxFit.cover, + // ), + // ), + + Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SizedBox(height: 444,), + Row( + children: [ + SizedBox(width: 16,), + Container( + width: 168, + height: 168, + child: ElevatedButton( + style: ui_miss? buttonChart().bluebtn2_1 : buttonChart().whitebtn_1, + onPressed: () { + //miss = true; + ui_grief = false; + if(ui_miss == false){ + ui_miss = true; + } else{ + ui_miss = false; + } + // nextQuestion++; + setState(() {}); + }, + child: Container( + padding: EdgeInsets.only(top:8.0,left: 8.0, bottom: 8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox(height: 16,), + Text("๊ทธ๋ฆฌ์›€", style: TextStyle(fontFamily: 'Pretendard',fontSize: 16, color: ui_miss? Color(0xff333333) : Color(0xff4B5396)),), + SizedBox(height: 16,), + Text("์šฐ๋ฆฌ ${dogName}๊ฐ€\n๊ทธ๋ฆฌ์šด ๋งˆ์Œ์ด ๋“ค์–ด์š”.", style: TextStyle(fontFamily: 'Pretendard',fontSize: 12, color: ui_miss? Color(0xff333333) : Color(0xff4B5396)),), + SizedBox(height: 16,), + Row( + children: [ + SizedBox(width: 76,), + SvgPicture.asset('assets/images/conversation/intro/miss.svg') + ], + ) + ], + ), + ) + ), + ), + SizedBox(width: 16,), + Container( + width: 168, + height: 168, + child: ElevatedButton( + style: ui_grief? buttonChart().bluebtn2_1 : buttonChart().whitebtn_1, + onPressed: () { + // grief = true; + ui_miss = false; + if(ui_grief == false){ + ui_grief = true; + } else{ + ui_grief = false; + } + // nextQuestion++; + setState(() {}); + }, + child: Container( + padding: EdgeInsets.only(top:8.0,left: 8.0, bottom: 8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox(height: 16,), + Text("์Šฌํ””", style: TextStyle(fontFamily: 'Pretendard',fontSize: 16, color: ui_grief? Color(0xff333333) : Color(0xff4B5396)),), + SizedBox(height: 16,), + Text("${dogName}๊ฐ€ ์—†์–ด์„œ\n์Šฌํ”ˆ ๋งˆ์Œ์ด ๋“ค์–ด์š”.", style: TextStyle(fontFamily: 'Pretendard',fontSize: 12, color: ui_grief? Color(0xff333333) : Color(0xff4B5396)),), + SizedBox(height: 16,), + Row( + children: [ + SizedBox(width: 76,), + SvgPicture.asset('assets/images/conversation/intro/grief.svg') + ], + ) + ], + ), + ) + ), + ), + ], + ), + ], + ), + ], + ), + + ] + else if(nextQuestion > 16)...[ + Stack( + children: [ + // ์œ ์ € ์œ„์น˜ + Column( + children: [ + SizedBox(height: 420,), + Container( + child: SvgPicture.asset( + 'assets/images/conversation/user7.svg', + height: 282, + width: screenSize.width, + ), + ), + ], + ), + Column( + children: [ + SizedBox(height: 144,), + Container( + width: screenSize.width, + height: 375, + child: + Stack( + children: [ + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child: Image.asset('assets/images/conversation/gif/muji_ear.gif', + fit: BoxFit.cover,),), + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child: Image.asset('assets/images/conversation/gif/muji_base.gif', fit: BoxFit.cover,),), + + if( (miss && nextQuestionMiss == 0) || (grief && nextQuestionGrief == 0) || (grief && nextQuestionGrief == 1))...[ + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child: GifImage( + controller: controller2, + image: const AssetImage("assets/images/conversation/gif/sad_muji.gif"), + ), + ), + ] else...[ + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child: Image.asset('assets/images/conversation/gif/muji_base_eye.gif', + fit: BoxFit.cover,),), + ], + + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child:GifImage( + controller: controller1, + image: const AssetImage("assets/images/conversation/gif/muji_mouth1.gif"), + ), + // Image.asset('assets/images/conversation/gif/muji_mouth1.gif', fit: BoxFit.cover,), + ) + ], + ) + + // SvgPicture.asset( + // 'assets/images/conversation/con_muji.svg', fit: BoxFit.cover, + // ), + ), + ], + ), + + ], + ), + ] + ], + ) + + ], + ), + ], + ], + ), + ), + ), + // ์ž…๋ ฅ ๋ฐ ๋ฆฌ์ŠคํŠธ ์ถ”๊ฐ€ ์ž‘์—… - ๋งค์šฐ ์ค‘์š” + // // nextQuestion ์ด 3๊ณผ 7์ผ๋•Œ ๋“ฑ์žฅ + bottomSheet: Padding( + padding: EdgeInsets.only( + bottom: MediaQuery.of(context).viewInsets.bottom * 0.001), + child: Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + if(nextQuestion == 4)...[ + Container( + color: Colors.white, + height: 48, + child: Padding( + padding: const EdgeInsets.only(bottom: 8.0, top: 8.0, left: 16,right: 16), + child: Stack( + children: [ + Container( + width: screenSize.width, + height: 48, + decoration: BoxDecoration( + color: Colors.white, + border: Border.all(color: setUserName? Color(colorChart.blue):Color(0xffC0D2FC)), + borderRadius: BorderRadius.circular(30), + ), + ), + Positioned( + left: 15, + right: 30, + bottom:-4, + child: TextField( + textAlignVertical: TextAlignVertical.center, + maxLines: 1, + controller: userNameController, + style: textStyle.bk14normal, + decoration: InputDecoration( + hintStyle: textStyle.grey14normal, + border: InputBorder.none, + hintText: '์ด๋ ‡๊ฒŒ ๋ถˆ๋Ÿฌ์ฃผ์„ธ์š”.'), + onChanged: (s) { + setUserName = true; + setState(() { + + }); + //text = s; + }, + onTap: () {}, + ), + ), + Positioned( + left: screenSize.width - 80, + //right: 30, + bottom: 3, + top: 3, + child: ElevatedButton( + onPressed: () { + + if(setUserName){ + nextQuestion++; + _player.setAsset(voice[voiceCount]); + voiceCount++; + _player.play(); + controller1.repeat( + min: 0, + max: 53, + period: const Duration(milliseconds: 1000) + ); + + Timer(Duration(milliseconds: 1500), () { + controller1.stop(); + }); + + controller3.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 2000) + ); + + Timer(Duration(milliseconds: 1000), () { + controller3.stop(); + }); + + // setUserName = true; + userName = userNameController.text; + userName_ = userName; + // ๋‹‰๋„ค์ž„ ์ถ”๊ฐ€ + // ํ†ต์œผ๋กœ ์ถ”๊ฐ€ + //"์ข‹์•„์š”. ๋ณดํ˜ธ์ž๋‹˜.", // this is modifi + //"์ œ๊ฐ€ ๋ณดํ˜ธ์ž๋‹˜๊ณผ์˜ ๋Œ€ํ™”๋ฅผ ์‹œ์ž‘ํ•˜๊ธฐ ์œ„ํ•ด", + //"๋ณดํ˜ธ์ž๋‹˜์— ๋Œ€ํ•ด์„œ\n๋” ์•Œ์•„๊ฐ€๋ ค๊ณ  ํ•ด์š”.", + //"๋‹ค์Œ ์งˆ๋ฌธ์— ๋‹ตํ•ด์ฃผ์„ธ์š”!", + question1_0.insertAll(5, [ + "์ข‹์•„์š”. ${userName}๋‹˜.", + "์ œ๊ฐ€ ${userName}๋‹˜๊ณผ์˜\n๋Œ€ํ™”๋ฅผ ์‹œ์ž‘ํ•˜๊ธฐ ์œ„ํ•ด", + "${userName}๋‹˜์— ๋Œ€ํ•ด์„œ\n๋” ์•Œ์•„๊ฐ€๋ ค๊ณ  ํ•ด์š”.", + "๋‹ค์Œ ์งˆ๋ฌธ์— ๋‹ตํ•ด์ฃผ์„ธ์š”!", + "๋ฐ˜๋ ค๊ฒฌ์˜ ์ด๋ฆ„์€ ๋ฌด์—‡์ด์—ˆ์„๊นŒ์š”?", + ]); + setState(() { + + }); + } + + }, + style: ElevatedButton.styleFrom( + backgroundColor: setUserName? Color(colorChart.blue):Color(0xffDDE7FD), + fixedSize: const Size(3, 3), + shape: const CircleBorder(), + ), + child: Icon( + Icons.arrow_upward, + color: Colors.white, + size: 16, + )), + ), + ], + ), + ), + ), + + ]else if(nextQuestion == 9)...[ + Container( + color:Colors.white, + height: 48, + child: Padding( + padding: const EdgeInsets.only(bottom: 8.0, top: 8.0, left: 16,right: 16), + child: Stack( + children: [ + Container( + width: screenSize.width, + height: 48, + decoration: BoxDecoration( + color: Colors.white, + border: + Border.all(color: setDogName? Color(colorChart.blue):Color(0xffC0D2FC)), + borderRadius: BorderRadius.circular(30), + ), + ), + Positioned( + left: 15, + right: 30, + bottom:-4, + child: TextField( + textAlignVertical: TextAlignVertical.center, + maxLines: 1, + // maxLength: 8, + controller: dogNameController, + style: textStyle.bk14normal, + decoration: InputDecoration( + hintStyle: textStyle.grey14normal, + border: InputBorder.none, + hintText: '๋ฐ˜๋ ค๊ฒฌ์˜ ์ด๋ฆ„์€...'), + onChanged: (s) { + //text = s; + setDogName = true; + setState(() { + + }); + }, + onTap: () {}, + ), + ), + Positioned( + left: screenSize.width - 81, + //right: 30, + bottom: 3, + top: 3, + child: ElevatedButton( + onPressed: () { + // setDogName = true; + if(setDogName){ + nextQuestion++; + _player.setAsset(voice[voiceCount]); + voiceCount++; + _player.play(); + + controller1.repeat( + min: 0, + max: 20, + period: const Duration( + milliseconds: 1000)); + + Timer(Duration(milliseconds: 2000), () { + controller1.stop(); + }); + dogName = dogNameController.text; + dogName_ = dogName; + + question1_0.insertAll(10, [ + "${dogName}์˜ ๋ชจ์Šต์€ ์–ด๋• ๋‚˜์š”? \n๋นˆ์นธ์„ ์ฑ„์›Œ ์•Œ๋ ค์ฃผ์„ธ์š”.", + "${dogName}์˜ ๋ชจ์Šต์€ ์–ด๋• ๋‚˜์š”? \n๋นˆ์นธ์„ ์ฑ„์›Œ ์•Œ๋ ค์ฃผ์„ธ์š”.", + // this is modifi + "์ข‹์•„์š”, ${userName}๋‹˜!", + "์งˆ๋ฌธ์— ๋‹ตํ•˜๋ฉฐ,\n์ž ๊น์ด๋‚˜๋งˆ", + "${dogName}์— ๋Œ€ํ•ด์„œ ๋– ์˜ฌ๋ ค๋ดค๋˜ ๊ฒƒ ๊ฐ™์•„์š”.", + "${dogName}์— ๋Œ€ํ•ด์„œ ์ƒ๊ฐํ•˜๋‹ˆ", + "${userName}๋‹˜์€\n์–ด๋–ค ๋งˆ์Œ์ด ๋“ค์—ˆ๋‚˜์š”?", + ]); + + setState(() {}); + } + + }, + style: ElevatedButton.styleFrom( + backgroundColor: setDogName? Color(colorChart.blue):Color(0xffDDE7FD), + fixedSize: const Size(23, 23), + shape: const CircleBorder(), + ), + child: Icon( + Icons.arrow_upward, + color: Colors.white, + size: 16, + )), + ), + ], + ), + ), + ), + ] + else if(chooseType && dogTypeinput == false)...[ + Container( + color: Colors.white, + child: Padding( + padding: const EdgeInsets.all(16.0), + child: Container( + width: screenSize.width, + height: 280, + child: + GridView.builder( + itemCount:49, + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 2, //1 ๊ฐœ์˜ ํ–‰์— ๋ณด์—ฌ์ค„ item ๊ฐœ์ˆ˜ + childAspectRatio: 3 / 0.7, //item ์˜ ๊ฐ€๋กœ 1, ์„ธ๋กœ 2 ์˜ ๋น„์œจ + mainAxisSpacing: 8, //์ˆ˜ํ‰ Padding + crossAxisSpacing: 8, //์ˆ˜์ง Padding + ), + itemBuilder: (BuildContext context, int index){ + return + ElevatedButton( + style: buttonChart().whitebtn, + onPressed: () { + if(index == 48){ + dogTypeinput = true; + setState(() {}); + } else{ + decidedType= true; + chooseType = false; + dogType = dogType_[index]; + userDogType = dogType_[index]; + setState(() {}); + } + }, + child: Text("${dogType_[index]}", style: textStyle.bk14normal,) + ); + }), + ) + ), + ), + ] + else if(nextQuestion == 11 && selectAT)...[ + Container( + color: Color(0xffFFFFFF).withOpacity(0.0), + child: Padding( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 24), + child: Container( + width: screenSize.width, + height: 40, + child: ElevatedButton( + style: buttonChart().bluebtn3, + onPressed: () { + _player.setAsset(voice[voiceCount]); + voiceCount++; + _player.play(); + + controller1.repeat( + min: 0, + max: 45, + period: const Duration(milliseconds: 1000) + ); + + Timer(Duration(seconds: 1), () { + controller1.stop(); + }); + controller3.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 2000) + ); + + Timer(Duration(milliseconds: 1000), () { + controller3.stop(); + }); + + decidedType = false; + dogAge = int.parse(dogAgeController.text); + if(dogTypeinput){ + dogType = dogTypeController.text; + } + nextQuestion++; + setState(() {}); + saveUserInfo(sign_in.userAccessToken, userName, dogName, dogAge, dogType); + }, + child: Text("๋‹ค์Œ"), + ), + ),), + ), + ] + else if(nextQuestion == 16 && (ui_miss || ui_grief) )...[ + Container( + color: Color(0xffFFFFFF).withOpacity(0.0), + child: Padding( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 24), + child: Container( + width: screenSize.width, + height: 40, + child: ElevatedButton( + style: buttonChart().bluebtn3, + onPressed: () { + nextQuestion++; + if(ui_miss){ + voice.insertAll(17, [ + "assets/voice/intro/intro_miss1.mp3", + "assets/voice/intro/intro_miss2.mp3", + "assets/voice/intro/intro_miss3.mp3", + "assets/voice/intro/intro_miss4.mp3", + "assets/voice/intro/intro_miss4.mp3", + ]); + questions1_2.insertAll(0,[ + "์ด์ œ๋Š” ${dogName}์˜\n๋ชจ์Šต์„ ๋ณด๊ฑฐ๋‚˜ ๋งŒ์งˆ ์ˆ˜ ์—†์ง€๋งŒ,", + "${dogName}๋ฅผ ์ƒ๊ฐํ•˜๋ฉฐ\n๊ทธ๋ฆฌ์›€์„ ์ฑ„์›Œ๊ฐˆ ์ˆ˜ ์žˆ์„ ๊ฒƒ ๊ฐ™์•„์š”.", + "${dogName}์™€์˜ ๊ธฐ์–ต์„\n์ฒ˜์Œ๋ถ€ํ„ฐ ๋– ์˜ฌ๋ ค๋ณผ๊นŒ์š”?", + "${dogName}์™€์˜ ๊ธฐ์–ต์ด ์‹œ์ž‘๋˜๋Š”\n๊ทธ๋‚ ์˜ ์‚ฌ์ง„๊ณผ ์ด์•ผ๊ธฐ๋ฅผ ๊ธฐ๋กํ•ด๋ณด์•„์š”.", + ]); + miss = true; + _player.setAsset(voice[voiceCount]); + voiceCount++; + controller1.repeat( + min: 0, + max: 45, + period: const Duration(milliseconds: 1000) + ); + controller2.repeat( + min: 0, + max: 32, + period: const Duration(milliseconds: 3500) + ); + Timer(Duration(seconds: 3), () { + controller2.stop(); + }); + Timer(Duration(milliseconds: 4000), () { + controller1.stop(); + }); + }else if (ui_grief){ + voice.insertAll(17, [ + "assets/voice/intro/intro_grief1.mp3", + "assets/voice/intro/intro_grief2.mp3", + "assets/voice/intro/intro_grief3.mp3", + "assets/voice/intro/intro_grief4.mp3", + "assets/voice/intro/intro_grief5.mp3", + "assets/voice/intro/intro_grief5.mp3", + ]); + questions1_3.insertAll(0,[ + "${dogName}๊ฐ€ ๊ณ์— ์—†๋Š” ์ง€๊ธˆโ€ฆ", + "${userName}๋‹˜์˜\n์Šฌํ”ˆ ๋งˆ์Œ์ด ์ œ๊ฒŒ๋„ ๋А๊ปด์ ธ์š”.", + "${dogName}์™€์˜\n๊ธฐ์–ต์„ ํ•˜๋‚˜์”ฉ ๋˜๋Œ์•„๋ณด๋ฉด", + "์Šฌํ”ˆ ๋งˆ์Œ์„ ๋œ๊ธฐ์— ๋„์›€์ด ๋ ๊ฑฐ์˜ˆ์š”.", + "${dogName}์™€์˜ ๊ธฐ์–ต์ด ์‹œ์ž‘๋˜๋Š”\n๊ทธ๋‚ ์˜ ์‚ฌ์ง„๊ณผ ์ด์•ผ๊ธฐ๋ฅผ ๊ธฐ๋กํ•ด๋ณด์•„์š”.", + ]); + grief = true; + _player.setAsset(voice[voiceCount]); + voiceCount++; + controller1.repeat( + min: 0, + max: 45, + period: const Duration(milliseconds: 1000) + ); + controller2.repeat( + min: 0, + max: 32, + period: const Duration(milliseconds: 3500) + ); + Timer(Duration(milliseconds: 3000), () { + controller1.stop(); + }); + Timer(Duration(seconds: 3), () { + controller2.stop(); + }); + } + + setState(() {}); + }, + child: Text("๋‹ค์Œ"), + ), + ),), + ), + ] + ], + ), + )), + ) + ); + + } +} diff --git a/client/lib/conversation/intro/intro2.dart b/client/lib/conversation/intro/intro2.dart new file mode 100644 index 0000000..0623a6c --- /dev/null +++ b/client/lib/conversation/intro/intro2.dart @@ -0,0 +1,563 @@ +import 'dart:async'; +import 'dart:convert'; +import 'package:flutter/material.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter_svg/svg.dart'; +import 'package:client/conversation/intro/intro_coach_mark.dart'; +import 'package:client/screen.dart'; +import 'package:http/http.dart' as http; +import 'package:client/progressbar/animation_progressbar.dart'; +import 'package:client/sign/sign_in.dart'; +import 'package:client/style.dart'; +import 'package:intl/intl.dart'; +import 'intro.dart' as intro; +import 'package:client/sign/sign_in.dart' as sign_in; +import 'package:just_audio/just_audio.dart'; +import 'package:flutter_gif/flutter_gif.dart'; +import 'package:client/main.dart'as main; + +/// ์ธํŠธ๋กœ_๋งˆ๋ฌด๋ฆฌ + +AudioPlayer player2 = AudioPlayer(); + +late FlutterGifController controller1, controller2, controller3; + +List voice =[ + "assets/voice/intro/intro2_1.mp3", "assets/voice/intro/intro2_2.mp3", "assets/voice/intro/intro2_3.mp3", + "assets/voice/intro/intro2_4.mp3", "assets/voice/intro/intro2_5.mp3", "assets/voice/intro/intro2_6.mp3", + "assets/voice/intro/intro2_7.mp3", "assets/voice/intro/intro2_8.mp3", "assets/voice/intro/intro2_9.mp3", +]; + +class Intro2Page extends StatefulWidget { + + static Future navigatorPush(BuildContext context) async { + return Navigator.push( + context, + MaterialPageRoute( + builder: (_) => Intro2Page(), + ), + ); + } + + @override + _Intro2PageState createState() => _Intro2PageState(); +} + +class _Intro2PageState extends State with TickerProviderStateMixin { + + bool finish = false; // ๋ฉ”๋ชจ๋ฆฌ์–ผ ๋ฐ ๋งˆ๋ฌด๋ฆฌ + bool selectedNextTime = false; + bool chooseTime = false; + int whatTime = 0; + + String sentDate = ""; + + // ํ…์ŠคํŠธ ์—๋””ํŒ… ์ปจํŠธ๋กค๋Ÿฌ๋ฅผ ์ƒ์„ฑํ•˜์—ฌ ํ•„๋“œ์— ํ• ๋‹น + final nextTimeController = TextEditingController(); // nextQuestion = 7์ผ๋•Œ + + + FocusNode _focusNode = FocusNode(); + + @override + void initState() { + super.initState(); + // ์Œ์› ์ ์šฉ + for(int i= 0 ; i < voice.length; i++){ + player2.setAudioSource(AudioSource.uri( + Uri.parse(voice[i])) + ); + } + + controller1 = FlutterGifController(vsync: this); + + player2.setAsset(voice[voiceCount]); + voiceCount++; + player2.play(); + + // 2.5์ดˆ ์ ์ • + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + Timer(Duration(milliseconds: 3800), () { + controller1.stop(); + }); + + _focusNode.addListener(_onFocusChange); + } + + void _onFocusChange() { + if (_focusNode.hasFocus) { + // ํ‚ค๋ณด๋“œ ์˜ฌ๋ฆฌ๊ธฐ + FocusScope.of(context).requestFocus(_focusNode); + } + } + + @override + void dispose() async { + super.dispose(); + } + + // int nextPage = 0; + + List introText =[]; + + int nextQuestion = 0; + + + int voiceCount = 0; + + + + List questions1_4 =[ + "${intro.userName_}๋‹˜!\n ๊ธฐ์–ตํ• ๊ฐœ๊ฐ€ ์™„์„ฑ๋˜์—ˆ์–ด์š”.", // 0 + "๊ธฐ์–ตํ• ๊ฐœ๋ฅผ ํ™•์ธํ•ด๋ณด์„ธ์š”!", //1 + "${intro.userName_}๋‹˜!", //2 + "์˜ค๋Š˜์€ ${intro.userName_}๋‹˜๊ณผ์˜ \n์ฒซ๋งŒ๋‚จ์ด์—ˆ์ง€๋งŒ", //3 + "${intro.dogName_}๊ฐ€ ์–ผ๋งˆ๋‚˜ ๋งŽ์€ ์‚ฌ๋ž‘์„ \n๋ฐ›์•˜๋Š”์ง€ ๋А๋‚„ ์ˆ˜ ์žˆ์—ˆ์–ด์š”.", //4 + "์•ž์œผ๋กœ ์ €์™€ ํ•จ๊ป˜ \n${intro.dogName_}์™€์˜ ์ˆœ๊ฐ„๋“ค์„ ๊ธฐ์–ตํ•˜๋ฉฐ,", //5 + "${intro.userName_}๋‹˜์˜ ๋งˆ์Œ ์† ์•ˆ์ •์„ \n์ฐพ์•„๊ฐ€๊ธธ ๋ฐ”๋ผ์š”.", //6 + "์ด์ œ ์šฐ๋ฆฌ๊ฐ€ ๋‹ค์‹œ ๋งŒ๋‚˜๊ฒŒ ๋  \n์‹œ๊ฐ„์„ ์•Œ๋ ค์ฃผ์„ธ์š”.", //7 + "๋„ค, ${intro.userName_}๋‹˜. ๊ทธ๋•Œ ๋‹ค์‹œ ๋งŒ๋‚˜์š”!" //8 + ]; + + // ๋Œ€ํ™” ๋‹จ๊ณ„ ์ €์žฅ + void saveCon(String aToken, String con, String nextcon) async { + // API ์—”๋“œํฌ์ธํŠธ URL + String apiUrl = 'http://3.38.1.125:8080/user/conversation-status'; + + // ์š”์ฒญ ๋ณธ๋ฌธ ๋ฐ์ดํ„ฐ + var data = { + "conversationStatus": con, + "nextConversationAt": nextcon, + }; + + // ํ—ค๋” ์ •๋ณด ์„ค์ • + Map headers = { + 'Authorization': 'Bearer $aToken', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• + 'Content-Type': 'application/json', // ์˜ˆ: JSON ์š”์ฒญ์ธ ๊ฒฝ์šฐ ํ—ค๋” ์„ค์ • + }; + + // HTTP GET ์š”์ฒญ ๋ณด๋‚ด๊ธฐ + var response = await http.put( + Uri.parse(apiUrl), + body: json.encode(data), + headers: headers, // ํ—ค๋” ์ถ”๊ฐ€ + ); + + ///var jsonResponse = utf8.decode(response.bodyBytes); + // HTTP ์‘๋‹ต ์ƒํƒœ ํ™•์ธ + if (response.statusCode == 200) { + // ์‘๋‹ต ๋ฐ์ดํ„ฐ๋ฅผ JSON ํ˜•์‹์œผ๋กœ ๋””์ฝ”๋”ฉ + print("๋Œ€ํ™” ๋‹จ๊ณ„ ๋„ฃ๊ธฐ ์„ฑ๊ณต"); + setState(() { + }); + + } else { + // ์š”์ฒญ์ด ์‹คํŒจํ•œ ๊ฒฝ์šฐ ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌ + print('HTTP ์š”์ฒญ ์‹คํŒจ..?: ${response.statusCode}'); + } + } + + + @override + Widget build(BuildContext context) { + MediaQueryData deviceData = MediaQuery.of(context); + Size screenSize = deviceData.size; + return + Container( + color: Color(0xffDDE7FD), + child: GestureDetector( + onTap: (){ + SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: [SystemUiOverlay.top]); + print("ํ™•์ธ: " + nextQuestion.toString()); + + if(nextQuestion == 0){ + nextQuestion++; + player2.setAsset(voice[voiceCount]); + voiceCount++; + player2.play(); + + // 2.5์ดˆ ์ ์ • + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + Timer(Duration(milliseconds: 2500), () { + controller1.stop(); + }); + } + else if(nextQuestion == 1){ + //nextQuestion++; + } + else if(nextQuestion == 2){ + nextQuestion++; // ์ธํŠธ๋กœ ์‹œ์ž‘ ํ›„ count + player2.setAsset(voice[voiceCount]); + voiceCount++; + player2.play(); + // 2.5์ดˆ ์ ์ • + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + Timer(Duration(milliseconds: 2500), () { + controller1.stop(); + }); + } + else if(nextQuestion > 2 && nextQuestion <= 6){ + nextQuestion++; + player2.setAsset(voice[voiceCount]); + voiceCount++; + player2.play(); + // 2.5์ดˆ ์ ์ • + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + if(nextQuestion == 2){ + Timer(Duration(seconds: 4), () { + controller1.stop(); + }); + } else if(nextQuestion == 3){ + Timer(Duration(milliseconds: 4000), () { + controller1.stop(); + }); + } else if(nextQuestion == 4){ + Timer(Duration(seconds: 5), () { + controller1.stop(); + }); + } else if(nextQuestion == 5){ + Timer(Duration(seconds: 4), () { + controller1.stop(); + }); + } else if(nextQuestion == 6){ + Timer(Duration(seconds: 4), () { + controller1.stop(); + }); + } + } + else if(nextQuestion == 7){ + + } + + setState(() { + }); + }, + child: Scaffold( + backgroundColor: Colors.transparent, + appBar: AppBar( + //title: Text("๊ธฐ์–ตํ• ๊ฐœ", style: TextStyle(fontSize:16, color: Colors.white ),), + //centerTitle: true, + leading: IconButton( + icon: SvgPicture.asset( + 'assets/images/conversation/home_icon.svg', + ), + onPressed: () => Navigator.of(context).pop(), + ), + backgroundColor: Colors.transparent, + elevation: 0.0, + ), + //extendBodyBehindAppBar: true, + body: + SingleChildScrollView( + child:Container( + child: Column( + children: [ + SizedBox(height: 3,), + Container( + width: screenSize.width, + height: 25, + child: Padding( + padding: EdgeInsets.only( left:16, right: 16), + child: Center( + child: FAProgressBar( + currentValue: 15, + size: 5, + backgroundColor: Colors.white, + ) + ), + ), + ), + Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children:[ + SizedBox( + height: 14, + ), + Stack( + children: [ + Container( + height: 157, + width: screenSize.width, + child: + Stack( + children: [ + Center(child: SvgPicture.asset('assets/images/conversation/bubble.svg',fit: BoxFit.fill,),), + Container( + padding: const EdgeInsets.symmetric(horizontal: 32, vertical: 12, ), + child: Center( + child: Column( + children: [ + if(questions1_4[nextQuestion].toString().contains("\n"))...[ + SizedBox(height: 28,), + Text( + questions1_4[nextQuestion], + textAlign: TextAlign.center, + style: textStyle.bubbletext, + ), + + ]else...[ + SizedBox(height: 42,), + Text( + questions1_4[nextQuestion], + textAlign: TextAlign.center, + style: textStyle.bubbletext, + ), + ], + ], + ) + ) + ), + ], + ) + ), + // ๋ฌด์ง€ ์œ„์น˜ + if(nextQuestion < 7 || nextQuestion == 8)...[ + Stack( + children: [ + // ์œ ์ € ์œ„์น˜ + Column( + children: [ + SizedBox(height: 420,), + Container( + child: SvgPicture.asset( + 'assets/images/conversation/user7.svg', + height: 282, + width: screenSize.width, + ), + ), + ], + ), + Column( + children: [ + SizedBox(height: 144,), + Container( + width: screenSize.width, + height: 375, + child: + Stack( + children: [ + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child: Image.asset('assets/images/conversation/gif/muji_ear.gif', + fit: BoxFit.cover,),), + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child: Image.asset('assets/images/conversation/gif/muji_base.gif', fit: BoxFit.cover,),), + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child: Image.asset('assets/images/conversation/gif/muji_base_eye.gif', + fit: BoxFit.cover,),), + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child:GifImage( + controller: controller1, + image: const AssetImage("assets/images/conversation/gif/muji_mouth1.gif"), + ), + // Image.asset('assets/images/conversation/gif/muji_mouth1.gif', fit: BoxFit.cover,), + ) + ], + ) + + + // SvgPicture.asset( + // 'assets/images/conversation/con_muji.svg', fit: BoxFit.cover, + // ), + ), + ], + ), + ], + ), + ] + else if(nextQuestion == 7)...[ + Padding( + padding: EdgeInsets.only(top:175, left:45), + child: Container( + width: 275, + height: 120, + child: Column( + children: [ + Row( + children: [ + SizedBox(width: 75,), + Container(width: 25, + padding: EdgeInsets.only(bottom:16), + child: TextField( + style: textStyle.inputfield, + onTap: (){ + chooseTime = true; + selectedNextTime = true; + whatTime = int.parse(nextTimeController.text); + setState(() { + }); + }, + keyboardType: TextInputType.number, + inputFormatters: [FilteringTextInputFormatter.allow(RegExp('[0-9]'))], + controller: nextTimeController, + decoration: InputDecoration( + hintText: '๋ช‡', + contentPadding: EdgeInsets.only(top: 16), + suffixStyle: TextStyle(color: Color(0xff83A8FF), fontSize: 20,), + hintStyle: textStyle.field + //labelText: '๋ช‡', + ), + ),), + Text("์‹œ๊ฐ„ ํ›„์— ๋งŒ๋‚˜์š”", style: TextStyle( + fontFamily: 'Pretendard', + fontSize: 20, fontWeight: FontWeight.w500, color: Colors.black),), + ],), + SizedBox(height: 8,), + // DateFormat('MM/dd HH:mm').format(DateTime.parse(parsedResponseHR[index]['createdAt'])) + // DateFormat('MM/dd HH:mm').format(DateTime.now().add(Duration(hours: whatTime))) + Text(chooseTime?"${DateFormat('MM์›” dd์ผ HH์‹œ mm๋ถ„').format(DateTime.now().add(Duration(hours: whatTime)))}":"์ตœ์†Œ 1์‹œ๊ฐ„์—์„œ 24์‹œ๊ฐ„ ์‚ฌ์ด๋กœ ์ •ํ•ด์ฃผ์„ธ์š”.", style: TextStyle( + fontFamily: 'Pretendard', + fontSize: 16, fontWeight: FontWeight.w500, color: Color(0xffAAAAAA)),), + + ],), + ), + ), + + ] + ], + ), + + + /// + + ], + ), + ], + ), + ), + ), + + // // nextQuestion ์ด 3๊ณผ 7์ผ๋•Œ ๋“ฑ์žฅ + bottomSheet: Padding( + padding: EdgeInsets.only( + bottom: MediaQuery.of(context).viewInsets.bottom * 0.001), + child: Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + if(nextQuestion == 1)...[ + Container( + color: Color(0xffFFFFFF).withOpacity(0.0), + child: Padding( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 24), + child: Container( + width: screenSize.width, + height: 40, + child: ElevatedButton( + style: buttonChart().bluebtn3, + onPressed: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => IntroMarkCoachPage())); + nextQuestion++; + // player2.setAsset(voice[voiceCount]); + voiceCount++; + // _player.play(); + setState(() { + + }); + }, + child: Text("๊ธฐ์–ตํ• ๊ฐœ ํ™•์ธํ•˜๊ธฐ", style: TextStyle( + fontFamily: 'Pretendard', + fontSize: 16, fontWeight: FontWeight.w500, color: Color(0xffFFFFFF))), + ), + ),), + ), + ] + else if(nextQuestion == 7 && selectedNextTime)...[ + Container( + color: Color(0xffFFFFFF).withOpacity(0.0), + child: Padding( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 24), + child: Container( + + width: screenSize.width, + height: 40, + child: ElevatedButton( + style: buttonChart().bluebtn3, + onPressed: () { + //decidedType = false; + nextQuestion++; + player2.setAsset(voice[voiceCount]); + voiceCount++; + player2.play(); + // 2.5์ดˆ ์ ์ • + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + Timer(Duration(milliseconds: 3800), () { + controller1.stop(); + }); + setState(() {}); + }, + child: Text("๋‹ค์Œ", style: TextStyle( + fontFamily: 'Pretendard', + fontSize: 16, fontWeight: FontWeight.w500, color: Color(0xffFFFFFF))), + ), + ),), + ), + ] + else if(nextQuestion == 8)...[ + Container( + color: Color(0xffFFFFFF).withOpacity(0.0), + child: Padding( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 24), + child: Container( + + width: screenSize.width, + height: 40, + child: ElevatedButton( + style: buttonChart().bluebtn3, + onPressed: () { + //decidedType = false; + //checkSignUp = false; + //checkSignIn = true; + checkSignUp = false; + var now = DateTime.now().add(Duration(hours: whatTime)); + sentDate = DateFormat('yyyy-MM-dd hh:mm:ss').format(now.toLocal()); + + saveCon(sign_in.userAccessToken, "0", sentDate); + setState(() {}); + main.player.stop(); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => MyScreenPage(title: '์Šคํฌ๋ฆฐ ํŽ˜์ด์ง€',))); + }, + child: Text("์™„๋ฃŒ", style: TextStyle( + fontFamily: 'Pretendard', + fontSize: 16, fontWeight: FontWeight.w500, color: Color(0xffFFFFFF))), + ), + ),), + ), + ] + ], + ), + )), + ) + + ); + + } +} diff --git a/client/lib/conversation/intro/intro_coach_mark.dart b/client/lib/conversation/intro/intro_coach_mark.dart new file mode 100644 index 0000000..85c008b --- /dev/null +++ b/client/lib/conversation/intro/intro_coach_mark.dart @@ -0,0 +1,287 @@ + +import 'dart:async'; +import 'dart:convert'; +import 'package:flutter/material.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/services.dart'; +import 'package:http/http.dart' as http; +import 'package:client/style.dart'; +import 'package:client/conversation/intro/intro2.dart' as intro2; + +/// ์ธํŠธ๋กœ_์ฝ”์น˜๋งˆํฌ +class IntroMarkCoachPage extends StatefulWidget { + + static Future navigatorPush(BuildContext context) async { + return Navigator.push( + context, + MaterialPageRoute( + builder: (_) => IntroMarkCoachPage(), + ), + ); + } + + @override + _IntroMarkCoachPageState createState() => _IntroMarkCoachPageState(); +} + +class _IntroMarkCoachPageState extends State { + + bool finish = false; // ๋ฉ”๋ชจ๋ฆฌ์–ผ ๋ฐ ๋งˆ๋ฌด๋ฆฌ + + // ํ…์ŠคํŠธ ์—๋””ํŒ… ์ปจํŠธ๋กค๋Ÿฌ๋ฅผ ์ƒ์„ฑํ•˜์—ฌ ํ•„๋“œ์— ํ• ๋‹น + final userNameController = TextEditingController(); // nextQuestion = 3์ผ๋•Œ + final dogNameController = TextEditingController(); // nextQuestion = 7์ผ๋•Œ + final dogAgeController = TextEditingController(); // nextQuestion = 10์ผ๋•Œ + final dogTypeController = TextEditingController(); // nextQuestion = 10์ผ๋•Œ + + + FocusNode _focusNode = FocusNode(); + + @override + void initState() { + super.initState(); + _callAPI(); + _focusNode.addListener(_onFocusChange); + } + + void _onFocusChange() { + if (_focusNode.hasFocus) { + // ํ‚ค๋ณด๋“œ ์˜ฌ๋ฆฌ๊ธฐ + FocusScope.of(context).requestFocus(_focusNode); + } + } + + @override + void dispose() async { + super.dispose(); + } + + int nextPage = 0; + + List introText =[]; + + int nextQuestion = 0; + + + void _callAPI() async { + // ์š”์ฒญ ๋ณธ๋ฌธ ๋ฐ์ดํ„ฐ + var data = { + "stage" : "0", + "set" : "0", + "lineId" : "0" + }; + + var url = Uri.parse('http://3.38.1.125:8080/conversation/line'); // ์—”๋“œํฌ์ธํŠธ URL ์„ค์ • + + try { + var response = await http.post( + url, + body: json.encode(data), // ์š”์ฒญ ๋ณธ๋ฌธ์— ๋ฐ์ดํ„ฐ๋ฅผ JSON ํ˜•์‹์œผ๋กœ ์ธ์ฝ”๋”ฉํ•˜์—ฌ ์ „๋‹ฌ + headers: {'Content-Type': 'application/json',}, // ์š”์ฒญ ํ—ค๋”์— Content-Type ์„ค์ • + ); + + if (response.statusCode == 200) { + // ์‘๋‹ต ์„ฑ๊ณต ์‹œ์˜ ์ฒ˜๋ฆฌ + + var jsonResponse = utf8.decode(response.bodyBytes); // ์‘๋‹ต ๋ณธ๋ฌธ์„ JSON ํ˜•์‹์œผ๋กœ ๋””์ฝ”๋”ฉ + // JSON ๊ฐ’์„ ํ™œ์šฉํ•œ ์›ํ•˜๋Š” ๋™์ž‘ ์ˆ˜ํ–‰ + //utf8.decode(jsonResponse); + print(jsonResponse); + + List contentList = []; + + List parsedResponse = json.decode(jsonResponse); + + setState(() { + for (var item in parsedResponse) { + if (item['content'] != null) { + introText.add(item['content']); + } + } + }); + + + print(introText); + + print('API ํ˜ธ์ถœ ์„ฑ๊ณต: ${response.statusCode}'); + } else { + // ์š”์ฒญ ์‹คํŒจ ์‹œ์˜ ์ฒ˜๋ฆฌ + print('API ํ˜ธ์ถœ ์‹คํŒจ: ${response.statusCode}'); + } + } catch (e) { + // ์˜ˆ์™ธ ๋ฐœ์ƒ ์‹œ์˜ ์ฒ˜๋ฆฌ + print('API ํ˜ธ์ถœ ์ค‘ ์˜ˆ์™ธ ๋ฐœ์ƒ: $e'); + } + } + + + @override + Widget build(BuildContext context) { + MediaQueryData deviceData = MediaQuery.of(context); + Size screenSize = deviceData.size; + return + Container( + decoration: BoxDecoration( + gradient: LinearGradient( + begin: Alignment.topRight, + end: Alignment.bottomLeft, + colors: [ + Color(0xffE4ECFF), + Color(0xffA2BEFF), + ], + ) + ), + child: GestureDetector( + onTap: (){ + print(nextQuestion); + if(nextPage == 3){ + + } else if(nextPage < 3){ + nextPage++; + } + + setState(() { + }); + }, + child: Scaffold( + backgroundColor: Colors.transparent, + appBar: AppBar( + //title: Text("๊ธฐ์–ตํ• ๊ฐœ", style: TextStyle(fontSize:16, color: Colors.white ),), + //centerTitle: true, + backgroundColor: Colors.transparent, + elevation: 0.0, + automaticallyImplyLeading: false, + ),extendBodyBehindAppBar: true, + body: + Container( + width: screenSize.width, + child: Column( + children: [ + + Stack( + children: [ + // Padding(padding: EdgeInsets.only(left: 12, top: 125), + // child: SvgPicture.asset('assets/images/conversation/intro/coach01.svg', + // height: 624, + // width: 380, fit: BoxFit.fill,), + // ), + + if(nextPage == 0)...[ + Padding(padding: EdgeInsets.only(left: 6, top: 145), + child: Container( + width: 260, + height: 575, + child: ClipRRect( + borderRadius: BorderRadius.circular(24.0), + child: Image.asset('assets/images/conversation/intro/iscreen1.png', + fit: BoxFit.fill,) + ), + ), + ), + ] else if(nextPage == 1)...[ + Padding(padding: EdgeInsets.only(left: 6, top: 145), + child: Container( + width: 260, + height: 575, + child: ClipRRect( + borderRadius: BorderRadius.circular(24.0), + child: Image.asset('assets/images/conversation/intro/iscreen2.png', + fit: BoxFit.fill,) + ), + ), + ), + ] else if(nextPage == 2)...[ + Padding(padding: EdgeInsets.only(left: 6, top: 145), + child: Container( + width: 260, + height: 575, + child: ClipRRect( + borderRadius: BorderRadius.circular(24.0), + child: Image.asset('assets/images/conversation/intro/iscreen3.png', + fit: BoxFit.fill,) + ), + ), + ), + ] else if(nextPage == 3)...[ + Padding(padding: EdgeInsets.only(left: 6, top: 145), + child: Container( + width: 260, + height: 575, + child: ClipRRect( + borderRadius: BorderRadius.circular(24.0), + child: Image.asset('assets/images/conversation/intro/iscreen4.png', + fit: BoxFit.fill,) + ), + ), + ), + ], + + Padding(padding: EdgeInsets.only(left: 120, top: 706), + child: Container( + width: 40, + height: 2, + child: Container( + width: 40, height: 2, + color: Colors.white, + ) + ), + ), + ], + ) + ], + ), + ), + bottomSheet: Padding( + padding: EdgeInsets.only( + bottom: MediaQuery.of(context).viewInsets.bottom * 0.001), + child: Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + if(nextPage == 3)...[ + Container( + color: Color(0xffFFFFFF).withOpacity(0.0), + child: Padding( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 24), + child: Container( + width: screenSize.width, + height: 40, + child: ElevatedButton( + style: buttonChart().bluebtn3, + onPressed: () { + Navigator.pop(context); // intro2๋กœ ๋Œ์•„๊ฐ€๊ธฐ + intro2.player2.setAsset(intro2.voice[2]); + intro2.player2.play(); + // 2.5์ดˆ ์ ์ • + intro2.controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + Timer(Duration(milliseconds: 1000), () { + intro2.controller1.stop(); + }); + // _player.play(); + setState(() { + + }); + }, + child: Text("ํ™•์ธ", style: TextStyle( + fontFamily: 'Pretendard', + fontSize: 16, fontWeight: FontWeight.w500, color: Color(0xffFFFFFF))), + ), + ),), + ), + ] + ], + ), + ) + + ), + ) + + ); + + } +} diff --git a/client/lib/conversation/intro/intro_memorial.dart b/client/lib/conversation/intro/intro_memorial.dart new file mode 100644 index 0000000..57e7e6a --- /dev/null +++ b/client/lib/conversation/intro/intro_memorial.dart @@ -0,0 +1,885 @@ +import 'dart:async'; +import 'dart:io'; +import 'package:flutter/material.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter_svg/svg.dart'; +import 'package:image_picker/image_picker.dart'; +import 'package:client/style.dart'; +import 'dart:convert'; +import 'package:flutter/services.dart'; +import 'package:http_parser/http_parser.dart'; +import 'package:dio/dio.dart'; +import 'package:client/sign/sign_in.dart' as sign_in; +import 'intro2.dart'; + +/// ์ธํŠธ๋กœ์—์„œ ์ถ”์–ต ์ž‘์„ฑํ•˜๊ธฐ +class IntroMemorialPage extends StatefulWidget { + static Future navigatorPush(BuildContext context) async { + return Navigator.push( + context, + MaterialPageRoute( + builder: (_) => IntroMemorialPage(), + ), + ); + } + + @override + _IntroMemorialPageState createState() => _IntroMemorialPageState(); +} + +class _IntroMemorialPageState extends State { + + String _imageDate = "์‚ฌ์ง„์„ ์ถ”๊ฐ€ํ•ด์ฃผ์„ธ์š”."; + + // ํ…์ŠคํŠธ์—๋””ํŒ…์ปจํŠธ๋กค๋Ÿฌ๋ฅผ ์ƒ์„ฑํ•˜์—ฌ ํ•„๋“œ์— ํ• ๋‹น + final titleController = TextEditingController(); + final dateController = TextEditingController(); + final locationController = TextEditingController(); + final contentController = TextEditingController(); + final hashtagController = TextEditingController(); + + bool title = false; + bool date = false; + bool location = false; + bool content = false; + bool hashtag = false; + + // ๋‚ ์งœ๋ฅผ ์ง์ ‘ ์กฐ์ •์ธ์ง€ ํ™•์ธ + bool modiDate = false; + + // ๊ณต๊ฐœ ๋น„๊ณต๊ฐœ: ์ฒ˜์Œ์—๋Š” ๊ณต๊ฐœ๋กœ ์„ค์ •๋˜์–ด ์žˆ์Œ + String isPrivate = "False"; + bool private = false; + + bool isPicSelected = false; // ์‚ฌ์ง„์ด ๋“ค์–ด๊ฐ€๋Š”์ง€ ํ™•์ธํ•˜๋Š” ์ฝ”๋“œ -> UI ๋ฐ”๋€œ + final ImagePicker _picker = ImagePicker(); + final List _pickedImages = []; + + // ์ด๋ฏธ์ง€ ์—ฌ๋Ÿฌ๊ฐœ ๋ถˆ๋Ÿฌ์˜ค๊ธฐ + void getMultiImage() async { + final List? images = await _picker.pickMultiImage(); + + if (images != null) { + setState(() async { + print("check it"); + //_picker.pickMultiImage().printInfo(); + _pickedImages.addAll(images); + print("??: "+ images[0].path); + + // /(?20(?:0|1|2)\d{1})(?:-|\.|_)?(?\d{2})(?:-|\.|_)?(?\d{2})(?:-|_|\.|\s)?(?\d{2})(?:-|\.|_)?(?\d{2})(?:-|\.|_)?(?\d{2})/ + final dateMatch = RegExp(r'(\d{4})(\d{2})(\d{2})').firstMatch(images[0].path); + + if (dateMatch != null) { + final year = dateMatch.group(1); + final month = dateMatch.group(2); + final day = dateMatch.group(3); + + setState(() { + _imageDate = '$year-$month-$day'; + + print("ํ™•์ธ ๋ถ€ํƒ" + _imageDate.toString()); + }); + } + + isPicSelected = true; + setState(() { + + }); + + }); + } + } + + Future uploadImagesAndData2(String aToken, List images, String title, String date, String place, String content, String hashtag, String isPrivate) async { + print('test'); + try { + var dio = Dio(); // Dio ์ธ์Šคํ„ด์Šค ์ƒ์„ฑ + + // JSON ๋ฐ์ดํ„ฐ ์ถ”๊ฐ€ + final jsonData = { + "title": title, + "date":date, + "place": place, + "content": content, + "hashtag": hashtag, + "isPrivate": isPrivate + }; + + // JSON ๋ฐ์ดํ„ฐ๋ฅผ ๋ฌธ์ž์—ด๋กœ ์ธ์ฝ”๋”ฉ + final jsonString = jsonEncode(jsonData); + + final List _files2 = images + .map((img) => MultipartFile.fromFileSync(img.path, + contentType: MediaType("image", "jpeg"))) + .toList(); + + //final List _files = images.map((img) => MultipartFile.fromFileSync(img!.path, contentType: new MediaType("image", "jpg"))).toList(); + + //print('Content-Type: ${_files.contentType}'); + + + final data = FormData.fromMap({ + "image": _files2, + "json": await MultipartFile.fromString( + jsonString, + contentType: MediaType.parse('application/json'), + ), + }, + ); + + + //dio.options.contentType = 'multipart/form-data'; + + // http://3.38.1.125:8080/memorial + // POST ์š”์ฒญ ๋ณด๋‚ด๊ธฐ + var response = await dio.post( + 'http://3.38.1.125:8080/memorial', // ์„œ๋ฒ„ ์—”๋“œํฌ์ธํŠธ ๊ฒฝ๋กœ ์„ค์ • + data: data, + options: Options( + method: 'POST', + headers: { + 'Content-Type': 'multipart/form-data', // Content-Type ์„ค์ • + 'Authorization': 'Bearer $aToken', + }, + //responseType: ResponseType.plain + ), + ); + + // ์‘๋‹ต ์ฒ˜๋ฆฌ + if (response.statusCode == 200) { + print('์ด๋ฏธ์ง€ ์—…๋กœ๋“œ ์„ฑ๊ณต'); + // ์‘๋‹ต ๋ฐ์ดํ„ฐ ์ฝ๊ธฐ + final responseJson = json.decode(response.data); + print('์„œ๋ฒ„ ์‘๋‹ต ๋ฐ์ดํ„ฐ: $responseJson'); + } else { + print('์ด๋ฏธ์ง€ ์—…๋กœ๋“œ ์‹คํŒจ. HTTP ์—๋Ÿฌ ์ฝ”๋“œ: ${response.statusCode}'); + } + } catch (e) { + if (e is DioError) { + if (e.response != null) { + print('์„œ๋ฒ„ ์‘๋‹ต ์—๋Ÿฌ ๋ฐ์ดํ„ฐ: ${e.response?.data}'); + } else { + print('Dio ์—๋Ÿฌ: ${e.message}'); + } + } else { + print('์—๋Ÿฌ ๋ฐœ์ƒ: $e'); + } + } + } + + + @override + void initState() { + super.initState(); + + } + + @override + void dispose() async { + super.dispose(); + } + + @override + Widget build(BuildContext context) { + MediaQueryData deviceData = MediaQuery.of(context); + Size screenSize = deviceData.size; + return + Container( + child: Scaffold( + backgroundColor: Color(0xffF2F4F6), + appBar: AppBar( + actions: [ + Padding(padding: EdgeInsets.only(right: 15), + child: Row( + children: [ + SizedBox(width: 8,), + InkWell( + onTap: (){ + // ์—ฌ๊ธฐ์— db๋กœ image path๋„ ๋ณด๋‚ด๊ธฐ + //uploadImages(_pickedImages); + print("test: " + _pickedImages.toString()); + //List images, String title, String place, String content, String hashtag, String isPrivate + uploadImagesAndData2( + sign_in.userAccessToken, + _pickedImages, + titleController.text.toString(), + _imageDate, + locationController.text.toString(), + contentController.text.toString(), + hashtagController.text.toString(), + isPrivate); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => Intro2Page())); + }, + child: SvgPicture.asset( + 'assets/images/memorial/upload_button.svg', + ), + ), + + ], + ),) + ], + // actions: [ + // new IconButton( + // icon: Container( + // child: SvgPicture.asset( + // 'assets/images/memorial/upload_button.svg', + // ),), + // onPressed: (){ + // // ์—ฌ๊ธฐ์— db๋กœ image path๋„ ๋ณด๋‚ด๊ธฐ + // print("test: "+_pickedImages.toString()); + // //List images, String title, String place, String content, String hashtag, String isPrivate + // uploadImagesAndData2(sign_in.userAccessToken, _pickedImages,titleController.text.toString(),_imageDate,locationController.text.toString(), + // contentController.text.toString(), hashtagController.text.toString(), isPrivate); + // Navigator.push( + // context, + // MaterialPageRoute( + // builder: (context) => Intro2Page())); + // }, + // ), + // ], + title: Text("๊ธฐ์–ต ๋‚จ๊ธฐ๊ธฐ", style: textStyle.bk20normal), + backgroundColor: Colors.transparent, + elevation: 0.0, + iconTheme: IconThemeData(color: Colors.black), + centerTitle: true, + leading: IconButton( + icon: Icon(Icons.arrow_back_ios_rounded, color: Colors.black), + onPressed: () => Navigator.of(context).pop(), + ), + + ), + body: Container( + // width: screenSize.width, + // height: screenSize.height, + child: SingleChildScrollView( + padding: EdgeInsets.fromLTRB(16, 16, 16, 16), + //scrollDirection: Axis.vertical, + child: + Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Container( + padding: EdgeInsets.all(16), + width: screenSize.width, + height: screenSize.width - 28, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(16), + ), + child: GridView.builder( + itemCount:9, + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 3, //1 ๊ฐœ์˜ ํ–‰์— ๋ณด์—ฌ์ค„ item ๊ฐœ์ˆ˜ + childAspectRatio: 1 / 1, //item ์˜ ๊ฐ€๋กœ 1, ์„ธ๋กœ 1 ์˜ ๋น„์œจ + mainAxisSpacing: 16, //์ˆ˜ํ‰ Padding + crossAxisSpacing: 16, //์ˆ˜์ง Padding + ), + itemBuilder: (BuildContext context, int index){ + return + Stack( + children: [ + SvgPicture.asset( + 'assets/images/memorial/memorial_img.svg', + width: 128, + height: 128, + ), + if(isPicSelected && index == 0 && _pickedImages.length >= 1)...[ + Container( + width: 128, + height: 128, + child: + ClipRRect( + borderRadius: BorderRadius.circular(16.0), + child: Image.file(File(_pickedImages![index]!.path), fit: BoxFit.cover,), + ), + ), + Row( + children: [ + SizedBox(width: 72,), + Container( + width: 24, + height: 24, + child:InkWell( + child: SvgPicture.asset( + 'assets/images/memorial/delete_bt.svg', + ), + onTap: (){ + _pickedImages.removeAt(index); + setState(() {}); + print("remove"); + }, + ) + ), + ], + ), + + ], + if(isPicSelected && index == 1 && _pickedImages.length >= 2)...[ + Container( + width: 128, + height: 128, + child: + ClipRRect( + borderRadius: BorderRadius.circular(16.0), + child: Image.file(File(_pickedImages![index]!.path), fit: BoxFit.cover,), + ), + ), + Row( + children: [ + SizedBox(width: 72,), + Container( + width: 24, + height: 24, + child:InkWell( + child: SvgPicture.asset( + 'assets/images/memorial/delete_bt.svg', + ), + onTap: (){ + _pickedImages.removeAt(index); + setState(() {}); + print("remove"); + }, + ) + ), + ], + ), + ], + if(isPicSelected && index == 2 && _pickedImages.length >= 3)...[ + Container( + width: 128, + height: 128, + child: + ClipRRect( + borderRadius: BorderRadius.circular(16.0), + child: Image.file(File(_pickedImages![index]!.path), fit: BoxFit.cover,), + ), + ), + Row( + children: [ + SizedBox(width: 72,), + Container( + width: 24, + height: 24, + child:InkWell( + child: SvgPicture.asset( + 'assets/images/memorial/delete_bt.svg', + ), + onTap: (){ + _pickedImages.removeAt(index); + setState(() {}); + print("remove"); + }, + ) + ), + ], + ), + ], + if(isPicSelected && index == 3 && _pickedImages.length >= 4)...[ + Container( + width: 128, + height: 128, + child: + ClipRRect( + borderRadius: BorderRadius.circular(16.0), + child: Image.file(File(_pickedImages![index]!.path), fit: BoxFit.cover,), + ), + ), + Row( + children: [ + SizedBox(width: 72,), + Container( + width: 24, + height: 24, + child:InkWell( + child: SvgPicture.asset( + 'assets/images/memorial/delete_bt.svg', + ), + onTap: (){ + _pickedImages.removeAt(index); + setState(() {}); + print("remove"); + }, + ) + ), + ], + ), + ], + if(isPicSelected && index == 4 && _pickedImages.length >= 5)...[ + Container( + width: 128, + height: 128, + child: + ClipRRect( + borderRadius: BorderRadius.circular(16.0), + child: Image.file(File(_pickedImages![index]!.path), fit: BoxFit.cover,), + ), + ), + Row( + children: [ + SizedBox(width: 72,), + Container( + width: 24, + height: 24, + child:InkWell( + child: SvgPicture.asset( + 'assets/images/memorial/delete_bt.svg', + ), + onTap: (){ + _pickedImages.removeAt(index); + setState(() {}); + print("remove"); + }, + ) + ), + ], + ), + ], + if(isPicSelected && index == 5 && _pickedImages.length >= 6)...[ + Container( + width: 128, + height: 128, + child: + ClipRRect( + borderRadius: BorderRadius.circular(16.0), + child: Image.file(File(_pickedImages![index]!.path), fit: BoxFit.cover,), + ), + ), + Row( + children: [ + SizedBox(width: 72,), + Container( + width: 24, + height: 24, + child:InkWell( + child: SvgPicture.asset( + 'assets/images/memorial/delete_bt.svg', + ), + onTap: (){ + _pickedImages.removeAt(index); + setState(() {}); + print("remove"); + }, + ) + ), + ], + ), + ], + if(isPicSelected && index == 6 && _pickedImages.length >= 7)...[ + Container( + width: 128, + height: 128, + child: + ClipRRect( + borderRadius: BorderRadius.circular(16.0), + child: Image.file(File(_pickedImages![index]!.path), fit: BoxFit.cover,), + ), + ), + Row( + children: [ + SizedBox(width: 72,), + Container( + width: 24, + height: 24, + child:InkWell( + child: SvgPicture.asset( + 'assets/images/memorial/delete_bt.svg', + ), + onTap: (){ + _pickedImages.removeAt(index); + setState(() {}); + print("remove"); + }, + ) + ), + ], + ), + ], + if(isPicSelected && index == 7 && _pickedImages.length >= 8)...[ + Container( + width: 128, + height: 128, + child: + ClipRRect( + borderRadius: BorderRadius.circular(16.0), + child: Image.file(File(_pickedImages![index]!.path), fit: BoxFit.cover,), + ), + ), + Row( + children: [ + SizedBox(width: 72,), + Container( + width: 24, + height: 24, + child:InkWell( + child: SvgPicture.asset( + 'assets/images/memorial/delete_bt.svg', + ), + onTap: (){ + _pickedImages.removeAt(index); + setState(() {}); + print("remove"); + }, + ) + ), + ], + ), + ], + if(isPicSelected && index == 8 && _pickedImages.length >= 9)...[ + Container( + width: 128, + height: 128, + child: + ClipRRect( + borderRadius: BorderRadius.circular(16.0), + child: Image.file(File(_pickedImages![index]!.path), fit: BoxFit.cover,), + ), + ), + Row( + children: [ + SizedBox(width: 72,), + Container( + width: 24, + height: 24, + child:InkWell( + child: SvgPicture.asset( + 'assets/images/memorial/delete_bt.svg', + ), + onTap: (){ + _pickedImages.removeAt(index); + setState(() {}); + print("remove"); + }, + ) + ), + ], + ), + ], + // Row( + // children: [ + // SizedBox(width: 70,), + // Container( + // width: 20, + // height: 20, + // child: IconButton( + // onPressed: (){ + // _pickedImages.removeAt(index); + // setState(() {}); + // print("remove"); + // }, icon: Icon(Icons.cancel, color: Colors.black,)), + // ), + // ],), + if(index == 0 && _pickedImages.length >= 1)...[ + Padding(padding: EdgeInsets.only(top: 70, left: 5), + child: SvgPicture.asset( + 'assets/images/memorial/image_rep.svg', + ), + ), + ], + + if(index == 8 && _pickedImages.length < 9)...[ + Center( + child: IconButton( + onPressed: (){ + getMultiImage(); + }, + icon: Image.asset('assets/images/memorial/memorial_upload.png'), + )) + ], + + ], + ); + + }), + ), + + SizedBox( + height: 8, + ), + Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(16), + ), + child: Column( + children: [ + Container( + alignment: Alignment.topLeft, + child: Padding(padding: EdgeInsets.only(top:16, left: 16, right:16), + child: Text("์ œ๋ชฉ",style: textStyle.bk14midium,), + ), + ), + Padding(padding: EdgeInsets.only(top:0,left: 20, right:20), + child: TextField( + controller: titleController, + decoration: InputDecoration( + contentPadding: EdgeInsets.only(top:3, left: 0), + hintStyle: textStyle.grey16normal, + border: InputBorder.none, + focusedBorder: InputBorder.none, + hintText: '์ œ๋ชฉ์„ ์ž…๋ ฅํ•˜์„ธ์š”.'),), + ), + ], + ), + ), + SizedBox( + height: 8, + ), + + Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(16), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + alignment: Alignment.topLeft, + child: Padding(padding: EdgeInsets.only(top:16,left: 16, right:16), + child: Text("๋‚ ์งœ", style: textStyle.bk14midium,), + ), + ), + SizedBox(height: 8,), + Padding(padding: EdgeInsets.only(top:0, left: 16, right:16, bottom: 8), + child: + Row(children: [ + Container( + width: 225, + child: modiDate? + Container( + height: 20, + child: TextField( + controller: dateController, + decoration: InputDecoration( + contentPadding: EdgeInsets.only(bottom:13), + hintStyle: textStyle.grey16normal, + border: InputBorder.none, + focusedBorder: InputBorder.none, + hintText: '2000-00-00'), + onTap: (){ + + }, + ),) + + : Text( "${_imageDate}", style: textStyle.bk16normal,), + ), + if(modiDate == false)...[ + SizedBox(width: 30,), + Container( + height: 24, + width: 62, + child: ElevatedButton( + onPressed: (){ + modiDate = true; + setState(() { + }); + }, + style: buttonChart().pinkbtn2, + child: Text("์ˆ˜์ •", style: textStyle.white16midium,) + ),) + ]else...[ + SizedBox(width: 30,), + Container( + height: 24, + width: 62, + child: ElevatedButton( + onPressed: (){ + modiDate = false; + _imageDate = dateController.text; + setState(() { + }); + }, + style: buttonChart().bluebtn, + child: Text("์™„๋ฃŒ", style: textStyle.white16midium,) + ),) + ] + ],), + ), + SizedBox(height: 6,), + ], + ), + ), + SizedBox( + height: 8, + ), + + Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(16), + ), + child: Column( + children: [ + Container( + alignment: Alignment.topLeft, + child: Padding(padding: EdgeInsets.only(top:16,left: 16, right:16), + child: Text("์œ„์น˜",style: textStyle.bk14midium,), + ), + ), + Padding(padding: EdgeInsets.only(top:0,left: 16, right:16), + child: + Row(children: [ + Container(width: 255, + child: TextField( + controller: locationController, + decoration: InputDecoration( + contentPadding: EdgeInsets.only(top:3, left: 0), + hintStyle: textStyle.grey16normal, + border: InputBorder.none, + focusedBorder: InputBorder.none, + hintText: '์œ„์น˜๋ฅผ ์ ๊ฑฐ๋‚˜ ์ž…๋ ฅํ•ด์ฃผ์„ธ์š”.'),), + ), + // Container( + // height: 25, + // width: 57, + // child: ElevatedButton( + // onPressed: (){ + // }, + // style: buttonChart().pinkbtn2, + // child: Text("๊ฒ€์ƒ‰", style: textStyle.white16midium,) + // ),) + ],), + + ), + ], + ), + ), + SizedBox( + height: 8, + ), + + Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(16), + ), + child: Column( + children: [ + Container( + alignment: Alignment.topLeft, + child: Padding(padding: EdgeInsets.only(top:16,left: 16, right:16), + child: Text("๋‚ด์šฉ", style: textStyle.bk14midium,), + ), + ), + Padding( + padding: + EdgeInsets.only(top: 0, left: 16, right: 16, bottom: 16), + child: TextField( + controller: contentController, + decoration: InputDecoration( + contentPadding: EdgeInsets.only(top:3, left:0), + hintStyle: textStyle.grey16normal, + border: InputBorder.none, + focusedBorder: InputBorder.none, + hintText: '๊ทธ๋‚ ์˜ ์ด์•ผ๊ธฐ๋ฅผ ์ ์–ด์ฃผ์„ธ์š”.'), + maxLines: null, + ), + ), + ], + ), + ), + + SizedBox( + height: 8, + ), + + Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(16), + ), + child: Column( + children: [ + Container( + alignment: Alignment.topLeft, + child: Padding(padding: EdgeInsets.only(top:16,left: 16, right:16), + child: Text("ํ•ด์‹œํƒœ๊ทธ", style: textStyle.bk14midium,), + ), + ), + Padding( + padding: EdgeInsets.only(top:0,left: 16, right:16), + child: TextField( + controller: hashtagController, + decoration: InputDecoration( + contentPadding: EdgeInsets.only(top:3, left: 0), + hintStyle: textStyle.grey16normal, + border: InputBorder.none, + focusedBorder: InputBorder.none, + hintText: '#ํ•ด์‹œํƒœ๊ทธ๋ฅผ ์‚ฌ์šฉํ•ด๋ณด์„ธ์š”.'),), + ), + ], + ), + ), + SizedBox(height: 8,), + + Container( + padding: EdgeInsets.all(16), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(16), + ), + child: Column( + children: [ + Container( + alignment: Alignment.topLeft, + child: Padding(padding: EdgeInsets.only(top:0), + child: Text("๊ณต๊ฐœ ์„ค์ •",style: textStyle.bk14midium), + ), + ), + SizedBox(height: 8,), + Container( + alignment: Alignment.topLeft, + child: Padding(padding: EdgeInsets.only(top:8), + child: Text("์ด ๋ฉ”๋ชจ๋ฆฌ์–ผ์„ ๊ณต๊ฐœํ•˜๋ฉด ๋‹ค๋ฅธ ๋ฐ˜๋ ค์ธ๋“ค์˜ '๊ตฌ๊ฒฝํ•˜๊ธฐ'ํŽ˜์ด์ง€์— ๊ณต์œ ๋ฉ๋‹ˆ๋‹ค.",style: TextStyle(fontSize: 11, color: Color(0xff555555)),), + ), + ), + SizedBox(height: 16,), + Row( + children: [ + //SizedBox(width: 20,), + Container( + height: 26, + width: 100, + child: ElevatedButton(onPressed: (){ + isPrivate = "False"; + private = false; + setState(() { + }); + }, + style: private? buttonChart().bluebtn4 : buttonChart().bluebtn2, + child: Text("๊ณต๊ฐœ", style: private? textStyle.bk14light :textStyle.bk14midium,) + ), + ), + SizedBox(width: 8,), + Container( + height: 26, + width: 100, + child: ElevatedButton(onPressed: (){ + isPrivate = "True"; + private = true; + setState(() { + }); + }, + style: private? buttonChart().bluebtn2 : buttonChart().bluebtn4, + child: Text("๋น„๊ณต๊ฐœ", style: private? textStyle.bk14midium :textStyle.bk14light,) + ), + ), + ], + ) + ], + ) + ), + + ], + ), + ), + ) + + ) + ); + + } +} diff --git a/client/lib/conversation/intro/intro_story.dart b/client/lib/conversation/intro/intro_story.dart new file mode 100644 index 0000000..2a86292 --- /dev/null +++ b/client/lib/conversation/intro/intro_story.dart @@ -0,0 +1,501 @@ +import 'dart:async'; +import 'dart:convert'; +import 'package:flutter/material.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter_svg/svg.dart'; +import 'package:http/http.dart' as http; +import 'package:client/conversation/intro/start_intro.dart'; +import 'package:client/style.dart'; +import 'package:just_audio/just_audio.dart'; + +/// ์ธํŠธ๋กœ_์Šคํ† ๋ฆฌ๋ณด๋“œ +class IntroStoryPage extends StatefulWidget { + + static Future navigatorPush(BuildContext context) async { + return Navigator.push( + context, + MaterialPageRoute( + builder: (_) => IntroStoryPage(), + ), + ); + } + + @override + _IntroStoryPageState createState() => _IntroStoryPageState(); +} + +class _IntroStoryPageState extends State { + + List voice =[ + "", + "assets/voice/story/pup1.mp3", + "assets/voice/story/muji1.mp3", + "assets/voice/story/pup2.mp3", + "assets/voice/story/muji2.mp3", + "assets/voice/story/pup3.mp3", + "assets/voice/story/pup4.mp3", + "assets/voice/story/pup5.mp3", + "assets/voice/story/pup6.mp3", + "", + "", "","", + ]; + + List img =[ + "assets/images/story/story1.svg", + "assets/images/story/story2.svg", + "assets/images/story/story3.svg", + "assets/images/story/story4.svg", + "assets/images/story/story5.svg", + "assets/images/story/story6.svg", + "assets/images/story/story7.svg", + "assets/images/story/story8.svg", + "assets/images/story/story9.svg", + "assets/images/story/story10.svg", + "assets/images/story/story11.svg", + ]; + + bool finish = false; // ๋งˆ๋ฌด๋ฆฌ + AudioPlayer player2 = AudioPlayer(); + + FocusNode _focusNode = FocusNode(); + + @override + void initState() { + super.initState(); + + _focusNode.addListener(_onFocusChange); + } + + void _onFocusChange() { + if (_focusNode.hasFocus) { + // ํ‚ค๋ณด๋“œ ์˜ฌ๋ฆฌ๊ธฐ + FocusScope.of(context).requestFocus(_focusNode); + } + } + + @override + void dispose() async { + super.dispose(); + } + + int nextPage = 0; + List introText =[]; + int voiceCount = 0; + int nextQuestion = 0; + + + @override + Widget build(BuildContext context) { + MediaQueryData deviceData = MediaQuery.of(context); + Size screenSize = deviceData.size; + return + Container( + decoration: BoxDecoration( + image: DecorationImage( + fit: BoxFit.cover, + image: AssetImage('assets/images/story/background2.png'), // ๋ฐฐ๊ฒฝ ์ด๋ฏธ์ง€ + ), + ), + //color: Color(0xffDDE7FD), + child: GestureDetector( + onTap: (){ + print(nextQuestion); + if(nextPage <11){ + nextPage++; + voiceCount++; + player2.setAsset(voice[voiceCount]); + player2.play(); + if(nextPage == 11){ + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => StartIntroPage())); + } + }else if(nextPage == 11){ + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => StartIntroPage())); + } + + setState(() { + }); + }, + child: Scaffold( + backgroundColor: Colors.transparent, + appBar: AppBar( + //title: Text("๊ธฐ์–ตํ• ๊ฐœ", style: TextStyle(fontSize:16, color: Colors.white ),), + //centerTitle: true, + backgroundColor: Colors.transparent, + elevation: 0.0, + automaticallyImplyLeading: false, + ),extendBodyBehindAppBar: true, + + body: + Container( + child: Column( + children: [ + if(nextPage == 0)...[ + SizedBox(height: 300,), + Center( + child: Image.asset( + 'assets/images/story/bbk1.png', + ), + ), + SizedBox(height: 16,), + Stack( + children: [ + Text( + '"..."', + textAlign: TextAlign.center, + style: TextStyle( + fontFamily: 'Nanum-BaReunHiPi', + //color: Color(0xff4B5396), + fontSize: 16,height: 1.4, + foreground: Paint() + ..style = PaintingStyle.stroke + ..strokeWidth = 2 + ..color = Colors.white, + ), + ), + Text('"..."',style: textStyle.bubbletext2,textAlign: TextAlign.center,), + ], + ) + + ]else if(nextPage == 1)...[ + SizedBox(height: 300,), + Center( + child: Stack( + children: [ + Image.asset( + 'assets/images/story/bbk2.png', + ), + Padding(padding: EdgeInsets.only(left: 80, top: 50), + child: SvgPicture.asset( + 'assets/images/story/st1.svg', + ), + ), + ], + ) + ), + SizedBox(height: 16,), + Stack( + children: [ + Text( + '"๊ทธ๋ ‡๊ฒŒ ๋‚˜๋Š” ์—ฌ๊ธฐ๋กœ ์˜ค๊ฒŒ ๋์–ด.\n๋ฌด์ง€๋Š” ํ•ญ์ƒ ์ด๊ณณ์—์„œ ๊ฐ•์•„์ง€๋“ค์„ ๋ฐฐ์›…ํ•ด ์ฃผ๋Š”๊ฑฐ์•ผ?"', + textAlign: TextAlign.center, + style: TextStyle( + fontFamily: 'Nanum-BaReunHiPi', + //color: Color(0xff4B5396), + fontSize: 16,height: 1.4, + foreground: Paint() + ..style = PaintingStyle.stroke + ..strokeWidth = 2 + ..color = Colors.white, + ), + ), + + Text('"๊ทธ๋ ‡๊ฒŒ ๋‚˜๋Š” ์—ฌ๊ธฐ๋กœ ์˜ค๊ฒŒ ๋์–ด.\n๋ฌด์ง€๋Š” ํ•ญ์ƒ ์ด๊ณณ์—์„œ ๊ฐ•์•„์ง€๋“ค์„ ๋ฐฐ์›…ํ•ด ์ฃผ๋Š”๊ฑฐ์•ผ?"', + style: textStyle.bubbletext2,textAlign: TextAlign.center,), + ], + ) + + ]else if(nextPage == 2)...[ + SizedBox(height: 236,), + Stack( + children: [ + Text( + '"๋งž์•„. ๊ฐ•์•„์ง€๋ณ„๋กœ ํ–ฅํ•˜๋Š”\n์ด ๋ฌด์ง€๊ฐœ ๋‹ค๋ฆฌ์—์„œ ๋ง๋™๋ฌด๊ฐ€ ๋˜์–ด์ฃผ๊ณค ํ•˜์ง€."', + textAlign: TextAlign.center, + style: TextStyle( + fontFamily: 'Nanum-BaReunHiPi', + //color: Color(0xff4B5396), + fontSize: 16,height: 1.4, + foreground: Paint() + ..style = PaintingStyle.stroke + ..strokeWidth = 2 + ..color = Color(0xffFCCBCD), + ), + ), + Text('"๋งž์•„. ๊ฐ•์•„์ง€๋ณ„๋กœ ํ–ฅํ•˜๋Š”\n์ด ๋ฌด์ง€๊ฐœ ๋‹ค๋ฆฌ์—์„œ ๋ง๋™๋ฌด๊ฐ€ ๋˜์–ด์ฃผ๊ณค ํ•˜์ง€."', + style: textStyle.bubbletext2,textAlign: TextAlign.center,), + ], + ), + SizedBox(height: 20,), + Center( + child: Stack( + children: [ + Image.asset( + 'assets/images/story/bbk2.png', + ), + Padding(padding: EdgeInsets.only(left: 100, top: 52), + child: SvgPicture.asset( + 'assets/images/story/st2.svg', + ), + ), + ], + ) + ), + + ]else if(nextPage == 3)...[ + SizedBox(height: 300,), + Center( + child: Stack( + children: [ + Image.asset( + 'assets/images/story/bbk2.png', + ), + Padding(padding: EdgeInsets.only(left: 80, top: 50), + child: SvgPicture.asset( + 'assets/images/story/st3.svg', + ), + ), + ], + ) + ), + SizedBox(height: 16,), + Stack( + children: [ + Text( + '"๊ทธ๋ ‡๊ตฌ๋‚˜. ๋•๋ถ„์— ์‹ฌ์‹ฌํ•˜์ง€ ์•Š์•„.\nํ•˜์ง€๋งŒโ€ฆ"', + textAlign: TextAlign.center, + style: TextStyle( + fontFamily: 'Nanum-BaReunHiPi', + //color: Color(0xff4B5396), + fontSize: 16,height: 1.4, + foreground: Paint() + ..style = PaintingStyle.stroke + ..strokeWidth = 2 + ..color = Colors.white, + ), + ), + Text('"๊ทธ๋ ‡๊ตฌ๋‚˜. ๋•๋ถ„์— ์‹ฌ์‹ฌํ•˜์ง€ ์•Š์•„.\nํ•˜์ง€๋งŒโ€ฆ"', style: textStyle.bubbletext2,textAlign: TextAlign.center,), + ], + ) + + ]else if(nextPage == 4)...[ + SizedBox(height: 252,), + Stack( + children: [ + Text( + '"๋ฌด์Šจ ์ผ์ด์•ผ?"', + textAlign: TextAlign.center, + style: TextStyle( + fontFamily: 'Nanum-BaReunHiPi', + //color: Color(0xff4B5396), + fontSize: 16,height: 1.4, + foreground: Paint() + ..style = PaintingStyle.stroke + ..strokeWidth = 2 + ..color = Color(0xffFCCBCD), + ), + ), + Text('"๋ฌด์Šจ ์ผ์ด์•ผ?"', style: textStyle.bubbletext2,), + ], + ), + SizedBox(height: 26,), + Center( + child: Stack( + children: [ + Image.asset( + 'assets/images/story/bbk2.png', + ), + Padding(padding: EdgeInsets.only(left: 100, top: 51), + child: SvgPicture.asset( + 'assets/images/story/st4.svg', + ), + ), + ], + ) + ), + + ]else if(nextPage == 5)...[ + SizedBox(height: 300,), + Center( + child: Stack( + children: [ + Image.asset( + 'assets/images/story/bbk2.png', + ), + Padding(padding: EdgeInsets.only(left: 112, top: 50), + child: SvgPicture.asset( + 'assets/images/story/st5.svg', + ), + ), + ], + ) + ), + SizedBox(height: 16,), + Stack( + children: [ + Text( + '"์šฐ๋ฆฌ ์ฃผ์ธ์ด ๊ฑฑ์ •๋ผ์„œ.\n์ด์   ๋‚ด๊ฐ€ ์ฃผ์ธ ๊ณ์— ์—†์œผ๋‹ˆ,\n์ฃผ์ธ์ด ์Šฌํผํ•  ๋•Œ ์œ„๋กœํ•ด์ค„ ์ˆ˜ ์—†์–ด."', + textAlign: TextAlign.center, + style: TextStyle( + fontFamily: 'Nanum-BaReunHiPi', + //color: Color(0xff4B5396), + fontSize: 16,height: 1.4, + foreground: Paint() + ..style = PaintingStyle.stroke + ..strokeWidth = 2 + ..color = Colors.white, + ), + ), + Text('"์šฐ๋ฆฌ ์ฃผ์ธ์ด ๊ฑฑ์ •๋ผ์„œ.\n์ด์   ๋‚ด๊ฐ€ ์ฃผ์ธ ๊ณ์— ์—†์œผ๋‹ˆ,\n์ฃผ์ธ์ด ์Šฌํผํ•  ๋•Œ ์œ„๋กœํ•ด์ค„ ์ˆ˜ ์—†์–ด."', + style: textStyle.bubbletext2,textAlign: TextAlign.center,), + ], + ) + + ]else if(nextPage == 6)...[ + SizedBox(height: 300,), + Center( + child: Stack( + children: [ + Image.asset( + 'assets/images/story/bbk2.png', + ), + Padding(padding: EdgeInsets.only(left: 100, top: 50), + child: SvgPicture.asset( + 'assets/images/story/st6.svg', + ), + ), + ], + ) + ), + SizedBox(height: 16,), + Stack( + children: [ + Text( + '"๋ฒŒ์จ ๋‹ค ์™”๋„ค."', + textAlign: TextAlign.center, + style: TextStyle( + fontFamily: 'Nanum-BaReunHiPi', + //color: Color(0xff4B5396), + fontSize: 16,height: 1.4, + foreground: Paint() + ..style = PaintingStyle.stroke + ..strokeWidth = 2 + ..color = Colors.white, + ), + ), + Text('"๋ฒŒ์จ ๋‹ค ์™”๋„ค."', style: textStyle.bubbletext2,), + ], + ) + + ]else if(nextPage == 7)...[ + SizedBox(height: 300,), + Center( + child: Stack( + children: [ + Image.asset( + 'assets/images/story/bbk2.png', + ), + Padding(padding: EdgeInsets.only(left: 112, top: 50), + child: SvgPicture.asset( + 'assets/images/story/st7.svg', + ), + ), + ], + ) + ), + SizedBox(height: 16,), + Stack( + children: [ + Text( + '"๋ฌด์ง€, ํ˜น์‹œ ๋‚ด๊ฐ€ ๋ถ€ํƒ ํ•˜๋‚˜๋งŒ ํ•ด๋„ ๋ ๊นŒ?"', + textAlign: TextAlign.center, + style: TextStyle( + fontFamily: 'Nanum-BaReunHiPi', + //color: Color(0xff4B5396), + fontSize: 16,height: 1.4, + foreground: Paint() + ..style = PaintingStyle.stroke + ..strokeWidth = 2 + ..color = Colors.white, + ), + ), + Text('"๋ฌด์ง€, ํ˜น์‹œ ๋‚ด๊ฐ€ ๋ถ€ํƒ ํ•˜๋‚˜๋งŒ ํ•ด๋„ ๋ ๊นŒ?"', style: textStyle.bubbletext2,textAlign: TextAlign.center,), + ], + ) + + ]else if(nextPage == 8)...[ + SizedBox(height: 300,), + Center( + child: Stack( + children: [ + Image.asset( + 'assets/images/story/bbk2.png', + ), + Padding(padding: EdgeInsets.only(left: 100, top: 52), + child: SvgPicture.asset( + 'assets/images/story/st8.svg', + ), + ), + ], + ) + ), + SizedBox(height: 16,), + Stack( + children: [ + Text( + '"์šฐ๋ฆฌ ์ฃผ์ธ์ด ๋‚˜ ์—†์ด๋„ ์•ˆ์˜จํ•œ ์ผ์ƒ์„ ๋ณด๋‚ผ ์ˆ˜ ์žˆ๋„๋ก ๋„์™€์ค˜."', + textAlign: TextAlign.center, + style: TextStyle( + fontFamily: 'Nanum-BaReunHiPi', + //color: Color(0xff4B5396), + fontSize: 16,height: 1.4, + foreground: Paint() + ..style = PaintingStyle.stroke + ..strokeWidth = 2 + ..color = Colors.white, + ), + ), + Text('"์šฐ๋ฆฌ ์ฃผ์ธ์ด ๋‚˜ ์—†์ด๋„ ์•ˆ์˜จํ•œ ์ผ์ƒ์„ ๋ณด๋‚ผ ์ˆ˜ ์žˆ๋„๋ก ๋„์™€์ค˜."', + style: textStyle.bubbletext2,textAlign: TextAlign.center,), + ], + ) + ]else if(nextPage == 9)...[ + SizedBox(height: 300,), + Center( + child: Stack( + children: [ + Image.asset( + 'assets/images/story/bbk1.png', + ), + ], + ) + ), + + ]else if(nextPage == 10)...[ + SizedBox(height: 300,), + Center( + child: Stack( + children: [ + Image.asset( + 'assets/images/story/bbk2.png', + ), + Padding(padding: EdgeInsets.only(left: 100, top: 74), + child: SvgPicture.asset( + 'assets/images/story/st9.svg', + ), + ), + ], + ) + ), + + ]else if(nextPage == 11)...[ + + + ] + ], + ), + ), + + ), + ) + + ); + + } +} diff --git a/client/lib/conversation/intro/start_intro.dart b/client/lib/conversation/intro/start_intro.dart new file mode 100644 index 0000000..f016235 --- /dev/null +++ b/client/lib/conversation/intro/start_intro.dart @@ -0,0 +1,225 @@ +import 'dart:async'; +import 'dart:convert'; +import 'package:flutter/material.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter_svg/svg.dart'; +import 'package:client/conversation/intro/intro.dart'; +import 'package:client/style.dart'; +import 'package:just_audio/just_audio.dart'; +import 'package:flutter_gif/flutter_gif.dart'; + +/// ์ธํŠธ๋กœ ์‹œ์ž‘ + +AudioPlayer player2 = AudioPlayer(); + +late FlutterGifController controller1, controller2, controller3; + +class StartIntroPage extends StatefulWidget { + + static Future navigatorPush(BuildContext context) async { + return Navigator.push( + context, + MaterialPageRoute( + builder: (_) => StartIntroPage(), + ), + ); + } + + @override + _StartIntroPageState createState() => _StartIntroPageState(); +} + +class _StartIntroPageState extends State with TickerProviderStateMixin { + + + FocusNode _focusNode = FocusNode(); + + + @override + void initState() { + super.initState(); + // ์Œ์› ์ ์šฉ + + controller1 = FlutterGifController(vsync: this); + + _focusNode.addListener(_onFocusChange); + } + + void _onFocusChange() { + if (_focusNode.hasFocus) { + // ํ‚ค๋ณด๋“œ ์˜ฌ๋ฆฌ๊ธฐ + FocusScope.of(context).requestFocus(_focusNode); + } + } + + @override + void dispose() async { + super.dispose(); + } + + List introText =[]; + int nextQuestion = 0; + int voiceCount = 0; + + @override + Widget build(BuildContext context) { + MediaQueryData deviceData = MediaQuery.of(context); + Size screenSize = deviceData.size; + return + Container( + decoration: BoxDecoration( + gradient: LinearGradient( + begin: Alignment.topRight, + end: Alignment.bottomLeft, + colors: [ + Color(0xffE4ECFF), + Color(0xffA2BEFF), + ], + ) + ), + + child: GestureDetector( + onTap: (){ + print("ํ™•์ธ: " + nextQuestion.toString()); + setState(() { + }); + }, + child: Scaffold( + backgroundColor: Colors.transparent, + appBar: AppBar( + title: + Container( + width: screenSize.width, + height: 46, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox(height: 18,), + SvgPicture.asset( + 'assets/images/logo/pup_logo.svg', + height: 25.41, + width: 110.19, + fit: BoxFit.cover, + ), + ], + ), + ), + + backgroundColor: Colors.transparent, + elevation: 0.0, + automaticallyImplyLeading: false, + ), + //extendBodyBehindAppBar: true, + body: + SingleChildScrollView( + child: Container( + child: Column( + children: [ + SizedBox(height: 60,), + Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children:[ + SizedBox( + height: 10, + ), + Stack( + children: [ + Container( + height: 157, + width: screenSize.width, + child: + Stack( + children: [ + Center(child: SvgPicture.asset('assets/images/conversation/intro/intro_bubble.svg',fit: BoxFit.fill,),), + Container( + padding: const EdgeInsets.symmetric(horizontal: 32, vertical: 12, ), + child: Center( + child: Column( + children: [ + SizedBox(height: 39,), + Text( + "๋‹น์‹ ์˜ ๋งˆ์Œ์— ์•ˆ์ •์ด ์ฐพ์•„์˜ค๋Š” ๊ทธ๋‚ ๊นŒ์ง€.\n๊ธฐ์–ตํ• ๊ฐœ์™€ ํ•จ๊ป˜.", + textAlign: TextAlign.center, + style: textStyle.introbubbletext, + ), + ], + ) + ) + ), + ], + ) + ), + // ๋ฌด์ง€ ์œ„์น˜ + Column( + children: [ + SizedBox(height: 188,), + Image.asset( + 'assets/images/story/bbkcloud.png', + width: screenSize.width, + fit: BoxFit.fill, + ), + ], + ), + + Padding( + padding: EdgeInsets.only(left: 95, top: 245), + child: SvgPicture.asset( + 'assets/images/story/muji3.svg', + height: 215, + width: 204, + fit: BoxFit.fill, + ), + ), + ], + ), + + ], + ), + ], + ), + ), + ), + // // nextQuestion ์ด 3๊ณผ 7์ผ๋•Œ ๋“ฑ์žฅ + bottomSheet: Padding( + padding: EdgeInsets.only( + bottom: MediaQuery.of(context).viewInsets.bottom * 0.001), + child: Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Container( + color: Color(0xffFFFFFF).withOpacity(0.0), + child: Padding( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 24), + child: Container( + + width: screenSize.width, + height: 40, + child: ElevatedButton( + style: buttonChart().bluebtn3, + onPressed: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => IntroPage())); + }, + child: Text("๊ธฐ์–ตํ• ๊ฐœ ์‹œ์ž‘ํ•˜๊ธฐ", style: TextStyle( + fontFamily: 'Pretendard', + fontSize: 16, fontWeight: FontWeight.w500, color: Color(0xffFFFFFF))), + ), + ),), + ), + ], + ), + )), + ) + + ); + + } +} + diff --git a/client/lib/conversation/late_period/late.dart b/client/lib/conversation/late_period/late.dart new file mode 100644 index 0000000..dee0ec9 --- /dev/null +++ b/client/lib/conversation/late_period/late.dart @@ -0,0 +1,1477 @@ +import 'dart:async'; +import 'dart:convert'; +import 'package:flutter/material.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter_svg/svg.dart'; +import 'package:client/conversation/late_period/late_watch_others.dart'; +import 'package:client/screen.dart'; +import 'package:http/http.dart' as http; +import 'package:client/progressbar/animation_progressbar.dart'; +import 'package:client/sign/sign_in.dart'; +import 'package:client/style.dart'; +import 'package:intl/intl.dart'; +import 'package:just_audio/just_audio.dart'; +import 'package:flutter_gif/flutter_gif.dart'; +import 'package:client/home.dart' as home; +import 'package:client/sign/sign_in.dart' as sign_in; +import 'package:client/main.dart'as main; +import 'package:intl/intl.dart'; + +/// ํ›„๊ธฐ ๋Œ€ํ™”-๊ธฐ์–ต + +AudioPlayer player2 = AudioPlayer(); + +late FlutterGifController controller1, controller2, controller3; +int voiceCount = 0; +List voice =[ + "assets/voice/late/late1.mp3", + "assets/voice/late/late2.mp3", + "assets/voice/late/late3.mp3", + "assets/voice/late/late4.mp3", + "assets/voice/late/late5.mp3", + "assets/voice/late/late6.mp3", + "assets/voice/late/late7.mp3", + "assets/voice/late/late8.mp3", + "assets/voice/late/late9.mp3", + "assets/voice/late/late10.mp3", + "assets/voice/late/late11.mp3", + "assets/voice/late/late12.mp3", + "assets/voice/late/late13.mp3", + "assets/voice/late/late14.mp3", + "assets/voice/late/late15.mp3", + "assets/voice/late/late16.mp3", + "assets/voice/late/late17.mp3", + "assets/voice/late/late18.mp3", + "assets/voice/late/late19.mp3", + "assets/voice/late/late20.mp3", + "assets/voice/late/late21.mp3", + "assets/voice/late/late22.mp3", + "assets/voice/late/late23.mp3", + "assets/voice/late/late24.mp3", + "assets/voice/late/late25.mp3", + "assets/voice/late/late26.mp3", + "assets/voice/late/late27.mp3", + "assets/voice/late/late28.mp3", + "assets/voice/late/late29.mp3", + "assets/voice/late/late30.mp3", + "assets/voice/late/late31.mp3", + "assets/voice/late/late32.mp3", + "assets/voice/late/late33.mp3", + "assets/voice/late/late34.mp3", +]; + +List endVoice =[ + "assets/voice/intro/intro2_8.mp3", + "", + "assets/voice/intro/intro2_9.mp3", +]; + +List lateConversation =[ + "๋„ค, ์˜ค๋Š˜์€ ", //0 + "${home.puppy}์˜ ๋นˆ์ž๋ฆฌ์— ๋Œ€ํ•ด ์–˜๊ธฐํ•ด ๋ณด์•„์š”.", //1 + "${home.puppy}๊ฐ€ ๊ณ์„ ๋– ๋‚œ ์ˆœ๊ฐ„,", //2 + "๊ฐ์ •์ ์ธ ๊ณต๋ฐฑ์€ \n์–ด๋”˜๊ฐ€์— ๊นŠ์ด ๋‚จ์•„์žˆ์„ ๊ฑฐ์˜ˆ์š”.", //3 + "ํ•˜์ง€๋งŒ ๊ทธ ๊ฐ์ •์„ ๋‹ค๋ฅด๊ฒŒ ๋ฐ›์•„๋“ค์ด๊ณ ,", //4 + "${home.puppy}์™€ ํ•จ๊ป˜ํ•œ\n์ˆœ๊ฐ„๋“ค์„ ์ƒ๊ฐํ•ด๋ณธ๋‹ค๋ฉด", //5 + "๊ฐ์ •์ ์ธ ๊ณต๋ฐฑ์ด ์ฑ„์›Œ์งˆ ๊ฑฐ์˜ˆ์š”.", //6 + "${home.puppy}๊ฐ€ ์—†๋Š” ์‚ถ์—์„œ", //7 + "${home.user}๋‹˜์€\n์–ด๋–ค ๊ฒฝํ—˜์„ ํ–ˆ๋‚˜์š”? ", //8 + "๋„ค, ๊ทธ๋ ‡๊ตฐ์š”. ", //9 + "์•ž์„  ๊ฒฝํ—˜๋“ค์„ ํ†ตํ•ด์„œ\n${home.user}๋‹˜์—๊ฒŒ", // 10 + "์–ด๋–ค ๋ณ€ํ™”๊ฐ€ ์ƒ๊ฒผ์„๊นŒ์š”?", //11 + "${home.user}๋‹˜์—๊ฒŒ\n๊ทธ๋Ÿฐ ๋ณ€ํ™”๊ฐ€ ์žˆ์—ˆ๊ตฐ์š”.", //12 + "๊ทธ๋ ‡๋‹ค๋ฉด ๊ทธ๋Ÿฐ ๋ณ€ํ™”๋“ค์„ ๋งˆ์ฃผํ•˜๊ณ ", //13 + "์ฆ๊ฑฐ์› ๋˜ ์ˆœ๊ฐ„๋“ค์ด ์žˆ๋‚˜์š”?", //14 + "์ผ์ƒ ์†์—์„œ ${home.user}๋‹˜์„ ๊ดด๋กญํžˆ๋Š”", //15 + "๋ณต์žกํ•œ ์ƒ๊ฐ๋“ค์„ ์ •๋ฆฌํ•˜๊ธฐ ์œ„ํ•ด์„œ\n์–ด๋–ค ํ–‰๋™์„ ํ•˜๋Š”์ง€", //16 + "๊ณต๊ฐ„, ์‹œ๊ฐ„, ํ–‰๋™, ๊ด€๊ณ„๋กœ ๋‚˜๋ˆ„์–ด\n์ƒ๊ฐํ•ด๋ณด์•„์š”.", //17 + "์–ด๋А ๊ณณ์—์„œ ์ƒ๊ฐ์„ ์ •๋ฆฌํ–ˆ๋‚˜์š”?", //18 + "์ฃผ๋กœ ์–ธ์ œ ์ƒ๊ฐ์„ ์ •๋ฆฌํ–ˆ๋‚˜์š”?", //19 + "๋ฌด์—‡์„ ํ•˜๋ฉฐ ์ƒ๊ฐ์„ ์ •๋ฆฌํ–ˆ๋‚˜์š”?", //20 + "๋ˆ„๊ตฌ์™€ ์ƒ๊ฐ์„ ์ •๋ฆฌํ–ˆ๋‚˜์š”?", //21 + "๊ทธ๋ ‡๊ตฐ์š”.", //22 + "ํž˜๋“  ์ƒํ™ฉ์—์„œ ์‚ฌ๋žŒ๋“ค๊ณผ ์†Œํ†ตํ•˜๊ณ \n๊ต๋ฅ˜ํ•˜๋Š” ๊ฑด ์ค‘์š”ํ•ด์š”.", //23 + "์–ธ์ œ๋‚˜ ${home.user}๋‹˜ ๊ณ์—\n์นœ๊ตฌ์™€ ๊ฐ€์กฑ์ด ์žˆ๊ณ ,", //24 + "๊ทธ๋ถ„๋“ค์€ ${home.user}๋‹˜์„\n์ง€์ง€ํ•˜๊ณ  ๊ธฐ๋‹ค๋ฆฌ๊ณ  ์žˆ์–ด์š”.", //25 + "โ€˜ํ•จ๊ป˜ํ• ๊ฒŒโ€™์—์„œ\n์œ„๋กœ์˜ ๋ง์„ ์ฃผ๊ณ  ๋ฐ›์œผ๋ฉฐ", //26 + "ํ•จ๊ป˜ ๊ฐ์ •์„ ๋‚˜๋ˆ ๋ณด์•„์š”.", // 27 + "${home.user}๋‹˜,\n${home.puppy}์™€ ํ•จ๊ป˜ํ•œ ์ˆœ๊ฐ„๋“ค์€", //28 + "๋” ์—†์ด ํŠน๋ณ„ํ•˜๊ณ  ๊ฐ’์ง„ ๊ฒฝํ—˜์ด์ง€๋งŒ,", //29 + "${home.puppy}๊ฐ€\n์—†๋Š” ์‚ถ์—์„œ๋„", //30 + "์ƒˆ๋กœ์šด ๊ฒฝํ—˜์„ ์ฐพ์•„๋‚˜๊ฐ€๋ฉฐ\nํ–‰๋ณต์„ ๋งŒ๋“ค์–ด๊ฐˆ ์ˆ˜ ์žˆ์–ด์š”.", //31 + "๊ทธ๋ฆฌ๊ณ  ์ด ๊ณผ์ •์—์„œ\n๋”์šฑ ๋” ๋‚˜ ์ž์‹ ์„ ์ดํ•ดํ•˜๊ณ ", //32 + "๋ฐœ์ „์‹œํ‚ฌ ์ˆ˜ ์žˆ๋‹ค๋Š” ๊ฒƒ๋„\n์•Œ๊ฒŒ ๋˜์—ˆ์œผ๋ฉด ์ข‹๊ฒ ์–ด์š”.", //33 +]; + +List questionsEnd =[ + "์ž, ์ด์ œ ์šฐ๋ฆฌ๊ฐ€ ๋‹ค์‹œ\n๋งŒ๋‚˜๊ฒŒ ๋  ์‹œ๊ฐ„์„ ์•Œ๋ ค์ฃผ์„ธ์š”.", + "์ž, ์ด์ œ ์šฐ๋ฆฌ๊ฐ€ ๋‹ค์‹œ\n๋งŒ๋‚˜๊ฒŒ ๋  ์‹œ๊ฐ„์„ ์•Œ๋ ค์ฃผ์„ธ์š”.", +]; + +class LatePage extends StatefulWidget { + + static Future navigatorPush(BuildContext context) async { + return Navigator.push( + context, + MaterialPageRoute( + builder: (_) => LatePage(), + ), + ); + } + + @override + _LatePageState createState() => _LatePageState(); +} + +class _LatePageState extends State with TickerProviderStateMixin { + + bool end = false; // ๋Œ€ํ™” ๋งˆ๋ฌด๋ฆฌ ๋‹จ๊ณ„ ์ง„์ž… + + int nextQuestion = 0; + int nextEnd = 0; + + int voiceEndCount = 0; + + bool selectedNextTime = false; + bool chooseTime = false; + int whatTime = 0; + + bool exp = false; + bool change = false; + bool joy = false; + bool where = false; + bool when = false; + bool what = false; + bool who = false; + + // ํ…์ŠคํŠธ ์—๋””ํŒ… ์ปจํŠธ๋กค๋Ÿฌ๋ฅผ ์ƒ์„ฑํ•˜์—ฌ ํ•„๋“œ์— ํ• ๋‹น + final expController = TextEditingController(); // nextQuestion = 15์ผ๋•Œ + final changeController = TextEditingController(); // nextQuestion = 19์ผ๋•Œ + final joyController = TextEditingController(); // nextQuestion = 20์ผ๋•Œ + final whereController = TextEditingController(); // nextQuestion = 21์ผ๋•Œ + final whenController = TextEditingController(); // nextQuestion = 12์ผ๋•Œ + final whatController = TextEditingController(); // nextQuestion = 12์ผ๋•Œ + final whoController = TextEditingController(); // nextQuestion = 12์ผ๋•Œ + + final nextTimeController = TextEditingController(); // nextQuestion = 12์ผ๋•Œ + + + FocusNode _focusNode = FocusNode(); + + double containerWidth1 = 35.0; + void updateContainerWidth1() { + // TextField ๋‚ด์šฉ์˜ ๊ธธ์ด์— ๋”ฐ๋ผ Container ๊ธธ์ด ์—…๋ฐ์ดํŠธ + setState(() { + containerWidth1 = 35.0 + (nextTimeController.text.length.toDouble() * 5.0); + }); + } + double containerWidth2 = 35.0; + void updateContainerWidth2() { + // TextField ๋‚ด์šฉ์˜ ๊ธธ์ด์— ๋”ฐ๋ผ Container ๊ธธ์ด ์—…๋ฐ์ดํŠธ + setState(() { + containerWidth2 = 35.0 + (nextTimeController.text.length.toDouble() * 5.0); + }); + } + + String sentDate = ""; + // ๋Œ€ํ™” ๋‹จ๊ณ„ ์ €์žฅ + void saveCon(String aToken, String con, String nextcon) async { + // API ์—”๋“œํฌ์ธํŠธ URL + String apiUrl = 'http://3.38.1.125:8080/user/conversation-status'; + + // ์š”์ฒญ ๋ณธ๋ฌธ ๋ฐ์ดํ„ฐ + var data = { + "conversationStatus": con, + "nextConversationAt": nextcon, + }; + + // ํ—ค๋” ์ •๋ณด ์„ค์ • + Map headers = { + 'Authorization': 'Bearer $aToken', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• + 'Content-Type': 'application/json', // ์˜ˆ: JSON ์š”์ฒญ์ธ ๊ฒฝ์šฐ ํ—ค๋” ์„ค์ • + }; + + // HTTP GET ์š”์ฒญ ๋ณด๋‚ด๊ธฐ + var response = await http.put( + Uri.parse(apiUrl), + body: json.encode(data), + headers: headers, // ํ—ค๋” ์ถ”๊ฐ€ + ); + + ///var jsonResponse = utf8.decode(response.bodyBytes); + // HTTP ์‘๋‹ต ์ƒํƒœ ํ™•์ธ + if (response.statusCode == 200) { + // ์‘๋‹ต ๋ฐ์ดํ„ฐ๋ฅผ JSON ํ˜•์‹์œผ๋กœ ๋””์ฝ”๋”ฉ + print("๋Œ€ํ™” ๋‹จ๊ณ„ ๋„ฃ๊ธฐ ์„ฑ๊ณต"); + setState(() { + }); + + } else { + // ์š”์ฒญ์ด ์‹คํŒจํ•œ ๊ฒฝ์šฐ ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌ + print('HTTP ์š”์ฒญ ์‹คํŒจ..?: ${response.statusCode}'); + } + } + + @override + void initState() { + super.initState(); + + main.play = true; + main.player.setAsset(main.musics[3]); + main.player.play(); + + voiceCount = 0; + + // ์Œ์› ์ ์šฉ + for(int i= 0 ; i < voice.length; i++){ + player2.setAudioSource(AudioSource.uri( + Uri.parse(voice[i])) + ); + } + + controller1 = FlutterGifController(vsync: this); + + player2.setAsset(voice[voiceCount]); + voiceCount++; + player2.play(); + + // 2.5์ดˆ ์ ์ • + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + Timer(Duration(milliseconds: 1500), () { + controller1.stop(); + }); + + _callAPI(); + _focusNode.addListener(_onFocusChange); + } + + void _onFocusChange() { + if (_focusNode.hasFocus) { + // ํ‚ค๋ณด๋“œ ์˜ฌ๋ฆฌ๊ธฐ + FocusScope.of(context).requestFocus(_focusNode); + } + } + + @override + void dispose() async { + super.dispose(); + } + + void _callAPI() async { + // ์š”์ฒญ ๋ณธ๋ฌธ ๋ฐ์ดํ„ฐ + var data = { + "stage" : "0", + "set" : "0", + "lineId" : "0" + }; + + var url = Uri.parse('http://3.38.1.125:8080/conversation/line'); // ์—”๋“œํฌ์ธํŠธ URL ์„ค์ • + + try { + var response = await http.post( + url, + body: json.encode(data), // ์š”์ฒญ ๋ณธ๋ฌธ์— ๋ฐ์ดํ„ฐ๋ฅผ JSON ํ˜•์‹์œผ๋กœ ์ธ์ฝ”๋”ฉํ•˜์—ฌ ์ „๋‹ฌ + headers: {'Content-Type': 'application/json',}, // ์š”์ฒญ ํ—ค๋”์— Content-Type ์„ค์ • + ); + + if (response.statusCode == 200) { + // ์‘๋‹ต ์„ฑ๊ณต ์‹œ์˜ ์ฒ˜๋ฆฌ + + var jsonResponse = utf8.decode(response.bodyBytes); // ์‘๋‹ต ๋ณธ๋ฌธ์„ JSON ํ˜•์‹์œผ๋กœ ๋””์ฝ”๋”ฉ + // JSON ๊ฐ’์„ ํ™œ์šฉํ•œ ์›ํ•˜๋Š” ๋™์ž‘ ์ˆ˜ํ–‰ + //utf8.decode(jsonResponse); + print(jsonResponse); + + List contentList = []; + + List parsedResponse = json.decode(jsonResponse); + + print('API ํ˜ธ์ถœ ์„ฑ๊ณต: ${response.statusCode}'); + } else { + // ์š”์ฒญ ์‹คํŒจ ์‹œ์˜ ์ฒ˜๋ฆฌ + print('API ํ˜ธ์ถœ ์‹คํŒจ: ${response.statusCode}'); + } + } catch (e) { + // ์˜ˆ์™ธ ๋ฐœ์ƒ ์‹œ์˜ ์ฒ˜๋ฆฌ + print('API ํ˜ธ์ถœ ์ค‘ ์˜ˆ์™ธ ๋ฐœ์ƒ: $e'); + } + } + + @override + Widget build(BuildContext context) { + MediaQueryData deviceData = MediaQuery.of(context); + Size screenSize = deviceData.size; + return + Container( + color: Color(0xffCEEEE9), + child: GestureDetector( + onTap: (){ + print("์ด๊ฑฐ๋งŒ ์ข€ ํ™•์ธ ๋ถ€ํƒ: " + nextQuestion.toString()); + + if(nextQuestion < 8){ + nextQuestion++; + player2.setAsset(voice[voiceCount]); + voiceCount++; + player2.play(); + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + if(nextQuestion == 1){ + Timer(Duration(milliseconds: 3000), () { + controller1.stop(); + }); + } else if(nextQuestion == 2){ + Timer(Duration(milliseconds: 2500), () { + controller1.stop(); + }); + } else if(nextQuestion == 3){ + Timer(Duration(milliseconds: 4500), () { + controller1.stop(); + }); + } else if(nextQuestion == 4){ + Timer(Duration(milliseconds: 3000), () { + controller1.stop(); + }); + } + else if(nextQuestion == 5){ + Timer(Duration(milliseconds: 3500), () { + controller1.stop(); + }); + } + else if(nextQuestion == 6){ + Timer(Duration(milliseconds: 3000), () { + controller1.stop(); + }); + } + else if(nextQuestion == 7){ + Timer(Duration(milliseconds: 2000), () { + controller1.stop(); + }); + } + else if(nextQuestion == 8){ + Timer(Duration(milliseconds: 3000), () { + controller1.stop(); + }); + } + } + else if(nextQuestion == 8){ + // ${home.user}๋‹˜์€ ์–ด๋–ค ๊ฒฝํ—˜์„ ํ–ˆ๋‚˜์š”? + } + else if(nextQuestion > 8 && nextQuestion<11){ + nextQuestion++; + player2.setAsset(voice[voiceCount]); + voiceCount++; + player2.play(); + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + if(nextQuestion == 10){ + Timer(Duration(milliseconds: 3000), () { + controller1.stop(); + }); + } else if(nextQuestion == 11){ + Timer(Duration(milliseconds: 2500), () { + controller1.stop(); + }); + } + } + else if(nextQuestion == 11){ + // ์–ด๋–ค ๋ณ€ํ™”๊ฐ€ ์ƒ๊ฒผ๋‚˜์š” + } + else if(nextQuestion > 11 && nextQuestion<14){ + nextQuestion++; + player2.setAsset(voice[voiceCount]); + voiceCount++; + player2.play(); + + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + if(nextQuestion == 13){ + Timer(Duration(milliseconds: 3000), () { + controller1.stop(); + }); + } else if(nextQuestion == 14){ + Timer(Duration(milliseconds: 2500), () { + controller1.stop(); + }); + } + } + else if(nextQuestion == 14){ + // ์–ด๋–ค ๋ณ€ํ™”๊ฐ€ ์ƒ๊ฒผ๋‚˜์š” + } + else if(nextQuestion > 14 && nextQuestion<18){ + nextQuestion++; + player2.setAsset(voice[voiceCount]); + voiceCount++; + player2.play(); + + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + if(nextQuestion == 16){ + Timer(Duration(milliseconds: 5000), () { + controller1.stop(); + }); + } else if(nextQuestion == 17){ + Timer(Duration(milliseconds: 5000), () { + controller1.stop(); + }); + } else if(nextQuestion == 18){ + Timer(Duration(milliseconds: 3000), () { + controller1.stop(); + }); + } + } + else if(nextQuestion == 18){ + // ์–ด๋А ๊ณณ์—์„œ ์ƒ๊ฐ + } + else if(nextQuestion == 19){ + // ์ฃผ๋กœ ์–ธ์ œ ์ƒ๊ฐ + } + else if(nextQuestion == 20){ + // ๋ฌด์—‡์„ ํ•˜๋ฉฐ ์ƒ๊ฐ + } + else if(nextQuestion == 21){ + // ๋ˆ„๊ตฌ์™€ ์ƒ๊ฐ + } + else if(nextQuestion > 21 && nextQuestion<27){ + nextQuestion++; + player2.setAsset(voice[voiceCount]); + voiceCount++; + player2.play(); + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + if(nextQuestion == 23){ + Timer(Duration(milliseconds: 5000), () { + controller1.stop(); + }); + } else if(nextQuestion == 24){ + Timer(Duration(milliseconds: 4500), () { + controller1.stop(); + }); + } else if(nextQuestion == 25){ + Timer(Duration(milliseconds: 4500), () { + controller1.stop(); + }); + } else if(nextQuestion == 26){ + Timer(Duration(milliseconds: 3500), () { + controller1.stop(); + }); + } + else if(nextQuestion == 27){ + Timer(Duration(milliseconds: 3000), () { + controller1.stop(); + }); + } + } + else if(nextQuestion == 27){ + // ํ•จ๊ป˜ ๊ฐ์ •์„ ๋‚˜๋ˆ ๋ณด์•„์š” + } + else if(nextQuestion > 27 && nextQuestion < 33){ + nextQuestion++; + player2.setAsset(voice[voiceCount]); + voiceCount++; + player2.play(); + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + if(nextQuestion == 29){ + Timer(Duration(milliseconds: 3500), () { + controller1.stop(); + }); + } else if(nextQuestion == 30){ + Timer(Duration(milliseconds: 2500), () { + controller1.stop(); + }); + } else if(nextQuestion == 31){ + Timer(Duration(milliseconds: 4500), () { + controller1.stop(); + }); + } else if(nextQuestion == 32){ + Timer(Duration(milliseconds: 4500), () { + controller1.stop(); + }); + } + else if(nextQuestion == 33){ + Timer(Duration(milliseconds: 4500), () { + controller1.stop(); + }); + } + } + else if(nextQuestion == 33 && end == false){ + // ํ•จ๊ป˜ ๊ฐ์ •์„ ๋‚˜๋ˆ ๋ณด์•„์š” + end = true; + // nextEnd++; + player2.setAsset(endVoice[voiceEndCount]); + voiceEndCount++; + player2.play(); + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + Timer(Duration(milliseconds: 3500), () { + controller1.stop(); + }); + } + else if(end && nextEnd <1){ + nextEnd++; + voiceEndCount++; + print("test"); + } + + else if(end && nextEnd == 1){ + // ์‹œ๊ฐ„ ๊ณ ๋ฅด๊ธฐ + print("์„ค๋งˆ ์—ฌ๊ธฐ>>?"); + } + else if(end && nextEnd == 2){ + nextEnd++; + player2.setAsset(endVoice[voiceEndCount]); + voiceEndCount++; + player2.play(); + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + Timer(Duration(milliseconds: 3000), () { + controller1.stop(); + }); + } + else if(end && nextEnd == 3){ + // ํ•˜๋‹จ ๋ฒ„ํŠผ + } + + + setState(() { + }); + }, + child: Scaffold( + backgroundColor: Colors.transparent, + appBar: AppBar( + //title: Text("๊ธฐ์–ตํ• ๊ฐœ", style: TextStyle(fontSize:16, color: Colors.white ),), + //centerTitle: true, + leading: IconButton( + icon: SvgPicture.asset( + 'assets/images/conversation/home_icon.svg', + ), + onPressed: () => Navigator.of(context).pop(), + ), + backgroundColor: Colors.transparent, + elevation: 0.0, + ), + //extendBodyBehindAppBar: true, + body: + SingleChildScrollView( + child: Container( + child: Column( + children: [ + SizedBox(height: 3,), + Container( + width: screenSize.width, + height: 25, + child: Padding( + padding: EdgeInsets.only( left:16, right: 16), + child: Center( + child: FAProgressBar( + currentValue: 80, + size: 5, + backgroundColor: Colors.white, + ) + ), + ), + ), + Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children:[ + SizedBox( + height: 10, + ), + Stack( + children: [ + Container( + height: 157, + width: screenSize.width, + child: + Stack( + children: [ + Center(child: SvgPicture.asset('assets/images/conversation/bubble.svg',fit: BoxFit.fill,),), + Container( + padding: const EdgeInsets.symmetric(horizontal: 32, vertical: 12, ), + child: Center( + child: Column( + children: [ + if(end == false)...[ + if(lateConversation[nextQuestion].toString().contains("\n"))...[ + SizedBox(height: 28,), + Text( + lateConversation[nextQuestion], + textAlign: TextAlign.center, + style: textStyle.bubbletext, + ), + ]else...[ + SizedBox(height: 42,), + Text( + lateConversation[nextQuestion], + textAlign: TextAlign.center, + style: textStyle.bubbletext, + ), + ], + ] + else if(end)...[ + if(questionsEnd[nextEnd].toString().contains("\n"))...[ + SizedBox(height: 28,), + Text( + questionsEnd[nextEnd], + textAlign: TextAlign.center, + style: textStyle.bubbletext, + ), + ]else...[ + SizedBox(height: 42,), + Text( + questionsEnd[nextEnd], + textAlign: TextAlign.center, + style: textStyle.bubbletext, + ), + ], + ] + ], + ) + ) + ), + ], + ) + ), + // ๋ฌด์ง€ ์œ„์น˜ + if( (nextQuestion<34 && end == false) || (end && nextEnd == 0)||(end && nextEnd > 1))...[ + Stack( + children: [ + // ์œ ์ € ์œ„์น˜ + Column( + children: [ + SizedBox(height: 420,), + Container( + child: SvgPicture.asset( + 'assets/images/conversation/user7.svg', + height: 282, + width: screenSize.width, + ), + ), + ], + ), + Column( + children: [ + SizedBox(height: 144,), + Container( + width: screenSize.width, + height: 375, + child: + Stack( + children: [ + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child: Image.asset('assets/images/conversation/gif/muji_ear.gif', + fit: BoxFit.cover,),), + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child: Image.asset('assets/images/conversation/gif/muji_base.gif', fit: BoxFit.cover,),), + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child: Image.asset('assets/images/conversation/gif/muji_base_eye.gif', + fit: BoxFit.cover,),), + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child:GifImage( + controller: controller1, + image: const AssetImage("assets/images/conversation/gif/muji_mouth1.gif"), + ), + // Image.asset('assets/images/conversation/gif/muji_mouth1.gif', fit: BoxFit.cover,), + ) + ], + ) + + // SvgPicture.asset( + // 'assets/images/conversation/con_muji.svg', fit: BoxFit.cover, + // ), + ), + ], + ), + ], + ), + ] + else if(end && nextEnd == 1)...[ + Padding( + padding: EdgeInsets.only(top:175, left:45), + child: Container( + width: 275, + height: 120, + child: Column( + children: [ + Row( + children: [ + SizedBox(width: 75,), + Container(width: 25, + child: TextField( + style: textStyle.inputfield, + onTap: (){ + chooseTime = true; + whatTime = int.parse(nextTimeController.text); + setState(() { + }); + }, + onChanged: (text){ + selectedNextTime = true; + whatTime = int.parse(nextTimeController.text); + }, + keyboardType: TextInputType.number, + inputFormatters: [FilteringTextInputFormatter.allow(RegExp('[0-9]'))], + controller: nextTimeController, + decoration: InputDecoration( + hintText: '๋ช‡', + suffixStyle: TextStyle(color: Color(0xff83A8FF), fontSize: 20,), + hintStyle: textStyle.field, + //labelText: '๋ช‡', + ), + ),), + Text("์‹œ๊ฐ„ ํ›„์— ๋งŒ๋‚˜์š”", style: TextStyle( + fontFamily: 'Pretendard', + fontSize: 20, fontWeight: FontWeight.w500, color: Colors.black),), + ],), + SizedBox(height: 15,), + // DateFormat('MM/dd HH:mm').format(DateTime.parse(parsedResponseHR[index]['createdAt'])) + // DateFormat('MM/dd HH:mm').format(DateTime.now().add(Duration(hours: whatTime))) + Text(chooseTime?"${DateFormat('MM์›” dd์ผ HH์‹œ mm๋ถ„').format(DateTime.now().add(Duration(hours: whatTime)))}":"์ตœ์†Œ 1์‹œ๊ฐ„์—์„œ 24์‹œ๊ฐ„ ์‚ฌ์ด๋กœ ์ •ํ•ด์ฃผ์„ธ์š”.", style: TextStyle( + fontFamily: 'Pretendard', + fontSize: 16, fontWeight: FontWeight.w500, color: Color(0xffAAAAAA)),), + + ],), + ), + ), + ] + + ], + ), + + ], + ), + ], + ), + ), + ), + // // nextQuestion ์ด 3๊ณผ 7์ผ๋•Œ ๋“ฑ์žฅ + bottomSheet: Padding( + padding: EdgeInsets.only( + bottom: MediaQuery.of(context).viewInsets.bottom * 0.001), + child: Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + if(nextQuestion == 27)...[ + Container( + color: Color(0xffFFFFFF).withOpacity(0.0), + child: Padding( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 24), + child: Container( + + width: screenSize.width, + height: 40, + child: ElevatedButton( + style: buttonChart().bluebtn3, + onPressed: () { + nextQuestion++; + voiceCount++; + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => LateWatchOthersPage())); + setState(() {}); + }, + child: Text("ํ•จ๊ป˜ํ• ๊ฐœ ํ™•์ธํ•˜๊ธฐ", style: TextStyle( + fontFamily: 'Pretendard', + fontSize: 16, fontWeight: FontWeight.w500, color: Color(0xffFFFFFF))), + ), + ),), + ), + ] + else if (nextQuestion == 8)...[ + Container( + color: Colors.white, + height: 48, + child: Padding( + padding: const EdgeInsets.only(bottom: 8.0, top: 8.0, left: 16,right: 16), + child: Stack( + children: [ + Container( + width: screenSize.width, + height: 48, + decoration: BoxDecoration( + color: Colors.white, + border: Border.all(color:exp? Color(colorChart.blue):Color(0xffC0D2FC)), + borderRadius: BorderRadius.circular(30), + ), + ), + Positioned( + left: 15, + right: 30, + bottom: -4, + child: TextField( + textAlignVertical: TextAlignVertical.center, + maxLines: 1, + controller: expController, + style: textStyle.bk14normal, + decoration: InputDecoration( + hintStyle: textStyle.grey14normal, + border: InputBorder.none, + hintText: '์ด๋ณ„ ํ›„ ์–ด๋–ค ๊ฒฝํ—˜์„ ํ–ˆ๋ƒ๋ฉด...'), + onChanged: (s) { + //text = s; + exp = true; + setState(() { + + }); + }, + onTap: () {}, + ), + ), + Positioned( + left: screenSize.width - 80, + //right: 30, + bottom: 3, + top: 3, + child: ElevatedButton( + onPressed: () { + if(exp){ + player2.setAsset(voice[voiceCount]); + voiceCount++; + player2.play(); + + controller1.repeat( + min: 0, + max: 20, + period: const Duration(milliseconds: 1000) + ); + + Timer(Duration(milliseconds: 1500), () { + controller1.stop(); + }); + nextQuestion++; + setState(() { + }); + } + }, + style: ElevatedButton.styleFrom( + backgroundColor: exp? Color(colorChart.blue):Color(0xffDDE7FD), + fixedSize: const Size(23, 23), + shape: const CircleBorder(), + ), + child: Icon( + Icons.arrow_upward, + color: Colors.white, + size: 16, + )), + ), + ], + ), + ), + ) + + ] + else if (nextQuestion == 11)...[ + Container( + color: Colors.white, + height: 48, + child: Padding( + padding: const EdgeInsets.only(bottom: 8.0, top: 8.0, left: 16,right: 16), + child: Stack( + children: [ + Container( + width: screenSize.width, + height: 48, + decoration: BoxDecoration( + color: Colors.white, + border: Border.all(color:change? Color(colorChart.blue):Color(0xffC0D2FC)), + borderRadius: BorderRadius.circular(30), + ), + ), + Positioned( + left: 15, + right: 30, + bottom:-4, + child: TextField( + textAlignVertical: TextAlignVertical.center, + maxLines: 1, + controller: changeController, + style: textStyle.bk14normal, + decoration: InputDecoration( + hintStyle: textStyle.grey14normal, + border: InputBorder.none, + hintText: '์ด ๊ฒฝํ—˜์„ ํ†ตํ•ด ์–ด๋–ค ๋ณ€ํ™”๊ฐ€ ์ƒ๊ฒผ๋ƒ๋ฉด...'), + onChanged: (s) { + //text = s; + change = true; + setState(() { + + }); + }, + onTap: () {}, + ), + ), + Positioned( + left: screenSize.width - 81, + //right: 30, + bottom: 3, + top: 3, + child: ElevatedButton( + onPressed: () { + if(change){ + player2.setAsset(voice[voiceCount]); + voiceCount++; + player2.play(); + + controller1.repeat( + min: 0, + max: 20, + period: const Duration(milliseconds: 1000) + ); + + Timer(Duration(milliseconds: 3000), () { + controller1.stop(); + }); + nextQuestion++; + setState(() { + }); + } + }, + style: ElevatedButton.styleFrom( + backgroundColor: change?Color(colorChart.blue):Color(0xffDDE7FD), + fixedSize: const Size(23, 23), + shape: const CircleBorder(), + ), + child: Icon( + Icons.arrow_upward, + color: Colors.white, + size: 16, + )), + ), + ], + ), + ), + ) + + ] + else if (nextQuestion == 14)...[ + Container( + color: Colors.white, + height: 48, + child: Padding( + padding: const EdgeInsets.only(bottom: 8.0, top: 8.0, left: 16,right: 16), + child: Stack( + children: [ + Container( + width: screenSize.width, + height: 48, + decoration: BoxDecoration( + color: Colors.white, + border: Border.all(color: joy? Color(colorChart.blue):Color(0xffC0D2FC)), + borderRadius: BorderRadius.circular(30), + ), + ), + Positioned( + left: 15, + right: 30, + bottom: -4, + child: TextField( + textAlignVertical: TextAlignVertical.center, + maxLines: 1, + controller: joyController, + style: textStyle.bk14normal, + decoration: InputDecoration( + hintStyle: textStyle.grey14normal, + border: InputBorder.none, + hintText: '๋ณ€ํ™”๋ฅผ ๋งˆ์ฃผํ•˜๊ณ  ์ฆ๊ฑฐ์šด ์ˆœ๊ฐ„์ด๋ผ๋ฉด...'), + onChanged: (s) { + //text = s; + joy = true; + setState(() { + + }); + }, + onTap: () {}, + ), + ), + Positioned( + left: screenSize.width - 81, + //right: 30, + bottom: 3, + top: 3, + child: ElevatedButton( + onPressed: () { + if(joy){ + player2.setAsset(voice[voiceCount]); + voiceCount++; + player2.play(); + + controller1.repeat( + min: 0, + max: 20, + period: const Duration(milliseconds: 1000) + ); + + Timer(Duration(milliseconds: 3000), () { + controller1.stop(); + }); + nextQuestion++; + setState(() { + }); + } + }, + style: ElevatedButton.styleFrom( + backgroundColor: joy?Color(colorChart.blue):Color(0xffDDE7FD), + fixedSize: const Size(23, 23), + shape: const CircleBorder(), + ), + child: Icon( + Icons.arrow_upward, + color: Colors.white, + size: 16, + )), + ), + ], + ), + ), + ) + + ] + else if (nextQuestion == 18)...[ + Container( + color: Colors.white, + height: 48, + child: Padding( + padding: const EdgeInsets.only(bottom: 8.0, top: 8.0, left: 16,right: 16), + child: Stack( + children: [ + Container( + width: screenSize.width, + height: 48, + decoration: BoxDecoration( + color: Colors.white, + border: Border.all(color: where? Color(colorChart.blue):Color(0xffC0D2FC)), + borderRadius: BorderRadius.circular(30), + ), + ), + Positioned( + left: 14, + right: 30, + bottom: -4, + child: TextField( + textAlignVertical: TextAlignVertical.center, + maxLines: 1, + controller: whereController, + style: textStyle.bk14normal, + decoration: InputDecoration( + hintStyle: textStyle.grey14normal, + border: InputBorder.none, + hintText: '์–ด๋””์—์„œ ์ƒ๊ฐ์„ ์ •๋ฆฌํ•˜๋ƒ๋ฉด...'), + onChanged: (s) { + //text = s; + where = true; + setState(() { + + }); + }, + onTap: () {}, + ), + ), + Positioned( + left: screenSize.width - 81, + //right: 30, + bottom: 3, + top: 3, + child: ElevatedButton( + onPressed: () { + if(where){ + player2.setAsset(voice[voiceCount]); + voiceCount++; + player2.play(); + + controller1.repeat( + min: 0, + max: 20, + period: const Duration(milliseconds: 1000) + ); + + Timer(Duration(milliseconds: 3000), () { + controller1.stop(); + }); + nextQuestion++; + setState(() { + }); + } + }, + style: ElevatedButton.styleFrom( + backgroundColor: where?Color(colorChart.blue):Color(0xffDDE7FD), + fixedSize: const Size(23, 23), + shape: const CircleBorder(), + ), + child: Icon( + Icons.arrow_upward, + color: Colors.white, + size: 16, + )), + ), + ], + ), + ), + ) + + ] + else if (nextQuestion == 19)...[ + Container( + color: Colors.white, + height: 48, + child: Padding( + padding: const EdgeInsets.only(bottom: 8.0, top: 8.0, left: 16,right: 16), + child: Stack( + children: [ + Container( + width: screenSize.width, + height: 48, + decoration: BoxDecoration( + color: Colors.white, + border: Border.all(color: when? Color(colorChart.blue):Color(0xffC0D2FC)), + borderRadius: BorderRadius.circular(30), + ), + ), + Positioned( + left: 15, + right: 30, + bottom: -4, + child: TextField( + textAlignVertical: TextAlignVertical.center, + maxLines: 1, + controller: whenController, + style: textStyle.bk14normal, + decoration: InputDecoration( + hintStyle: textStyle.grey14normal, + border: InputBorder.none, + hintText: '์–ธ์ œ ์ƒ๊ฐ์„ ์ •๋ฆฌํ•˜๋ƒ๋ฉด...'), + onChanged: (s) { + //text = s; + when = true; + setState(() { + + }); + }, + onTap: () {}, + ), + ), + Positioned( + left: screenSize.width - 81, + //right: 30, + bottom: 3, + top: 3, + child: ElevatedButton( + onPressed: () { + if(when){ + player2.setAsset(voice[voiceCount]); + voiceCount++; + player2.play(); + + controller1.repeat( + min: 0, + max: 20, + period: const Duration(milliseconds: 1000) + ); + + Timer(Duration(milliseconds: 3000), () { + controller1.stop(); + }); + nextQuestion++; + setState(() { + }); + } + }, + style: ElevatedButton.styleFrom( + backgroundColor: when? Color(colorChart.blue):Color(0xffDDE7FD), + fixedSize: const Size(23, 23), + shape: const CircleBorder(), + ), + child: Icon( + Icons.arrow_upward, + color: Colors.white, + size: 16, + )), + ), + ], + ), + ), + ) + + ] + else if (nextQuestion == 20)...[ + Container( + color: Colors.white, + height: 48, + child: Padding( + padding: const EdgeInsets.only(bottom: 8.0, top: 8.0, left: 16,right: 16), + child: Stack( + children: [ + Container( + width: screenSize.width, + height: 48, + decoration: BoxDecoration( + color: Colors.white, + border: Border.all(color: what? Color(colorChart.blue):Color(0xffC0D2FC)), + borderRadius: BorderRadius.circular(30), + ), + ), + Positioned( + left: 15, + right: 30, + bottom: -4, + child: TextField( + textAlignVertical: TextAlignVertical.center, + maxLines: 1, + controller: whatController, + style: textStyle.bk14normal, + decoration: InputDecoration( + hintStyle: textStyle.grey14normal, + border: InputBorder.none, + hintText: '๋ญ˜ ํ•˜๋ฉด์„œ ์ƒ๊ฐ์„ ์ •๋ฆฌํ•˜๋ƒ๋ฉด...'), + onChanged: (s) { + //text = s; + what = true; + setState(() { + + }); + }, + onTap: () {}, + ), + ), + Positioned( + left: screenSize.width - 81, + //right: 30, + bottom: 3, + top: 3, + child: ElevatedButton( + onPressed: () { + if(what){ + player2.setAsset(voice[voiceCount]); + voiceCount++; + player2.play(); + + controller1.repeat( + min: 0, + max: 20, + period: const Duration(milliseconds: 1000) + ); + + Timer(Duration(milliseconds: 3000), () { + controller1.stop(); + }); + nextQuestion++; + setState(() { + }); + } + }, + style: ElevatedButton.styleFrom( + backgroundColor: what?Color(colorChart.blue):Color(0xffC0D2FC), + fixedSize: const Size(23, 23), + shape: const CircleBorder(), + ), + child: Icon( + Icons.arrow_upward, + color: Colors.white, + size: 16, + )), + ), + ], + ), + ), + ) + + ] + else if (nextQuestion == 21)...[ + Container( + color: Colors.white, + height: 48, + child: Padding( + padding: const EdgeInsets.only(bottom: 8.0, top: 8.0, left: 16,right: 16), + child: Stack( + children: [ + Container( + width: screenSize.width, + height: 48, + decoration: BoxDecoration( + color: Colors.white, + border: Border.all(color: Color(colorChart.blue)), + borderRadius: BorderRadius.circular(30), + ), + ), + Positioned( + left: 15, + right: 30, + bottom:-4, + child: TextField( + textAlignVertical: TextAlignVertical.center, + maxLines: 1, + controller: whoController, + style: textStyle.bk14normal, + decoration: InputDecoration( + hintStyle: textStyle.grey14normal, + border: InputBorder.none, + hintText: '๋ˆ„๊ตฌ์™€ ์ƒ๊ฐ์„ ์ •๋ฆฌํ•˜๋ƒ๋ฉด...'), + onChanged: (s) { + //text = s; + who = true; + setState(() { + + }); + }, + onTap: () {}, + ), + ), + Positioned( + left: screenSize.width - 81, + //right: 30, + bottom: 3, + top: 3, + child: ElevatedButton( + onPressed: () { + if(who){ + player2.setAsset(voice[voiceCount]); + voiceCount++; + player2.play(); + + controller1.repeat( + min: 0, + max: 20, + period: const Duration(milliseconds: 1000) + ); + + Timer(Duration(milliseconds: 1500), () { + controller1.stop(); + }); + nextQuestion++; + setState(() { + }); + } + }, + style: ElevatedButton.styleFrom( + backgroundColor: who?Color(colorChart.blue):Color(0xffDDE7FD), + fixedSize: const Size(23, 23), + shape: const CircleBorder(), + ), + child: Icon( + Icons.arrow_upward, + color: Colors.white, + size: 16, + )), + ), + ], + ), + ), + ) + + ] + + else if(nextEnd == 1 && selectedNextTime)...[ + Container( + color: Color(0xffFFFFFF).withOpacity(0.0), + child: Padding( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 24), + child: Container( + + width: screenSize.width, + height: 40, + child: ElevatedButton( + style: buttonChart().bluebtn3, + onPressed: () { + questionsEnd.insertAll(2, [ + "๋„ค, ${home.user}๋‹˜.\n${whatTime}์‹œ๊ฐ„ ํ›„์— ๋‹ค์‹œ ๋งŒ๋‚˜์š”!", + "๋„ค, ${home.user}๋‹˜.\n${whatTime}์‹œ๊ฐ„ ํ›„์— ๋‹ค์‹œ ๋งŒ๋‚˜์š”!", + ]); + //decidedType = false; + nextEnd++; + player2.setAsset(endVoice[voiceEndCount]); + voiceEndCount++; + player2.play(); + // 2.5์ดˆ ์ ์ • + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + Timer(Duration(milliseconds: 3500), () { + controller1.stop(); + }); + setState(() {}); + }, + child: Text("๋‹ค์Œ", style: TextStyle( + fontFamily: 'Pretendard', + fontSize: 16, fontWeight: FontWeight.w500, color: Color(0xffFFFFFF))), + ), + ),), + ), + ] + else if(nextEnd == 3)...[ + Container( + color: Color(0xffFFFFFF).withOpacity(0.0), + child: Padding( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 24), + child: Container( + + width: screenSize.width, + height: 40, + child: ElevatedButton( + style: buttonChart().bluebtn3, + onPressed: () { + //decidedType = false; + //checkSignUp = false; + //checkSignIn = true; + //checkSignUp = false; + var now = DateTime.now(); + sentDate = DateFormat('yyyy-MM-dd hh:mm:ss').format(now.toLocal()); + saveCon(sign_in.userAccessToken, "3", sentDate); + setState(() {}); + main.player.stop(); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => MyScreenPage(title: '์Šคํฌ๋ฆฐ ํŽ˜์ด์ง€',))); + }, + child: Text("์™„๋ฃŒ", style: TextStyle( + fontFamily: 'Pretendard', + fontSize: 16, fontWeight: FontWeight.w500, color: Color(0xffFFFFFF))), + ), + ),), + ), + ] + ], + ), + ) + ), + ) + + ); + + } +} \ No newline at end of file diff --git a/client/lib/conversation/late_period/late_memorial_search.dart b/client/lib/conversation/late_period/late_memorial_search.dart new file mode 100644 index 0000000..ca7137c --- /dev/null +++ b/client/lib/conversation/late_period/late_memorial_search.dart @@ -0,0 +1,312 @@ +import 'dart:convert'; +import 'package:flutter_svg/svg.dart'; +import 'package:get/get.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:client/style.dart'; +import 'package:http/http.dart' as http; +import 'package:client/sign/sign_in.dart' as sign_in; +import 'late_memorial_search_result.dart'; + +String searchKeyword = ""; + +class LateMemorialSearchPage extends StatefulWidget { + @override + State createState() => _LateMemorialSearchPageState(); +} + +class _LateMemorialSearchPageState extends State { + + // ํ…์ŠคํŠธ์—๋””ํŒ…์ปจํŠธ๋กค๋Ÿฌ๋ฅผ ์ƒ์„ฑํ•˜์—ฌ ํ•„๋“œ์— ํ• ๋‹น + final myController = TextEditingController(); + + // ์ตœ๊ทผ ๊ฒ€์ƒ‰์–ด ์กฐํšŒ(GET) + late List parsedResponseRS; // ์ตœ๊ทผ ๊ฒ€์ƒ‰์–ด + bool recentKeyword = false; + + void fetchDataRecentSearch(String aToken) async { + // API ์—”๋“œํฌ์ธํŠธ URL + String apiUrl = 'http://3.38.1.125:8080/search/history'; + + // ํ—ค๋” ์ •๋ณด ์„ค์ • + Map headers = { + 'Authorization': 'Bearer $aToken', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• + 'Content-Type': 'application/json', // ์˜ˆ: JSON ์š”์ฒญ์ธ ๊ฒฝ์šฐ ํ—ค๋” ์„ค์ • + }; + + // HTTP GET ์š”์ฒญ ๋ณด๋‚ด๊ธฐ + var response = await http.get( + Uri.parse(apiUrl), + headers: headers, // ํ—ค๋” ์ถ”๊ฐ€ + ); + + ///var jsonResponse = utf8.decode(response.bodyBytes); + // HTTP ์‘๋‹ต ์ƒํƒœ ํ™•์ธ + if (response.statusCode == 200) { + // ์‘๋‹ต ๋ฐ์ดํ„ฐ๋ฅผ JSON ํ˜•์‹์œผ๋กœ ๋””์ฝ”๋”ฉ + var data = json.decode(response.body); + var jsonResponse = utf8.decode(response.bodyBytes); + + parsedResponseRS = json.decode(jsonResponse); + + // ๋ฐ์ดํ„ฐ ์ฒ˜๋ฆฌ + print('์„œ๋ฒ„๋กœ๋ถ€ํ„ฐ ๋ฐ›์€ ๋ฐ์ดํ„ฐS: $jsonResponse'); + + recentKeyword = true; + setState(() { + }); + + } else { + // ์š”์ฒญ์ด ์‹คํŒจํ•œ ๊ฒฝ์šฐ ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌ + print('HTTP ์š”์ฒญ ์‹คํŒจ: ${response.statusCode}'); + } + } + + // ์ถ”์ฒœ ๊ฒ€์ƒ‰์–ด ์กฐํšŒ(GET) + late List parsedResponseSR; // ์ตœ๊ทผ ๊ฒ€์ƒ‰์–ด + bool rankKeyword = false; + void fetchDataSearchRank() async { + // API ์—”๋“œํฌ์ธํŠธ URL + String apiUrl = 'http://3.38.1.125:8080/search/rank'; + + // HTTP GET ์š”์ฒญ ๋ณด๋‚ด๊ธฐ + var response = await http.get( + Uri.parse(apiUrl), + ); + + // HTTP ์‘๋‹ต ์ƒํƒœ ํ™•์ธ + if (response.statusCode == 200) { + // ์‘๋‹ต ๋ฐ์ดํ„ฐ๋ฅผ JSON ํ˜•์‹์œผ๋กœ ๋””์ฝ”๋”ฉ + var data = json.decode(response.body); + var jsonResponse = utf8.decode(response.bodyBytes); + + parsedResponseSR = json.decode(jsonResponse); + + // ๋ฐ์ดํ„ฐ ์ฒ˜๋ฆฌ + print('์„œ๋ฒ„๋กœ๋ถ€ํ„ฐ ๋ฐ›์€ ๋ฐ์ดํ„ฐ: $jsonResponse'); + + rankKeyword = true; + setState(() { + }); + + } else { + // ์š”์ฒญ์ด ์‹คํŒจํ•œ ๊ฒฝ์šฐ ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌ + print('HTTP ์š”์ฒญ ์‹คํŒจ: ${response.statusCode}'); + } + } + + // ์ตœ๊ทผ ๊ฒ€์ƒ‰์–ด ์‚ญ์ œ + void deleteDataSearch(String aToken, String search) async { + // API ์—”๋“œํฌ์ธํŠธ URL + String apiUrl = 'http://3.38.1.125:8080/search/history?keyword=${search}'; + + // ํ—ค๋” ์ •๋ณด ์„ค์ • + Map headers = { + 'Authorization': 'Bearer $aToken', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• + 'Content-Type': 'application/json', // ์˜ˆ: JSON ์š”์ฒญ์ธ ๊ฒฝ์šฐ ํ—ค๋” ์„ค์ • + }; + + // HTTP GET ์š”์ฒญ ๋ณด๋‚ด๊ธฐ + var response = await http.delete( + Uri.parse(apiUrl), + headers: headers, // ํ—ค๋” ์ถ”๊ฐ€ + ); + + ///var jsonResponse = utf8.decode(response.bodyBytes); + // HTTP ์‘๋‹ต ์ƒํƒœ ํ™•์ธ + if (response.statusCode == 200) { + // ์‘๋‹ต ๋ฐ์ดํ„ฐ๋ฅผ JSON ํ˜•์‹์œผ๋กœ ๋””์ฝ”๋”ฉ + print("์‚ญ์ œ์„ฑ๊ณต"); + setState(() { + }); + + } else { + // ์š”์ฒญ์ด ์‹คํŒจํ•œ ๊ฒฝ์šฐ ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌ + print('HTTP ์š”์ฒญ ์‹คํŒจ: ${response.statusCode}'); + } + } + + + + @override + void initState() { + super.initState(); + SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: [SystemUiOverlay.top]); + fetchDataRecentSearch(sign_in.userAccessToken); + fetchDataSearchRank(); + } + + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + leading: IconButton( + icon: Icon(Icons.arrow_back_ios_rounded, color: Colors.black), + onPressed: () => Navigator.of(context).pop(), + ), + title: Center( + child: Padding(padding: EdgeInsets.only(right: 60), + child: Text('ํ•จ๊ป˜ํ• ๊ฐœ', style: textStyle.bk20normal,), + ) + ), + backgroundColor: Color(0xffF3F3F3), + elevation: 0.0, + iconTheme: IconThemeData(color: Colors.black), + ), + body: Container( + color: Color(0xffF3F3F3), + padding: EdgeInsets.only(left: 15, right: 15 ), + width: Get.width, + height: Get.height, + child: SingleChildScrollView( + padding: EdgeInsets.fromLTRB(0, 0, 0, 0), + scrollDirection: Axis.vertical, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox(height: 8,), + Padding( + padding: const EdgeInsets.all(0.0), + child: Stack( + children: [ + Container( + width: Get.width- 25, + height: 32, + decoration: BoxDecoration( + color: Colors.white, + border: Border.all(color: Color(0xff99A8CB),), + borderRadius: BorderRadius.circular(8), + ), + ), + Positioned( + left: 34, + right: 80, + bottom: 0, + top: 15, + child: TextField( + controller: myController, + decoration: InputDecoration( + border: InputBorder.none, + hintText: '๊ฒ€์ƒ‰', + hintStyle: textStyle.grey16normal), + onChanged: (s) { + //text = s; + }, + onTap: (){ + + }, + ), + ), + Positioned( + right: Get.width - 75, + //right: 30, + bottom: 7, + top: -3, + child: IconButton( + onPressed: (){ + searchKeyword = myController.text; + setState(() { + }); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => MemorialSearchResultPage())); + }, + icon: Icon(Icons.search, color: Color(0xff99A8CB),), + ) + ), + ], + ), + ), + SizedBox(height: 8,), + Row( + children: [ + Text('์ตœ๊ทผ ๊ฒ€์ƒ‰์–ด', style: TextStyle(color: Color(0xff4B5396), fontSize: 14, fontFamily: 'Pretendard',fontWeight: FontWeight.w500,),), + SizedBox(width: 226, ), + TextButton( + onPressed: (){}, + child: Text('์ „์ฒด ์‚ญ์ œ', style: TextStyle(color: Color(0xff4B5396), fontSize: 12, fontFamily: 'Pretendard',fontWeight: FontWeight.w500,),), + ) + ], + ), + Container( + width: Get.width, + height: 350, + child:Column( + children: [ + if(recentKeyword)...[ + for(int i=0; i MemorialSearchResultPage())); + }, + child: Text('${parsedResponseSR[index]['keyword']}', style: TextStyle(color: Color(0xff333333),fontSize: 14, fontFamily: 'Pretendard', + fontWeight: FontWeight.w300,),), + ); + + }) + ), + ], + + + ], + ), + + ), + ), + + ); + } +} \ No newline at end of file diff --git a/client/lib/conversation/late_period/late_memorial_search_result.dart b/client/lib/conversation/late_period/late_memorial_search_result.dart new file mode 100644 index 0000000..df44169 --- /dev/null +++ b/client/lib/conversation/late_period/late_memorial_search_result.dart @@ -0,0 +1,315 @@ +import 'dart:convert'; +import 'package:get/get.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'late_watch_others_detail.dart'; +import 'package:client/style.dart'; +import 'package:http/http.dart' as http; +import 'late_memorial_search.dart'as search; +import 'package:flutter_svg/flutter_svg.dart'; +import 'late_memorial_search.dart'; +import 'package:client/sign/sign_in.dart' as sign_in; + +String selectedOthersImage = ""; + +class MemorialSearchResultPage extends StatefulWidget { + @override + State createState() => _MemorialSearchResultPageState(); +} + +class _MemorialSearchResultPageState extends State { + + // ํ…์ŠคํŠธ์—๋””ํŒ…์ปจํŠธ๋กค๋Ÿฌ๋ฅผ ์ƒ์„ฑํ•˜์—ฌ ํ•„๋“œ์— ํ• ๋‹น + final myController = TextEditingController(); + + // ๊ฒ€์ƒ‰์–ด ์กฐํšŒ(GET) + late List parsedResponseSR; // ๊ฒ€์ƒ‰ ๊ฒฐ๊ณผ + bool result = false; + + void fetchDataSearchResult(String aToken) async { + // API ์—”๋“œํฌ์ธํŠธ URL + String apiUrl = 'http://3.38.1.125:8080/search?keyword=${search.searchKeyword}'; + + // ํ—ค๋” ์ •๋ณด ์„ค์ • + Map headers = { + 'Authorization': 'Bearer $aToken', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• + 'Content-Type': 'application/json', // ์˜ˆ: JSON ์š”์ฒญ์ธ ๊ฒฝ์šฐ ํ—ค๋” ์„ค์ • + }; + + // HTTP GET ์š”์ฒญ ๋ณด๋‚ด๊ธฐ + var response = await http.get( + Uri.parse(apiUrl), + headers: headers, // ํ—ค๋” ์ถ”๊ฐ€ + ); + + ///var jsonResponse = utf8.decode(response.bodyBytes); + // HTTP ์‘๋‹ต ์ƒํƒœ ํ™•์ธ + if (response.statusCode == 200) { + // ์‘๋‹ต ๋ฐ์ดํ„ฐ๋ฅผ JSON ํ˜•์‹์œผ๋กœ ๋””์ฝ”๋”ฉ + var data = json.decode(response.body); + var jsonResponse = utf8.decode(response.bodyBytes); + + parsedResponseSR = json.decode(jsonResponse); + + // ๋ฐ์ดํ„ฐ ์ฒ˜๋ฆฌ + print('์„œ๋ฒ„๋กœ๋ถ€ํ„ฐ ๋ฐ›์€ ๋ฐ์ดํ„ฐS: $jsonResponse'); + + result = true; + setState(() { + }); + + } else { + // ์š”์ฒญ์ด ์‹คํŒจํ•œ ๊ฒฝ์šฐ ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌ + print('HTTP ์š”์ฒญ ์‹คํŒจ: ${response.statusCode}'); + } + } + + + @override + void initState() { + super.initState(); + SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: [SystemUiOverlay.top]); + fetchDataSearchResult(sign_in.userAccessToken); + } + + + @override + Widget build(BuildContext context) { + MediaQueryData deviceData = MediaQuery.of(context); + Size screenSize = deviceData.size; + return Scaffold( + appBar: PreferredSize( + preferredSize: Size.fromHeight(72), + child: AppBar( + actions: [ + Padding( + padding: EdgeInsets.only(top: 15), + child: IconButton( + icon: Icon(Icons.search), + onPressed: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + LateMemorialSearchPage())); // ๊ฒ€์ƒ‰ํŽ˜์ด์ง€๋กœ ์ด๋™ + }, + ), + ), + ], + leading: + Padding( + padding: EdgeInsets.only(top: 20), + child: IconButton( + icon: Icon(Icons.arrow_back_ios_rounded, color: Colors.black), + onPressed: () => Navigator.of(context).pop(), + ), + ), + title: Container( + height: 50, + width: screenSize.width, + child: Column( + children: [ + SizedBox(height: 24,), + Center( + child: Padding( + padding: EdgeInsets.only(right: 0), + child: Text( + 'ํ•จ๊ป˜ํ• ๊ฐœ', + style: textStyle.bk20bold, + ), + )), + ], + )), + backgroundColor: Colors.transparent, + elevation: 0.0, + iconTheme: IconThemeData(color: Colors.black), + ), + ), + body: Container( + color: Color(0xffDDE7FD), + //padding: EdgeInsets.only(left: 16, right: 16 ), + width: Get.width, + height: Get.height, + child: SingleChildScrollView( + padding: EdgeInsets.fromLTRB(0, 0, 0, 0), + scrollDirection: Axis.vertical, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + + ClipRRect( + borderRadius: BorderRadius.only(topLeft: Radius.circular(16.0), topRight: Radius.circular(16.0)), + child: Container( + padding: EdgeInsets.all(16), + width: Get.width, + color: Color(0xffF1F5FE), + child: Column(children: [ + SizedBox(height: 8,), + Row(children: [ + Text('"${search.searchKeyword}" ', style: textStyle.bk16semibold), + Text('${parsedResponseSR.length}๊ฑด์˜ ๊ฒฐ๊ณผ ', style: textStyle.bk16normal), + ],), + SizedBox(height: 20,), + + if(parsedResponseSR.length == 0)...[ + Column( + children: [ + SizedBox(height: 200,), + SvgPicture.asset( + 'assets/images/no_result.svg', + height: 124, + ), + SizedBox(height: 16,), + Text("์ผ์น˜ํ•˜๋Š” ๋‚ด์šฉ์ด ์—†์Šต๋‹ˆ๋‹ค.", style: textStyle.bk16normal,) + ], + ), + ], + + + if(result && parsedResponseSR != "[]")...[ + Container( + width: Get.width, + height: 760, + color: Color(0xffF1F5FE), + child: GridView.builder( + itemCount:parsedResponseSR.length, + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 2, //1 ๊ฐœ์˜ ํ–‰์— ๋ณด์—ฌ์ค„ item ๊ฐœ์ˆ˜ + childAspectRatio: 1.56 / 2.04, //item ์˜ ๊ฐ€๋กœ 1, ์„ธ๋กœ 2 ์˜ ๋น„์œจ + mainAxisSpacing: 16, //์ˆ˜ํ‰ Padding + crossAxisSpacing: 16, //์ˆ˜์ง Padding + ), + itemBuilder: (BuildContext context, int index){ + return + InkWell( + onTap: (){ + selectedOthersImage = parsedResponseSR[index]['image']; + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => LateWatchOthersMemorialDetailPage())); + }, + child: Container( + // width: 200, + // height: 200, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(16), + ), + child:Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // SizedBox(height: 5,), + // SizedBox(height: 2,), + Container( + height: 166, + width: 204, + child: + Stack( + children: [ + Container( + height: 204, + width: 204, + child: + ClipRRect( + borderRadius: BorderRadius.only(topLeft: Radius.circular(16.0), topRight: Radius.circular(16.0)), + child: Image.network(parsedResponseSR[index]['image'], fit: BoxFit.cover,), + ) + + + ), + InkWell( + onTap: (){ + + }, + child: Padding( + padding: EdgeInsets.only(left: 10, top: 10), + child: Container( + decoration: BoxDecoration( + color: Colors.black.withOpacity(0.2), + borderRadius: BorderRadius.circular(32), + ), + // color: Colors.white.withOpacity(0.7), + width: 81, + height: 32, + child: Row( + children: [ + SizedBox(width: 10,), + CircleAvatar( + backgroundColor: Colors.white, + radius: 10, + child: CircleAvatar( + radius: 9, + backgroundImage: NetworkImage(parsedResponseSR[index]['profileImage']), + ), + ), + + // CircleAvatar( + // minRadius: 10, + // maxRadius: 15, + // backgroundImage: + // NetworkImage(parsedResponseSR[index]['profileImage'], + // ), + // ), + SizedBox(width: 5,), + Text(parsedResponseSR[index]['nickname'], style: TextStyle(color: Colors.white, fontSize: 14, fontFamily: 'Pretendard',fontWeight: FontWeight.w600,),), + Container( + width: 20, + child: + Icon(Icons.arrow_forward_ios_rounded, color: Colors.white,size: 12,) + //Image.asset('assets/images/memorial/look_others_arrow.png'), + ) + ], + ), + ), + ), + ) + ],), + + ), + SizedBox(height: 8,), + Container( + height: 16, + width: 155, + child: Row( + children: [ + SizedBox(width: 10,), + Container( + width: 145, + height: 65, + child: Text(parsedResponseSR[index]['title'],style: TextStyle(color: Color(0xff333333), fontSize: 13.5, fontFamily: 'Pretendard',fontWeight: FontWeight.w400,), ), + ), + //Text(parsedResponseSR[index]['title'],style: TextStyle(color: Color(0xff333333), fontSize: 14.5, fontFamily: 'Pretendard',fontWeight: FontWeight.w400,),) + ], + ), + ), + // Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // + // ], + // ) + + ], + ) + + ), + ); + + }) + ), + ] + ], + ),),), + + + + ], + ), + + ), + ), + + ); + } +} \ No newline at end of file diff --git a/client/lib/conversation/late_period/late_watch_others.dart b/client/lib/conversation/late_period/late_watch_others.dart new file mode 100644 index 0000000..86736a6 --- /dev/null +++ b/client/lib/conversation/late_period/late_watch_others.dart @@ -0,0 +1,697 @@ +import 'dart:async'; +import 'dart:convert'; +import 'package:flutter_svg/svg.dart'; +import 'package:get/get.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'late_memorial_search.dart'; +import 'late_watch_others_detail.dart'; +import 'package:client/style.dart'; +import 'package:http/http.dart' as http; +import '../../memorial/others_memorial_main.dart'; +import 'package:client/sign/sign_in.dart' as sign_in; +import 'late.dart' as late_; + +String selectedOthersImage = ""; +String selectedOthersProfileImage = ""; +String selectedOthersNickaname = ""; +String selectedUser = ""; +int selectedPostId = 0; + +class LateWatchOthersPage extends StatefulWidget { + @override + State createState() => _LateWatchOthersPageState(); +} + +class _LateWatchOthersPageState extends State { + + late List parsedResponseCM; // ์‹ค์‹œ๊ฐ„ ํ”ผ๋“œ + late List parsedResponseFC; // ์‹ค์‹œ๊ฐ„ ํ”ผ๋“œ_ํ•„ํ„ฐ์ ์šฉ + + bool checkUser = false; + bool isLastest = false; + + String dogType = ""; // ๊ฐ•์•„์ง€ ํƒ€์ž… + String dogAge = ""; // ๊ฐ•์•„์ง€ ๋‚˜์ด + + // ํ•„ํ„ฐ๋ง ์„ ํƒ ๋‚˜์ด or ๊ฒฌ์ข… + bool selectType = false; + bool selectAge = false; + + List parsedResponseIMGS = []; // ์ด๋ฏธ์ง€ ๊ฐœ์ˆ˜ + + // ๋‚ด์šฉ ์ตœ์‹  ํ”ผ๋“œ ๋ถˆ๋Ÿฌ์˜ค๊ธฐ(GET) + void fetchWithHeaders(String aToken) async { + // API ์—”๋“œํฌ์ธํŠธ URL + String apiUrl = 'http://3.38.1.125:8080/memorial/feed?filter=false'; // ์‹ค์ œ API ์—”๋“œํฌ์ธํŠธ๋กœ ๋ณ€๊ฒฝํ•˜์„ธ์š” + + // ํ—ค๋” ์ •๋ณด ์„ค์ • + Map headers = { + 'Authorization': 'Bearer $aToken', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• + 'Content-Type': 'application/json', // ์˜ˆ: JSON ์š”์ฒญ์ธ ๊ฒฝ์šฐ ํ—ค๋” ์„ค์ • + }; + + // HTTP GET ์š”์ฒญ ๋ณด๋‚ด๊ธฐ + var response = await http.get( + Uri.parse(apiUrl), + headers: headers, // ํ—ค๋” ์ถ”๊ฐ€ + ); + + // HTTP ์‘๋‹ต ์ƒํƒœ ํ™•์ธ + if (response.statusCode == 200) { + // ์‘๋‹ต ๋ฐ์ดํ„ฐ ์ฒ˜๋ฆฌ + print('์„œ๋ฒ„๋กœ๋ถ€ํ„ฐ ๋ฐ›์€ ๋‚ด์šฉ ๋ฐ์ดํ„ฐ: ${response.body}'); + var jsonResponse = utf8.decode(response.bodyBytes); + + parsedResponseCM = json.decode(jsonResponse); + + + isLastest = true; + setState(() {}); + + } else { + // ์š”์ฒญ์ด ์‹คํŒจํ•œ ๊ฒฝ์šฐ ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌ + print('HTTP ์š”์ฒญ ์‹คํŒจ: ${response.statusCode}'); + } + } + + void sendPostRequest(String aToken) async { + // API ์—”๋“œํฌ์ธํŠธ URL + String apiUrl = 'http://3.38.1.125:8080/memorial/feed?filter=false'; // ์‹ค์ œ API ์—”๋“œํฌ์ธํŠธ๋กœ ๋ณ€๊ฒฝํ•˜์„ธ์š” + + // POST ์š”์ฒญ ๋ณด๋‚ด๊ธฐ + var response = await http.post( + Uri.parse(apiUrl), + headers: { + 'Authorization': 'Bearer $aToken', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• + 'Content-Type': 'application/json', // ์˜ˆ: JSON ์š”์ฒญ์ธ ๊ฒฝ์šฐ ํ—ค๋” ์„ค์ • + //'Content-Type': 'application/json', + }, // ์š”์ฒญ ํ—ค๋”์— Content-Type ์„ค์ • + ); + + // HTTP ์‘๋‹ต ์ƒํƒœ ํ™•์ธ + if (response.statusCode == 200) { + // ์‘๋‹ต ๋ฐ์ดํ„ฐ ์ฒ˜๋ฆฌ + print('์„œ๋ฒ„๋กœ๋ถ€ํ„ฐ ๋ฐ›์€ ๋‚ด์šฉ ๋ฐ์ดํ„ฐ: ${response.body}'); + var jsonResponse = utf8.decode(response.bodyBytes); + + parsedResponseCM = json.decode(jsonResponse); + + print("๊ฐฏ์ˆ˜:" + parsedResponseCM.length.toString()); + + isLastest = true; + setState(() {}); + // print('์„œ๋ฒ„๋กœ๋ถ€ํ„ฐ ๋ฐ›์€ ๋ฐ์ดํ„ฐ: ${response.body}'); + } else { + // ์š”์ฒญ์ด ์‹คํŒจํ•œ ๊ฒฝ์šฐ ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌ + print('HTTP ์š”์ฒญ ์‹คํŒจ: ${response.statusCode}'); + } + } + + late Map parsedResponseUser; // ์‚ฌ์šฉ์ž ์ •๋ณด + + // ํ•„ํ„ฐ๋ง ์ ์šฉ์„ ์œ„ํ•œ ์‚ฌ์šฉ์ž ์ •๋ณด ๊ฐ€์ ธ์˜ค๊ธฐ + void fetchUserInfo(String aToken) async { + // API ์—”๋“œํฌ์ธํŠธ URL + print("๋ฐ›ํ† :" + aToken); + String apiUrl = 'http://3.38.1.125:8080/user/info'; // ์‹ค์ œ API ์—”๋“œํฌ์ธํŠธ๋กœ ๋ณ€๊ฒฝํ•˜์„ธ์š” + + // ํ—ค๋” ์ •๋ณด ์„ค์ • + Map headers = { + 'Authorization': 'Bearer $aToken', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• + 'Content-Type': 'application/json', // ์˜ˆ: JSON ์š”์ฒญ์ธ ๊ฒฝ์šฐ ํ—ค๋” ์„ค์ • + }; + + // HTTP GET ์š”์ฒญ ๋ณด๋‚ด๊ธฐ + var response = await http.get( + Uri.parse(apiUrl), + headers: headers, // ํ—ค๋” ์ถ”๊ฐ€ + ); + + // HTTP ์‘๋‹ต ์ƒํƒœ ํ™•์ธ + if (response.statusCode == 200) { + // ์‘๋‹ต ๋ฐ์ดํ„ฐ ์ฒ˜๋ฆฌ + print('์„œ๋ฒ„๋กœ๋ถ€ํ„ฐ ๋ฐ›์€ ๋‚ด์šฉ ๋ฐ์ดํ„ฐ(์‚ฌ์šฉ์ž ์ •๋ณด): ${response.body}'); + var jsonResponse = utf8.decode(response.bodyBytes); + + parsedResponseUser = json.decode(jsonResponse); + + } else { + // ์š”์ฒญ์ด ์‹คํŒจํ•œ ๊ฒฝ์šฐ ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌ + print('HTTP ์š”์ฒญ ์‹คํŒจ: ${response.statusCode}'); + } + } + + void sendPostRequestFilter(String aToken, String type) async { + + // ์š”์ฒญ ๋ณธ๋ฌธ ๋ฐ์ดํ„ฐ + var data = { + "type" : type, + }; + // API ์—”๋“œํฌ์ธํŠธ URL + String apiUrl = 'http://3.38.1.125:8080/memorial/feed?filter=true'; + + // POST ์š”์ฒญ ๋ณด๋‚ด๊ธฐ + var response = await http.post( + Uri.parse(apiUrl), + body: json.encode(data), // ์š”์ฒญ ๋ณธ๋ฌธ์— ๋ฐ์ดํ„ฐ๋ฅผ JSON ํ˜•์‹์œผ๋กœ ์ธ์ฝ”๋”ฉํ•˜์—ฌ ์ „๋‹ฌ + headers: { + 'Authorization': 'Bearer $aToken', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• + 'Content-Type': 'application/json', // ์˜ˆ: JSON ์š”์ฒญ์ธ ๊ฒฝ์šฐ ํ—ค๋” ์„ค์ • + //'Content-Type': 'application/json', + }, // ์š”์ฒญ ํ—ค๋”์— Content-Type ์„ค์ • + ); + + // HTTP ์‘๋‹ต ์ƒํƒœ ํ™•์ธ + if (response.statusCode == 200) { + // ์‘๋‹ต ๋ฐ์ดํ„ฐ ์ฒ˜๋ฆฌ + print('์„œ๋ฒ„๋กœ๋ถ€ํ„ฐ ๋ฐ›์€ ๋‚ด์šฉ ๋ฐ์ดํ„ฐ: ${response.body}'); + var jsonResponse = utf8.decode(response.bodyBytes); + + parsedResponseCM = json.decode(jsonResponse); + + // isLastest = true; + setState(() {}); + // print('์„œ๋ฒ„๋กœ๋ถ€ํ„ฐ ๋ฐ›์€ ๋ฐ์ดํ„ฐ: ${response.body}'); + } else { + // ์š”์ฒญ์ด ์‹คํŒจํ•œ ๊ฒฝ์šฐ ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌ + print('HTTP ์š”์ฒญ ์‹คํŒจ: ${response.statusCode}'); + } + } + + void sendPostRequestFilter2(String aToken ,String age) async { + + // ์š”์ฒญ ๋ณธ๋ฌธ ๋ฐ์ดํ„ฐ + var data = { + "age" : age, + }; + // API ์—”๋“œํฌ์ธํŠธ URL + String apiUrl = 'http://3.38.1.125:8080/memorial/feed?filter=true'; + + // POST ์š”์ฒญ ๋ณด๋‚ด๊ธฐ + var response = await http.post( + Uri.parse(apiUrl), + body: json.encode(data), // ์š”์ฒญ ๋ณธ๋ฌธ์— ๋ฐ์ดํ„ฐ๋ฅผ JSON ํ˜•์‹์œผ๋กœ ์ธ์ฝ”๋”ฉํ•˜์—ฌ ์ „๋‹ฌ + headers: { + 'Authorization': 'Bearer $aToken', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• + 'Content-Type': 'application/json', // ์˜ˆ: JSON ์š”์ฒญ์ธ ๊ฒฝ์šฐ ํ—ค๋” ์„ค์ • + //'Content-Type': 'application/json', + }, // ์š”์ฒญ ํ—ค๋”์— Content-Type ์„ค์ • + ); + + // HTTP ์‘๋‹ต ์ƒํƒœ ํ™•์ธ + if (response.statusCode == 200) { + // ์‘๋‹ต ๋ฐ์ดํ„ฐ ์ฒ˜๋ฆฌ + print('์„œ๋ฒ„๋กœ๋ถ€ํ„ฐ ๋ฐ›์€ ๋‚ด์šฉ ๋ฐ์ดํ„ฐ: ${response.body}'); + var jsonResponse = utf8.decode(response.bodyBytes); + + parsedResponseCM = json.decode(jsonResponse); + + selectAge = true; + // isLastest = true; + setState(() {}); + // print('์„œ๋ฒ„๋กœ๋ถ€ํ„ฐ ๋ฐ›์€ ๋ฐ์ดํ„ฐ: ${response.body}'); + } else { + // ์š”์ฒญ์ด ์‹คํŒจํ•œ ๊ฒฝ์šฐ ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌ + print('HTTP ์š”์ฒญ ์‹คํŒจ: ${response.statusCode}'); + } + } + + // ๋‘๊ฐœ ๋‹ค ์„ ํƒ + void sendPostRequestFilter3(String aToken, String age, String type) async { + + // ์š”์ฒญ ๋ณธ๋ฌธ ๋ฐ์ดํ„ฐ + var data = { + "age" : age, + "type" : type, + }; + // API ์—”๋“œํฌ์ธํŠธ URL + String apiUrl = 'http://3.38.1.125:8080/memorial/feed?filter=true'; + + // POST ์š”์ฒญ ๋ณด๋‚ด๊ธฐ + var response = await http.post( + Uri.parse(apiUrl), + body: json.encode(data), // ์š”์ฒญ ๋ณธ๋ฌธ์— ๋ฐ์ดํ„ฐ๋ฅผ JSON ํ˜•์‹์œผ๋กœ ์ธ์ฝ”๋”ฉํ•˜์—ฌ ์ „๋‹ฌ + headers: { + 'Authorization': 'Bearer $aToken', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• + 'Content-Type': 'application/json', // ์˜ˆ: JSON ์š”์ฒญ์ธ ๊ฒฝ์šฐ ํ—ค๋” ์„ค์ • + //'Content-Type': 'application/json', + }, // ์š”์ฒญ ํ—ค๋”์— Content-Type ์„ค์ • + ); + + // HTTP ์‘๋‹ต ์ƒํƒœ ํ™•์ธ + if (response.statusCode == 200) { + // ์‘๋‹ต ๋ฐ์ดํ„ฐ ์ฒ˜๋ฆฌ + print('์„œ๋ฒ„๋กœ๋ถ€ํ„ฐ ๋ฐ›์€ ๋‚ด์šฉ ๋ฐ์ดํ„ฐ: ${response.body}'); + var jsonResponse = utf8.decode(response.bodyBytes); + + parsedResponseCM = json.decode(jsonResponse); + + selectAge = true; + // isLastest = true; + setState(() {}); + // print('์„œ๋ฒ„๋กœ๋ถ€ํ„ฐ ๋ฐ›์€ ๋ฐ์ดํ„ฐ: ${response.body}'); + } else { + // ์š”์ฒญ์ด ์‹คํŒจํ•œ ๊ฒฝ์šฐ ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌ + print('HTTP ์š”์ฒญ ์‹คํŒจ: ${response.statusCode}'); + } + } + + // ํ…์ŠคํŠธ์—๋””ํŒ…์ปจํŠธ๋กค๋Ÿฌ๋ฅผ ์ƒ์„ฑํ•˜์—ฌ ํ•„๋“œ์— ํ• ๋‹น + final myController = TextEditingController(); + + @override + void initState() { + super.initState(); + SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: [SystemUiOverlay.top]); + //fetchWithHeaders(); + + fetchUserInfo(sign_in.userAccessToken); + //_callAPI(); + sendPostRequest(sign_in.userAccessToken); + } + + double calculateGridViewHeight() { + // ๊ทธ๋ฆฌ๋“œ๋ทฐ์˜ ์•„์ดํ…œ ์ˆ˜ + int itemCount = parsedResponseCM.length; + + // ๊ทธ๋ฆฌ๋“œ๋ทฐ์˜ ์—ด ์ˆ˜ (3๊ฐœ์˜ ์•„์ดํ…œ์ด ํ•œ ํ–‰์— ์žˆ์„ ๋•Œ) + int columnCount = 2; + + // ์•„์ดํ…œ์˜ ๋†’์ด (๊ฐ€๋กœ:์„ธ๋กœ ๋น„์œจ์„ ์„ค์ •ํ•  ์ˆ˜ ์žˆ์Œ) + double itemHeight = 204; // ์ด ๊ฐ’์€ ์ ์ ˆํžˆ ์กฐ์ • + + // ์•„์ดํ…œ ๊ฐ„์˜ ์ˆ˜์ง ๊ฐ„๊ฒฉ + double crossAxisSpacing = 8.0; + + // ๊ทธ๋ฆฌ๋“œ๋ทฐ์˜ ๋†’์ด ๊ณ„์‚ฐ + double gridHeight = ((itemCount / columnCount).ceil() * itemHeight) + + ((itemCount / columnCount - 1).ceil() * crossAxisSpacing); + + return gridHeight; + } + + @override + Widget build(BuildContext context) { + MediaQueryData deviceData = MediaQuery.of(context); + Size screenSize = deviceData.size; + return Scaffold( + appBar: PreferredSize( + preferredSize: Size.fromHeight(72), + child: AppBar( + actions: [ + Padding(padding: EdgeInsets.only(top:15), + child: new IconButton( + icon:Icon(Icons.search, size: 24,), + onPressed: (){ + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => LateMemorialSearchPage())); // ๊ฒ€์ƒ‰ํŽ˜์ด์ง€๋กœ ์ด๋™ + }, + ), + ), + + ], + automaticallyImplyLeading:false, + title: + Container( + height: 50, + width: screenSize.width, + child: Column( + children: [ + SizedBox(height: 24,), + Center( + child: Padding(padding: EdgeInsets.only(left: 60), + child: Text('ํ•จ๊ป˜ํ• ๊ฐœ', style: textStyle.bk20normal,), + ) + ), + ], + ), + ), + backgroundColor: Color(0xffDDE7FD), + elevation: 0.0, + iconTheme: IconThemeData(color: Colors.black), + ), + ), + body: Container( + color: Color(0xffDDE7FD), + //width: Get.width, + //height: Get.height, + child: SingleChildScrollView( + + scrollDirection: Axis.vertical, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + if(isLastest)...[ + ClipRRect( + borderRadius: BorderRadius.only(topLeft: Radius.circular(16.0), topRight: Radius.circular(16.0)), + child: Container( + padding: EdgeInsets.all(16), + width: Get.width, + color: Color(0xffF1F5FE), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding(padding: EdgeInsets.only(bottom: 22, left: 0), + child: Row( + children: [ + if(selectType)...[ + Container( + height: 28, + width: 119, + child: ElevatedButton(onPressed: (){ + dogType = "${parsedResponseUser['puppyType']}"; + selectType = false; + if(selectAge){ + sendPostRequestFilter2(sign_in.userAccessToken,parsedResponseUser['puppyAge'].toString()); + }else{ + sendPostRequest(sign_in.userAccessToken); + } + setState(() {}); + //sendPostRequestFilter(sign_in.userAccessToken); + }, + style: buttonChart().whitebtn4, + child: Text("${parsedResponseUser['puppyType']}", style: textStyle.wo16semibold,) + ), + ), + ]else...[ + Container( + height: 28, + width: 119, + child: ElevatedButton(onPressed: (){ + dogType = "${parsedResponseUser['puppyType']}"; + selectType = true; + setState(() {}); + if(selectAge){ + sendPostRequestFilter3(sign_in.userAccessToken, parsedResponseUser['puppyAge'].toString() ,parsedResponseUser['puppyType']); + }else{ + sendPostRequestFilter(sign_in.userAccessToken, parsedResponseUser['puppyType']); + } + }, + style: buttonChart().whitebtn3, + child: Text("${parsedResponseUser['puppyType']}", style: textStyle.bk16light,) + ), + ), + ], + + SizedBox(width: 16,), + if(selectAge)...[ + Container( + height: 28, + width: 63, + child: ElevatedButton(onPressed: (){ + dogAge = "${parsedResponseUser['puppyAge']}์‚ด"; + selectAge = false; + setState(() {}); + if(selectType){ + sendPostRequestFilter(sign_in.userAccessToken, parsedResponseUser['puppyType']); + }else{ + sendPostRequest(sign_in.userAccessToken); + } + }, + style: buttonChart().whitebtn4, + child: Text("${parsedResponseUser['puppyAge']}์‚ด", style: textStyle.wo16semibold,) + ), + ), + ] + else...[ + Container( + height: 28, + width: 63, + child: ElevatedButton(onPressed: (){ + dogAge = "${parsedResponseUser['puppyAge']}์‚ด"; + selectAge = true; + setState(() {}); + if(selectType){ + sendPostRequestFilter3(sign_in.userAccessToken, parsedResponseUser['puppyAge'].toString() ,parsedResponseUser['puppyType']); + }else{ + sendPostRequestFilter2(sign_in.userAccessToken,parsedResponseUser['puppyAge'].toString()); + } + }, + style: buttonChart().whitebtn3, + child: Text("${parsedResponseUser['puppyAge']}์‚ด", style: textStyle.bk16light,) + ), + ), + ], + SizedBox(width: 16,), + Container( + height: 28, + width: 52, + child: ElevatedButton(onPressed: (){ + setState(() {}); + selectAge = false; + selectType = false; + sendPostRequest(sign_in.userAccessToken); + }, + style: buttonChart().whitebtn3, + child: SvgPicture.asset( + 'assets/images/memorial/reset.svg', + ), + ), + ) + ], + ), + ), + Container( + //padding: EdgeInsets.all(8.0), + width: Get.width, + height: (parsedResponseCM.length) == 0? Get.height - 234 : calculateGridViewHeight() + 188, + color: Color(0xffF1F5FE), + child: + Column( + children: [ + Expanded( + child: Column( + children: [ + (parsedResponseCM.length) != 0? + GridView.builder( + shrinkWrap: true, // ๊ทธ๋ฆฌ๋“œ๋ทฐ๊ฐ€ ์ž์‹ ์˜ ๋‚ด์šฉ์— ๋งž๊ฒŒ ํฌ๊ธฐ๋ฅผ ์กฐ์ ˆํ•˜๋„๋ก ํ•จ + physics: NeverScrollableScrollPhysics(), + itemCount:parsedResponseCM.length, + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 2, //1 ๊ฐœ์˜ ํ–‰์— ๋ณด์—ฌ์ค„ item ๊ฐœ์ˆ˜ + childAspectRatio: 1.56 / 2.04, //item ์˜ ๊ฐ€๋กœ 1, ์„ธ๋กœ 2 ์˜ ๋น„์œจ + mainAxisSpacing: 16, //์ˆ˜ํ‰ Padding + crossAxisSpacing: 16, //์ˆ˜์ง Padding + ), + itemBuilder: (BuildContext context, int index){ + return + InkWell( + onTap: (){ + selectedOthersImage = parsedResponseCM[index]['image']; + selectedOthersProfileImage = parsedResponseCM[index]['profileImage'].toString(); + selectedOthersNickaname = parsedResponseCM[index]['nickname']; + selectedUser = parsedResponseCM[index]['userUid']; + selectedPostId = parsedResponseCM[index]['id']; + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => LateWatchOthersMemorialDetailPage())); + }, + child: Container( + // width: 156, + // height: 204, + padding: EdgeInsets.all(1.0), + decoration: BoxDecoration( + boxShadow: [ + BoxShadow( + color: Colors.black.withOpacity(0.05), + blurRadius: 10.0, + spreadRadius: 0.0, + offset: const Offset(0,7), + ) + ], + color: Colors.white, + borderRadius: BorderRadius.circular(16), + ), + child:Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + height: 166, + width: 204, + child: + Stack( + children: [ + Container( + height: 204, + width: 204, + child: + ClipRRect( + borderRadius: BorderRadius.only(topLeft: Radius.circular(16.0), topRight: Radius.circular(16.0)), + child: + Image( + image: NetworkImage(parsedResponseCM[index]['image'],), + fit: BoxFit.cover, + errorBuilder: (context, error, stackTrace) { + // ์˜ค๋ฅ˜ ๋ฐœ์ƒ ์‹œ ๋Œ€์ฒด ์ด๋ฏธ์ง€๋ฅผ ํ‘œ์‹œ + return SvgPicture.asset( + 'assets/images/no_result.svg',); + }, + ) + //Image.network(parsedResponseCM[index]['image'], fit: BoxFit.cover,), + ), + //Image.network(parsedResponseCM[index]['image'], fit: BoxFit.cover,), + ), + + Padding(padding: EdgeInsets.only(left: 8, top:8), + child: InkWell( + onTap: (){ + // selectedUser = parsedResponseCM[index]['userUid']; + // Navigator.push( + // context, + // MaterialPageRoute( + // builder: (context) => OthersMemorialMainPage())); + }, + child: + Container( + decoration: BoxDecoration( + color: Colors.black.withOpacity(0.2), + borderRadius: BorderRadius.circular(32), + ), + // color: Colors.white.withOpacity(0.7), + width: 86, + height: 32, + child: Row( + children: [ + SizedBox(width: 5,), + if(parsedResponseCM[index]['profileImage'].toString() == "null")...[ + CircleAvatar( + backgroundColor: Colors.white, + radius: 10, + child: CircleAvatar( + child: SvgPicture.asset('assets/images/user_null2.svg',), + radius: 9, + ), + ), + ]else...[ + CircleAvatar( + backgroundColor: Colors.white, + radius: 10, + child: CircleAvatar( + radius: 9, + backgroundImage: NetworkImage(parsedResponseCM[index]['profileImage'].toString()), + ), + ), + ], + + SizedBox(width: 5,), + Container( + width: 37, + child:Text(parsedResponseCM[index]['nickname'], + overflow: TextOverflow.ellipsis, // "..."์œผ๋กœ ํ‘œ์‹œ + maxLines: 1, // ์›ํ•˜๋Š” ์ค„ ์ˆ˜๋กœ ์„ค์ • + style: TextStyle(color: Colors.white, fontSize: 14, fontFamily: 'Pretendard',fontWeight: FontWeight.w600,),), + ), + SizedBox(width: 1,), + Container( + width: 11, + child: + Icon(Icons.arrow_forward_ios_rounded, color: Colors.white,size: 12,) + // SvgPicture.asset( + // 'assets/images/memorial/blue_arrow.svg', + // //fit: BoxFit.cover,), + ) + ], + ), + ), + ), + ), + ],), + ), + SizedBox(height: 8,), + Container( + height: 16, + width: 150, + child: Row( + children: [ + SizedBox(width: 10,), + Container( + width: 140, + height: 65, + child: Text(parsedResponseCM[index]['title'],style: TextStyle(color: Color(0xff333333), fontSize: 13.5, fontFamily: 'Pretendard',fontWeight: FontWeight.w400,), ), + ), + ], + ), + ), + ], + ) + ), + ); + + }): + Padding(padding: EdgeInsets.only(top: 200), + child: Column( + children: [ + SvgPicture.asset( + 'assets/images/no_result.svg', + height: 124, + ), + SizedBox(height: 16,), + Text("์ผ์น˜ํ•˜๋Š” ๋‚ด์šฉ์ด ์—†์Šต๋‹ˆ๋‹ค.", style: textStyle.bk16normal,) + ], + ) + ) + ], + ) + ) + ], + ) + ), + ], + ), + ), + ), + ], + ], + ), + ), + ), + bottomSheet: Padding( + padding: EdgeInsets.only( + bottom: MediaQuery.of(context).viewInsets.bottom * 0.001), + child: Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Container( + color: Color(0xffFFFFFF).withOpacity(0.0), + child: Padding( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 24), + child: Container( + width: screenSize.width, + height: 40, + child: ElevatedButton( + style: buttonChart().bluebtn3, + onPressed: () { + Navigator.pop(context); + + late_.player2.setAsset(late_.voice[28]); + late_.player2.play(); + // 2.5์ดˆ ์ ์ • + late_.controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + Timer(Duration(milliseconds: 3500), () { + late_.controller1.stop(); + }); + setState(() {}); + }, + child: Text("๋Œ€ํ™”๋กœ ๋Œ์•„๊ฐ€๊ธฐ", style: TextStyle( + fontFamily: 'Pretendard', + fontSize: 16, fontWeight: FontWeight.w500, color: Color(0xffFFFFFF))), + ), + ),), + ), + ], + ), + ), + + ); + } +} \ No newline at end of file diff --git a/client/lib/conversation/late_period/late_watch_others_detail.dart b/client/lib/conversation/late_period/late_watch_others_detail.dart new file mode 100644 index 0000000..601ed23 --- /dev/null +++ b/client/lib/conversation/late_period/late_watch_others_detail.dart @@ -0,0 +1,863 @@ +import 'dart:async'; +import 'dart:convert'; +import 'package:flutter_svg/svg.dart'; +import 'package:get/get.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:client/style.dart'; +import 'package:intl/intl.dart'; +import 'late_watch_others.dart'as lwatch; +import 'package:http/http.dart' as http; +import 'package:client/sign/sign_in.dart' as sign_in; +import 'package:client/home.dart' as home; +import 'package:client/memorial/slide/flutter_image_slideshow.dart'; + +class LateWatchOthersMemorialDetailPage extends StatefulWidget { + @override + State createState() => _LateWatchOthersMemorialDetailPageState(); +} + +class _LateWatchOthersMemorialDetailPageState extends State { + + //lwatch.selectedPostId.toString() + + // ํ™”๋ฉด์— ๋ณด์ด๋Š” UI ์„ค์ • bool + bool askHelp = true; + bool sendHelp = false; + + bool fetchSuccess = false; + + // ํ…์ŠคํŠธ์—๋””ํŒ…์ปจํŠธ๋กค๋Ÿฌ๋ฅผ ์ƒ์„ฑํ•˜์—ฌ ํ•„๋“œ์— ํ• ๋‹น + final myController = TextEditingController(); + + late Map parsedResponseCN; // ๊ธ€ ๋‚ด์šฉ + late List parsedResponseCM; // ๋Œ“๊ธ€ + + List parsedResponseIMGS = []; // ์ด๋ฏธ์ง€ ๊ฐœ์ˆ˜ + + bool isComment = false; + + // ์ฝ”๋ฉ˜ํŠธ ์ˆ˜์™€ ์ข‹์•„์š” ์ˆ˜ + int comments = 0; + int hearts = 0; + + late bool myHeart; + + bool setComment = false; + + // ๊ธ€๋‚ด์šฉ ๊ฐ€์ ธ์˜ค๊ธฐ + void fetchWithHeaders(String aToken) async { + // API ์—”๋“œํฌ์ธํŠธ URL + String apiUrl = 'http://3.38.1.125:8080/memorial?postId=${lwatch.selectedPostId.toString()}'; // ์‹ค์ œ API ์—”๋“œํฌ์ธํŠธ๋กœ ๋ณ€๊ฒฝํ•˜์„ธ์š” + + print("๋ช‡๋ฒˆ์ด์•ผ? "+lwatch.selectedPostId.toString()); + // ํ—ค๋” ์ •๋ณด ์„ค์ • + Map headers = { + 'Authorization': 'Bearer $aToken', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• + 'Content-Type': 'application/json', // ์˜ˆ: JSON ์š”์ฒญ์ธ ๊ฒฝ์šฐ ํ—ค๋” ์„ค์ • + }; + + // HTTP GET ์š”์ฒญ ๋ณด๋‚ด๊ธฐ + var response = await http.get( + Uri.parse(apiUrl), + headers: headers, // ํ—ค๋” ์ถ”๊ฐ€ + ); + + // HTTP ์‘๋‹ต ์ƒํƒœ ํ™•์ธ + if (response.statusCode == 200) { + // ์‘๋‹ต ๋ฐ์ดํ„ฐ ์ฒ˜๋ฆฌ + fetchSuccess = true; + setState(() {}); + print('์„œ๋ฒ„๋กœ๋ถ€ํ„ฐ ๋ฐ›์€ ๋‚ด์šฉ ๋ฐ์ดํ„ฐ(๊ธ€ ๋‚ด์šฉ): ${response.body}'); + var jsonResponse = utf8.decode(response.bodyBytes); + + parsedResponseCN = json.decode(jsonResponse); + + // List ํ˜•์‹ + print("image test" + parsedResponseCN['imageList'][0].toString()); + + for(int i = 0; i headers = { + 'Authorization': 'Bearer $aToken', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• + 'Content-Type': 'application/json', // ์˜ˆ: JSON ์š”์ฒญ์ธ ๊ฒฝ์šฐ ํ—ค๋” ์„ค์ • + }; + + var url = Uri.parse('http://3.38.1.125:8080/memorial/comment?postId=${lwatch.selectedPostId.toString()}'); // ์—”๋“œํฌ์ธํŠธ URL ์„ค์ • + + try { + var response = await http.post( + url, + body: json.encode(data), // ์š”์ฒญ ๋ณธ๋ฌธ์— ๋ฐ์ดํ„ฐ๋ฅผ JSON ํ˜•์‹์œผ๋กœ ์ธ์ฝ”๋”ฉํ•˜์—ฌ ์ „๋‹ฌ + headers: headers, // ํ—ค๋” ์ถ”๊ฐ€ + ); + + if (response.statusCode == 200) { + // ์‘๋‹ต ์„ฑ๊ณต ์‹œ์˜ ์ฒ˜๋ฆฌ + + var jsonResponse = utf8.decode(response.bodyBytes); // ์‘๋‹ต ๋ณธ๋ฌธ์„ JSON ํ˜•์‹์œผ๋กœ ๋””์ฝ”๋”ฉ + // JSON ๊ฐ’์„ ํ™œ์šฉํ•œ ์›ํ•˜๋Š” ๋™์ž‘ ์ˆ˜ํ–‰ + //utf8.decode(jsonResponse); + print(jsonResponse); + + List contentList = []; + + List parsedResponse = json.decode(jsonResponse); + + setState(() { + }); + + + print('API ํ˜ธ์ถœ ์„ฑ๊ณต!!: ${response.statusCode}'); + } else { + // ์š”์ฒญ ์‹คํŒจ ์‹œ์˜ ์ฒ˜๋ฆฌ + print('API ํ˜ธ์ถœ ์‹คํŒจ!!: ${response.statusCode}'); + } + } catch (e) { + // ์˜ˆ์™ธ ๋ฐœ์ƒ ์‹œ์˜ ์ฒ˜๋ฆฌ + print('API ํ˜ธ์ถœ ์ค‘ ์˜ˆ์™ธ ๋ฐœ์ƒ: $e'); + } + } + + // ์ข‹์•„์š” ๋ˆ„๋ฅด๊ธฐ(POST) + void sendPostRequest(String aToken) async { + // API ์—”๋“œํฌ์ธํŠธ URL + String apiUrl = 'http://3.38.1.125:8080/memorial/like?postId=${lwatch.selectedPostId.toString()}'; // ์‹ค์ œ API ์—”๋“œํฌ์ธํŠธ๋กœ ๋ณ€๊ฒฝํ•˜์„ธ์š” + + // POST ์š”์ฒญ ๋ณด๋‚ด๊ธฐe + var response = await http.post( + Uri.parse(apiUrl), + headers: { + 'Authorization': 'Bearer $aToken', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• + 'Content-Type': 'application/json', // ์˜ˆ: JSON ์š”์ฒญ์ธ ๊ฒฝ์šฐ ํ—ค๋” ์„ค์ • + //'Content-Type': 'application/json', + }, // ์š”์ฒญ ํ—ค๋”์— Content-Type ์„ค์ • + ); + + // HTTP ์‘๋‹ต ์ƒํƒœ ํ™•์ธ + if (response.statusCode == 200) { + // ์‘๋‹ต ๋ฐ์ดํ„ฐ ์ฒ˜๋ฆฌ + print('์„œ๋ฒ„๋กœ๋ถ€ํ„ฐ ๋ฐ›์€ ๋‚ด์šฉ ๋ฐ์ดํ„ฐ: ${response.body}'); + var jsonResponse = utf8.decode(response.bodyBytes); + + setState(() {}); + // print('์„œ๋ฒ„๋กœ๋ถ€ํ„ฐ ๋ฐ›์€ ๋ฐ์ดํ„ฐ: ${response.body}'); + } else { + // ์š”์ฒญ์ด ์‹คํŒจํ•œ ๊ฒฝ์šฐ ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌ + print('HTTP ์š”์ฒญ ์‹คํŒจ: ${response.statusCode}'); + } + } + + // ์ข‹์•„์š” ๊ฐ€์ ธ์˜ค๊ธฐ- ํด๋ฆญ์—ฌ๋ถ€ ํ™•์ธ(GET) + void fetchDataLike(String aToken) async { + // API ์—”๋“œํฌ์ธํŠธ URL + String apiUrl = 'http://3.38.1.125:8080/memorial/like?postId=${lwatch.selectedPostId.toString()}'; /// postId=1 ์ถ”ํ›„์— ๋ฐ”๊ฟ”์ฃผ๊ธฐ + + // ํ—ค๋” ์ •๋ณด ์„ค์ • + Map headers = { + 'Authorization': 'Bearer $aToken', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• + 'Content-Type': 'application/json', // ์˜ˆ: JSON ์š”์ฒญ์ธ ๊ฒฝ์šฐ ํ—ค๋” ์„ค์ • + }; + + // HTTP GET ์š”์ฒญ ๋ณด๋‚ด๊ธฐ + var response = await http.get( + Uri.parse(apiUrl), + headers: headers, // ํ—ค๋” ์ถ”๊ฐ€ + ); + + ///var jsonResponse = utf8.decode(response.bodyBytes); + // HTTP ์‘๋‹ต ์ƒํƒœ ํ™•์ธ + if (response.statusCode == 200) { + // ์‘๋‹ต ๋ฐ์ดํ„ฐ๋ฅผ JSON ํ˜•์‹์œผ๋กœ ๋””์ฝ”๋”ฉ + var data = json.decode(response.body); + var jsonResponse = utf8.decode(response.bodyBytes); + + myHeart = json.decode(jsonResponse); + + // ๋ฐ์ดํ„ฐ ์ฒ˜๋ฆฌ + print('์ข‹์•„์š”~: $myHeart'); + if(myHeart == true){ + hearts = 1; + } else{ + hearts = 0; + } + + setState(() { + }); + + } else { + // ์š”์ฒญ์ด ์‹คํŒจํ•œ ๊ฒฝ์šฐ ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌ + print('HTTP ์š”์ฒญ ์‹คํŒจ: ${response.statusCode}'); + } + } + + + @override + void initState() { + super.initState(); + SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: [SystemUiOverlay.top]); + fetchWithHeaders(sign_in.userAccessToken); + fetchDataLike(sign_in.userAccessToken); + + print("test" + lwatch.selectedPostId.toString()); + fetchDataComment(); + setState(() { + + }); + } + + // ๋Œ“๊ธ€ ์‚ญ์ œํ•˜๊ธฐ + void deleteComment(String aToken, int commentId) async { + // API ์—”๋“œํฌ์ธํŠธ URL + String apiUrl = 'http://3.38.1.125:8080/memorial/comment?commentId=${commentId}'; + + // ํ—ค๋” ์ •๋ณด ์„ค์ • + Map headers = { + 'Authorization': 'Bearer $aToken', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• + 'Content-Type': 'application/json', // ์˜ˆ: JSON ์š”์ฒญ์ธ ๊ฒฝ์šฐ ํ—ค๋” ์„ค์ • + }; + + // HTTP GET ์š”์ฒญ ๋ณด๋‚ด๊ธฐ + var response = await http.delete( + Uri.parse(apiUrl), + headers: headers, // ํ—ค๋” ์ถ”๊ฐ€ + ); + + ///var jsonResponse = utf8.decode(response.bodyBytes); + // HTTP ์‘๋‹ต ์ƒํƒœ ํ™•์ธ + if (response.statusCode == 200) { + // ์‘๋‹ต ๋ฐ์ดํ„ฐ๋ฅผ JSON ํ˜•์‹์œผ๋กœ ๋””์ฝ”๋”ฉ + print("์‚ญ์ œ์„ฑ๊ณต"); + setState(() { + }); + + } else { + // ์š”์ฒญ์ด ์‹คํŒจํ•œ ๊ฒฝ์šฐ ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌ + print('HTTP ์š”์ฒญ ์‹คํŒจ: ${response.statusCode}'); + } + } + + int comIndex = 0; // ์‚ญ์ œํ•  ๋Œ“๊ธ€ ์ธ๋ฑ์Šค + // ๋Œ“๊ธ€ ์‚ญ์ œ ํŒ์—… + void FlutterDialog() { + showDialog( + context: context, + builder: (_) => new AlertDialog( + shape: RoundedRectangleBorder( + borderRadius: + BorderRadius.all( + Radius.circular(12.0))), + content: Builder( + builder: (context) { + + return Container( + height: 298, + width: 412, + child: + Padding(padding: EdgeInsets.all(0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SizedBox(height: 12,), + Container( + width: 125, + height: 117, + child: SvgPicture.asset( + 'assets/images/no_result.svg', + width: 132, + height: 123, + fit: BoxFit.contain, + ), + ), + SizedBox(height: 32,), + Text("๋Œ“๊ธ€์„ ์‚ญ์ œ ํ•˜์‹œ๊ฒ ์–ด์š”?",style: textStyle.bk16bold,), + SizedBox(height: 8,), + Text("์‚ญ์ œํ•œ ํ›„, ๋‚ด์šฉ์ด ๋ณต๊ตฌ๋˜์ง€ ์•Š์•„์š”!", style: textStyle.bk14normal,), + SizedBox(height: 32,), + Row( + children: [ + Container( + height: 40, + width: 120, + child: ElevatedButton( + child: new Text("์ทจ์†Œ", style: textStyle.purple16midium), + style: buttonChart().purplebtn3, + onPressed: () { + Navigator.pop(context); + }, + ), + ), + SizedBox(width: 16,), + Container( + height: 40, + width: 120, + child: ElevatedButton( + child: new Text("์‚ญ์ œํ•˜๊ธฐ", style: textStyle.white16semibold), + style: buttonChart().purplebtn, + onPressed: () { + + // ์„œ๋ฒ„์— ์ „์†ก + deleteComment(sign_in.userAccessToken, comIndex); + setState(() {}); + Timer(Duration(milliseconds: 500), () { + fetchDataComment(); + }); + + Navigator.pop(context); + }, + ), + ), + ], + ) + ], + ),) + ); + }, + ), + ) + ); + } + + // ๋Œ“๊ธ€ ์œ„์ ฏ + Widget listview_builder(){ + return ListView.builder( + shrinkWrap: true, + scrollDirection: Axis.vertical, + padding: EdgeInsets.all(0), + physics: NeverScrollableScrollPhysics(), + itemCount: parsedResponseCM.length, + itemBuilder: (BuildContext context, int index){ + return Column( + children: [ + Container( + padding: EdgeInsets.fromLTRB(16, 16, 0, 16), + height: 104, + width: Get.width, + decoration: BoxDecoration( + color: Colors.white, + //borderRadius: BorderRadius.circular(16), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + if(parsedResponseCM[index]['profileImage'].toString() == "null")...[ + CircleAvatar( + radius: 10, + child: SvgPicture.asset('assets/images/user_null2.svg',), + ), + ]else...[ + CircleAvatar( + radius: 10, + backgroundImage: NetworkImage(parsedResponseCM[index]['profileImage'].toString()), + ), + ], + SizedBox(width: 8,), + Container(width: 55, + child: Text(parsedResponseCM[index]['nickname'], style: textStyle.bk12normal,),), + SizedBox(width: 204,), + if(parsedResponseCM[index]['nickname'] == home.user)...[ + Container(width: 78, height: 32, + child: TextButton(onPressed: (){ + comIndex = parsedResponseCM[index]['id']; + setState(() { + }); + FlutterDialog(); + }, child: Row( + children: [ + Text("์‚ญ์ œํ•˜๊ธฐ", style: textStyle.grey12normal,), + SvgPicture.asset('assets/images/memorial/deletecom.svg',), + ], + ) + + ), + ), + + ], + + + ], + ), + SizedBox(height: 6,), + Text(parsedResponseCM[index]['content'], style: textStyle.bk12normal,), + SizedBox(height: 6,), + Text(DateFormat('MM/dd HH:mm').format(DateTime.parse(parsedResponseCM[index]['createdAt'])).toString(), style: TextStyle(fontSize: 10, color: Color(0xffAAAAAA)),) + + //DateFormat('yy/MM/dd - HH:mm:ss').format(parsedResponse[0]['createdAt']) + ], + ), + ), + SizedBox(height: 4,), + ], + ); + + } + ); + } + + double calculateListViewHeight() { + // ๋ฆฌ์ŠคํŠธ๋ทฐ์˜ ์•„์ดํ…œ ์ˆ˜ + int itemCount = parsedResponseCM.length; + + // ๋ฆฌ์ŠคํŠธ๋ทฐ์˜ ์—ด ์ˆ˜ (3๊ฐœ์˜ ์•„์ดํ…œ์ด ํ•œ ํ–‰์— ์žˆ์„ ๋•Œ) + int columnCount = 1; + + // ์•„์ดํ…œ์˜ ๋†’์ด (๊ฐ€๋กœ:์„ธ๋กœ ๋น„์œจ์„ ์„ค์ •ํ•  ์ˆ˜ ์žˆ์Œ) + double itemHeight = 90; // ์ด ๊ฐ’์€ ์ ์ ˆํžˆ ์กฐ์ • + + // ์•„์ดํ…œ ๊ฐ„์˜ ์ˆ˜์ง ๊ฐ„๊ฒฉ + double crossAxisSpacing = 8.0; + + // ๋ฆฌ์ŠคํŠธ๋ทฐ์˜ ๋†’์ด ๊ณ„์‚ฐ + double listHeight = ((itemCount / columnCount).ceil() * itemHeight) + + ((itemCount / columnCount - 1).ceil() * crossAxisSpacing); + + return listHeight; + } + + + @override + Widget build(BuildContext context) { + MediaQueryData deviceData = MediaQuery.of(context); + Size screenSize = deviceData.size; + return Scaffold( + appBar: PreferredSize( + preferredSize: Size.fromHeight(72), + child: AppBar( + leading: + Padding( + padding: EdgeInsets.only(top: 20), + child: IconButton( + icon: Icon(Icons.arrow_back_ios_rounded, color: Colors.black), + onPressed: () => Navigator.of(context).pop(), + ), + ), + backgroundColor: Color(0xffDDE7FD), + elevation: 0.0, + title: + Container( + height: 50, + width: screenSize.width, + child: Column( + children: [ + SizedBox(height: 24,), + Center( + child: Padding( + padding: EdgeInsets.only(right: 60), + child: Text( + 'ํ•จ๊ป˜ํ• ๊ฐœ', + style: textStyle.bk20normal, + ), + )), + ], + )), + iconTheme: IconThemeData(color: Colors.black), + ), + ), + body: Container( + color: Color(0xffDDE7FD), + width: Get.width, + height: Get.height, + child: SingleChildScrollView( + padding: EdgeInsets.fromLTRB(0, 0, 0, 0), + scrollDirection: Axis.vertical, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + if(fetchSuccess)...[ + ClipRRect( + borderRadius: BorderRadius.only(topLeft: Radius.circular(16.0), topRight: Radius.circular(16.0)), + child: Container( + width: Get.width, + //height: 578, + color: Colors.white, + child: + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding(padding: EdgeInsets.all(16), + child: Column( + children: [ + Container( + width: Get.width, + height: Get.width - 32, + child: Stack( + children: [ + Container( + width: Get.width, + height: Get.width - 32, + child: + ClipRRect( + borderRadius: BorderRadius.circular(16.0), + child: + ImageSlideshow( + indicatorColor: Color(0xffFEFBAC), + onPageChanged: (value) { + debugPrint('Page changed: $value'); + }, + //autoPlayInterval: 3000, + isLoop: false, + children: [ + for(int i= 0; i OthersMemorialMainPage())); + }, + child: Padding( + padding: EdgeInsets.only(left: 10, top: 10), + child: Container( + decoration: BoxDecoration( + color: Colors.black.withOpacity(0.2), + borderRadius: BorderRadius.circular(32), + ), + // color: Colors.white.withOpacity(0.7), + width: 90, + height: 32, + child: Row( + children: [ + SizedBox(width: 6,), + if(lwatch.selectedOthersProfileImage.toString() == "null")...[ + CircleAvatar( + backgroundColor: Colors.white, + radius: 10, + child: CircleAvatar( + child: SvgPicture.asset('assets/images/user_null2.svg',), + radius: 9, + ), + ), + ]else...[ + CircleAvatar( + backgroundColor: Colors.white, + radius: 10, + child: CircleAvatar( + radius: 9, + backgroundImage: NetworkImage(lwatch.selectedOthersProfileImage.toString()), + ), + ), + ], + // CircleAvatar( + // backgroundColor: Colors.white, + // radius: 10, + // child: CircleAvatar( + // radius: 9, + // backgroundImage: NetworkImage(lwatch.selectedOthersProfileImage.toString(),), + // ), + // ), + + SizedBox(width: 5,), + Container( + width: 37, + child:Text(lwatch.selectedOthersNickaname, + overflow: TextOverflow.ellipsis, // "..."์œผ๋กœ ํ‘œ์‹œ + maxLines: 1, // ์›ํ•˜๋Š” ์ค„ ์ˆ˜๋กœ ์„ค์ • + style: TextStyle(color: Colors.white, fontSize: 14, fontFamily: 'Pretendard',fontWeight: FontWeight.w600,),), + ), + SizedBox(width: 5,), + Container( + width: 11, + child: + Icon(Icons.arrow_forward_ios_rounded, color: Colors.white,size: 12,), + // SvgPicture.asset( + // 'assets/images/memorial/blue_arrow.svg', + // //fit: BoxFit.cover, + // ), + ) + ], + ), + ), + ), + ) + ], + ), + ), + SizedBox(height: 15,), + Row( + children: [ + Container( + width: 120, + height: 32, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text("${parsedResponseCN['date']}์˜ ๊ธฐ์–ต", style: textStyle.grey12normal,), + SizedBox(height: 4,), + Text(parsedResponseCN['place'], style: textStyle.grey12normal) + ], + ), + ), + SizedBox(width: 150,), + Row( + children: [ + Container( + width: 19, + height: 19, + child: InkWell( + onTap: (){}, + child: SvgPicture.asset( + 'assets/images/memorial/comments.svg', + ), + ),), + SizedBox( width: 3,), + Text('${comments}'), + SizedBox( width: 10,), + if(hearts >= 1)...[ + Container( + // width: 22, + // height: 22, + child: InkWell( + onTap: (){ + // ์ข‹์•„์š” ๋ˆ„๋ฅด๊ธฐ + sendPostRequest(sign_in.userAccessToken); + // fetchDataLike(sign_in.userAccessToken); + hearts= 0; + setState(() { + }); + }, + child: SvgPicture.asset( + 'assets/images/memorial/heart-fill.svg', + ), + ),), + ] else...[ + SizedBox(width: 2,), + Container( + // width: 22, + // height: 22, + child: InkWell( + onTap: (){ + // ์ข‹์•„์š” ๋ˆ„๋ฅด๊ธฐ + sendPostRequest(sign_in.userAccessToken); + // fetchDataLike(sign_in.userAccessToken); + hearts= 1; + setState(() { + }); + }, + child: SvgPicture.asset( + 'assets/images/memorial/heart-empty.svg', + ), + ), + ), + ], + SizedBox( width: 3,), + Text('${hearts}'), + ], + ) + + ], + ), + SizedBox(height: 15,), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text(parsedResponseCN['title'],style: textStyle.bk16semibold,), + SizedBox(height: 8,), + Container(width: Get.width, + //height: 50, + child: Text(parsedResponseCN['content'], style: textStyle.bk14normal,), + ), + SizedBox(height: 8,), + Container(width: Get.width, + height: 12, + child: Text('#${parsedResponseCN['hashtag']}', style: textStyle.grey12normal), + ), + SizedBox(height: 5,), + ], + ), + ], + ),), + + ], + ), + + ), + ), + + SizedBox(height: 4,), + Container( + width: Get.width, + height: calculateListViewHeight() + 86, + child: Column( + children: [ + Expanded( + child: Column( + children: [ + listview_builder(), + ], + ) + ), + ], + ) + ), + + ], + + ], + ), + ), + ), + bottomSheet: Padding( + padding: EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom * 0.001), + child: Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.end, + children:[ + Container( + color:Color(0xffF2F4F6), + height: 48, + child: Padding( + padding: const EdgeInsets.only(bottom: 8.0, top: 8.0, left: 16,right: 16), + child: Stack( + children: [ + Container( + width: Get.width, + height: 48, + decoration: BoxDecoration( + color: Colors.white, + border: Border.all(color: setComment?Color(colorChart.blue):Color(0xffC0D2FC)), + borderRadius: BorderRadius.circular(30), + ), + ), + Positioned( + left: 15, + right: 30, + bottom: -4, + child: TextField( + textAlignVertical: TextAlignVertical.center, + maxLines: 1, + controller: myController, + style: textStyle.bk14normal, + decoration: InputDecoration( + hintStyle: textStyle.grey14normal, + border: InputBorder.none, + hintText: '๋Œ“๊ธ€์„ ์ž…๋ ฅํ•˜๋ ค๋ฉด ์—ฌ๊ธฐ๋ฅผ ํƒญํ•˜์„ธ์š”.'), + onChanged: (s) { + //text = s; + setComment = true; + setState(() { + + }); + }, + onTap: (){ + + }, + ), + ), + Positioned( + left: Get.width - 81, + //right: 30, + bottom: 3, + top: 3, + child: ElevatedButton( + onPressed: () { + saveComment(sign_in.userAccessToken, myController.text); + setState(() { + }); + + myController.clear(); + Timer(Duration(milliseconds: 500), () { + fetchDataComment(); + }); + }, + style: ElevatedButton.styleFrom( + backgroundColor: setComment? Color(colorChart.blue):Color(0xffDDE7FD), + fixedSize: const Size(23, 23), + shape: const CircleBorder(), + ), + child:Icon(Icons.arrow_upward, color: Colors.white,size: 16,) + ), + ), + ], + ), + ), + ), + ], + ), + ) + ); + } +} \ No newline at end of file diff --git a/client/lib/conversation/middle_period/sadness.dart b/client/lib/conversation/middle_period/sadness.dart new file mode 100644 index 0000000..4ea144f --- /dev/null +++ b/client/lib/conversation/middle_period/sadness.dart @@ -0,0 +1,1730 @@ +import 'dart:async'; +import 'dart:convert'; +import 'package:flutter/material.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter_svg/svg.dart'; +import 'package:client/home.dart' as home; +import 'package:client/screen.dart'; +import 'package:http/http.dart' as http; +import 'package:client/progressbar/animation_progressbar.dart'; +import 'package:client/sign/sign_in.dart'; +import 'package:client/style.dart'; +import 'package:intl/intl.dart'; +import 'package:just_audio/just_audio.dart'; +import 'package:flutter_gif/flutter_gif.dart'; +import 'package:client/sign/sign_in.dart' as sign_in; +import 'package:client/main.dart'as main; +import 'package:input_slider/input_slider.dart'; + +/// ์ค‘๊ธฐ๋Œ€ํ™”-์Šฌํ”” + +AudioPlayer player2 = AudioPlayer(); + +late FlutterGifController controller1, controller2, controller3; + +// start +List voice =[ + "assets/voice/middle/sadness/start1.mp3", "assets/voice/middle/sadness/start2.mp3", + "assets/voice/middle/sadness/start3.mp3", "assets/voice/middle/sadness/start4.mp3", + "assets/voice/middle/sadness/start5.mp3", "assets/voice/middle/sadness/start6.mp3", + "assets/voice/middle/sadness/start7.mp3", +]; + +// good +List goodVoice =[ + "assets/voice/middle/sadness/good1.mp3", "assets/voice/middle/sadness/good2.mp3", + "assets/voice/middle/sadness/good3.mp3", "assets/voice/middle/sadness/good4.mp3", + +]; + +// little +List littleVoice =[ + "assets/voice/middle/sadness/little_1.mp3", "assets/voice/middle/sadness/little_2.mp3", + "assets/voice/middle/sadness/little_3.mp3", "assets/voice/middle/sadness/little_4.mp3", +]; + +//hard +List hardVoice =[ + "assets/voice/middle/sadness/hard1.mp3", "assets/voice/middle/sadness/hard2.mp3", + "assets/voice/middle/sadness/hard3.mp3", +]; + +//next +List nextVoice =[ + "assets/voice/middle/sadness/next1.mp3", "assets/voice/middle/sadness/next2.mp3", + "assets/voice/middle/sadness/next3.mp3", "assets/voice/middle/sadness/next4.mp3", +]; + +//sad +List sadVoice =[ + "assets/voice/middle/sadness/sad1.mp3", "assets/voice/middle/sadness/sad2.mp3", + "assets/voice/middle/sadness/sad3.mp3", +]; + +//endure +List endureVoice =[ + "assets/voice/middle/sadness/endure1.mp3", "assets/voice/middle/sadness/endure2.mp3", + "assets/voice/middle/sadness/endure3.mp3", "assets/voice/middle/sadness/endure4.mp3", + "assets/voice/middle/sadness/endure5.mp3", "assets/voice/middle/sadness/endure6.mp3", +]; + +//last +List lastVoice =[ + "assets/voice/middle/sadness/last1.mp3", "assets/voice/middle/sadness/last2.mp3", + "assets/voice/middle/sadness/last3.mp3", "assets/voice/middle/sadness/last4.mp3", + "assets/voice/middle/sadness/last5.mp3", "assets/voice/middle/sadness/last6.mp3", + "assets/voice/middle/sadness/last7.mp3", "assets/voice/middle/sadness/last8.mp3", + "assets/voice/middle/sadness/last9.mp3", "assets/voice/middle/sadness/last10.mp3", + "assets/voice/middle/sadness/last11.mp3", "assets/voice/middle/sadness/last12.mp3", + "assets/voice/middle/sadness/last13.mp3", +]; + +//end +List endVoice =[ + "assets/voice/middle/sadness/end1.mp3", "assets/voice/middle/sadness/end2.mp3", + "assets/voice/middle/sadness/end3.mp3", "assets/voice/middle/sadness/end4.mp3", + "assets/voice/intro/intro2_8.mp3", + "", + "assets/voice/intro/intro2_9.mp3", +]; + + + + +class SadnessPage extends StatefulWidget { + + static Future navigatorPush(BuildContext context) async { + return Navigator.push( + context, + MaterialPageRoute( + builder: (_) => SadnessPage(), + ), + ); + } + + @override + _SadnessPageState createState() => _SadnessPageState(); +} + +class _SadnessPageState extends State with TickerProviderStateMixin { + + bool selectedNextTime = false; + bool chooseTime = false; + int whatTime = 0; + + bool selectedLocate = false; + bool chooseLocate = false; + String whatLocate = ""; + + bool selectedHow = false; + bool chooseHow = false; + String whatHow = ""; + + // ํ…์ŠคํŠธ ์—๋””ํŒ… ์ปจํŠธ๋กค๋Ÿฌ๋ฅผ ์ƒ์„ฑํ•˜์—ฌ ํ•„๋“œ์— ํ• ๋‹น + final nextTimeController = TextEditingController(); // nextQuestion = 7์ผ๋•Œ + final whatController = TextEditingController(); // nextQuestion = 7์ผ๋•Œ + + FocusNode _focusNode = FocusNode(); + + String sentDate = ""; + // ๋Œ€ํ™” ๋‹จ๊ณ„ ์ €์žฅ + void saveCon(String aToken, String con, String nextcon) async { + // API ์—”๋“œํฌ์ธํŠธ URL + String apiUrl = 'http://3.38.1.125:8080/user/conversation-status'; + + // ์š”์ฒญ ๋ณธ๋ฌธ ๋ฐ์ดํ„ฐ + var data = { + "conversationStatus": con, + "nextConversationAt": nextcon, + }; + + // ํ—ค๋” ์ •๋ณด ์„ค์ • + Map headers = { + 'Authorization': 'Bearer $aToken', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• + 'Content-Type': 'application/json', // ์˜ˆ: JSON ์š”์ฒญ์ธ ๊ฒฝ์šฐ ํ—ค๋” ์„ค์ • + }; + + // HTTP GET ์š”์ฒญ ๋ณด๋‚ด๊ธฐ + var response = await http.put( + Uri.parse(apiUrl), + body: json.encode(data), + headers: headers, // ํ—ค๋” ์ถ”๊ฐ€ + ); + + ///var jsonResponse = utf8.decode(response.bodyBytes); + // HTTP ์‘๋‹ต ์ƒํƒœ ํ™•์ธ + if (response.statusCode == 200) { + // ์‘๋‹ต ๋ฐ์ดํ„ฐ๋ฅผ JSON ํ˜•์‹์œผ๋กœ ๋””์ฝ”๋”ฉ + print("๋Œ€ํ™” ๋‹จ๊ณ„ ๋„ฃ๊ธฐ ์„ฑ๊ณต"); + setState(() { + }); + + } else { + // ์š”์ฒญ์ด ์‹คํŒจํ•œ ๊ฒฝ์šฐ ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌ + print('HTTP ์š”์ฒญ ์‹คํŒจ..?: ${response.statusCode}'); + } + } + + @override + void initState() { + super.initState(); + + main.play = true; + main.player.setAsset(main.musics[2]); + main.player.play(); + + // ์Œ์› ์ ์šฉ + for(int i= 0 ; i < voice.length; i++){ + player2.setAudioSource(AudioSource.uri( + Uri.parse(voice[i])) + ); + } + + controller1 = FlutterGifController(vsync: this); + + player2.setAsset(voice[voiceCount]); + voiceCount++; + player2.play(); + + // 2.5์ดˆ ์ ์ • + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + Timer(Duration(milliseconds: 1500), () { + controller1.stop(); + }); + + _callAPI(); + _focusNode.addListener(_onFocusChange); + } + + void _onFocusChange() { + if (_focusNode.hasFocus) { + // ํ‚ค๋ณด๋“œ ์˜ฌ๋ฆฌ๊ธฐ + FocusScope.of(context).requestFocus(_focusNode); + } + } + + @override + void dispose() async { + super.dispose(); + } + List introText =[]; + int startQuestion = 0; + int voiceCount = 0; + int voiceGoodCount = 0; + int voiceLittleCount = 0; + int voiceHardCount = 0; + int voiceNextCount = 0; + int voiceSadCount = 0; + int voiceEndureCount = 0; + int voiceLastCount = 0; + int voiceEndCount = 0; + + int goodQuestion = 0; + bool goodAns = false; + bool ui_good = false; + + int littleQuestion = 0; + bool littleAns = false; + bool ui_little = false; + + int hardQuestion = 0; + bool hardAns = false; + bool ui_hard = false; + + int nextQuestion = 0; + bool nextQ = false; + + bool ui_bad = false; + bool ui_sad = false; + bool ui_endure = false; + + int sadQuestion = 0; + bool sadAns = false; + + int endureQuestion = 0; + bool endureAns = false; + + int lastQuestion = 0; + bool last = false; + + int endQuestion = 0; + bool end = false; + + int happyVoiceCount = 0; + int griefVoiceCount = 0; + + // ์‹œ์ž‘ + List startQuestions =[ + "์ข‹์•„์š”, ${home.user}๋‹˜", + "${home.puppy}์™€์˜\n์ด๋ณ„๋กœ ๊ฒช์€ ์Šฌํ”ˆ ๊ฐ์ •๋“ค์€", + "${home.user}๋‹˜์˜ ์‚ถ์—\n๋ณ€ํ™”๋ฅผ ๊ฐ€์ ธ์™”์„ ๊ฑฐ์˜ˆ์š”.", + "์š”์ฆ˜ ${home.user}๋‹˜์€", + "์–ด๋–ป๊ฒŒ ์ง€๋‚ด๊ณ  ์žˆ๋Š”์ง€ ๊ถ๊ธˆํ•ด์š”.", + "ํ˜„์žฌ ${home.user}๋‹˜์˜\n๊ฑด๊ฐ• ์ƒํƒœ๋Š” ์–ด๋–ค๊ฐ€์š”?", + "๊ฑด๊ฐ• ์ƒํƒœ์˜ ์ •๋„๋ฅผ ์•Œ๋ ค์ฃผ์„ธ์š”.", + + ]; + +// ์ข‹์•„์š” + List good= [ + "${home.user}๋‹˜์€ ์Šฌํ””์„", + "๊ฑด๊ฐ•ํ•˜๊ฒŒ ๊ทน๋ณตํ•˜๊ณ  ๊ณ„์‹œ๋„ค์š”.", + "์•ž์œผ๋กœ๋„ ${home.user}๋‹˜์˜\n์ผ์ƒ์„ ์œ ์ง€ํ•˜๋ฉด์„œ.", + "์ฐจ์ฐจ ์ด๋ณ„์„ ๊ทน๋ณตํ•ด๊ฐ€๋ฉด ๋œ๋‹ต๋‹ˆ๋‹ค!", + ]; + +// ์กฐ๊ธˆ ์•„ํŒŒ์š” + List little =[ + "์ด๋ณ„์€ ๋ˆ„๊ตฌ์—๊ฒŒ๋‚˜\nํฐ ํ›„์œ ์ฆ์„ ๋‚จ๊ธฐ์ฃ .", + "ํ•˜์ง€๋งŒ,\n์ด๋ณ„์„ ์ž˜ ๋ณด๋‚ด๊ธฐ ์œ„ํ•ด์„œ๋Š”", + "๊ฑด๊ฐ•ํ•œ ๋ชธ๋„ ์ •๋ง ์ค‘์š”ํ•˜๋‹ต๋‹ˆ๋‹ค.", + "์‚ฌ์†Œํ•œ ์ผ์ƒ์„ ์ง€ํ‚ค๋ฉฐ\n์ด๋ณ„์„ ๊ฐ™์ด ๊ทน๋ณตํ•ด๋ด์š”!", + ]; + +// ์•„ํŒŒ์š” + List hard =[ + "์ด๋ณ„์„ ๊ฒช์œผ๋ฉด ๋งˆ์Œ์„ ๋”ฐ๋ผ\n๋ชธ๋„ ๋„ˆ๋ฌด๋‚˜ ์•„ํŒŒ์˜ค์ฃ .", + "๋“ ๋“ ํ•œ ๋ฐฅ์„ ๋จน๊ณ \n๊ฐ„๋‹จํ•œ ์•ผ์™ธํ™œ๋™์„ ํ•˜๋ฉด์„œ", + "์šฐ๋ฆฌ ์‚ฌ์†Œํ•œ ๊ฒƒ๋ถ€ํ„ฐ ์‹œ์ž‘ํ•ด๋ณด์•„์š”!", + ]; + +// ๋‹ค์Œ ์งˆ๋ฌธ + List nextQuestions =[ + "๋‹ค์Œ ์งˆ๋ฌธ์ด์—์š”.", + "${home.user}๋‹˜,\nํ˜„์žฌ ๋งˆ์Œ์˜ ์Šฌํ””์€", + "์–ด๋А ์ •๋„์ธ๊ฐ€์š”?", + "์Šฌํ””์˜ ์ •๋„๋ฅผ ์•Œ๋ ค์ฃผ์„ธ์š”.", + ]; + +// ๊ณ ํ†ต, ์Šฌํผ์š” + List sad =[ + "${home.user}๋‹˜์˜\n์•„ํ”ˆ ๋งˆ์Œ์ด ์ œ๊ฒŒ๋„ ๋А๊ปด์ ธ์š”.", + "์Šฌํ”„๊ณ  ๊ณ ํ†ต์Šค๋Ÿฌ์šด ๋งˆ์Œ์„\n์ €์—๊ฒŒ ํ„ธ์–ด๋†“์œผ๋ฉด์„œ", + "์กฐ๊ธˆ์ด๋‚˜๋งˆ ๋œ์–ด์ง€๊ธธ\n๋ฐ”๋ผ๋Š” ๋งˆ์Œ์ด๋ž๋‹ˆ๋‹ค.", + ]; + +// ๊ฒฌ๋”œ ์ˆ˜ ์žˆ์–ด์š” + List endure =[ + "${home.user}๋‹˜,", + "์Šฌํ””์„ ์žˆ๋Š” ๊ทธ๋Œ€๋กœ ํ‘œํ˜„ํ•˜๋Š” ๊ณผ์ •์€\n๋งค์šฐ ์ค‘์š”ํ•˜๋‹ต๋‹ˆ๋‹ค.", + "๊ทธ๋ž˜๋„ ${home.user}๋‹˜์€\n์Šฌํ””์œผ๋กœ ์ธํ•œ ๊ฐ์ •์„", + "์ž˜ ํ’€์–ด๋‚˜๊ฐ€๊ณ  ์žˆ๋Š” ๊ฒƒ ๊ฐ™์•„์š”.", + "์•ž์œผ๋กœ๋„ ์ง€๊ธˆ์ฒ˜๋Ÿผ๋งŒ\n${home.user}๋‹˜์˜ ์Šฌํ””์„", + "์žˆ๋Š” ๊ทธ๋Œ€๋กœ ํ‘œํ˜„ํ•ด ๋ณด์•„์š”.", + ]; + + List lastQuestions =[ + "${home.user}๋‹˜", + "${home.puppy}์™€์˜\n์ด๋ณ„๋กœ ๊ฒช๊ฒŒ๋œ ์Šฌํ”ˆ ๊ฐ์ •๋“ค์ด", + "๋ชธ๊ณผ ๋งˆ์Œ์—\n์—ฌ๋Ÿฌ๊ฐ€์ง€ ๋ณ€ํ™”๋ฅผ ๊ฐ€์ ธ์˜จ ๊ฒƒ ๊ฐ™์•„์š”.", + "๋งˆ์ง€๋ง‰์œผ๋กœ\n${home.puppy}์™€์˜ ์ด๋ณ„์ด", + "์–ด๋–ค ๋ณ€ํ™”๋“ค์„ ๊ฐ€์ ธ์™”๋Š”์ง€\n๊ตฌ์ฒด์ ์œผ๋กœ ์–˜๊ธฐํ•ด๋ณด๋ ค๊ณ  ํ•ด์š”.", + "๊ตฌ์ฒด์ ์œผ๋กœ ${home.user}๋‹˜์€\n์–ด๋–ค ์ƒํ™ฉ์ธ๊ฐ€์š”?", + "์ด๋ณ„์€ ๋ฌด๊ธฐ๋ ฅํ•˜๊ฒŒ\n๋•Œ๋กœ๋Š” ํ•˜์—ผ์—†์ด ์Šฌํ”„๊ฒŒ ๋งŒ๋“ค๊ธฐ๋„ ํ•ด์š”.", + "์•„์ฃผ ๊ณ ํ†ต์Šค๋Ÿฝ๊ฒŒ ๋งŒ๋“ค๊ธฐ๋„ ํ•˜์ฃ .", + "${home.user}๋‹˜ ํ˜ผ์ž\n์ด ๊ฐ์ •๋“ค์„ ๊ฐ๋‹นํ•˜๊ธฐ์—", + "์–ด๋ ค์›€์ด ์žˆ์–ด ๋ณด์—ฌ์š”.", + "๊ฐ™์€ ์ƒํ™ฉ์„ ๊ฒฝํ—˜ํ•œ\nํ˜น์€ ๊ฒฝํ—˜์ค‘์ธ", + "๋งŽ์€ ๋ฐ˜๋ ค์ธ๋“ค์˜ ์–˜๊ธฐ๋ฅผ\n๋“ค์–ด๋ณด๋Š” ๊ฑด ์–ด๋–จ๊นŒ์š”?", + "${home.user}๋‹˜์—๊ฒŒ\nโ€˜๋„์›€ ์š”์ฒญํ•˜๊ธฐโ€™๋ฅผ ์ถ”์ฒœํ•ด๋“œ๋ฆด๊ฒŒ์š”!", + ]; + + List questionsEnd =[ + "${home.user}๋‹˜,", + "์˜ค๋Š˜ ์ œ๊ฐ€ ์ค€๋น„ํ•œ ๋Œ€ํ™”๋Š”\n์—ฌ๊ธฐ๊นŒ์ง€์˜ˆ์š”.", + "${home.user}๋‹˜์˜\n์Šฌํ”ˆ ๊ฐ์ •๋“ค์„ ์–˜๊ธฐํ•˜๊ณ ", + "์Šค์Šค๋กœ๋ฅผ ๋‹ค๋…์ผ ์ˆ˜ ์žˆ๊ธฐ๋ฅผ ๋ฐ”๋ผ์š”!", + "์ž, ์ด์ œ ์šฐ๋ฆฌ๊ฐ€ ๋‹ค์‹œ\n๋งŒ๋‚˜๊ฒŒ ๋  ์‹œ๊ฐ„์„ ์•Œ๋ ค์ฃผ์„ธ์š”.", + "์ž, ์ด์ œ ์šฐ๋ฆฌ๊ฐ€ ๋‹ค์‹œ\n๋งŒ๋‚˜๊ฒŒ ๋  ์‹œ๊ฐ„์„ ์•Œ๋ ค์ฃผ์„ธ์š”.", + ]; + + void _callAPI() async { + // ์š”์ฒญ ๋ณธ๋ฌธ ๋ฐ์ดํ„ฐ + var data = { + "stage" : "0", + "set" : "0", + "lineId" : "0" + }; + + var url = Uri.parse('http://3.38.1.125:8080/conversation/line'); // ์—”๋“œํฌ์ธํŠธ URL ์„ค์ • + + try { + var response = await http.post( + url, + body: json.encode(data), // ์š”์ฒญ ๋ณธ๋ฌธ์— ๋ฐ์ดํ„ฐ๋ฅผ JSON ํ˜•์‹์œผ๋กœ ์ธ์ฝ”๋”ฉํ•˜์—ฌ ์ „๋‹ฌ + headers: {'Content-Type': 'application/json',}, // ์š”์ฒญ ํ—ค๋”์— Content-Type ์„ค์ • + ); + + if (response.statusCode == 200) { + // ์‘๋‹ต ์„ฑ๊ณต ์‹œ์˜ ์ฒ˜๋ฆฌ + + var jsonResponse = utf8.decode(response.bodyBytes); // ์‘๋‹ต ๋ณธ๋ฌธ์„ JSON ํ˜•์‹์œผ๋กœ ๋””์ฝ”๋”ฉ + // JSON ๊ฐ’์„ ํ™œ์šฉํ•œ ์›ํ•˜๋Š” ๋™์ž‘ ์ˆ˜ํ–‰ + //utf8.decode(jsonResponse); + print(jsonResponse); + + List contentList = []; + + List parsedResponse = json.decode(jsonResponse); + + setState(() { + for (var item in parsedResponse) { + if (item['content'] != null) { + introText.add(item['content']); + } + } + }); + + print(introText); + + print('API ํ˜ธ์ถœ ์„ฑ๊ณต: ${response.statusCode}'); + } else { + // ์š”์ฒญ ์‹คํŒจ ์‹œ์˜ ์ฒ˜๋ฆฌ + print('API ํ˜ธ์ถœ ์‹คํŒจ: ${response.statusCode}'); + } + } catch (e) { + // ์˜ˆ์™ธ ๋ฐœ์ƒ ์‹œ์˜ ์ฒ˜๋ฆฌ + print('API ํ˜ธ์ถœ ์ค‘ ์˜ˆ์™ธ ๋ฐœ์ƒ: $e'); + } + } + + + @override + Widget build(BuildContext context) { + MediaQueryData deviceData = MediaQuery.of(context); + Size screenSize = deviceData.size; + return + Container( + color: Color(0xffFBF3B8), + child: GestureDetector( + onTap: (){ + print("์ด๊ฑฐ๋งŒ ์ข€ ํ™•์ธ ๋ถ€ํƒ: " + nextQuestion.toString()); + + if(startQuestion < 6){ + startQuestion++; // ์ธํŠธ๋กœ ์‹œ์ž‘ ํ›„ count + player2.setAsset(voice[voiceCount]); + voiceCount++; + player2.play(); + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + if(startQuestion == 1){ + Timer(Duration(milliseconds: 3500), () { + controller1.stop(); + }); + } else if(startQuestion == 2){ + Timer(Duration(milliseconds: 3500), () { + controller1.stop(); + }); // ok + } else if(startQuestion == 3){ + Timer(Duration(milliseconds: 2000), () { + controller1.stop(); + }); + } else if(startQuestion == 4){ + Timer(Duration(milliseconds: 3000), () { + controller1.stop(); + }); + } + else if(startQuestion == 5){ + Timer(Duration(milliseconds: 4000), () { + controller1.stop(); + }); + } + else if(startQuestion == 6){ + Timer(Duration(milliseconds: 3000), () { + controller1.stop(); + }); + } + } + else if(nextQuestion == 6){ + // ๊ฑด๊ฐ•์ƒํƒœ ์ •๋„? + } + else if(goodAns && goodQuestion < 3){ + goodQuestion++; + player2.setAsset(goodVoice[voiceGoodCount]); + voiceGoodCount++; + player2.play(); + + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + if(goodQuestion == 1){ + Timer(Duration(milliseconds: 2500), () { + controller1.stop(); + }); + } else if(goodQuestion == 2){ + Timer(Duration(milliseconds: 3500), () { + controller1.stop(); + }); // ok + } + else if(goodQuestion == 3){ + Timer(Duration(milliseconds: 3500), () { + controller1.stop(); + }); // ok + } + } + else if(goodQuestion == 3 && nextQ == false){ + //goodQuestion++; + nextQ = true; + player2.setAsset(nextVoice[voiceNextCount]); + voiceNextCount++; + player2.play(); + + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + if(voiceNextCount == 1){ + Timer(Duration(milliseconds: 2000), () { + controller1.stop(); + }); + } + } + else if(littleAns && littleQuestion < 3){ + littleQuestion++; + player2.setAsset(littleVoice[voiceLittleCount]); + voiceLittleCount++; + player2.play(); + + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + if(littleQuestion == 1){ + Timer(Duration(milliseconds: 3000), () { + controller1.stop(); + }); + } else if(littleQuestion == 2){ + Timer(Duration(milliseconds: 3000), () { + controller1.stop(); + }); // ok + } else if(littleQuestion == 3){ + Timer(Duration(milliseconds: 4000), () { + controller1.stop(); + }); // ok + } + } + else if(littleQuestion == 3 && nextQ == false){ + //littleQuestion++; + nextQ = true; + player2.setAsset(nextVoice[voiceNextCount]); + voiceNextCount++; + player2.play(); + + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + if(voiceNextCount == 1){ + Timer(Duration(milliseconds: 2000), () { + controller1.stop(); + }); + } + } + else if(hardAns && hardQuestion < 2){ + hardQuestion++; + player2.setAsset(hardVoice[voiceHardCount]); + voiceHardCount++; + player2.play(); + + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + if(hardQuestion == 1){ + Timer(Duration(milliseconds: 4000), () { + controller1.stop(); + }); + } else if(hardQuestion == 2){ + Timer(Duration(milliseconds: 3000), () { + controller1.stop(); + }); // ok + } + } + else if(hardQuestion == 2 && nextQ == false){ + //hardQuestion++; + nextQ = true; + player2.setAsset(nextVoice[voiceNextCount]); + voiceNextCount++; + player2.play(); + + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + if(voiceNextCount == 1){ + Timer(Duration(milliseconds: 2000), () { + controller1.stop(); + }); + } + } + else if(nextQ && nextQuestion <3){ + nextQuestion++; + player2.setAsset(nextVoice[voiceNextCount]); + voiceNextCount++; + player2.play(); + + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + if(nextQuestion == 1){ + Timer(Duration(milliseconds: 3000), () { + controller1.stop(); + }); + } else if(nextQuestion == 2){ + Timer(Duration(milliseconds: 2000), () { + controller1.stop(); + }); // ok + } else if(nextQuestion == 3){ + Timer(Duration(milliseconds: 2500), () { + controller1.stop(); + }); // ok + } + } + else if(nextQuestion == 3){ + // ์Šฌํ””์˜ ์ •๋„? + } + else if(sadAns && sadQuestion <2){ + sadQuestion++; + player2.setAsset(sadVoice[voiceSadCount]); + voiceSadCount++; + player2.play(); + + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + if(sadQuestion == 1){ + Timer(Duration(milliseconds: 4500), () { + controller1.stop(); + }); + } else if(sadQuestion == 2){ + Timer(Duration(milliseconds: 4000), () { + controller1.stop(); + }); // ok + } + } + else if(sadQuestion == 2 && last == false){ + last = true; + player2.setAsset(lastVoice[voiceLastCount]); + voiceLastCount++; + player2.play(); + + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + Timer(Duration(milliseconds: 1000), () { + controller1.stop(); + }); + } + else if(endureAns && endureQuestion <5){ + endureQuestion++; + player2.setAsset(endureVoice[voiceEndureCount]); + voiceEndureCount++; + player2.play(); + + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + if(endureQuestion == 1){ + Timer(Duration(milliseconds: 5000), () { + controller1.stop(); + }); + } else if(endureQuestion == 2){ + Timer(Duration(milliseconds: 4000), () { + controller1.stop(); + }); // ok + } else if(endureQuestion == 3){ + Timer(Duration(milliseconds: 3000), () { + controller1.stop(); + }); // ok + } else if(endureQuestion == 4){ + Timer(Duration(milliseconds: 3500), () { + controller1.stop(); + }); // ok + } else if(endureQuestion == 5){ + Timer(Duration(milliseconds: 2500), () { + controller1.stop(); + }); // ok + } + } + else if(endureQuestion == 5 && last == false){ + last = true; + player2.setAsset(lastVoice[voiceLastCount]); + voiceLastCount++; + player2.play(); + + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + Timer(Duration(milliseconds: 1000), () { + controller1.stop(); + }); + } + else if(last && lastQuestion <5){ + lastQuestion++; + player2.setAsset(lastVoice[voiceLastCount]); + voiceLastCount++; + player2.play(); + + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + if(lastQuestion == 1){ + Timer(Duration(milliseconds: 3500), () { + controller1.stop(); + }); + } else if(lastQuestion == 2){ + Timer(Duration(milliseconds: 4000), () { + controller1.stop(); + }); // ok + } else if(lastQuestion == 3){ + Timer(Duration(milliseconds: 3000), () { + controller1.stop(); + }); // ok + } else if(lastQuestion == 4){ + Timer(Duration(milliseconds: 5000), () { + controller1.stop(); + }); // ok + } else if(lastQuestion == 5){ + Timer(Duration(milliseconds: 4000), () { + controller1.stop(); + }); // ok + } + } + else if(last && lastQuestion == 5){ + // ์–ด๋–ค ์ƒํ™ฉ์ธ๊ฐ€์š” + } + else if(last && lastQuestion > 5 && lastQuestion <12){ + // ์–ด๋–ค ์ƒํ™ฉ์ธ๊ฐ€์š” + lastQuestion++; + player2.setAsset(lastVoice[voiceLastCount]); + voiceLastCount++; + player2.play(); + + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + if(lastQuestion == 7){ + Timer(Duration(milliseconds: 3000), () { + controller1.stop(); + }); + } else if(lastQuestion == 8){ + Timer(Duration(milliseconds: 3500), () { + controller1.stop(); + }); // ok + } else if(lastQuestion == 9){ + Timer(Duration(milliseconds: 2000), () { + controller1.stop(); + }); // ok + } else if(lastQuestion == 10){ + Timer(Duration(milliseconds: 3500), () { + controller1.stop(); + }); // ok + } else if(lastQuestion == 11){ + Timer(Duration(milliseconds: 4000), () { + controller1.stop(); + }); // ok + } else if(lastQuestion == 12){ + Timer(Duration(milliseconds: 4500), () { + controller1.stop(); + }); // ok + } + + } + else if(last && lastQuestion == 12 && end == false){ + end = true; + player2.setAsset(endVoice[voiceEndCount]); + voiceEndCount++; + player2.play(); + + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + Timer(Duration(milliseconds: 1000), () { + controller1.stop(); + }); + + } + else if(end && endQuestion < 5){ + endQuestion++; + player2.setAsset(endVoice[voiceEndCount]); + voiceEndCount++; + + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + if(endQuestion == 1){ + Timer(Duration(milliseconds: 3500), () { + controller1.stop(); + }); + } else if(endQuestion == 2){ + Timer(Duration(milliseconds: 3500), () { + controller1.stop(); + }); // ok + } else if(endQuestion == 3){ + Timer(Duration(milliseconds: 3000), () { + controller1.stop(); + }); // ok + } else if(endQuestion == 4){ + Timer(Duration(milliseconds: 4000), () { + controller1.stop(); + }); // ok + } + } + else if(end && endQuestion == 5){ + // ๋งŒ๋‚  ์‹œ๊ฐ„ + } + else if(end && endQuestion > 5 && endQuestion < 7){ + endQuestion++; + player2.setAsset(endVoice[voiceEndCount]); + voiceCount++; + } + else if(endQuestion == 7){ + + } + + setState(() { + }); + }, + child: Scaffold( + backgroundColor: Colors.transparent, + appBar: AppBar( + //title: Text("๊ธฐ์–ตํ• ๊ฐœ", style: TextStyle(fontSize:16, color: Colors.white ),), + //centerTitle: true, + leading: IconButton( + icon: SvgPicture.asset( + 'assets/images/conversation/home_icon.svg', + ), + onPressed: () => Navigator.of(context).pop(), + ), + backgroundColor: Colors.transparent, + elevation: 0.0, + ), + //extendBodyBehindAppBar: true, + body: + SingleChildScrollView( + child: Container( + child: Column( + children: [ + SizedBox(height: 3,), + Container( + width: screenSize.width, + height: 25, + child: Padding( + padding: EdgeInsets.only( left:16, right: 16), + child: Center( + child: FAProgressBar( + currentValue: 60, + size: 5, + backgroundColor: Colors.white, + ) + ), + ), + ), + Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children:[ + SizedBox( + height: 10, + ), + Stack( + children: [ + Container( + height: 157, + width: screenSize.width, + child: + Stack( + children: [ + Center(child: SvgPicture.asset('assets/images/conversation/bubble.svg',fit: BoxFit.fill,),), + Container( + padding: const EdgeInsets.symmetric(horizontal: 32, vertical: 12, ), + child: Center( + child: Column( + children: [ + if(goodAns == false && littleAns ==false && hardAns == false && last == false + && nextQ == false && sadAns == false && endureAns == false && end == false)...[ + if(startQuestions[startQuestion].toString().contains("\n"))...[ + SizedBox(height: 28,), + Text( + startQuestions[startQuestion], + textAlign: TextAlign.center, + style: textStyle.bubbletext, + ), + ]else...[ + SizedBox(height: 42,), + Text( + startQuestions[startQuestion], + textAlign: TextAlign.center, + style: textStyle.bubbletext, + ), + ], + ] + // ์ข‹์•„์š”์ผ์‹œ + else if (goodAns && nextQ == false) ...[ + if(good[goodQuestion].toString().contains("\n"))...[ + SizedBox(height: 28,), + Text( + good[goodQuestion], + textAlign: TextAlign.center, + style: textStyle.bubbletext, + ), + ]else...[ + SizedBox(height: 42,), + Text( + good[goodQuestion], + textAlign: TextAlign.center, + style: textStyle.bubbletext, + ), + ], + ] + // ์กฐ๊ธˆ ์•„ํŒŒ์š”์ผ์‹œ + else if (littleAns && nextQ == false) ...[ + if(little[littleQuestion].toString().contains("\n"))...[ + SizedBox(height: 28,), + Text( + little[littleQuestion], + textAlign: TextAlign.center, + style: textStyle.bubbletext, + ), + ]else...[ + SizedBox(height: 42,), + Text( + little[littleQuestion], + textAlign: TextAlign.center, + style: textStyle.bubbletext, + ), + ], + ] + // ์•„ํŒŒ์š”์ผ์‹œ + else if (hardAns && nextQ == false) ...[ + if(hard[hardQuestion].toString().contains("\n"))...[ + SizedBox(height: 28,), + Text( + hard[hardQuestion], + textAlign: TextAlign.center, + style: textStyle.bubbletext, + ), + ]else...[ + SizedBox(height: 42,), + Text( + hard[hardQuestion], + textAlign: TextAlign.center, + style: textStyle.bubbletext, + ), + ], + ] + // ๋‹ค์Œ ์งˆ๋ฌธ + else if (nextQ && sadAns == false && endureAns == false && end == false) ...[ + if(nextQuestions[nextQuestion].toString().contains("\n"))...[ + SizedBox(height: 28,), + Text( + nextQuestions[nextQuestion], + textAlign: TextAlign.center, + style: textStyle.bubbletext, + ), + ]else...[ + SizedBox(height: 42,), + Text( + nextQuestions[nextQuestion], + textAlign: TextAlign.center, + style: textStyle.bubbletext, + ), + ], + ] + // ๊ณ ํ†ต, ์Šฌํผ์š”์ผ์‹œ + else if (sadAns && last== false && end == false) ...[ + if(sad[sadQuestion].toString().contains("\n"))...[ + SizedBox(height: 28,), + Text( + sad[sadQuestion], + textAlign: TextAlign.center, + style: textStyle.bubbletext, + ), + ]else...[ + SizedBox(height: 42,), + Text( + sad[sadQuestion], + textAlign: TextAlign.center, + style: textStyle.bubbletext, + ), + ], + ] + // ๊ฒฌ๋”œ์ˆ˜ ์žˆ์–ด์š”์ผ์‹œ + else if (endureAns && last== false && end == false) ...[ + if(endure[endureQuestion].toString().contains("\n"))...[ + SizedBox(height: 28,), + Text( + endure[endureQuestion], + textAlign: TextAlign.center, + style: textStyle.bubbletext, + ), + ]else...[ + SizedBox(height: 42,), + Text( + endure[endureQuestion], + textAlign: TextAlign.center, + style: textStyle.bubbletext, + ), + ], + ] + // ๋งˆ์ง€๋ง‰ ์งˆ๋ฌธ + else if (last && end == false) ...[ + if(lastQuestions[lastQuestion].toString().contains("\n"))...[ + SizedBox(height: 28,), + Text( + lastQuestions[lastQuestion], + textAlign: TextAlign.center, + style: textStyle.bubbletext, + ), + ]else...[ + SizedBox(height: 42,), + Text( + lastQuestions[lastQuestion], + textAlign: TextAlign.center, + style: textStyle.bubbletext, + ), + ], + ] + // ๋Œ€ํ™” ๋งˆ๋ฌด๋ฆฌ + else if (end) ...[ + if(questionsEnd[endQuestion].toString().contains("\n"))...[ + SizedBox(height: 28,), + Text( + questionsEnd[endQuestion], + textAlign: TextAlign.center, + style: textStyle.bubbletext, + ), + ]else...[ + SizedBox(height: 42,), + Text( + questionsEnd[endQuestion], + textAlign: TextAlign.center, + style: textStyle.bubbletext, + ), + ], + ] + ], + ) + ) + ), + ], + ) + ), + // ๋ฌด์ง€ ์œ„์น˜ + if(startQuestion < 6 || (hardAns && nextQuestion<3) ||(littleAns && nextQuestion<3) ||(goodAns && nextQuestion<3) || + (sadAns && endQuestion<5) || (endureAns && endQuestion<5) || (end && endQuestion>5))...[ + Stack( + children: [ + // ์œ ์ € ์œ„์น˜ + Column( + children: [ + SizedBox(height: 420,), + Container( + child: SvgPicture.asset( + 'assets/images/conversation/user7.svg', + height: 282, + width: screenSize.width, + ), + ), + ], + ), + Column( + children: [ + SizedBox(height: 144,), + Container( + width: screenSize.width, + height: 375, + child: + Stack( + children: [ + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child: Image.asset('assets/images/conversation/gif/muji_ear.gif', + fit: BoxFit.cover,),), + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child: Image.asset('assets/images/conversation/gif/muji_base.gif', fit: BoxFit.cover,),), + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child: Image.asset('assets/images/conversation/gif/muji_base_eye.gif', + fit: BoxFit.cover,),), + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child:GifImage( + controller: controller1, + image: const AssetImage("assets/images/conversation/gif/muji_mouth1.gif"), + ), + // Image.asset('assets/images/conversation/gif/muji_mouth1.gif', fit: BoxFit.cover,), + ) + ], + ) + ), + ], + ), + ], + ), + ] + // ํ˜„์žฌ ์ƒํƒœ ๋ฌป๊ธฐ + else if(startQuestion == 6 && hardAns == false && littleAns == false && goodAns == false )...[ + Stack( + children: [ + + Column( + children: [ + SizedBox(height: 418,), + Container( + height: 284, + width: screenSize.width, + color: Color(0xffFFFFF7), + ) + ], + ), + Column( + children: [ + SizedBox(height: 418,), + SvgPicture.asset( + 'assets/images/conversation/shadow.svg', fit: BoxFit.cover, + ), + ], + ), + Column( + children: [ + SizedBox(height: 144,), + Container( + width: screenSize.width, + height: 375, + child: + Stack( + children: [ + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child: Image.asset('assets/images/conversation/gif/muji_ear.gif', + fit: BoxFit.cover,),), + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child: Image.asset('assets/images/conversation/gif/muji_base.gif', fit: BoxFit.cover,),), + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child: Image.asset('assets/images/conversation/gif/muji_base_eye.gif', + fit: BoxFit.cover,),), + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child:GifImage( + controller: controller1, + image: const AssetImage("assets/images/conversation/gif/muji_mouth1.gif"), + ), + // Image.asset('assets/images/conversation/gif/muji_mouth1.gif', fit: BoxFit.cover,), + ) + ], + ) + ), + ], + ), + Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SizedBox(height: 528,), + Stack( + children: [ + Padding( + padding: EdgeInsets.only(left:65, top: 25), + child: Container( + width: 264, + height: 16, + color: Color(0xffC0D2FC), + ), + ), + Padding(padding: EdgeInsets.only(left:28), + child: Row( + children: [ + Column( + children: [ + InkWell( + child: + ui_hard? SvgPicture.asset('assets/images/conversation/middle/hard.svg',): + SvgPicture.asset('assets/images/conversation/middle/hard_un.svg',), + onTap: () { + ui_hard = true; + ui_little = false; + ui_good = false; + setState(() {}); + }, + ), + SizedBox(height: 8,), + Text("์•„ํŒŒ์š”", style: ui_hard? textStyle.pp2 : textStyle.pp1) + ], + ), + SizedBox(width:68), + Column( + children: [ + InkWell( + child: ui_little? + SvgPicture.asset('assets/images/conversation/middle/little.svg',): + SvgPicture.asset('assets/images/conversation/middle/little_un.svg',), + onTap: () { + ui_hard = false; + ui_little = true; + ui_good = false; + setState(() {}); + }, + ), + SizedBox(height: 8,), + Text("์กฐ๊ธˆ ์•„ํŒŒ์š”", style: ui_little? textStyle.pp2 : textStyle.pp1) + ], + ), + SizedBox(width:68), + Column( + children: [ + InkWell( + child: ui_good? + SvgPicture.asset('assets/images/conversation/middle/good.svg',): + SvgPicture.asset('assets/images/conversation/middle/good_un.svg',), + onTap: () { + ui_hard = false; + ui_little = false; + ui_good = true; + setState(() {}); + }, + ), + SizedBox(height: 8,), + Text("์ข‹์•„์š”", style: ui_good? textStyle.pp2 : textStyle.pp1) + ], + ), + + ], + ), + + ), + ], + ), + ], + ), + ], + ), + ] + // ์Šฌํ””์˜ ์ •๋„ ๋ฌป๊ธฐ + else if(nextQuestion == 3 && sadAns == false && endureAns == false)...[ + Stack( + children: [ + + Column( + children: [ + SizedBox(height: 418,), + Container( + height: 284, + width: screenSize.width, + color: Color(0xffFFFFF7), + ) + ], + ), + Column( + children: [ + SizedBox(height: 418,), + SvgPicture.asset( + 'assets/images/conversation/shadow.svg', fit: BoxFit.cover, + ), + ], + ), + + Column( + children: [ + SizedBox(height: 144,), + Container( + width: screenSize.width, + height: 375, + child: + Stack( + children: [ + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child: Image.asset('assets/images/conversation/gif/muji_ear.gif', + fit: BoxFit.cover,),), + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child: Image.asset('assets/images/conversation/gif/muji_base.gif', fit: BoxFit.cover,),), + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child: Image.asset('assets/images/conversation/gif/muji_base_eye.gif', + fit: BoxFit.cover,),), + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child:GifImage( + controller: controller1, + image: const AssetImage("assets/images/conversation/gif/muji_mouth1.gif"), + ), + // Image.asset('assets/images/conversation/gif/muji_mouth1.gif', fit: BoxFit.cover,), + ) + ], + ) + ), + ], + ), + Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SizedBox(height: 528,), + Stack( + children: [ + Padding( + padding: EdgeInsets.only(left:65, top: 25), + child: Container( + width: 264, + height: 16, + color: Color(0xffC0D2FC), + ), + ), + Padding(padding: EdgeInsets.only(left:28), + child: Row( + children: [ + Column( + children: [ + InkWell( + child: + ui_bad? SvgPicture.asset('assets/images/conversation/middle/hard.svg',): + SvgPicture.asset('assets/images/conversation/middle/hard_un.svg',), + onTap: () { + ui_bad = true; + ui_sad = false; + ui_endure = false; + setState(() {}); + }, + ), + SizedBox(height: 8,), + Text("๊ณ ํ†ต\n์Šค๋Ÿฌ์›Œ์š”", style: ui_bad? textStyle.pp2 : textStyle.pp1) + ], + ), + SizedBox(width:68), + Column( + children: [ + InkWell( + child: ui_sad? + SvgPicture.asset('assets/images/conversation/middle/little.svg',): + SvgPicture.asset('assets/images/conversation/middle/little_un.svg',), + onTap: () { + ui_bad = false; + ui_sad = true; + ui_endure = false; + setState(() {}); + }, + ), + SizedBox(height: 8,), + Text("์Šฌํผ์š”", style: ui_sad? textStyle.pp2 : textStyle.pp1) + ], + ), + SizedBox(width:68), + Column( + children: [ + InkWell( + child: ui_endure? + SvgPicture.asset('assets/images/conversation/middle/good.svg',): + SvgPicture.asset('assets/images/conversation/middle/good_un.svg',), + onTap: () { + ui_bad = false; + ui_sad = false; + ui_endure = true; + setState(() {}); + }, + ), + SizedBox(height: 8,), + Text("๊ฒฌ๋”œ ์ˆ˜\n์žˆ์–ด์š”", style: ui_endure? textStyle.pp2 : textStyle.pp1) + ], + ), + ], + ) + ), + ], + ), + ], + ), + ], + ), + ] + else if(end && endQuestion == 5)...[ + Padding( + padding: EdgeInsets.only(top:175, left:45), + child: Container( + width: 275, + height: 120, + child: Column( + children: [ + Row( + children: [ + SizedBox(width: 75,), + Container(width: 25, + child: TextField( + style: textStyle.inputfield, + onTap: (){ + chooseTime = true; + selectedNextTime = true; + whatTime = int.parse(nextTimeController.text); + setState(() { + }); + }, + onChanged: (text){ + whatTime = int.parse(nextTimeController.text); + }, + keyboardType: TextInputType.number, + inputFormatters: [FilteringTextInputFormatter.allow(RegExp('[0-9]'))], + controller: nextTimeController, + decoration: InputDecoration( + hintText: '๋ช‡', + suffixStyle: TextStyle(color: Color(0xff83A8FF), fontSize: 20,), + hintStyle: textStyle.field, + //labelText: '๋ช‡', + ), + ),), + Text("์‹œ๊ฐ„ ํ›„์— ๋งŒ๋‚˜์š”", style: TextStyle( + fontFamily: 'Pretendard', + fontSize: 20, fontWeight: FontWeight.w500, color: Colors.black),), + ],), + SizedBox(height: 15,), + // DateFormat('MM/dd HH:mm').format(DateTime.parse(parsedResponseHR[index]['createdAt'])) + // DateFormat('MM/dd HH:mm').format(DateTime.now().add(Duration(hours: whatTime))) + Text(chooseTime?"${DateFormat('MM์›” dd์ผ HH์‹œ mm๋ถ„').format(DateTime.now().add(Duration(hours: whatTime)))}":"์ตœ์†Œ 1์‹œ๊ฐ„์—์„œ 24์‹œ๊ฐ„ ์‚ฌ์ด๋กœ ์ •ํ•ด์ฃผ์„ธ์š”.", style: TextStyle( + fontFamily: 'Pretendard', + fontSize: 16, fontWeight: FontWeight.w500, color: Color(0xffAAAAAA)),), + + ],), + ), + ), + ] + ], + ), + ], + ), + ], + ), + ), + ), + + // // nextQuestion ์ด 3๊ณผ 7์ผ๋•Œ ๋“ฑ์žฅ + bottomSheet: Padding( + padding: EdgeInsets.only( + bottom: MediaQuery.of(context).viewInsets.bottom * 0.001), + child: Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + if(startQuestion == 6 && (ui_little|| ui_good || ui_hard))...[ + Container( + color: Color(0xffFFFFFF).withOpacity(0), + child: Padding( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 24), + child: Container( + + width: screenSize.width, + height: 40, + child: ElevatedButton( + style: buttonChart().bluebtn3, + onPressed: () { + //decidedType = false; + startQuestion++; + if(ui_hard){ + hardAns = true; + player2.setAsset(hardVoice[voiceHardCount]); + voiceHardCount++; + player2.play(); + + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + Timer(Duration(milliseconds: 4500), () { + controller1.stop(); + }); + + } else if(ui_little){ + littleAns = true; + player2.setAsset(littleVoice[voiceLittleCount]); + voiceLittleCount++; + player2.play(); + + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + Timer(Duration(milliseconds: 3500), () { + controller1.stop(); + }); + } else if(ui_good){ + goodAns = true; + player2.setAsset(goodVoice[voiceGoodCount]); + voiceGoodCount++; + player2.play(); + + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + Timer(Duration(milliseconds: 2000), () { + controller1.stop(); + }); + } + //player2.setAsset(voice[voiceCount]); + setState(() {}); + }, + child: Text("๋‹ค์Œ", style: TextStyle( + fontFamily: 'Pretendard', + fontSize: 16, fontWeight: FontWeight.w500, color: Color(0xffFFFFFF))), + ), + ),), + ), + ] + else if(nextQuestion == 3 && (ui_bad|| ui_sad || ui_endure))...[ + Container( + color: Color(0xffFFFFFF).withOpacity(0), + child: Padding( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 24), + child: Container( + + width: screenSize.width, + height: 40, + child: ElevatedButton( + style: buttonChart().bluebtn3, + onPressed: () { + //decidedType = false; + nextQuestion++; + if(ui_bad){ + sadAns = true; + player2.setAsset(sadVoice[voiceSadCount]); + voiceSadCount++; + player2.play(); + + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + Timer(Duration(milliseconds: 3500), () { + controller1.stop(); + }); + + } else if(ui_sad){ + sadAns = true; + player2.setAsset(sadVoice[voiceSadCount]); + voiceSadCount++; + player2.play(); + + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + Timer(Duration(milliseconds: 3500), () { + controller1.stop(); + }); + + } else if(ui_endure){ + endureAns = true; + player2.setAsset(endureVoice[voiceEndureCount]); + voiceEndureCount++; + player2.play(); + + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + Timer(Duration(milliseconds: 1500), () { + controller1.stop(); + }); + } + //player2.setAsset(voice[voiceCount]); + setState(() {}); + }, + child: Text("๋‹ค์Œ", style: TextStyle( + fontFamily: 'Pretendard', + fontSize: 16, fontWeight: FontWeight.w500, color: Color(0xffFFFFFF))), + ), + ),), + ), + ] + else if(lastQuestion == 5)...[ + Container( + color: Colors.white, + height: 48, + child: Padding( + padding: const EdgeInsets.only(bottom: 8.0, top: 8.0, left: 16,right: 16), + child: Stack( + children: [ + Container( + width: screenSize.width, + height: 48, + decoration: BoxDecoration( + color: Colors.white, + border: Border.all(color: selectedHow? Color(colorChart.blue):Color(0xffC0D2FC)), + borderRadius: BorderRadius.circular(30), + ), + ), + Positioned( + left: 15, + right: 30, + bottom:-4, + child: TextField( + textAlignVertical: TextAlignVertical.center, + maxLines: 1, + controller: whatController, + style: textStyle.bk14normal, + decoration: InputDecoration( + hintStyle: textStyle.grey14normal, + border: InputBorder.none, + hintText: '์ด๋ณ„๋กœ ์–ด๋–ค ๋ณ€ํ™”๋ฅผ ๊ฒช๊ณ  ์žˆ๋ƒ๋ฉด...'), + onChanged: (s) { + selectedHow = true; + setState(() { + + }); + //text = s; + }, + onTap: () {}, + ), + ), + Positioned( + left: screenSize.width - 81, + //right: 30, + bottom: 3, + top: 3, + child: ElevatedButton( + onPressed: () { + player2.setAsset(lastVoice[voiceLastCount]); + voiceLastCount++; + player2.play(); + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + + Timer(Duration(milliseconds: 5000), () { + controller1.stop(); + }); + + lastQuestion++; + setState(() { + + }); + }, + style: ElevatedButton.styleFrom( + backgroundColor: selectedHow? Color(colorChart.blue):Color(0xffDDE7FD), + fixedSize: const Size(23, 23), + shape: const CircleBorder(), + ), + child: Icon( + Icons.arrow_upward, + color: Colors.white, + size: 16, + )), + ), + ], + ), + ), + ), + ] + else if(endQuestion == 5 && selectedNextTime)...[ + Container( + color: Color(0xffFFFFFF).withOpacity(0.0), + child: Padding( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 24), + child: Container( + + width: screenSize.width, + height: 40, + child: ElevatedButton( + style: buttonChart().bluebtn3, + onPressed: () { + questionsEnd.insertAll(6, [ + "๋„ค, ${home.user}๋‹˜.\n${whatTime}์‹œ๊ฐ„ ํ›„์— ๋‹ค์‹œ ๋งŒ๋‚˜์š”!", + "๋„ค, ${home.user}๋‹˜.\n${whatTime}์‹œ๊ฐ„ ํ›„์— ๋‹ค์‹œ ๋งŒ๋‚˜์š”!", + ]); + //decidedType = false; + endQuestion++; + player2.setAsset(endVoice[voiceEndCount]); + voiceEndCount++; + player2.play(); + // 2.5์ดˆ ์ ์ • + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + Timer(Duration(milliseconds: 3500), () { + controller1.stop(); + }); + setState(() {}); + }, + child: Text("๋‹ค์Œ", style: TextStyle( + fontFamily: 'Pretendard', + fontSize: 16, fontWeight: FontWeight.w500, color: Color(0xffFFFFFF))), + ), + ),), + ), + ] + else if(endQuestion == 7)...[ + Container( + color: Color(0xffFFFFFF).withOpacity(0.0), + child: Padding( + padding: EdgeInsets.all(12), + child: Container( + + width: screenSize.width, + height: 40, + child: ElevatedButton( + style: buttonChart().bluebtn3, + onPressed: () { + //decidedType = false; + //checkSignUp = false; + //checkSignIn = true; + checkSignUp = false; + var now = DateTime.now(); + sentDate = DateFormat('yyyy-MM-dd hh:mm:ss').format(now.toLocal()); + saveCon(sign_in.userAccessToken, "2A", sentDate); + setState(() {}); + main.player.stop(); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => MyScreenPage(title: '์Šคํฌ๋ฆฐ ํŽ˜์ด์ง€',))); + }, + child: Text("์™„๋ฃŒ", style: TextStyle( + fontFamily: 'Pretendard', + fontSize: 16, fontWeight: FontWeight.w500, color: Color(0xffFFFFFF))), + ), + ),), + ), + ] + ], + ), + )), + ) + + ); + + } +} + diff --git a/client/lib/conversation/middle_period/start_middle.dart b/client/lib/conversation/middle_period/start_middle.dart new file mode 100644 index 0000000..4a53d59 --- /dev/null +++ b/client/lib/conversation/middle_period/start_middle.dart @@ -0,0 +1,625 @@ +import 'dart:async'; +import 'dart:convert'; +import 'package:flutter/material.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter_svg/svg.dart'; +import 'package:fluttertoast/fluttertoast.dart'; +import 'package:http/http.dart' as http; +import 'package:client/progressbar/animation_progressbar.dart'; +import 'package:client/style.dart'; +import 'package:client/sign/sign_in.dart' as sign_in; +import 'package:just_audio/just_audio.dart'; +import 'package:flutter_gif/flutter_gif.dart'; + +/// ์ค‘๊ธฐ๋Œ€ํ™” ์‹œ์ž‘ + +class StartMiddlePage extends StatefulWidget { + + static Future navigatorPush(BuildContext context) async { + return Navigator.push( + context, + MaterialPageRoute( + builder: (_) => StartMiddlePage(), + ), + ); + } + + @override + _StartMiddlePageState createState() => _StartMiddlePageState(); +} + +class _StartMiddlePageState extends State with TickerProviderStateMixin { + + late FlutterGifController controller1, controller2, controller3; + + bool grief = false; // ์ด๋ณ„ ์„ ํƒ ์‹œ + bool ui_grief = false; + bool miss = false; // ์ „๋ชป์ง„ ์„ ํƒ ์‹œ + bool ui_miss = false; + + + void showToast(){ + Fluttertoast.showToast( + msg: 'ํ™”๋ฉด์„ ํƒญํ•˜๋ฉด ๋‹ค์Œ์œผ๋กœ ๋„˜์–ด๊ฐ€์š”', + gravity: ToastGravity.BOTTOM, + textColor: Color(0xff4B5396), + backgroundColor: Colors.white.withOpacity(0.5), + toastLength: Toast.LENGTH_SHORT + ); + } + + FocusNode _focusNode = FocusNode(); + + @override + void initState() { + super.initState(); + // SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersive, overlays: []); + // ์Œ์› ์ ์šฉ + for(int i= 0 ; i < voice.length; i++){ + _player.setAudioSource(AudioSource.uri( + Uri.parse(voice[i])) + ); + } + controller1 = FlutterGifController(vsync: this); + + _callAPI(); + _focusNode.addListener(_onFocusChange); + showToast(); + } + + void _onFocusChange() { + if (_focusNode.hasFocus) { + // ํ‚ค๋ณด๋“œ ์˜ฌ๋ฆฌ๊ธฐ + FocusScope.of(context).requestFocus(_focusNode); + } + } + + @override + void dispose() async { + super.dispose(); + } + + int nextPage = 0; + + List introText =[]; + + int nextQuestion = 0; + int nextQuestionGrief = 0; + int nextQuestionMiss = 0; + + // ์ธํŠธ๋กœ ์‚ฌ์šฉ์ž ์ •๋ณด ์ €์žฅํ•˜๊ธฐ (POST) + void saveUserInfo(String aToken, String nickname, String puppyName, int puppyAge, String puppyType) async { + + // ์š”์ฒญ ๋ณธ๋ฌธ ๋ฐ์ดํ„ฐ + var data = { + "nickname": nickname, + "puppyName": puppyName, + "puppyAge" : puppyAge, + "puppyType" : puppyType, + "profile-image" : "null" + }; + + // ํ—ค๋” ์ •๋ณด ์„ค์ • + Map headers = { + 'Authorization': 'Bearer $aToken', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• + 'Content-Type': 'application/json', // ์˜ˆ: JSON ์š”์ฒญ์ธ ๊ฒฝ์šฐ ํ—ค๋” ์„ค์ • + }; + + var url = Uri.parse('http://3.38.1.125:8080/conversation/intro/info'); // ์—”๋“œํฌ์ธํŠธ URL ์„ค์ • + + try { + var response = await http.post( + url, + body: json.encode(data), // ์š”์ฒญ ๋ณธ๋ฌธ์— ๋ฐ์ดํ„ฐ๋ฅผ JSON ํ˜•์‹์œผ๋กœ ์ธ์ฝ”๋”ฉํ•˜์—ฌ ์ „๋‹ฌ + headers: headers, // ํ—ค๋” ์ถ”๊ฐ€ + ); + + if (response.statusCode == 200) { + // ์‘๋‹ต ์„ฑ๊ณต ์‹œ์˜ ์ฒ˜๋ฆฌ + + var jsonResponse = utf8.decode(response.bodyBytes); // ์‘๋‹ต ๋ณธ๋ฌธ์„ JSON ํ˜•์‹์œผ๋กœ ๋””์ฝ”๋”ฉ + // JSON ๊ฐ’์„ ํ™œ์šฉํ•œ ์›ํ•˜๋Š” ๋™์ž‘ ์ˆ˜ํ–‰ + //utf8.decode(jsonResponse); + print(jsonResponse); + + List contentList = []; + + List parsedResponse = json.decode(jsonResponse); + + setState(() { + }); + + + print('API ํ˜ธ์ถœ ์„ฑ๊ณต!!: ${response.statusCode}'); + } else { + // ์š”์ฒญ ์‹คํŒจ ์‹œ์˜ ์ฒ˜๋ฆฌ + print('API ํ˜ธ์ถœ ์‹คํŒจ!!: ${response.statusCode}'); + } + } catch (e) { + // ์˜ˆ์™ธ ๋ฐœ์ƒ ์‹œ์˜ ์ฒ˜๋ฆฌ + print('API ํ˜ธ์ถœ ์ค‘ ์˜ˆ์™ธ ๋ฐœ์ƒ: $e'); + } + } + + final _player = AudioPlayer(); + int voiceCount = 0; + + List voice =[ + "assets/voice/start1.mp3", "assets/voice/yes.mp3", + "assets/voice/no1.mp3", "assets/voice/no2.mp3", + ]; + + List question1_0= [ + "๋‹˜ ๊ธฐ๋‹ค๋ฆฌ๊ณ  ์žˆ์—ˆ์–ด์š”!", + "๋Œ€ํ™”๋ฅผ ์‹œ์ž‘ํ•ด๋ณผ๊นŒ์š”?", + "์˜ค๋Š˜์€ ์–ด๋–ค ์ฃผ์ œ๋กœ ์–˜๊ธฐํ•ด๋ณผ๊นŒ์š”?", + ]; + + + void _callAPI() async { + + // ์š”์ฒญ ๋ณธ๋ฌธ ๋ฐ์ดํ„ฐ + var data = { + "stage" : "0", + "set" : "0", + "lineId" : "0" + }; + + var url = Uri.parse('http://3.38.1.125:8080/conversation/line'); // ์—”๋“œํฌ์ธํŠธ URL ์„ค์ • + + try { + var response = await http.post( + url, + body: json.encode(data), // ์š”์ฒญ ๋ณธ๋ฌธ์— ๋ฐ์ดํ„ฐ๋ฅผ JSON ํ˜•์‹์œผ๋กœ ์ธ์ฝ”๋”ฉํ•˜์—ฌ ์ „๋‹ฌ + headers: {'Content-Type': 'application/json',}, // ์š”์ฒญ ํ—ค๋”์— Content-Type ์„ค์ • + ); + + if (response.statusCode == 200) { + // ์‘๋‹ต ์„ฑ๊ณต ์‹œ์˜ ์ฒ˜๋ฆฌ + + var jsonResponse = utf8.decode(response.bodyBytes); // ์‘๋‹ต ๋ณธ๋ฌธ์„ JSON ํ˜•์‹์œผ๋กœ ๋””์ฝ”๋”ฉ + // JSON ๊ฐ’์„ ํ™œ์šฉํ•œ ์›ํ•˜๋Š” ๋™์ž‘ ์ˆ˜ํ–‰ + //utf8.decode(jsonResponse); + print(jsonResponse); + + List contentList = []; + + List parsedResponse = json.decode(jsonResponse); + + setState(() { + for (var item in parsedResponse) { + if (item['content'] != null) { + introText.add(item['content']); + } + } + }); + print(introText); + + print('API ํ˜ธ์ถœ ์„ฑ๊ณต: ${response.statusCode}'); + } else { + // ์š”์ฒญ ์‹คํŒจ ์‹œ์˜ ์ฒ˜๋ฆฌ + print('API ํ˜ธ์ถœ ์‹คํŒจ: ${response.statusCode}'); + } + } catch (e) { + // ์˜ˆ์™ธ ๋ฐœ์ƒ ์‹œ์˜ ์ฒ˜๋ฆฌ + print('API ํ˜ธ์ถœ ์ค‘ ์˜ˆ์™ธ ๋ฐœ์ƒ: $e'); + } + } + + bool _visible = true; + + @override + Widget build(BuildContext context) { + MediaQueryData deviceData = MediaQuery.of(context); + Size screenSize = deviceData.size; + return + Container( + color: Color(0xffDDE7FD), + child: GestureDetector( + onTap: (){ + // _player.setAsset(voice[voiceCount]); + if(nextQuestion == 0){ + nextQuestion++; + _player.setAsset(voice[voiceCount]); + voiceCount++; + _player.play(); + + // 2.5์ดˆ ์ ์ • + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + Timer(Duration(milliseconds: 2500), () { + controller1.stop(); + }); + } + else if(nextQuestion == 1){ + nextQuestion++; // ์ธํŠธ๋กœ ์‹œ์ž‘ ํ›„ count + _player.setAsset(voice[voiceCount]); + voiceCount++; + _player.play(); + // 2.5์ดˆ ์ ์ • + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + Timer(Duration(milliseconds: 2500), () { + controller1.stop(); + }); + } + else if(nextQuestion == 2){ + + } + + + setState(() { + }); + }, + child: Scaffold( + backgroundColor: Colors.transparent, + appBar: AppBar( + //title: Text("๊ธฐ์–ตํ• ๊ฐœ", style: TextStyle(fontSize:16, color: Colors.white ),), + //centerTitle: true, + leading: IconButton( + icon: SvgPicture.asset( + 'assets/images/conversation/home_icon.svg', + ), + onPressed: () => Navigator.of(context).pop(), + ), + backgroundColor: Colors.transparent, + elevation: 0.0, + ), + //extendBodyBehindAppBar: true, + body: + SingleChildScrollView( + child: Container( + child: Column( + children: [ + SizedBox(height: 3,), + Container( + width: screenSize.width, + height: 25, + child: Padding( + padding: EdgeInsets.only( left:16, right: 16), + child: Center( + child: FAProgressBar( + currentValue: 20, + size: 5, + backgroundColor: Colors.white, + ) + ), + ), + ), + Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children:[ + SizedBox( + height: 10, + ), + Stack( + children: [ + Container( + height: 157, + width: screenSize.width, + child: + Stack( + children: [ + Center(child: SvgPicture.asset('assets/images/conversation/bubble.svg',fit: BoxFit.fill,),), + Container( + padding: const EdgeInsets.symmetric(horizontal: 32, vertical: 12, ), + child: Center( + child: Column( + children: [ + if(question1_0[nextQuestion].toString().contains("\n"))...[ + SizedBox(height: 28,), + Text( + question1_0[nextQuestion], + textAlign: TextAlign.center, + style: textStyle.bubbletext, + ), + ]else...[ + SizedBox(height: 42,), + Text( + question1_0[nextQuestion], + textAlign: TextAlign.center, + style: textStyle.bubbletext, + ), + ], + ], + ) + ) + ), + ], + ) + ), + // ๋ฌด์ง€ ์œ„์น˜ + if(nextQuestion < 11)...[ + Stack( + children: [ + // ์œ ์ € ์œ„์น˜ + Column( + children: [ + SizedBox(height: 420,), + Container( + child: SvgPicture.asset( + 'assets/images/conversation/user7.svg', + height: 282, + width: screenSize.width, + ), + ), + ], + ), + Column( + children: [ + SizedBox(height: 144,), + Container( + width: screenSize.width, + height: 375, + child: + Stack( + children: [ + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child: Image.asset('assets/images/conversation/gif/muji_ear.gif', + fit: BoxFit.cover,),), + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child: Image.asset('assets/images/conversation/gif/muji_base.gif', fit: BoxFit.cover,),), + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child: Image.asset('assets/images/conversation/gif/muji_base_eye.gif', + fit: BoxFit.cover,),), + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child:GifImage( + controller: controller1, + image: const AssetImage("assets/images/conversation/gif/muji_mouth1.gif"), + ), + // Image.asset('assets/images/conversation/gif/muji_mouth1.gif', fit: BoxFit.cover,), + ) + ], + ) + ), + ], + ), + ], + ), + ] + else if(nextQuestion == 16)...[ + Stack( + children: [ + + Column( + children: [ + SizedBox(height: 418,), + Container( + height: 280, + width: screenSize.width, + color: Color(0xffFFFFF7), + ) + ], + ), + Column( + children: [ + SizedBox(height: 418,), + SvgPicture.asset( + 'assets/images/conversation/shadow.svg', fit: BoxFit.cover, + ), + ], + ), + + Column( + children: [ + SizedBox(height: 144,), + Container( + width: screenSize.width, + height: 375, + child: + Stack( + children: [ + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child: Image.asset('assets/images/conversation/gif/muji_ear.gif', + fit: BoxFit.cover,),), + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child: Image.asset('assets/images/conversation/gif/muji_base.gif', fit: BoxFit.cover,),), + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child: Image.asset('assets/images/conversation/gif/muji_base_eye.gif', + fit: BoxFit.cover,),), + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child:GifImage( + controller: controller1, + image: const AssetImage("assets/images/conversation/gif/muji_mouth1.gif"), + ), + // Image.asset('assets/images/conversation/gif/muji_mouth1.gif', fit: BoxFit.cover,), + ) + ], + ) + + // SvgPicture.asset( + // 'assets/images/conversation/con_muji.svg', fit: BoxFit.cover, + // ), + ), + ], + ), + + + Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SizedBox(height: 465,), + Row( + children: [ + SizedBox(width: 25,), + Container( + width: 156, + height: 156, + child: ElevatedButton( + style: ui_miss? buttonChart().bluebtn2 : buttonChart().whitebtn, + onPressed: () { + //miss = true; + ui_grief = false; + if(ui_miss == false){ + ui_miss = true; + } else{ + ui_miss = false; + } + // nextQuestion++; + setState(() {}); + }, + child: Container( + padding: EdgeInsets.all(10.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox(height: 15,), + Text("์ „ํ•˜์ง€ ๋ชปํ•œ\n์ง„์‹ฌ", style: TextStyle(fontSize: 16, color: ui_miss? Color(0xff333333) : Color(0xff4B5396)),), + SizedBox(height: 15,), + Text("์ „ํ•˜๊ณ ํ”ˆ ์ง„์‹ฌ์„\n์ด์•ผ๊ธฐํ•ด์š”.", style: TextStyle(fontSize: 12, color: ui_miss? Color(0xff333333) : Color(0xff4B5396)),), + SizedBox(height: 5,), + Row( + children: [ + SizedBox(width: 55,), + SvgPicture.asset('assets/images/conversation/intro/miss.svg') + ], + ) + ], + ), + ) + ), + ), + SizedBox(width: 20,), + Container( + width: 156, + height: 156, + child: ElevatedButton( + style: ui_grief? buttonChart().bluebtn2 : buttonChart().whitebtn, + onPressed: () { + // grief = true; + ui_miss = false; + if(ui_grief == false){ + ui_grief = true; + } else{ + ui_grief = false; + } + // nextQuestion++; + setState(() {}); + }, + child: Container( + padding: EdgeInsets.all(10.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox(height: 15,), + Text("์Šฌํ””์˜\n๊ฐ์ •", style: TextStyle(fontSize: 16, color: ui_grief? Color(0xff333333) : Color(0xff4B5396)),), + SizedBox(height: 15,), + Text("์ด๋ณ„๋กœ ์ธํ•œ\n์Šฌํ””์„ ์ด์•ผ๊ธฐํ•ด์š”.", style: TextStyle(fontSize: 12, color: ui_grief? Color(0xff333333) : Color(0xff4B5396)),), + SizedBox(height: 5,), + Row( + children: [ + SizedBox(width: 55,), + SvgPicture.asset('assets/images/conversation/intro/grief.svg') + ], + ) + ], + ), + ) + ), + ), + ], + ), + ], + ), + ], + ), + ] + ], + ) + + ], + ), + ], + ), + ), + ), + // ์ž…๋ ฅ ๋ฐ ๋ฆฌ์ŠคํŠธ ์ถ”๊ฐ€ ์ž‘์—… - ๋งค์šฐ ์ค‘์š” + // // nextQuestion ์ด 3๊ณผ 7์ผ๋•Œ ๋“ฑ์žฅ + bottomSheet: Padding( + padding: EdgeInsets.only( + bottom: MediaQuery.of(context).viewInsets.bottom * 0.01), + child: Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + if(nextQuestion == 1)...[ + Column( + children: [ + ElevatedButton( + style: buttonChart().bluebtn3, + onPressed: () { + nextQuestion++; + setState(() {}); + }, + child: Text("๋„ค ์ข‹์•„์š”.", style: textStyle.white16semibold,), + ), + SizedBox(height: 16,), + ElevatedButton( + style: buttonChart().bluebtn3, + onPressed: () { + nextQuestion++; + setState(() {}); + }, + child: Text("์•„๋‹ˆ์š”, ์•„์ง ์‹œ๊ฐ„์ด ํ•„์š”ํ•ด์š”.", style: textStyle.white16semibold,), + ), + ], + ), + + ] + else if(nextQuestion == 2)...[ + Container( + color: Color(0xffFFFFFF), + child: Padding( + padding: EdgeInsets.all(12), + child: Container( + width: screenSize.width, + height: 40, + child: ElevatedButton( + style: buttonChart().bluebtn3, + onPressed: () { + nextQuestion++; + if(ui_miss){ + miss = true; + _player.setAsset(voice[voiceCount]); + voiceCount++; + // Navigator.push( + // context, + // MaterialPageRoute( + // builder: (context) => IntroMarkCoachPage())); + + }else if (ui_grief){ + grief = true; + _player.setAsset(voice[voiceCount]); + voiceCount++; + // Navigator.push( + // context, + // MaterialPageRoute( + // builder: (context) => IntroMarkCoachPage())); + } + + setState(() {}); + }, + child: Text("๋‹ค์Œ"), + ), + ),), + ), + ] + ], + ), + )), + ) + + ); + + } +} \ No newline at end of file diff --git a/client/lib/conversation/middle_period/the_truth_untold.dart b/client/lib/conversation/middle_period/the_truth_untold.dart new file mode 100644 index 0000000..bbe4134 --- /dev/null +++ b/client/lib/conversation/middle_period/the_truth_untold.dart @@ -0,0 +1,1282 @@ +import 'dart:async'; +import 'dart:convert'; +import 'package:flutter/material.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter_svg/svg.dart'; +import 'package:client/home.dart' as home; +import 'package:client/screen.dart'; +import 'package:http/http.dart' as http; +import 'package:client/progressbar/animation_progressbar.dart'; +import 'package:client/sign/sign_in.dart'; +import 'package:client/style.dart'; +import 'package:intl/intl.dart'; +import 'package:just_audio/just_audio.dart'; +import 'package:flutter_gif/flutter_gif.dart'; +import 'package:client/sign/sign_in.dart' as sign_in; +import 'package:client/main.dart'as main; + +/// ์ค‘๊ธฐ ๋Œ€ํ™” - ์ „ํ•˜์ง€ ๋ชปํ•œ ์ง„์‹ฌ + +AudioPlayer player2 = AudioPlayer(); + +late FlutterGifController controller1, controller2, controller3; + +List voice =[ + "assets/voice/middle/truth/truth1.mp3", "assets/voice/middle/truth/truth2.mp3", + "assets/voice/middle/truth/truth3.mp3", "assets/voice/middle/truth/truth4.mp3", + "assets/voice/middle/truth/truth5.mp3", "assets/voice/middle/truth/truth6.mp3", + "assets/voice/middle/truth/truth7.mp3", "assets/voice/middle/truth/truth8.mp3", + "assets/voice/middle/truth/truth9.mp3", "assets/voice/middle/truth/truth10.mp3", + "assets/voice/middle/truth/truth11.mp3", "", // ์•„์ด์—๊ฒŒ ๋ณด๋‚ผํŽธ์ง€ + "assets/voice/middle/truth/truth12.mp3", "assets/voice/middle/truth/truth13.mp3", + "assets/voice/middle/truth/truth14.mp3", "", // ์ž‘์„ฑ์ค‘ + "assets/voice/middle/truth/truth15.mp3", "assets/voice/middle/truth/truth16.mp3", + "assets/voice/middle/truth/truth17.mp3", "assets/voice/middle/truth/truth18.mp3", + "assets/voice/middle/truth/truth19.mp3", "","", // ๋‚˜๋ ˆ์ด์…˜ + "assets/voice/middle/truth/truth20.mp3", "assets/voice/middle/truth/truth21.mp3", + "assets/voice/middle/truth/truth22.mp3", "assets/voice/middle/truth/truth23.mp3", + "assets/voice/middle/truth/truth24.mp3", "assets/voice/middle/truth/truth25.mp3", + "assets/voice/middle/truth/truth26.mp3", "assets/voice/middle/truth/truth27.mp3", + "assets/voice/middle/truth/truth28.mp3", "assets/voice/middle/truth/truth29.mp3", + "assets/voice/middle/truth/truth30.mp3", "assets/voice/middle/truth/truth31.mp3", +]; + +List endVoice =[ + "assets/voice/intro/intro2_8.mp3", + "assets/voice/intro/intro2_9.mp3", +]; + + +class TheTruthUntoldPage extends StatefulWidget { + + static Future navigatorPush(BuildContext context) async { + return Navigator.push( + context, + MaterialPageRoute( + builder: (_) => TheTruthUntoldPage(), + ), + ); + } + + @override + _TheTruthUntoldPageState createState() => _TheTruthUntoldPageState(); +} + +class _TheTruthUntoldPageState extends State with TickerProviderStateMixin { + + List questions0 =[ + "${home.puppy}๋Š” ์ง€๊ธˆ", + "๋ฌด์ง€๊ฐœ๋‹ค๋ฆฌ ๋„ˆ๋จธ์—\n์ž˜ ๋„์ฐฉํ–ˆ์„ ๊ฑฐ์˜ˆ์š”.", + "๋ถ„๋ช… ์ž˜ ์ง€๋‚ด๊ณ  ์žˆ์„ ๊ฒƒ์„ ์•Œ์•„๋„", + "์—ฌ์ „ํžˆ\n${home.user}๋‹˜์—๊ฒŒ๋Š”", + "${home.puppy}์—๊ฒŒ\nํ•ด์ฃผ๊ณ  ์‹ถ์€ ๋ง์ด ๋‚จ์•„์žˆ๊ฒ ์ฃ .", + "์˜ค๋Š˜์€ ${home.puppy}์—๊ฒŒ\n์ „ํ•˜์ง€ ๋ชปํ•œ", + "${home.user}๋‹˜์˜\n์ง„์‹ฌ์„ ๋‹ด์•„", + "๋ฌด์ง€๊ฐœ ๋„ˆ๋จธ๋กœ ํŽธ์ง€๋ฅผ ๋ณด๋‚ผ๊ฑฐ์˜ˆ์š”.", + "ํŽธ์ง€๋ฅผ ์“ฐ๊ธฐ ์ „์—,\n๋จผ์ € ํŽธ์ง€๋ฅผ ๊พธ๋ฉฐ๋ณผ๊ฒŒ์š”.", + "${home.puppy}๋Š”\n์–ด๋–ค ๋‚ ์”จ๋ฅผ ์ข‹์•„ํ–ˆ๋‚˜์š”?", + + "${home.puppy}์—๊ฒŒ ๋ณด๋‚ผ\nํŽธ์ง€์ง€๊ฐ€ ์™„์„ฑ๋˜์—ˆ์–ด์š”!", + "${home.puppy}์—๊ฒŒ ๋ณด๋‚ผ\nํŽธ์ง€์ง€๊ฐ€ ์™„์„ฑ๋˜์—ˆ์–ด์š”!", + "์™„์„ฑ๋œ ํŽธ์ง€์ง€์—", + "${home.puppy}์—๊ฒŒ\n์ „ํ•˜๊ณ  ์‹ถ์—ˆ๋˜ ์ง„์‹ฌ์„ ๋‹ด์•„", + "ํŽธ์ง€๋ฅผ ์ž‘์„ฑํ•ด์ฃผ์„ธ์š”.", + "", // ์ž‘์„ฑ์ค‘ + + "${home.user}๋‹˜,", + "ํŽธ์ง€์— ${home.puppy}๋ฅผ ํ–ฅํ•œ ์ง„์‹ฌ์„", + "์ž˜ ์ ์–ด๋ณด์•˜๋‚˜์š”?", + "${home.user}๋‹˜์˜\n์†Œ์ค‘ํ•œ ๋งˆ์Œ์„ ๋‹ด์•„", + "${home.puppy}์—๊ฒŒ\n์ง์ ‘ ํŽธ์ง€๋ฅผ ์ „๋‹ฌํ•ด๋“œ๋ฆด๊ฒŒ์š”!", + + "๋ฌด์ง€๊ฐœ ๋‹ค๋ฆฌ ๋„ˆ๋จธ ${home.puppy}์—๊ฒŒ\nํŽธ์ง€๊ฐ€ ์ „๋‹ฌ๋˜๋Š” ์ค‘...", + "${home.puppy}์—๊ฒŒ\nํŽธ์ง€๊ฐ€ ์ „๋‹ฌ๋˜์—ˆ์Šต๋‹ˆ๋‹ค!", + + "${home.user}๋‹˜์˜ ํŽธ์ง€๊ฐ€\n${home.puppy}์—๊ฒŒ ์ „๋‹ฌ๋˜์—ˆ์–ด์š”.", + "${home.puppy}๊ฐ€\n${home.user}๋‹˜์˜ ํŽธ์ง€๋ฅผ ๋ฐ›๊ณ ", + "์ด ๋ง์„ ๊ผญ ์ „ํ•ด๋‹ฌ๋ผ๊ณ  ํ–ˆ์–ด์š”.", + "${home.puppy}๋Š”\n${home.user}๋‹˜์„", + "์ •๋ง ๋งŽ์ด ์‚ฌ๋ž‘ํ•œ๋‹ต๋‹ˆ๋‹ค.", + "${home.user}๋‹˜๊ณผ\n๋‹ค์‹œ ๋งŒ๋‚˜๋Š” ๊ทธ๋‚ ๊นŒ์ง€", + "์นœ๊ตฌ๋“ค๊ณผ ๊ธฐ๋‹ค๋ฆฌ๊ณ  ์žˆ์„๊ฑฐ๋ผ๊ณ  ํ–ˆ์–ด์š”!", + "${home.user}๋‹˜์˜\n์†Œ์ค‘ํ•œ ๋งˆ์Œ์ด", + "${home.puppy}์—๊ฒŒ๋„\n์ž˜ ์ „๋‹ฌ๋œ ๊ฒƒ ๊ฐ™์•„์š”!", + "ํŽธ์ง€๋ฅผ ํ†ตํ•ด\n${home.user}๋‹˜์˜ ๋งˆ์Œ ์†", + "์ „ํ•˜์ง€ ๋ชปํ–ˆ๋˜ ์ง„์‹ฌ๋“ค์ด", + "์กฐ๊ธˆ์€ ๊ฐ€๋ฒผ์›Œ์กŒ๊ธฐ๋ฅผ ๋ฐ”๋ผ์š”.", + ]; + + List questionsEnd =[ + "์ž, ์ด์ œ ์šฐ๋ฆฌ๊ฐ€ ๋‹ค์‹œ\n๋งŒ๋‚˜๊ฒŒ ๋  ์‹œ๊ฐ„์„ ์•Œ๋ ค์ฃผ์„ธ์š”.", + "์ž, ์ด์ œ ์šฐ๋ฆฌ๊ฐ€ ๋‹ค์‹œ\n๋งŒ๋‚˜๊ฒŒ ๋  ์‹œ๊ฐ„์„ ์•Œ๋ ค์ฃผ์„ธ์š”.", + "๋„ค, ${home.user}๋‹˜.\n()์‹œ๊ฐ„ ํ›„์— ๋‹ค์‹œ ๋งŒ๋‚˜์š”!", + "๋„ค, ${home.user}๋‹˜.\n()์‹œ๊ฐ„ ํ›„์— ๋‹ค์‹œ ๋งŒ๋‚˜์š”!", + ]; + + int voiceEndCount = 0; + bool selectedNextTime = false; + bool chooseTime = false; + int whatTime = 0; + + bool ui_sunny = false; + bool sunny = false; + bool ui_cool = false; + bool cool = false; + bool ui_rainy = false; + bool rainy = false; + bool ui_snow = false; + bool snow = false; + + bool startWrite = false; + bool wrote = false; // ํŽธ์ง€๋ฅผ ์ผ๋Š”์ง€ + + // ํ…์ŠคํŠธ ์—๋””ํŒ… ์ปจํŠธ๋กค๋Ÿฌ๋ฅผ ์ƒ์„ฑํ•˜์—ฌ ํ•„๋“œ์— ํ• ๋‹น + final letterController = TextEditingController(); // nextQuestion = 7์ผ๋•Œ + final nextTimeController = TextEditingController(); // nextQuestion = 7์ผ๋•Œ + final whatController = TextEditingController(); // nextQuestion = 7์ผ๋•Œ + + FocusNode _focusNode = FocusNode(); + + String sentDate = ""; + // ๋Œ€ํ™” ๋‹จ๊ณ„ ์ €์žฅ + void saveCon(String aToken, String con, String nextcon) async { + // API ์—”๋“œํฌ์ธํŠธ URL + String apiUrl = 'http://3.38.1.125:8080/user/conversation-status'; + + // ์š”์ฒญ ๋ณธ๋ฌธ ๋ฐ์ดํ„ฐ + var data = { + "conversationStatus": con, + "nextConversationAt": nextcon, + }; + + // ํ—ค๋” ์ •๋ณด ์„ค์ • + Map headers = { + 'Authorization': 'Bearer $aToken', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• + 'Content-Type': 'application/json', // ์˜ˆ: JSON ์š”์ฒญ์ธ ๊ฒฝ์šฐ ํ—ค๋” ์„ค์ • + }; + + // HTTP GET ์š”์ฒญ ๋ณด๋‚ด๊ธฐ + var response = await http.put( + Uri.parse(apiUrl), + body: json.encode(data), + headers: headers, // ํ—ค๋” ์ถ”๊ฐ€ + ); + + ///var jsonResponse = utf8.decode(response.bodyBytes); + // HTTP ์‘๋‹ต ์ƒํƒœ ํ™•์ธ + if (response.statusCode == 200) { + // ์‘๋‹ต ๋ฐ์ดํ„ฐ๋ฅผ JSON ํ˜•์‹์œผ๋กœ ๋””์ฝ”๋”ฉ + print("๋Œ€ํ™” ๋‹จ๊ณ„ ๋„ฃ๊ธฐ ์„ฑ๊ณต"); + setState(() { + }); + + } else { + // ์š”์ฒญ์ด ์‹คํŒจํ•œ ๊ฒฝ์šฐ ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌ + print('HTTP ์š”์ฒญ ์‹คํŒจ..?: ${response.statusCode}'); + } + } + + @override + void initState() { + super.initState(); + + main.play = true; + main.player.setAsset(main.musics[2]); + main.player.play(); + + // ์Œ์› ์ ์šฉ + for(int i= 0 ; i < voice.length; i++){ + player2.setAudioSource(AudioSource.uri( + Uri.parse(voice[i])) + ); + } + + player2.setAsset(voice[voiceCount]); + voiceCount++; + player2.play(); + controller1 = FlutterGifController(vsync: this); + + // 2.5์ดˆ ์ ์ • + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + Timer(Duration(milliseconds: 1500), () { + controller1.stop(); + }); + _focusNode.addListener(_onFocusChange); + } + + void _onFocusChange() { + if (_focusNode.hasFocus) { + // ํ‚ค๋ณด๋“œ ์˜ฌ๋ฆฌ๊ธฐ + FocusScope.of(context).requestFocus(_focusNode); + } + } + + @override + void dispose() async { + super.dispose(); + } + + int nextQuestion = 0; + bool nextQ = false; + + int voiceCount = 0; + + int endQuestion = 0; + bool end = false; + + @override + Widget build(BuildContext context) { + MediaQueryData deviceData = MediaQuery.of(context); + Size screenSize = deviceData.size; + return + Container( + decoration: (nextQuestion>20 && nextQuestion<23)? + BoxDecoration( + gradient: LinearGradient( + begin: Alignment.topCenter, + end: Alignment.bottomCenter, + colors: [ + Color(0xffFCCBCC), + Color(0xffFEF3B0), + ], + ) + ) : + BoxDecoration( + gradient: LinearGradient( + begin: Alignment.topRight, + end: Alignment.bottomLeft, + colors: [ + Color(0xffFBF3B8), + Color(0xffFBF3B8), + ], + ) + ), + child: GestureDetector( + onTap: (){ + print("์ด๊ฑฐ๋งŒ ์ข€ ํ™•์ธ ๋ถ€ํƒ: " + nextQuestion.toString()); + + if(nextQuestion < 9){ + nextQuestion++; // ์ธํŠธ๋กœ ์‹œ์ž‘ ํ›„ count + + player2.setAsset(voice[voiceCount]); + voiceCount++; + player2.play(); + + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + + if(nextQuestion == 1){ + Timer(Duration(milliseconds: 4000), () { + controller1.stop(); + }); + } else if(nextQuestion == 2){ + Timer(Duration(milliseconds: 3500), () { + controller1.stop(); + }); // ok + } else if(nextQuestion == 3){ + Timer(Duration(milliseconds: 2000), () { + controller1.stop(); + }); + } else if(nextQuestion == 4){ + Timer(Duration(milliseconds: 3500), () { + controller1.stop(); + }); + } + else if(nextQuestion == 5){ + Timer(Duration(milliseconds: 3000), () { + controller1.stop(); + }); + } + else if(nextQuestion == 6){ + Timer(Duration(milliseconds: 2500), () { + controller1.stop(); + }); + } + else if(nextQuestion == 7){ + Timer(Duration(milliseconds: 3500), () { + controller1.stop(); + }); + } + else if(nextQuestion == 8){ + Timer(Duration(milliseconds: 4000), () { + controller1.stop(); + }); + } + else if(nextQuestion == 9){ + Timer(Duration(milliseconds: 3000), () { + controller1.stop(); + }); + } + } + else if(nextQuestion == 9){ + // ${home.puppy}๊ฐ€ ์ข‹์•„ํ•˜๋Š” ๊ณ„์ ˆ ๊ณ ๋ฅด๊ธฐ + } + else if(nextQuestion >9 && nextQuestion < 15){ + nextQuestion++; + player2.setAsset(voice[voiceCount]); + voiceCount++; + player2.play(); + + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + + if(nextQuestion == 11){ + Timer(Duration(milliseconds: 2000), () { + controller1.stop(); + }); + } else if(nextQuestion == 12){ + Timer(Duration(milliseconds: 2000), () { + controller1.stop(); + }); // ok + } else if(nextQuestion == 13){ + Timer(Duration(milliseconds: 3000), () { + controller1.stop(); + }); + } else if(nextQuestion == 14){ + Timer(Duration(milliseconds: 2500), () { + controller1.stop(); + }); + } + else if(nextQuestion == 15){ + Timer(Duration(milliseconds: 1000), () { + controller1.stop(); + }); + } + } + else if(nextQuestion == 15){ + // ํŽธ์ง€์ง€ ์ž‘์„ฑ + } + else if(nextQuestion >15 && nextQuestion < 34){ + nextQuestion++; + player2.setAsset(voice[voiceCount]); + voiceCount++; + player2.play(); + + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + + if(nextQuestion == 17){ + Timer(Duration(milliseconds: 3000), () { + controller1.stop(); + }); + } else if(nextQuestion == 18){ + Timer(Duration(milliseconds: 2000), () { + controller1.stop(); + }); // ok + } else if(nextQuestion == 19){ + Timer(Duration(milliseconds: 3000), () { + controller1.stop(); + }); + } else if(nextQuestion == 20){ + Timer(Duration(milliseconds: 3500), () { + controller1.stop(); + }); + } + else if(nextQuestion == 21){ + Timer(Duration(milliseconds: 1000), () { + controller1.stop(); + }); + } + else if(nextQuestion == 22){ + Timer(Duration(milliseconds: 3500), () { + controller1.stop(); + }); + } + else if(nextQuestion == 23){ + Timer(Duration(milliseconds: 3500), () { + controller1.stop(); + }); + } + else if(nextQuestion == 24){ + Timer(Duration(milliseconds: 3000), () { + controller1.stop(); + }); + } + else if(nextQuestion == 25){ + Timer(Duration(milliseconds: 3000), () { + controller1.stop(); + }); + } + else if(nextQuestion == 26){ + Timer(Duration(milliseconds: 2000), () { + controller1.stop(); + }); + } + else if(nextQuestion == 27){ + Timer(Duration(milliseconds: 2500), () { + controller1.stop(); + }); + } + else if(nextQuestion == 28){ + Timer(Duration(milliseconds: 3000), () { + controller1.stop(); + }); + } + else if(nextQuestion == 29){ + Timer(Duration(milliseconds: 3000), () { + controller1.stop(); + }); + } + else if(nextQuestion == 30){ + Timer(Duration(milliseconds: 2500), () { + controller1.stop(); + }); + } + else if(nextQuestion == 31){ + Timer(Duration(milliseconds: 3000), () { + controller1.stop(); + }); + } + else if(nextQuestion == 32){ + Timer(Duration(milliseconds: 3000), () { + controller1.stop(); + }); + } + else if(nextQuestion == 33){ + Timer(Duration(milliseconds: 2500), () { + controller1.stop(); + }); + } + else if(nextQuestion == 34){ + Timer(Duration(milliseconds: 2500), () { + controller1.stop(); + }); + } + } + else if(nextQuestion == 34 && end == false){ + end = true; + nextQuestion++; + player2.setAsset(endVoice[voiceEndCount]); + voiceEndCount++; + player2.play(); + + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + Timer(Duration(milliseconds: 4000), () { + controller1.stop(); + }); + + } + else if(end && endQuestion < 1){ + endQuestion++; + } + else if(endQuestion == 1){ + } + else if(endQuestion == 2){ + endQuestion++; + } + else if(endQuestion == 3){ + } + + setState(() { + }); + }, + child: Scaffold( + backgroundColor: Colors.transparent, + appBar: AppBar( + //title: Text("๊ธฐ์–ตํ• ๊ฐœ", style: TextStyle(fontSize:16, color: Colors.white ),), + //centerTitle: true, + leading: IconButton( + icon: SvgPicture.asset( + 'assets/images/conversation/home_icon.svg', + ), + onPressed: () => Navigator.of(context).pop(), + ), + backgroundColor: Colors.transparent, + elevation: 0.0, + ), + //extendBodyBehindAppBar: true, + body: + SingleChildScrollView( + child: Container( + child: Column( + children: [ + SizedBox(height: 3,), + Container( + width: screenSize.width, + height: 25, + child: Padding( + padding: EdgeInsets.only( left:16, right: 16), + child: Center( + child: FAProgressBar( + currentValue: 60, + size: 5, + backgroundColor: Colors.white, + ) + ), + ), + ), + Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children:[ + SizedBox( + height: 10, + ), + Stack( + children: [ + Container( + height: 157, + width: screenSize.width, + child: + Stack( + children: [ + if(nextQuestion < 15 || (nextQuestion > 15 && nextQuestion<21) || (nextQuestion > 22) )...[ + // ํŽธ์ง€์ง€ ์“ฐ๊ธฐ์ „ ๋งํ’์„  + Center(child: SvgPicture.asset('assets/images/conversation/bubble.svg',fit: BoxFit.fill,),), + ] else if(nextQuestion > 20 && nextQuestion < 23)...[ + // ๋‚˜๋ ˆ์ด์…˜ + Center(child: SvgPicture.asset('assets/images/conversation/intro/intro_bubble.svg',fit: BoxFit.fill,),), + ], + Container( + padding: const EdgeInsets.symmetric(horizontal: 32, vertical: 12, ), + child: Center( + child: Column( + children: [ + if(end == false)...[ + if(questions0[nextQuestion].toString().contains("\n"))...[ + SizedBox(height: (nextQuestion>20 && nextQuestion<23)? 39 : 28,), + Text( + questions0[nextQuestion], + textAlign: TextAlign.center, + style: (nextQuestion>20 && nextQuestion<23)? textStyle.introbubbletext : textStyle.bubbletext, + ), + ]else...[ + SizedBox(height: (nextQuestion>20 && nextQuestion<23)? 48 :42,), + Text( + questions0[nextQuestion], + textAlign: TextAlign.center, + style: (nextQuestion>20 && nextQuestion<23)? textStyle.introbubbletext : textStyle.bubbletext, + ), + ], + ] + // ๋Œ€ํ™” ๋งˆ๋ฌด๋ฆฌ + else if (end) ...[ + if(questionsEnd[endQuestion] + .toString() + .contains("\n"))...[ + SizedBox(height: 28,), + Text(questionsEnd[endQuestion], textAlign: TextAlign.center, + style: textStyle.bubbletext,), + ]else...[ + SizedBox(height: 42,), + Text(questionsEnd[endQuestion], textAlign: TextAlign.center, style: textStyle.bubbletext,), + ], + ] + ], + ) + ) + ), + ], + ) + ), + // ๋ฌด์ง€ ์œ„์น˜ + if(nextQuestion < 9 || nextQuestion == 10 || (nextQuestion > 11 && nextQuestion < 15) || + (nextQuestion > 15 && nextQuestion < 21) || (nextQuestion > 15 && nextQuestion < 21) || + (nextQuestion > 22 && nextQuestion < 35) || (end && endQuestion<1) || (end && endQuestion>1))...[ + Stack( + children: [ + // ์œ ์ € ์œ„์น˜ + Column( + children: [ + SizedBox(height: 420,), + Container( + child: SvgPicture.asset( + 'assets/images/conversation/user7.svg', + height: 282, + width: screenSize.width, + ), + ), + ], + ), + Column( + children: [ + SizedBox(height: 144,), + Container( + width: screenSize.width, + height: 375, + child: + Stack( + children: [ + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child: Image.asset('assets/images/conversation/gif/muji_ear.gif', + fit: BoxFit.cover,),), + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child: Image.asset('assets/images/conversation/gif/muji_base.gif', fit: BoxFit.cover,),), + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child: Image.asset('assets/images/conversation/gif/muji_base_eye.gif', + fit: BoxFit.cover,),), + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child:GifImage( + controller: controller1, + image: const AssetImage("assets/images/conversation/gif/muji_mouth1.gif"), + ), + // Image.asset('assets/images/conversation/gif/muji_mouth1.gif', fit: BoxFit.cover,), + ) + ], + ) + + // SvgPicture.asset( + // 'assets/images/conversation/con_muji.svg', fit: BoxFit.cover, + // ), + ), + ], + ), + ], + ), + ] + else if(nextQuestion == 9)...[ + Stack( + children: [ + + Column( + children: [ + SizedBox(height: 418,), + Container( + height: 284, + width: screenSize.width, + color: Color(0xffFFFFF7), + ) + ], + ), + Column( + children: [ + SizedBox(height: 418,), + SvgPicture.asset( + 'assets/images/conversation/shadow.svg', fit: BoxFit.cover, + ), + ], + ), + + Column( + children: [ + SizedBox(height: 144,), + Container( + width: screenSize.width, + height: 375, + child: + Stack( + children: [ + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child: Image.asset('assets/images/conversation/gif/muji_ear.gif', + fit: BoxFit.cover,),), + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child: Image.asset('assets/images/conversation/gif/muji_base.gif', fit: BoxFit.cover,),), + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child: Image.asset('assets/images/conversation/gif/muji_base_eye.gif', + fit: BoxFit.cover,),), + Padding(padding: EdgeInsets.only(bottom: 0, left: 0), + child:GifImage( + controller: controller1, + image: const AssetImage("assets/images/conversation/gif/muji_mouth1.gif"), + ), + // Image.asset('assets/images/conversation/gif/muji_mouth1.gif', fit: BoxFit.cover,), + ) + ], + ) + ), + ], + ), + Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SizedBox(height: 256,), + Row( + children: [ + SizedBox(width: 16,), + Container( + width: 168, + height: 168, + child: ElevatedButton( + style: ui_sunny? buttonChart().bluebtn2_1 : buttonChart().whitebtn_1, + onPressed: () { + ui_sunny = true; + ui_cool = false; + ui_rainy = false; + ui_snow = false; + // nextQuestion++; + setState(() {}); + }, + child: Container( + padding: EdgeInsets.only(top:8.0,left: 8.0, bottom: 8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox(height: 16,), + Text("ํ™”์ฐฝํ•œ ๋‚ ์”จ", style: TextStyle(fontSize: 16, color: ui_sunny? Color(0xff333333) : Color(0xff4B5396)),), + SizedBox(height: 16,), + Text("ํ•ด๊ฐ€ ํ™”์ฐฝํ•œ ๋‚ ์”จ๋ฅผ\n์ข‹์•„ํ–ˆ์–ด์š”.", style: TextStyle(fontSize: 12, color: ui_sunny? Color(0xff333333) : Color(0xff4B5396)),), + SizedBox(height: 16,), + Row( + children: [ + SizedBox(width: 76,), + SvgPicture.asset('assets/images/conversation/middle/sun.svg') + ], + ) + ], + ), + ) + ), + ), + SizedBox(width: 16,), + Container( + width: 168, + height: 168, + child: ElevatedButton( + style: ui_cool? buttonChart().bluebtn2_1 : buttonChart().whitebtn_1, + onPressed: () { + ui_sunny = false; + ui_cool = true; + ui_rainy = false; + ui_snow = false; + // nextQuestion++; + setState(() {}); + }, + child: Container( + padding: EdgeInsets.only(top:8.0,left: 8.0, bottom: 8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox(height: 16,), + Text("์„ ์„ ํ•œ ๋‚ ์”จ", style: TextStyle(fontSize: 16, color: ui_cool? Color(0xff333333) : Color(0xff4B5396)),), + SizedBox(height: 16,), + Text("์„ ์„ ํ•˜๊ณ  ์‹œ์›ํ•œ ๋‚ ์”จ๋ฅผ\n์ข‹์•„ํ–ˆ์–ด์š”.", style: TextStyle(fontSize: 12, color: ui_cool? Color(0xff333333) : Color(0xff4B5396)),), + SizedBox(height: 16,), + Row( + children: [ + SizedBox(width: 76,), + SvgPicture.asset('assets/images/conversation/intro/grief.svg') + ], + ) + ], + ), + ) + ), + ), + ], + ), + SizedBox(height: 16,), + Row( + children: [ + SizedBox(width: 16,), + Container( + width: 168, + height: 168, + child: ElevatedButton( + style: ui_rainy? buttonChart().bluebtn2_1 : buttonChart().whitebtn_1, + onPressed: () { + ui_sunny = false; + ui_cool = false; + ui_rainy = true; + ui_snow = false; + // nextQuestion++; + setState(() {}); + }, + child: Container( + padding: EdgeInsets.only(top:8.0,left: 8.0, bottom: 8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox(height: 16,), + Text("๋น„์˜ค๋Š” ๋‚ ์”จ", style: TextStyle(fontSize: 16, color: ui_rainy? Color(0xff333333) : Color(0xff4B5396)),), + SizedBox(height: 16,), + Text("์ถ”์ ์ถ”์  ๋น„์˜ค๋Š” ๋‚ ์”จ๋ฅผ\n์ข‹์•„ํ–ˆ์–ด์š”.", style: TextStyle(fontSize: 12, color: ui_rainy? Color(0xff333333) : Color(0xff4B5396)),), + SizedBox(height: 16,), + Row( + children: [ + SizedBox(width: 76,), + SvgPicture.asset('assets/images/conversation/intro/grief.svg') + ], + ) + ], + ), + ) + ), + ), + SizedBox(width: 16,), + Container( + width: 168, + height: 168, + child: ElevatedButton( + style: ui_snow? buttonChart().bluebtn2_1 : buttonChart().whitebtn_1, + onPressed: () { + ui_sunny = false; + ui_cool = false; + ui_rainy = false; + ui_snow = true; + // nextQuestion++; + setState(() {}); + }, + child: Container( + padding: EdgeInsets.only(top:8.0,left: 8.0, bottom: 8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox(height: 16,), + Text("๋ˆˆ ์˜ค๋Š” ๋‚ ์”จ", style: TextStyle(fontSize: 16, color: ui_snow? Color(0xff333333) : Color(0xff4B5396)),), + SizedBox(height: 16,), + Text("ํฐ ๋ˆˆ์ด ์˜ค๋Š” ๋‚ ์”จ๋ฅผ\n์ข‹์•„ํ–ˆ์–ด์š”.", style: TextStyle(fontSize: 12, color: ui_snow? Color(0xff333333) : Color(0xff4B5396)),), + SizedBox(height: 16,), + Row( + children: [ + SizedBox(width: 76,), + SvgPicture.asset('assets/images/conversation/middle/sno.svg') + ], + ) + ], + ), + ) + ), + ), + ], + ), + ], + ), + ], + ), + ] + // ํŽธ์ง€์ง€ ์ž‘์„ฑํ•˜๊ธฐ + else if(nextQuestion == 15)...[ + Column( + children: [ + SizedBox(height: 96,), + Stack( + children: [ + Padding( + padding: EdgeInsets.only(left: 16), + child: Column( + children: [ + if(sunny)...[ + SvgPicture.asset('assets/images/conversation/middle/sunny.svg', + fit: BoxFit.contain, + height: 438, + width: screenSize.width, + ), + ] + else if(cool)...[ + SvgPicture.asset('assets/images/conversation/middle/cool.svg', + fit: BoxFit.contain, + height: 438, + width: screenSize.width, + ), + ] + else if(rainy)...[ + SvgPicture.asset('assets/images/conversation/middle/rainy.svg', + fit: BoxFit.contain, + height: 438, + width: screenSize.width, + ), + ] + else if(snow)...[ + SvgPicture.asset('assets/images/conversation/middle/snow.svg', + fit: BoxFit.contain, + height: 438, + width: screenSize.width, + ), + ], + ], + ), + ), + + Padding( + padding: EdgeInsets.only(top:16,left: 48, right:48, bottom:16), + child: SizedBox( + width: screenSize.width, + //height: 150, + child: TextField( + style: textStyle.bubbletext, + controller: letterController, + decoration: InputDecoration( + contentPadding: EdgeInsets.only(top:3, left: 0), + hintStyle: textStyle.bubbletext, + border: InputBorder.none, + focusedBorder: InputBorder.none, + hintText: '์ด๊ณณ์— ํŽธ์ง€๋ฅผ ์ž‘์„ฑํ•ด์ฃผ์„ธ์š”.(300์ž)', + counterText:'', + ), + maxLines: 14, + maxLength: 300, + onTap: (){ + // ํŽธ์ง€์ง€ ์˜ฌ๋ฆฌ๊ธฐ? + }, + onChanged: (text){ + // ํŽธ์ง€๋ฅผ ์จ์•ผ ๋‹ค์Œ์œผ๋กœ ๋„˜์–ด๊ฐˆ ์ˆ˜ ์žˆ๋„๋ก ์„ค์ • + wrote = true; + setState(() {}); + }, + ), + ), + ), + + ], + ), + + ], + ), + ] + // ๋งˆ๋ฌด๋ฆฌ + else if (end && endQuestion == 1) ...[ + Padding( + padding: EdgeInsets.only(top: 175, left: 45), + child: Container( + width: 275, + height: 120, + child: Column( + children: [ + Row( + children: [ + SizedBox( + width: 75, + ), + Container( + width: 25, + child: TextField( + style: textStyle.inputfield, + onTap: () { + chooseTime = true; + whatTime = int.parse( + nextTimeController.text); + setState(() {}); + }, + onChanged: (text) { + selectedNextTime = true; + whatTime = int.parse( + nextTimeController.text); + }, + keyboardType: + TextInputType.number, + inputFormatters: [ + FilteringTextInputFormatter + .allow(RegExp('[0-9]')) + ], + controller: nextTimeController, + decoration: InputDecoration( + hintText: '๋ช‡', + suffixStyle: TextStyle( + color: Color(0xff83A8FF), + fontSize: 20, + ), + hintStyle: textStyle.field, + //labelText: '๋ช‡', + ), + ), + ), + Text( + "์‹œ๊ฐ„ ํ›„์— ๋งŒ๋‚˜์š”", + style: TextStyle( + fontFamily: 'Pretendard', + fontSize: 20, + fontWeight: FontWeight.w500, + color: Colors.black), + ), + ], + ), + SizedBox( + height: 15, + ), + // DateFormat('MM/dd HH:mm').format(DateTime.parse(parsedResponseHR[index]['createdAt'])) + // DateFormat('MM/dd HH:mm').format(DateTime.now().add(Duration(hours: whatTime))) + Text( + chooseTime + ? "${DateFormat('MM์›” dd์ผ HH์‹œ mm๋ถ„').format(DateTime.now().add(Duration(hours: whatTime)))}" + : "์ตœ์†Œ 1์‹œ๊ฐ„์—์„œ 24์‹œ๊ฐ„ ์‚ฌ์ด๋กœ ์ •ํ•ด์ฃผ์„ธ์š”.", + style: TextStyle( + fontFamily: 'Pretendard', + fontSize: 16, + fontWeight: FontWeight.w500, + color: Color(0xffAAAAAA)), + ), + ], + ), + ), + ), + ] else if (nextQuestion == 11) ...[ + Stack( + children: [ + // ์œ ์ € ์œ„์น˜ + Column( + children: [ + SizedBox( + height: 420, + ), + Container( + child: SvgPicture.asset( + 'assets/images/conversation/user7.svg', + height: 282, + width: screenSize.width, + ), + ), + ], + ), + Column( + children: [ + SizedBox( + height: 144, + ), + Container( + width: screenSize.width, + height: 375, + child: Stack( + children: [ + Padding( + padding: EdgeInsets.only( + bottom: 0, left: 0), + child: Image.asset( + 'assets/images/conversation/gif/muji_ear.gif', + fit: BoxFit.cover, + ), + ), + Padding( + padding: EdgeInsets.only( + bottom: 0, left: 0), + child: Image.asset( + 'assets/images/conversation/gif/muji_base.gif', + fit: BoxFit.cover, + ), + ), + Padding( + padding: EdgeInsets.only( + bottom: 0, left: 0), + child: Image.asset( + 'assets/images/conversation/gif/muji_base_eye.gif', + fit: BoxFit.cover, + ), + ), + Padding( + padding: EdgeInsets.only( + bottom: 0, left: 0), + child: GifImage( + controller: controller1, + image: const AssetImage( + "assets/images/conversation/gif/muji_mouth1.gif"), + ), + // Image.asset('assets/images/conversation/gif/muji_mouth1.gif', fit: BoxFit.cover,), + ) + ], + ) + + // SvgPicture.asset( + // 'assets/images/conversation/con_muji.svg', fit: BoxFit.cover, + // ), + ), + ], + ), + + // ํŽธ์ง€ ์œ„์น˜ + Padding(padding: EdgeInsets.only(top:240, left:65), + child: Column( + children: [ + if(sunny)...[ + SvgPicture.asset('assets/images/conversation/middle/sunny_min.svg', fit: BoxFit.cover,), + ]else if(cool)...[ + SvgPicture.asset('assets/images/conversation/middle/cool_min.svg', fit: BoxFit.cover,), + ] else if(rainy)...[ + SvgPicture.asset('assets/images/conversation/middle/rainy_min.svg', fit: BoxFit.cover,), + ] else if(snow)...[ + SvgPicture.asset('assets/images/conversation/middle/snow_min.svg', fit: BoxFit.cover,), + ], + ], + ),) + ], + ), + ] else if (nextQuestion == 21) ...[ + Padding(padding: EdgeInsets.only(top:248, left:80), + child: SvgPicture.asset('assets/images/conversation/middle/realmuji.svg', fit: BoxFit.cover,),), + ] else if (nextQuestion == 22) ...[ + Padding(padding: EdgeInsets.only(top:256, left:56), + child: SvgPicture.asset('assets/images/conversation/middle/myletter.svg', fit: BoxFit.cover,),), + ] + ], + ), + ], + ), + ], + ), + ), + ), + bottomSheet: Padding( + padding: EdgeInsets.only( + bottom: MediaQuery.of(context).viewInsets.bottom * 0.001), + child: Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + if(nextQuestion == 9 && (ui_sunny|| ui_cool || ui_rainy || ui_snow))...[ + Container( + color: Color(0xffFFFFFF).withOpacity(0), + child: Padding( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 24), + child: Container( + width: screenSize.width, + height: 40, + child: ElevatedButton( + style: buttonChart().bluebtn3, + onPressed: () { + //decidedType = false; + nextQuestion++; + if(ui_sunny){ + sunny = true; + } else if(ui_cool){ + cool = true; + } else if(ui_rainy){ + rainy = true; + } else if(ui_snow){ + snow = true; + } + player2.setAsset(voice[voiceCount]); + voiceCount++; + player2.play(); + + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + Timer(Duration(milliseconds: 3000), () { + controller1.stop(); + }); + + setState(() {}); + }, + child: Text("๋‹ค์Œ", style: TextStyle( + fontFamily: 'Pretendard', + fontSize: 16, fontWeight: FontWeight.w500, color: Color(0xffFFFFFF))), + ), + ),), + ), + ] + else if(nextQuestion == 15 && wrote)...[ + Container( + color: Color(0xffFFFFFF).withOpacity(0), + child: Padding( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 24), + child: Container( + width: screenSize.width, + height: 40, + child: ElevatedButton( + style: buttonChart().bluebtn3, + onPressed: () { + nextQuestion++; + player2.setAsset(voice[voiceCount]); + voiceCount++; + player2.play(); + setState(() {}); + + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + Timer(Duration(milliseconds: 1500), () { + controller1.stop(); + }); + }, + child: Text("๋‹ค์Œ", style: TextStyle( + fontFamily: 'Pretendard', + fontSize: 16, fontWeight: FontWeight.w500, color: Color(0xffFFFFFF))), + ), + ),), + ), + ] + else if(endQuestion == 1 && selectedNextTime)...[ + Container( + color: Color(0xffFFFFFF).withOpacity(0.0), + child: Padding( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 24), + child: Container( + + width: screenSize.width, + height: 40, + child: ElevatedButton( + style: buttonChart().bluebtn3, + onPressed: () { + questionsEnd.insertAll(2, [ + "๋„ค, ${home.user}๋‹˜.\n${whatTime}์‹œ๊ฐ„ ํ›„์— ๋‹ค์‹œ ๋งŒ๋‚˜์š”!", + "๋„ค, ${home.user}๋‹˜.\n${whatTime}์‹œ๊ฐ„ ํ›„์— ๋‹ค์‹œ ๋งŒ๋‚˜์š”!", + ]); + //decidedType = false; + endQuestion++; + player2.setAsset(endVoice[voiceEndCount]); + voiceEndCount++; + player2.play(); + // 2.5์ดˆ ์ ์ • + controller1.repeat( + min: 0, + max: 30, + period: const Duration(milliseconds: 1000) + ); + Timer(Duration(milliseconds: 3500), () { + controller1.stop(); + }); + setState(() {}); + }, + child: Text("๋‹ค์Œ", style: TextStyle( + fontFamily: 'Pretendard', + fontSize: 16, fontWeight: FontWeight.w500, color: Color(0xffFFFFFF))), + ), + ),), + ), + ] + else if(endQuestion == 3)...[ + Container( + color: Color(0xffFFFFFF).withOpacity(0.0), + child: Padding( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 24), + child: Container( + + width: screenSize.width, + height: 40, + child: ElevatedButton( + style: buttonChart().bluebtn3, + onPressed: () { + //decidedType = false; + //checkSignUp = false; + //checkSignIn = true; + checkSignUp = false; + var now = DateTime.now(); + sentDate = DateFormat('yyyy-MM-dd hh:mm:ss').format(now.toLocal()); + saveCon(sign_in.userAccessToken, "2B", sentDate); + setState(() {}); + main.player.stop(); + Navigator.pop(context); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => MyScreenPage(title: '์Šคํฌ๋ฆฐ ํŽ˜์ด์ง€',))); + }, + child: Text("์™„๋ฃŒ", style: TextStyle( + fontFamily: 'Pretendard', + fontSize: 16, fontWeight: FontWeight.w500, color: Color(0xffFFFFFF))), + ), + ),), + ), + ] + ], + ), + )), + ) + + ); + + } +} + diff --git a/client/lib/firebase_options.dart b/client/lib/firebase_options.dart new file mode 100644 index 0000000..f9044c3 --- /dev/null +++ b/client/lib/firebase_options.dart @@ -0,0 +1,82 @@ +// File generated by FlutterFire CLI. +// ignore_for_file: lines_longer_than_80_chars, avoid_classes_with_only_static_members +import 'package:firebase_core/firebase_core.dart' show FirebaseOptions; +import 'package:flutter/foundation.dart' + show defaultTargetPlatform, kIsWeb, TargetPlatform; + +/// Default [FirebaseOptions] for use with your Firebase apps. +/// +/// Example: +/// ```dart +/// import 'firebase_options.dart'; +/// // ... +/// await Firebase.initializeApp( +/// options: DefaultFirebaseOptions.currentPlatform, +/// ); +/// ``` +class DefaultFirebaseOptions { + static FirebaseOptions get currentPlatform { + if (kIsWeb) { + return web; + } + switch (defaultTargetPlatform) { + case TargetPlatform.android: + return android; + case TargetPlatform.iOS: + return ios; + case TargetPlatform.macOS: + return macos; + case TargetPlatform.windows: + throw UnsupportedError( + 'DefaultFirebaseOptions have not been configured for windows - ' + 'you can reconfigure this by running the FlutterFire CLI again.', + ); + case TargetPlatform.linux: + throw UnsupportedError( + 'DefaultFirebaseOptions have not been configured for linux - ' + 'you can reconfigure this by running the FlutterFire CLI again.', + ); + default: + throw UnsupportedError( + 'DefaultFirebaseOptions are not supported for this platform.', + ); + } + } + + static const FirebaseOptions web = FirebaseOptions( + apiKey: 'AIzaSyAKjk_V7cU041qwnCmubJbQZ556oUEVHII', + appId: '1:1011915138729:web:91b67dcd9c8dc74d562bb8', + messagingSenderId: '1011915138729', + projectId: 'capstone-c4d77', + authDomain: 'capstone-c4d77.firebaseapp.com', + storageBucket: 'capstone-c4d77.appspot.com', + ); + + static const FirebaseOptions android = FirebaseOptions( + apiKey: 'AIzaSyCuLQM-2nHpFngqgL7grLVs7NpjOvh5efc', + appId: '1:1011915138729:android:2a248dd403041036562bb8', + messagingSenderId: '1011915138729', + projectId: 'capstone-c4d77', + storageBucket: 'capstone-c4d77.appspot.com', + ); + + static const FirebaseOptions ios = FirebaseOptions( + apiKey: 'AIzaSyBaCzvi4zyTx2EP7BmMHyAYMbOowIW4CEI', + appId: '1:1011915138729:ios:8d26be11845937dc562bb8', + messagingSenderId: '1011915138729', + projectId: 'capstone-c4d77', + storageBucket: 'capstone-c4d77.appspot.com', + iosClientId: '1011915138729-rf6mfju2810d8aa2milt8k5hrlm108pl.apps.googleusercontent.com', + iosBundleId: 'com.example.petlose', + ); + + static const FirebaseOptions macos = FirebaseOptions( + apiKey: 'AIzaSyBaCzvi4zyTx2EP7BmMHyAYMbOowIW4CEI', + appId: '1:1011915138729:ios:8d26be11845937dc562bb8', + messagingSenderId: '1011915138729', + projectId: 'capstone-c4d77', + storageBucket: 'capstone-c4d77.appspot.com', + iosClientId: '1011915138729-rf6mfju2810d8aa2milt8k5hrlm108pl.apps.googleusercontent.com', + iosBundleId: 'com.example.petlose', + ); +} diff --git a/client/lib/flutter_hashtags.dart b/client/lib/flutter_hashtags.dart new file mode 100644 index 0000000..48ff6e1 --- /dev/null +++ b/client/lib/flutter_hashtags.dart @@ -0,0 +1,42 @@ +import 'dart:ui'; + +import 'package:flutter/painting.dart'; + +class FlutterHashtag { + const FlutterHashtag( + this.hashtag, + this.color, + this.size, + this.rotated, + ); + final String hashtag; + final Color color; + final int size; + final bool rotated; +} + +class FlutterColors { + const FlutterColors._(); + + static const Color popular = Color(0xFF545454); + static const Color medium = Color(0xFF797979); + static const Color less = Color(0xFFCECECE); +} + +const List kFlutterHashtags = const [ + FlutterHashtag('์ถ”์–ต', FlutterColors.popular, 100, false), + FlutterHashtag('๋‹น์‹ ์˜', FlutterColors.medium, 24, false), + FlutterHashtag('ํ•จ๊ป˜ํ•œ', FlutterColors.less, 12, true), + FlutterHashtag('๊ฐ•์•„์ง€์™€', FlutterColors.less, 14, false), + FlutterHashtag('ํ–‰๋ณตํ•œ', FlutterColors.medium, 16, false), + FlutterHashtag('๋งˆ์Œ', FlutterColors.less, 12, true), + FlutterHashtag('ํ•จ๊ป˜', FlutterColors.medium, 20, true), + FlutterHashtag('๊ฑฐ์˜ˆ์š”', FlutterColors.popular, 36, false), + FlutterHashtag('์žˆ์„', FlutterColors.popular, 40, false), + FlutterHashtag('์‚ฌ๋ž‘๊ณผ', FlutterColors.popular, 32, true), + FlutterHashtag('๋™์•ˆ', FlutterColors.less, 12, false), + FlutterHashtag('์ˆœ๊ฐ„๋“ค์„', FlutterColors.less, 14, false), + FlutterHashtag('๊ฐ•์•„์ง€์™€', FlutterColors.less, 16, false), + FlutterHashtag('์žˆ์„', FlutterColors.medium, 20, true), + FlutterHashtag('์˜์›ํžˆ', FlutterColors.medium, 22, false), +]; \ No newline at end of file diff --git a/client/lib/help/answer_help_request.dart b/client/lib/help/answer_help_request.dart index 3d12632..e3fcf42 100644 --- a/client/lib/help/answer_help_request.dart +++ b/client/lib/help/answer_help_request.dart @@ -8,6 +8,10 @@ import 'package:flutter/services.dart'; import 'help_main.dart'as help ; import 'package:intl/intl.dart'; import 'package:http/http.dart' as http; +import 'package:client/sign/sign_in.dart' as sign_in; +import 'help_main.dart' as main; +import 'package:client/home.dart' as home; + class AnswerHelpRequestPage extends StatefulWidget { @override @@ -16,19 +20,23 @@ class AnswerHelpRequestPage extends StatefulWidget { class _AnswerHelpRequestPageState extends State { - late List parsedResponseHA; // ๋„์›€ ๋‹ต๋ณ€ ๋‚ด์—ญ + late Map parsedResponseHA; // ๋„์›€ ๋‹ต๋ณ€ ๋‚ด์—ญ + + bool watchContent = true; bool answered = false; // ๋‹ต๋ณ€ํ•œ ์ ์ด ์žˆ๋Š”์ง€ ํ™•์ธ int answerid = 0; // ๋‹ต๋ณ€ํ•œ ์ ์ด ์žˆ๋‹ค๋ฉด ํ•ด๋‹น ๋‚ด์šฉ๋“ค ๊ฐ€์ ธ์˜ค๊ธฐ ์œ„ํ•œ ์ •์ˆ˜ + bool send = false; + // ๋‚ด๊ฐ€ ๋ณด๋‚ธ "๋„์›€" ๋‚ด์—ญ ๋ถˆ๋Ÿฌ์˜ค๊ธฐ(GET) ๋ฐ ์ƒ๋Œ€๋ฐฉ์ด ๋ณด๋‚ธ ๋„์›€ ๋‚ด์—ญ ๊ฐ€์ ธ์˜ค๊ธฐ - void callHelpAnswer() async { + void callHelpRequest(int id, String aToken) async { // API ์—”๋“œํฌ์ธํŠธ URL - String apiUrl = 'http://3.38.1.125:8080/community/help/all?type=ans'; // ์‹ค์ œ API ์—”๋“œํฌ์ธํŠธ๋กœ ๋ณ€๊ฒฝํ•˜์„ธ์š” + String apiUrl = 'http://3.38.1.125:8080/community/help?hid=${id}'; // ์‹ค์ œ API ์—”๋“œํฌ์ธํŠธ๋กœ ๋ณ€๊ฒฝํ•˜์„ธ์š” // ํ—ค๋” ์ •๋ณด ์„ค์ • Map headers = { - 'Authorization': 'axNNnzcfJaSiTPI6kW23G2Vns9o1', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• + 'Authorization': 'Bearer $aToken', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• 'Content-Type': 'application/json', // ์˜ˆ: JSON ์š”์ฒญ์ธ ๊ฒฝ์šฐ ํ—ค๋” ์„ค์ • }; @@ -41,29 +49,15 @@ class _AnswerHelpRequestPageState extends State { // HTTP ์‘๋‹ต ์ƒํƒœ ํ™•์ธ if (response.statusCode == 200) { // ์‘๋‹ต ๋ฐ์ดํ„ฐ ์ฒ˜๋ฆฌ - print('์„œ๋ฒ„๋กœ๋ถ€ํ„ฐ ๋ฐ›์€ ๋‚ด์šฉ ๋ฐ์ดํ„ฐ: ${response.body}'); + print('์„œ๋ฒ„๋กœ๋ถ€ํ„ฐ ๋ฐ›์€ ๋‚ด์šฉ ๋ฐ์ดํ„ฐ(์„ธ๋ถ€๋‚ด์šฉ): ${response.body}'); var jsonResponse = utf8.decode(response.bodyBytes); parsedResponseHA = json.decode(jsonResponse); - - // ์‚ฌ์šฉ์ž์˜ ๋‹ต๋ณ€ ์ˆ˜ ์ฐพ์•„๊ฐ€๊ธฐ - for(int i =0; i < parsedResponseHA.length; i++){ - if(parsedResponseHA[i]['answer'] != null){ - countHelp++; - } - } - - countHelp %= 3; - - // ํ˜„์žฌ ๋‹ต๋ณ€ ๋‚ด์šฉ ์ฐพ์•„๊ฐ€๊ธฐ - for(int i =0; i < parsedResponseHA.length; i++){ - if(parsedResponseHA[i]['id'] == help.hid && parsedResponseHA[i]['answer'] != null){ - answered = true; - answerid = i; - } + // ๋‹ต๋ณ€์„ ํ–ˆ๋‹ค๋ฉด + if(parsedResponseHA['answer'] != null){ + answered = true; } - setState(() {}); } else { @@ -73,7 +67,7 @@ class _AnswerHelpRequestPageState extends State { } // ๋„์›€ ๋‹ต๋ณ€ ์ €์žฅํ•˜๊ธฐ (POST) - void saveHelpAnswer(int id, String content) async { + void saveHelpAnswer(int id, String content, String aToken) async { // ์š”์ฒญ ๋ณธ๋ฌธ ๋ฐ์ดํ„ฐ var data = { @@ -83,7 +77,7 @@ class _AnswerHelpRequestPageState extends State { // ํ—ค๋” ์ •๋ณด ์„ค์ • Map headers = { - 'Authorization': 'axNNnzcfJaSiTPI6kW23G2Vns9o1', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• + 'Authorization': 'Bearer $aToken', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• 'Content-Type': 'application/json', // ์˜ˆ: JSON ์š”์ฒญ์ธ ๊ฒฝ์šฐ ํ—ค๋” ์„ค์ • }; @@ -128,7 +122,7 @@ class _AnswerHelpRequestPageState extends State { bool askHelp = true; bool sendHelp = false; bool popup = true; - bool sent = false; + bool sent = false; // ์ฒ˜์Œ์— ๋‹ต์„ ๋ณด๋ƒˆ์„๋–„ ํ™”๋ฉด ํ‘œ์‹œ๋ฅผ ์œ„ํ•œ ๊ฒƒ // ๋„์›€ ๋ณด๋‚ด๊ธฐ ์ˆ˜ int countHelp = 0; @@ -145,69 +139,75 @@ class _AnswerHelpRequestPageState extends State { void initState() { super.initState(); SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: [SystemUiOverlay.top]); - callHelpAnswer(); + callHelpRequest(help.hid,sign_in.userAccessToken); } void FlutterDialog2() { - showDialog( context: context, builder: (_) => new AlertDialog( shape: RoundedRectangleBorder( borderRadius: BorderRadius.all( - Radius.circular(30.0))), + Radius.circular(12.0))), content: Builder( builder: (context) { return Container( - height: 296, - width: 316, + height: 298, + width: 412, child: Padding(padding: EdgeInsets.all(0), child: Column( children: [ - SizedBox(height: 20,), + SizedBox(height: 12,), Container( width: 125, height: 117, child: SvgPicture.asset( - 'assets/images/help/attention.svg', + 'assets/images/no_result.svg', + width: 132, + height: 123, + fit: BoxFit.contain, ), ), - SizedBox(height: 30,), - Text("๋‹‰๋„ค์ž„๋‹˜์—๊ฒŒ ๋„์›€์„ ๋ณด๋‚ด์‹œ๊ฒ ์–ด์š”?",style: textStyle.bk16bold,), - SizedBox(height: 10,), - Text("ํ•œ ๋ฒˆ ๋ณด๋‚ธ ๋„์›€์€ ํšŒ์ˆ˜ํ•  ์ˆ˜ ์—†์–ด์š”!", style: textStyle.bk14normal,), - SizedBox(height: 20,), + SizedBox(height: 32,), + Text("${main.fromUsernickname}๋‹˜์—๊ฒŒ ๋„์›€์„ ๋ณด๋‚ด์‹œ๊ฒ ์–ด์š”?",style: textStyle.bk16bold,), + SizedBox(height: 8,), + Text("ํ•œ ๋ฒˆ ๋ณด๋‚ธ ๋„์›€์€ ์ˆ˜์ •ํ•˜๊ฑฐ๋‚˜ ํšŒ์ˆ˜ํ• ์ˆ˜ ์—†์–ด์š”!", style: textStyle.bk14normal,), + SizedBox(height: 32,), Row( children: [ - Container(width: 120, + Container( + height: 40, + width: 120, child: ElevatedButton( - child: new Text("์ทจ์†Œ"), - style: buttonChart().purplebtn2, + child: new Text("์ทจ์†Œ", style: textStyle.purple16midium), + style: buttonChart().purplebtn3, onPressed: () { Navigator.pop(context); }, ), ), - SizedBox(width: 10,), - Container(width: 124, + SizedBox(width: 16,), + Container( + height: 40, + width: 120, child: ElevatedButton( - child: new Text("๋„์›€ ๋ณด๋‚ด๊ธฐ", style: TextStyle(color: Colors.white),), + child: new Text("๋„์›€ ๋ณด๋‚ด๊ธฐ", style: textStyle.white16semibold), style: buttonChart().purplebtn, onPressed: () { var now = DateTime.now(); - sentDate = DateFormat('yy/mm/dd h:mm').format(now); - sent = true; + sentDate = DateFormat('yy/MM/dd h:mm').format(now); helpContents = myController.text; countHelp ++; + sent = true; // ์„œ๋ฒ„์— ์ „์†ก - saveHelpAnswer(help.hid, myController.text); + saveHelpAnswer(help.hid, myController.text, sign_in.userAccessToken); // !!ํ™”๋ฉด ๊ฐฑ์‹ !! - callHelpAnswer(); + callHelpRequest(help.hid, sign_in.userAccessToken); setState(() {}); myController.clear(); @@ -226,114 +226,84 @@ class _AnswerHelpRequestPageState extends State { ); } - void FlutterDialog() { - showDialog( - context: context, - //barrierDismissible - Dialog๋ฅผ ์ œ์™ธํ•œ ๋‹ค๋ฅธ ํ™”๋ฉด ํ„ฐ์น˜ x - barrierDismissible: false, - builder: (BuildContext context) { - return AlertDialog( - // RoundedRectangleBorder - Dialog ํ™”๋ฉด ๋ชจ์„œ๋ฆฌ ๋‘ฅ๊ธ€๊ฒŒ ์กฐ์ ˆ - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10.0)), - //Dialog Main Title - title: Column( - children: [ - Container( - width: 180, - height: 80, - decoration: BoxDecoration( - image: DecorationImage( - image: AssetImage('assets/images/help/help_pop_up.png') - ) - ), - child: SvgPicture.asset( - 'assets/images/help/attention.svg', - ), - ), - new Text("๋‹‰๋„ค์ž„๋‹˜์—๊ฒŒ ๋„์›€์„ ๋ณด๋‚ด์‹œ๊ฒ ์–ด์š”?"), - ], - ), - // - content: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - "ํ•œ ๋ฒˆ ๋ณด๋‚ธ ๋„์›€์€ ํšŒ์ˆ˜ํ•  ์ˆ˜ ์—†์–ด์š”!", - ), - ], - ), - actions: [ - ElevatedButton( - child: new Text("์ทจ์†Œ"), - onPressed: () { - Navigator.pop(context); - }, - ), - ElevatedButton( - child: new Text("๋„์›€ ๋ณด๋‚ด๊ธฐ"), - onPressed: () { - Navigator.pop(context); - }, - ), - ], - ); - }); - } - @override Widget build(BuildContext context) { + MediaQueryData deviceData = MediaQuery.of(context); + Size screenSize = deviceData.size; return Scaffold( - appBar: AppBar( - title: Center( - child: Padding(padding: EdgeInsets.only(right: 60), - child: Text('๋„์›€ ๋ณด๋‚ด๊ธฐ', style: textStyle.bk20bold,), - ) - ), - leading: IconButton( - icon: Icon(Icons.arrow_back_ios_rounded, color: Colors.black), - onPressed: () => Navigator.of(context).pop(), + appBar: PreferredSize( + preferredSize: Size.fromHeight(72), + child: AppBar( + title: + Container( + child: Column( + children: [ + SizedBox(height: 24,), + Center( + child: Padding( + padding: EdgeInsets.only(right: 60), + child: Text( + '๋„์›€ ๋ณด๋‚ด๊ธฐ', + style: textStyle.bk20normal, + ), + )), + ], + ), + ), + leading: + Padding(padding: EdgeInsets.only(top:20), + child: IconButton( + icon: Icon(Icons.arrow_back_ios_rounded, color: Colors.black), + onPressed: () => Navigator.of(context).pop(), + ), + ), + backgroundColor: Colors.transparent, + elevation: 0.0, + iconTheme: IconThemeData(color: Colors.black), ), - backgroundColor: Colors.transparent, - elevation: 0.0, - iconTheme: IconThemeData(color: Colors.black), ), body: Container( //color: Color(0xffF3F3F3), width: Get.width, height: Get.height, - padding: EdgeInsets.only(left: 15, right: 15), + padding: EdgeInsets.only(left: 16, right: 16), child: SingleChildScrollView( padding: EdgeInsets.fromLTRB(0, 0, 0, 0), scrollDirection: Axis.vertical, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - SizedBox(height: 15,), + SizedBox(height: 8,), Container( width: Get.width, height: 56, - padding: const EdgeInsets.all(15), + padding: const EdgeInsets.all(16), decoration: BoxDecoration( color: Color(0xffF3F3F3), borderRadius: BorderRadius.circular(16), ), child: Row( children: [ - CircleAvatar( - minRadius: 15, - maxRadius: 15, - backgroundImage: - NetworkImage(help.selectedProfile, + if(main.fromUserProfileImage.toString() == "null")...[ + CircleAvatar( + radius: 12, + child: SvgPicture.asset('assets/images/user_null2.svg',), ), - ), - SizedBox(width: 10,), - Text('${parsedResponseHA[answerid]['fromUserUid']}๋‹˜์ด ์š”์ฒญํ•œ ๋„์›€์ž…๋‹ˆ๋‹ค.', style: textStyle.bk14normal,) + ]else...[ + CircleAvatar( + radius: 12, + backgroundImage: + NetworkImage(main.fromUserProfileImage, + ), + ), + ], + + SizedBox(width: 8,), + Text('${main.fromUsernickname}๋‹˜์ด ์š”์ฒญํ•œ ๋„์›€์ž…๋‹ˆ๋‹ค.', style: textStyle.bk14normal,) ], ), ), - SizedBox(height: 10,), + SizedBox(height: 8,), Container( width: Get.width, child: @@ -347,9 +317,9 @@ class _AnswerHelpRequestPageState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ SizedBox(height: 5,), - Text('์ œ๋ชฉ', style: answered? textStyle.grey14regular : textStyle.bk14regular,), + Text('์ œ๋ชฉ', style: answered? textStyle.grey14midium : textStyle.bk14semibold,), SizedBox(height: 5,), - Text('${parsedResponseHA[answerid]['title']}', style: answered? textStyle.grey16normal :textStyle.bk16normal,), + Text('${parsedResponseHA['title']}', style: answered? textStyle.grey16normalCon :textStyle.bk16normalCon,), SizedBox(height: 5,), ], ), @@ -358,28 +328,81 @@ class _AnswerHelpRequestPageState extends State { //Image.network(parsedResponseCM[index]['image'], fit: BoxFit.cover,), ), - SizedBox(height: 10,), + SizedBox(height: 8,), - Container( - width: Get.width, - child: ClipRRect( - borderRadius: BorderRadius.only(bottomLeft: Radius.circular(16.0), bottomRight: Radius.circular(16.0)), - child: - Container( - color: Colors.white, - padding: const EdgeInsets.all(15), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text('๋‚ด์šฉ', style: answered? textStyle.grey14regular : textStyle.bk14regular,), - SizedBox(height: 5,), - Text('${parsedResponseHA[answerid]['content']}', style:answered? textStyle.grey16normal : textStyle.bk16normal,) - ], - ), - ) + if(watchContent)...[ + Container( + width: Get.width, + child: ClipRRect( + borderRadius: BorderRadius.only(bottomLeft: Radius.circular(16.0), bottomRight: Radius.circular(16.0)), + child: + Container( + color: Colors.white, + padding: const EdgeInsets.only(top: 16, left: 16, bottom: 16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Text('๋‚ด์šฉ', style: answered? textStyle.grey14midium : textStyle.bk14midium,), + SizedBox(width: 263,), + Container( + height: 30, child: IconButton(onPressed: (){ + watchContent = false; + setState(() { + }); + }, icon: SvgPicture.asset( + 'assets/images/help/dropdown_up.svg', + ), + ) + ), + + ], + ), + Text('${parsedResponseHA['content']}', style: answered? textStyle.grey16normalCon : textStyle.bk16normalCon,) + ], + ), + ) + ), ), - ), - SizedBox(height: 10,), + ]else...[ + Container( + width: Get.width, + child: ClipRRect( + borderRadius: BorderRadius.only(bottomLeft: Radius.circular(16.0), bottomRight: Radius.circular(16.0)), + child: + Container( + color: Colors.white, + padding: const EdgeInsets.only(top: 16, left: 16, bottom: 8), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Text('๋‚ด์šฉ', style: answered? textStyle.grey14regular : textStyle.bk14midium,), + SizedBox(width: 263,), + Container( + height: 30, child: IconButton(onPressed: (){ + watchContent = true; + setState(() { + }); + }, icon: SvgPicture.asset( + 'assets/images/help/dropdown_down.svg', + ), + ) + ), + + ], + ), + //SizedBox(height: 5,), + ], + ), + ) + ), + ), + ], + + SizedBox(height: 16,), if(answered)...[ Container( width: Get.width, @@ -393,264 +416,154 @@ class _AnswerHelpRequestPageState extends State { children: [ Row( children: [ - CircleAvatar( - minRadius: 15, - maxRadius: 15, - backgroundImage: - NetworkImage(help.selectedProfile, + if(main.toUserProfileImage.toString() == "null")...[ + CircleAvatar( + radius: 12, + child: SvgPicture.asset('assets/images/user_null2.svg',), ), - ), + ]else...[ + CircleAvatar( + radius: 12, + backgroundImage: + NetworkImage(main.toUserProfileImage, + ), + ), + ], + SizedBox(width: 10,), Container(width: 200, - child: Text('${parsedResponseHA[answerid]['fromUserUid']}๋‹˜์ด ๋ณด๋‚ธ ๋„์›€', style: textStyle.bk14regular,),), - SizedBox(width: 25,), - Text(DateFormat('MM/dd HH:mm').format(DateTime.parse(parsedResponseHA[answerid]['answeredAt'])), style: TextStyle(fontFamily: 'Pretendard', + child: Text('${main.toUsernickname}๋‹˜์ด ๋ณด๋‚ธ ๋„์›€', style: textStyle.bk14midium,),), + SizedBox(width: 22,), + Text(DateFormat('MM/dd HH:mm').format(DateTime.parse(parsedResponseHA['answeredAt'])), style: TextStyle(fontFamily: 'Pretendard', fontWeight: FontWeight.w500, fontSize: 12, color: Color(0xff4B5396)),) ], ), - SizedBox(height: 5,), - Text(parsedResponseHA[answerid]['answer'], style: textStyle.bk16normal,) + SizedBox(height: 10,), + Text(parsedResponseHA['answer'], style: textStyle.bk16normalCon,) ], ), ), ], - SizedBox(height: 15,), - if(popup)...[ + // ์ฒ˜์Œ์— ๋‹ต์„ ๋ณด๋ƒˆ์„๋•Œ ๋ณด์—ฌ์ค„ ๋ถ€๋ถ„ + if(sent)...[ Container( - height: 210, width: Get.width, - padding: const EdgeInsets.all(3), + padding: const EdgeInsets.all(15), decoration: BoxDecoration( - color: Colors.white, + color: Color(0xffFEFBAC), borderRadius: BorderRadius.circular(16), ), child: Column( - crossAxisAlignment: CrossAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( children: [ - SizedBox(width: 300,), - IconButton(onPressed: (){ - popup = false; - setState(() { - }); - - }, icon: SvgPicture.asset( - 'assets/images/cancel_icon.svg', - ),), - ], - ), - if(countHelp == 0)...[ - Row( - children: [ - SizedBox(width: 45,), - SvgPicture.asset( - 'assets/images/help/help_count_n.svg', - ), - SvgPicture.asset( - 'assets/images/help/help_count_n.svg', + if(home.userprof == "null")...[ + CircleAvatar( + radius: 12, + child: SvgPicture.asset('assets/images/user_null2.svg',), ), - SvgPicture.asset( - 'assets/images/help/help_count_n.svg', + ]else...[ + CircleAvatar( + radius: 12, + backgroundImage: + NetworkImage(main.toUserProfileImage,), ), ], - ), - ] else if(countHelp == 1)...[ - Row( - children: [ - SizedBox(width: 45,), - SvgPicture.asset( - 'assets/images/help/help_count_y.svg', - ), - SvgPicture.asset( - 'assets/images/help/help_count_n.svg', - ), - SvgPicture.asset( - 'assets/images/help/help_count_n.svg', - ), - ], - ), - ] - else if(countHelp == 2)...[ - Row( - children: [ - SizedBox(width: 45,), - SvgPicture.asset( - 'assets/images/help/help_count_y.svg', - ), - SvgPicture.asset( - 'assets/images/help/help_count_y.svg', - ), - SvgPicture.asset( - 'assets/images/help/help_count_n.svg', - ), - ], - ), - ] else if(countHelp == 3)...[ - Row( - children: [ - SizedBox(width: 45,), - SvgPicture.asset( - 'assets/images/help/help_count_y.svg', - ), - SvgPicture.asset( - 'assets/images/help/help_count_y.svg', - ), - SvgPicture.asset( - 'assets/images/help/help_count_y.svg', - ), - ], - ), - ], - SizedBox(height: 5,), - Column( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Row( - children: [ - SizedBox(width: 115,), - Text('๋„์›€ ๋ณด๋‚ด๊ธฐ 3๋ฒˆ', style: TextStyle(fontFamily: 'Pretendard', - fontWeight: FontWeight.w700, fontSize: 14),), - Text('๋‹ฌ์„ฑ ์‹œ,', style: TextStyle(fontFamily: 'Pretendard', - fontWeight: FontWeight.w400, fontSize: 14),), - ], - ), - SizedBox(height: 5,), - Row( - children: [ - SizedBox(width: 85,), - Text('1๋ฒˆ์˜ ๋„์›€ ์š”์ฒญํ•˜๊ธฐ', style: TextStyle(fontFamily: 'Pretendard', - fontWeight: FontWeight.w700, fontSize: 14),), - Text('๊ฐ€ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.', style: TextStyle(fontFamily: 'Pretendard', - fontWeight: FontWeight.w400, fontSize: 14),) - ], - ), - SizedBox(height: 5,), - Text('ํ˜„์žฌ 3๋ฒˆ์ค‘ ${countHelp}๋ฒˆ ๋‹ฌ์„ฑ', style: TextStyle(fontFamily: 'Pretendard', - fontWeight: FontWeight.w700, fontSize: 10, color: Color(0xffAAAAAA)),), + SizedBox(width: 8,), + Container(width: 180, + child: Text('${home.user}๋‹˜์ด ๋ณด๋‚ธ ๋„์›€', style: textStyle.bk14midium,),), + SizedBox(width: 25,), + Text(sentDate, style: TextStyle(fontFamily: 'Pretendard', + fontWeight: FontWeight.w500, fontSize: 12, color: Color(0xff4B5396)),) ], ), - + SizedBox(height: 10,), + Text(helpContents, style: textStyle.bk16normalCon,) ], ), ), - ] - // SingleChildScrollView( - // scrollDirection: Axis.horizontal, - // child: - // Row( - // children: [ - // for(int i= 0; i < 5; i++)...[ - // Padding(padding:EdgeInsets.all(15), - // child: Column( - // children: [ - // Container( - // width: 350, - // height: 350, - // color: Colors.white, - // child: - // Padding( - // padding: EdgeInsets.all(20), - // child: Column( - // crossAxisAlignment: CrossAxisAlignment.start, - // children: [ - // Row( - // children: [ - // CircleAvatar( - // backgroundImage: - // NetworkImage( 'https://images.unsplash.com/photo-1519098901909-b1553a1190af?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1974&q=80', - // ), - // ), - // SizedBox(width: 20,), - // Text('๋‹‰๋„ค์ž„'), - // SizedBox(width: 190,), - // Text('๋‚ ์งœ') - // ], - // ), - // SizedBox(height: 15,), - // Column( - // crossAxisAlignment: CrossAxisAlignment.start, - // children: [ - // Text('๋„์›€ ์š”์ฒญ ์ œ๋ชฉ',style: textStyle.bk16bold,), - // Container(width: 300, - // height: 200, - // child: Text('๋„์›€์„ ์š”์ฒญํ•˜๋Š” ๋‚ด์šฉ ๋„์›€์„ ์š”์ฒญํ•˜๋Š” ๋‚ด์šฉ ๋„์›€์„ ์š”์ฒญํ•˜๋Š” ๋‚ด์šฉ ๋„์›€์„ ์š”์ฒญํ•˜๋Š” ๋‚ด์šฉ ๋„์›€์„ ์š”์ฒญํ•˜๋Š” ๋‚ด์šฉ ๋„์›€์„ ์š”์ฒญํ•˜๋Š” ๋‚ด์šฉ ๋„์›€์„ ์š”์ฒญํ•˜๋Š” ๋‚ด์šฉ ๋„์›€์„ ์š”์ฒญํ•˜๋Š” ๋‚ด์šฉ ๋„์›€์„ ์š”์ฒญํ•˜๋Š” ๋‚ด์šฉ ๋„์›€์„ ์š”์ฒญํ•˜๋Š” ๋‚ด์šฉ ๋„์›€์„ ์š”์ฒญํ•˜๋Š” ๋‚ด์šฉ ๋„์›€์„ ์š”์ฒญํ•˜๋Š” ๋‚ด์šฉ ๋„์›€์„ ์š”์ฒญํ•˜๋Š” ๋‚ด์šฉ ๋„์›€์„ ์š”์ฒญํ•˜๋Š” ๋‚ด์šฉ ๋„์›€์„ ์š”์ฒญํ•˜๋Š” ๋‚ด์šฉ ๋„์›€์„ ์š”์ฒญํ•˜๋Š” ๋‚ด์šฉ ๋„์›€์„ ์š”์ฒญํ•˜๋Š” ๋‚ด์šฉ ๋„์›€์„ ์š”์ฒญํ•˜๋Š” ๋‚ด์šฉ ๋„์›€์„ ์š”์ฒญํ•˜๋Š” ๋‚ด์šฉ ๋„์›€์„ ์š”์ฒญํ•˜๋Š” ๋‚ด์šฉ ๋„์›€์„ ์š”์ฒญํ•˜๋Š” ๋‚ด์šฉ ๋„์›€์„ ์š”์ฒญํ•˜๋Š” ๋‚ด์šฉ ๋„์›€์„ ์š”์ฒญํ•˜๋Š” ๋‚ด์šฉ ๋„์›€์„ ์š”์ฒญํ•˜๋Š” ๋‚ด์šฉ ๋„์›€์„ ์š”์ฒญํ•˜๋Š” ๋‚ด์šฉ ๋„์›€์„ ์š”์ฒญํ•˜๋Š” ๋‚ด์šฉ ๋„์›€์„ ์š”์ฒญํ•˜๋Š” ๋‚ด์šฉ ๋„์›€์„ ์š”์ฒญํ•˜๋Š” ๋‚ด์šฉ ๋„์›€์„ ์š”์ฒญํ•˜๋Š” ๋‚ด์šฉ ๋„์›€์„ ์š”์ฒญํ•˜๋Š” ๋‚ด์šฉ ๋„์›€์„ ์š”์ฒญํ•˜๋Š” ๋‚ด์šฉ ๋„์›€์„ ์š”์ฒญํ•˜๋Š” ๋‚ด์šฉ ๋„์›€์„ ์š”์ฒญํ•˜๋Š” ๋‚ด์šฉ ๋„์›€์„ ์š”์ฒญํ•˜๋Š” ๋‚ด์šฉ '),) - // ], - // ), - // ], - // ), - // ), - // - // ) - // ], - // ),) - // ] - // ], - // ), - // ), + ], + SizedBox(height: 15,), + ], ), ), ), bottomSheet: Padding( - padding: EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom * 0.01), + padding: EdgeInsets.only( + bottom: MediaQuery.of(context).viewInsets.bottom * 0.001), child: Column( mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.end, children:[ - if(answered == false)...[ - Padding( - padding: const EdgeInsets.all(12.0), - child: Stack( - children: [ - Container( - width: Get.width, - height: 40, - decoration: BoxDecoration( - color: Colors.white, - border: Border.all(color: Color(colorChart.blue)), - borderRadius: BorderRadius.circular(30), - ), - ), - Positioned( - left: 20, - right: 30, - bottom: 1, - top: 1, - child: TextField( - controller: myController, - decoration: InputDecoration( - border: InputBorder.none, hintText: '๋„์›€์„ ๋ณด๋‚ด๋ ค๋ฉด ์—ฌ๊ธฐ๋ฅผ ํƒญํ•˜์„ธ์š”.'), - onChanged: (s) { - //text = s; - }, - onTap: (){ - - }, + if(answered == false && sent == false)...[ + Container( + color: Colors.white, + height: 48, + child: Padding( + padding: const EdgeInsets.only(bottom: 8.0, top: 8.0, left: 16,right: 16), + child: Stack( + children: [ + Container( + width: Get.width, + height: 48, + decoration: BoxDecoration( + color: Colors.white, + border: Border.all(color: send?Color(colorChart.blue):Color(0xffC0D2FC)), + borderRadius: BorderRadius.circular(30), + ), ), - ), - Positioned( - left: Get.width - 78, - //right: 30, - bottom: 3, - top: 3, - child: ElevatedButton( - onPressed: () { - FlutterDialog2(); + Positioned( + left: 15, + right: 30, + bottom:-4, + child: TextField( + textAlignVertical: TextAlignVertical.center, + maxLines: 1, + controller: myController, + style: textStyle.bk14normal, + decoration: InputDecoration( + hintStyle: textStyle.grey14normal, + border: InputBorder.none, hintText: '๋„์›€์„ ๋ณด๋‚ด๋ ค๋ฉด ์—ฌ๊ธฐ๋ฅผ ํƒญํ•˜์„ธ์š”.'), + onChanged: (s) { + //text = s; + send = true; + setState(() { + + }); }, - style: ElevatedButton.styleFrom( - backgroundColor: Color(colorChart.blue), - fixedSize: const Size(23, 23), - shape: const CircleBorder(), - ), - child:Icon(Icons.arrow_upward, color: Colors.white,) + onTap: (){ + + }, + //maxLines: null, + ), ), - ), - ], + Positioned( + left: Get.width - 81, + //right: 30, + bottom: 3, + top: 3, + child: ElevatedButton( + onPressed: () { + if(send){ + FlutterDialog2(); + } + }, + style: ElevatedButton.styleFrom( + backgroundColor: send?Color(colorChart.blue):Color(0xffDDE7FD), + fixedSize: const Size(23, 23), + shape: const CircleBorder(), + ), + child:Icon(Icons.arrow_upward, color: Colors.white, size: 16,) + ), + ), + ], + ), ), - ), + ) ], ], diff --git a/client/lib/help/help_main.dart b/client/lib/help/help_main.dart index 9d30a72..4559d1e 100644 --- a/client/lib/help/help_main.dart +++ b/client/lib/help/help_main.dart @@ -3,16 +3,19 @@ import 'package:flutter_svg/svg.dart'; import 'package:get/get.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import 'package:client/help/answer_help_request.dart'; -import 'package:client/help/received_help.dart'; -import 'package:client/help/write_help_request.dart'; import 'package:client/style.dart'; -import 'package:flutter/services.dart'; import 'package:http/http.dart' as http; import 'package:intl/intl.dart'; +import 'received_help.dart'; +import 'answer_help_request.dart'; +import 'package:client/sign/sign_in.dart' as sign_in; String selectedProfile = ""; int hid = 0; +String fromUsernickname = ""; +String fromUserProfileImage = ""; +String toUsernickname = ""; +String toUserProfileImage = ""; class HelpMainPage extends StatefulWidget { @override @@ -25,6 +28,9 @@ class _HelpMainPageState extends State { bool askHelp = true; bool sendHelp = false; + bool newAns = false; + bool newAsk = false; + int askHelpCount = 5; int sendHelpCount = 5; @@ -35,30 +41,18 @@ class _HelpMainPageState extends State { /// ๋„์›€ ๋ณด๋‚ด๊ธฐ bool checkSendHelp = false; // ๋„์›€์„ ์ž˜ ๋ณด๋ƒˆ๋Š”์ง€ - List parsedResponse = [ - 'https://images.unsplash.com/photo-1615751072497-5f5169febe17?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1935&q=80', - 'https://images.unsplash.com/photo-1588943211346-0908a1fb0b01?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1935&q=80', - 'https://images.unsplash.com/photo-1596492784531-6e6eb5ea9993?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1887&q=80', - 'https://images.unsplash.com/photo-1544568100-847a948585b9?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1974&q=80', - 'https://images.unsplash.com/photo-1546447147-3fc2b8181a74?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1887&q=80', - 'https://images.unsplash.com/photo-1636910825807-171715240043?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1992&q=80', - 'https://images.unsplash.com/photo-1579807351146-e6dd49462635?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1935&q=80', - 'https://images.unsplash.com/photo-1634635880938-d81e973bcd6c?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1935&q=80', - 'https://images.unsplash.com/photo-1534176043700-789edb4e2f91?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=2070&q=80', - ]; - late List parsedResponseHR; // ๋„์›€ ์š”์ฒญ ๋‚ด์—ญ late List parsedResponseHA; // ๋„์›€ ๋‹ต๋ณ€ ๋‚ด์—ญ bool isLastest = false; // ๋‚ด๊ฐ€ ๋ณด๋‚ธ "๋„์›€ ์š”์ฒญ" ๋‚ด์—ญ ๋ถˆ๋Ÿฌ์˜ค๊ธฐ(GET) - void callHelpRequest() async { + void callHelpRequest(String aToken) async { // API ์—”๋“œํฌ์ธํŠธ URL String apiUrl = 'http://3.38.1.125:8080/community/help/all?type=req'; // ์‹ค์ œ API ์—”๋“œํฌ์ธํŠธ๋กœ ๋ณ€๊ฒฝํ•˜์„ธ์š” // ํ—ค๋” ์ •๋ณด ์„ค์ • Map headers = { - 'Authorization': 'axNNnzcfJaSiTPI6kW23G2Vns9o1', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• + 'Authorization': 'Bearer $aToken', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• 'Content-Type': 'application/json', // ์˜ˆ: JSON ์š”์ฒญ์ธ ๊ฒฝ์šฐ ํ—ค๋” ์„ค์ • }; @@ -71,11 +65,19 @@ class _HelpMainPageState extends State { // HTTP ์‘๋‹ต ์ƒํƒœ ํ™•์ธ if (response.statusCode == 200) { // ์‘๋‹ต ๋ฐ์ดํ„ฐ ์ฒ˜๋ฆฌ - print('์„œ๋ฒ„๋กœ๋ถ€ํ„ฐ ๋ฐ›์€ ๋‚ด์šฉ ๋ฐ์ดํ„ฐ: ${response.body}'); + print('์„œ๋ฒ„๋กœ๋ถ€ํ„ฐ ๋ฐ›์€ ๋‚ด์šฉ ๋ฐ์ดํ„ฐ(๋„์›€์š”์ฒญํ•˜๊ธฐ): ${response.body}'); var jsonResponse = utf8.decode(response.bodyBytes); parsedResponseHR = json.decode(jsonResponse); + print("๋ช‡๊ฐœ์ธ์ง€ ํ™•์ธ(๋„์›€์š”์ฒญํ•˜๊ธฐ) "+parsedResponseHR.length.toString()); + + for(int i = 0; i< parsedResponseHR.length; i++){ + if(parsedResponseHR[i]['isFromUserReadAnswer'] == 1){ + newAns = true; + } + } + setState(() {}); } else { @@ -85,13 +87,13 @@ class _HelpMainPageState extends State { } // ๋‚ด๊ฐ€ ๋ณด๋‚ธ "๋„์›€" ๋‚ด์—ญ ๋ถˆ๋Ÿฌ์˜ค๊ธฐ(GET) - void callHelpAnswer() async { + void callHelpAnswer(String aToken) async { // API ์—”๋“œํฌ์ธํŠธ URL String apiUrl = 'http://3.38.1.125:8080/community/help/all?type=ans'; // ์‹ค์ œ API ์—”๋“œํฌ์ธํŠธ๋กœ ๋ณ€๊ฒฝํ•˜์„ธ์š” // ํ—ค๋” ์ •๋ณด ์„ค์ • Map headers = { - 'Authorization': 'axNNnzcfJaSiTPI6kW23G2Vns9o1', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• + 'Authorization': 'Bearer $aToken', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• 'Content-Type': 'application/json', // ์˜ˆ: JSON ์š”์ฒญ์ธ ๊ฒฝ์šฐ ํ—ค๋” ์„ค์ • }; @@ -104,11 +106,19 @@ class _HelpMainPageState extends State { // HTTP ์‘๋‹ต ์ƒํƒœ ํ™•์ธ if (response.statusCode == 200) { // ์‘๋‹ต ๋ฐ์ดํ„ฐ ์ฒ˜๋ฆฌ - print('์„œ๋ฒ„๋กœ๋ถ€ํ„ฐ ๋ฐ›์€ ๋‚ด์šฉ ๋ฐ์ดํ„ฐ: ${response.body}'); + print('์„œ๋ฒ„๋กœ๋ถ€ํ„ฐ ๋ฐ›์€ ๋‚ด์šฉ ๋ฐ์ดํ„ฐ(๋‚ด๊ฐ€ ๋ณด๋‚ธ๋„์›€): ${response.body}'); var jsonResponse = utf8.decode(response.bodyBytes); parsedResponseHA = json.decode(jsonResponse); + print("๋ช‡๊ฐœ์ธ์ง€ ํ™•์ธ(๋‚ด๊ฐ€ ๋ณด๋‚ธ๋„์›€) "+parsedResponseHA.length.toString()); + + for(int i = 0; i< parsedResponseHA.length; i++){ + if(parsedResponseHA[i]['answeredAt'] == null){ + newAsk = true; + } + } + setState(() {}); } else { @@ -121,25 +131,46 @@ class _HelpMainPageState extends State { void initState() { super.initState(); SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: [SystemUiOverlay.top]); - callHelpRequest(); + callHelpRequest(sign_in.userAccessToken); + callHelpAnswer(sign_in.userAccessToken); } @override Widget build(BuildContext context) { + MediaQueryData deviceData = MediaQuery.of(context); + Size screenSize = deviceData.size; return Scaffold( - appBar: AppBar( - title: Center( - child: Padding(padding: EdgeInsets.only(right: 60), - child: Text('๋„์›€ ๋‚ด์—ญ', style: textStyle.bk20bold,), - ) - ), - leading: IconButton( - icon: Icon(Icons.arrow_back_ios_rounded, color: Colors.black), - onPressed: () => Navigator.of(context).pop(), + appBar: + PreferredSize( + preferredSize: Size.fromHeight(72), + child:AppBar( + title: + Container( + height: 50, + width: screenSize.width, + child: Column( + children: [ + SizedBox(height: 24,), + Center( + child: Padding(padding: EdgeInsets.only(right: 60), + child: Text('๋„์›€ ๋‚ด์—ญ', style: textStyle.bk20normal,), + ) + ), + ], + ), + ), + leading: + Padding(padding: EdgeInsets.only(top:20), + child: IconButton( + icon: Icon(Icons.arrow_back_ios_rounded, color: Colors.black), + onPressed: () => Navigator.of(context).pop(), + ), + ), + + backgroundColor: Colors.transparent, + elevation: 0.0, + iconTheme: IconThemeData(color: Colors.black), ), - backgroundColor: Colors.transparent, - elevation: 0.0, - iconTheme: IconThemeData(color: Colors.black), ), body: Container( color: Color(0xffDDE7FD), @@ -151,10 +182,9 @@ class _HelpMainPageState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ - SizedBox(height: 15,), - + SizedBox(height: 10,), Container( - width: 328, + width: screenSize.width - 32, height: 40, decoration: BoxDecoration( color: Color(0xffF2F6FF), @@ -170,38 +200,85 @@ class _HelpMainPageState extends State { color: Color(0xffC0D2FC), borderRadius: BorderRadius.circular(13), ), - width: 156, + width: 174, height: 32, - child: Center(child: Text("๋„์›€ ์š”์ฒญํ•˜๊ธฐ", style: TextStyle(color: Color(0xff4B5396),fontFamily: 'Pretendard', - fontWeight: FontWeight.w600, fontSize: 16),),) + child: Center( + child:Row(children: [ + SizedBox(width: 44,), + Text("๋„์›€ ์š”์ฒญํ•˜๊ธฐ", style: TextStyle(color: Color(0xff4B5396),fontFamily: 'Pretendard', + fontWeight: FontWeight.w600, fontSize: 16),), + if(newAns)...[ + Padding(padding: EdgeInsets.only(bottom: 15, left: 3), + child: Container(width: 4, height:4, child: Icon(Icons.circle,color: Color(0xffFEFBAC), size: 5,),),) + ] + ], + ), + ) ), - SizedBox(width: 42,), + SizedBox(width: 40,), TextButton(onPressed: (){ askHelp = false; sendHelp = true; - callHelpAnswer(); + callHelpAnswer(sign_in.userAccessToken); setState(() {}); - }, child: Text("๋„์›€ ๋ณด๋‚ด๊ธฐ", style: textStyle.bk16normal,)), + }, child: Row(children: [ + Text("๋„์›€ ๋ณด๋‚ด๊ธฐ", style: textStyle.bk16light,), + if(newAsk)...[ + Padding(padding: EdgeInsets.only(bottom: 15, left: 3), + child: Container(width: 4, height:4, child: Icon(Icons.circle,color: Color(0xff83A8FF), size: 5,),),) + ] + ],) + + ), SizedBox(width: 20,), ]else if(askHelp == false && sendHelp)...[ - SizedBox(width: 36,), + SizedBox(width: 41,), TextButton(onPressed: (){ askHelp = true; sendHelp = false; - callHelpRequest(); + callHelpRequest(sign_in.userAccessToken); setState(() {}); - }, child: Text("๋„์›€ ์š”์ฒญํ•˜๊ธฐ", style: textStyle.bk16normal,)), - SizedBox(width: 36,), + }, child: Container( - decoration: BoxDecoration( - color: Color(0xffC0D2FC), - borderRadius: BorderRadius.circular(13), - ), - width: 156, - height: 32, - child: Center(child: Text("๋„์›€ ๋ณด๋‚ด๊ธฐ", style: TextStyle(color: Color(0xff4B5396),fontFamily: 'Pretendard', - fontWeight: FontWeight.w600, fontSize: 16)),) + width: 96, + child: Row( + children: [ + Text("๋„์›€ ์š”์ฒญํ•˜๊ธฐ", style: textStyle.bk16light,), + if(newAns)...[ + Padding(padding: EdgeInsets.only(bottom: 15, left: 3), + child: Container(width: 4, height:4, child: Icon(Icons.circle,color: Color(0xff83A8FF), size: 5,),),) + ] + ],), + ), + + + //Text("๋„์›€ ์š”์ฒญํ•˜๊ธฐ", style: textStyle.bk16light,) + + ), + SizedBox(width: 22,), + Container( + decoration: BoxDecoration( + color: Color(0xffC0D2FC), + borderRadius: BorderRadius.circular(13), + ), + width: 174, + height: 32, + child: + + Row(children: [ + SizedBox(width: 52,), + Text("๋„์›€ ๋ณด๋‚ด๊ธฐ", style: TextStyle(color: Color(0xff4B5396),fontFamily: 'Pretendard', + fontWeight: FontWeight.w600, fontSize: 16),), + if(newAsk)...[ + Padding(padding: EdgeInsets.only(bottom: 15, left: 3), + child: Container(width: 4, height:4, child: Icon(Icons.circle,color: Color(0xffFEFBAC), size: 5,),),) + ] + ], + ), + // + // Center(child: Text("๋„์›€ ๋ณด๋‚ด๊ธฐ", style: TextStyle(color: Color(0xff4B5396),fontFamily: 'Pretendard', + // fontWeight: FontWeight.w500, fontSize: 16)),) ), //SizedBox(width: 20,), ] @@ -209,13 +286,13 @@ class _HelpMainPageState extends State { ), ), - SizedBox(height: 5,), + //SizedBox(height: 5,), if(askHelp)...[ if(parsedResponseHR.length == 0)...[ Container( width: Get.width, - height: 120, + height: 128, color: Color(0xffDDE7FD), child: Row( children: [ @@ -223,39 +300,43 @@ class _HelpMainPageState extends State { SvgPicture.asset( 'assets/images/help/no_help.svg', ), - SizedBox(width: 55,), + SizedBox(width: 30,), Column( crossAxisAlignment: CrossAxisAlignment.end, children: [ - SizedBox(height: 45,), + SizedBox(height: 34,), Text('๋„์›€์„ ์š”์ฒญํ•˜๊ณ  ๋ฐ›์€ ๋‚ด์—ญ์ด ์—†์Šต๋‹ˆ๋‹ค.', style: TextStyle(color: Colors.black,fontFamily: 'Pretendard', - fontWeight: FontWeight.w600, fontSize: 16)), + fontWeight: FontWeight.w600, fontSize: 14, letterSpacing: 1.0)), SizedBox(height: 5,), - Text(' ์–ด๋ ค์›€์„ ๊ฒช๊ณ  ์žˆ๋‹ค๋ฉด ์–ธ์ œ๋“ ์ง€\n๋‹ค๋ฅธ ๋ฐ˜๋ ค์ธ๋“ค์—๊ฒŒ ๋„์›€์„ ์š”์ฒญํ•ด๋ณด์„ธ์š”!', style: textStyle.bk14normal) + Text(' ์–ด๋ ค์›€์„ ๊ฒช๊ณ  ์žˆ๋‹ค๋ฉด ์–ธ์ œ๋“ ์ง€\n๋‹ค๋ฅธ ๋ฐ˜๋ ค์ธ๋“ค์—๊ฒŒ ๋„์›€์„ ์š”์ฒญํ•ด๋ณด์„ธ์š”!', style: textStyle.bk12light) ],) ], ), ), - ]else...[ + ] + else...[ Container( width: Get.width, - height: 120, + height: 128, color: Color(0xffDDE7FD), child: Row( children: [ SizedBox(width: 25,), SvgPicture.asset( 'assets/images/help/ask_help.svg', + width: 93, + height: 76, + fit: BoxFit.cover, ), - SizedBox(width: 45,), + SizedBox(width: 32,), Column( crossAxisAlignment: CrossAxisAlignment.end, children: [ - SizedBox(height: 45,), + SizedBox(height: 34,), Text('์ด ${parsedResponseHR.length}๋ฒˆ์˜ ์†Œ์ค‘ํ•œ ๋„์›€์„ ๋ฐ›์•˜์Šต๋‹ˆ๋‹ค.', style: TextStyle(color: Colors.black,fontFamily: 'Pretendard', - fontWeight: FontWeight.w600, fontSize: 16)), + fontWeight: FontWeight.w600, fontSize: 14, letterSpacing: 1.0,)), SizedBox(height: 5,), - Text(' ์–ด๋ ค์›€์„ ๊ฒช๊ณ  ์žˆ๋‹ค๋ฉด ์–ธ์ œ๋“ ์ง€\n๋‹ค๋ฅธ ๋ฐ˜๋ ค์ธ๋“ค์—๊ฒŒ ๋„์›€์„ ์š”์ฒญํ•ด๋ณด์„ธ์š”!', style: textStyle.bk14normal) + Text(' ์–ด๋ ค์›€์„ ๊ฒช๊ณ  ์žˆ๋‹ค๋ฉด ์–ธ์ œ๋“ ์ง€\n๋‹ค๋ฅธ ๋ฐ˜๋ ค์ธ๋“ค์—๊ฒŒ ๋„์›€์„ ์š”์ฒญํ•ด๋ณด์„ธ์š”!', style: textStyle.bk12light) ],) ], ), @@ -263,10 +344,10 @@ class _HelpMainPageState extends State { ] ] else if(sendHelp)...[ - if(parsedResponseHA.length ==0)...[ + if(parsedResponseHA.length == 0)...[ Container( width: Get.width, - height: 120, + height: 128, color: Color(0xffDDE7FD), child: Row( children: [ @@ -274,39 +355,44 @@ class _HelpMainPageState extends State { SvgPicture.asset( 'assets/images/help/no_help.svg', ), - SizedBox(width: 55,), + SizedBox(width: 30,), Column( crossAxisAlignment: CrossAxisAlignment.end, children: [ - SizedBox(height: 45,), + SizedBox(height: 34,), Text('๋„์›€์„ ์š”์ฒญ๋ฐ›๊ณ  ๋ณด๋‚ธ ๋‚ด์—ญ์ด ์—†์Šต๋‹ˆ๋‹ค.', style: TextStyle(color: Colors.black,fontFamily: 'Pretendard', - fontWeight: FontWeight.w600, fontSize: 16)), + fontWeight: FontWeight.w600, fontSize: 14, letterSpacing: 1.0,)), SizedBox(height: 5,), - Text(' ๋‹ค๋ฅธ ๋ฐ˜๋ ค์ธ์ด ๋„์›€์„ ์š”์ฒญํ•˜๋ฉด \n๋”ฐ๋œปํ•œ ๋งˆ์Œ์„ ๋‹ด์•„ ๋„์›€์„ ๋ณด๋‚ด์ฃผ์„ธ์š”!', style: textStyle.bk14normal,) + Text(' ๋‹ค๋ฅธ ๋ฐ˜๋ ค์ธ์ด ๋„์›€์„ ์š”์ฒญํ•˜๋ฉด \n๋”ฐ๋œปํ•œ ๋งˆ์Œ์„ ๋‹ด์•„ ๋„์›€์„ ๋ณด๋‚ด์ฃผ์„ธ์š”!', style: textStyle.bk12light,) ],) ], ), ), - ]else...[ + ] + else...[ Container( width: Get.width, - height: 120, + height: 128, color: Color(0xffDDE7FD), - child: Row( + child: + Row( children: [ SizedBox(width: 25,), SvgPicture.asset( 'assets/images/help/send_help.svg', + width: 82, + height: 82, + fit: BoxFit.contain, ), - SizedBox(width: 63,), + SizedBox(width: 44,), Column( crossAxisAlignment: CrossAxisAlignment.end, children: [ - SizedBox(height: 45,), + SizedBox(height: 34,), Text('์ด ${parsedResponseHA.length}๋ฒˆ์˜ ์†Œ์ค‘ํ•œ ๋„์›€์„ ๋ณด๋ƒˆ์Šต๋‹ˆ๋‹ค.', style: TextStyle(color: Colors.black,fontFamily: 'Pretendard', - fontWeight: FontWeight.w600, fontSize: 16)), + fontWeight: FontWeight.w600, fontSize: 14, letterSpacing: 1.0,)), SizedBox(height: 5,), - Text(' ๋‹ค๋ฅธ ๋ฐ˜๋ ค์ธ์ด ๋„์›€์„ ์š”์ฒญํ•˜๋ฉด \n๋”ฐ๋œปํ•œ ๋งˆ์Œ์„ ๋‹ด์•„ ๋„์›€์„ ๋ณด๋‚ด์ฃผ์„ธ์š”!', style: textStyle.bk14normal) + Text(' ๋‹ค๋ฅธ ๋ฐ˜๋ ค์ธ์ด ๋„์›€์„ ์š”์ฒญํ•˜๋ฉด \n๋”ฐ๋œปํ•œ ๋งˆ์Œ์„ ๋‹ด์•„ ๋„์›€์„ ๋ณด๋‚ด์ฃผ์„ธ์š”!', style: textStyle.bk12light) ],) ], ), @@ -315,7 +401,7 @@ class _HelpMainPageState extends State { ], Container( - padding: EdgeInsets.fromLTRB(15, 15, 15, 15), + padding: EdgeInsets.fromLTRB(16, 16, 16, 16), width: Get.width, //height: Get.height-30, color: Color(0xffF2F4F6), @@ -331,108 +417,136 @@ class _HelpMainPageState extends State { child: Column( children: [ SvgPicture.asset( - 'assets/images/memorial/no_result.svg', + 'assets/images/no_result.svg', + height: 140, + width: 128, ), SizedBox( - height: 15, + height: 16, ), - Text('๋„์›€์„ ์š”์ฒญํ•œ ๋‚ด์—ญ์ด ์—†์Šต๋‹ˆ๋‹ค.', style: textStyle.bk14normal), + Text('๋„์›€์„ ์š”์ฒญํ•œ ๋‚ด์—ญ์ด ์—†์Šต๋‹ˆ๋‹ค.', style: textStyle.bk16normal), ], ), ), ) - ]else...[ + ] + else...[ Container( - height: Get.height - 300, - child: ListView.builder( - padding: const EdgeInsets.all(5), - itemCount: parsedResponseHR.length, - itemBuilder: (BuildContext context, int index) { - return - Padding(padding: EdgeInsets.only(bottom: 15), - child: InkWell( - onTap: (){ - hid = parsedResponseHR[index]['id']; - setState(() { - - }); - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => ReceivedHelpPage())); - }, - child: Container( - width: Get.width, - height: 88, - padding: const EdgeInsets.all(12), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(16), - ), - child: Row( - children: [ - CircleAvatar( - minRadius: 30, - maxRadius: 35, - backgroundImage: - NetworkImage(parsedResponse[index], - ), - ), - SizedBox(width: 15,), - Container(width: 165, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox(height: 15,), - Row( - children: [ - Text('${parsedResponseHR[index]['toUserUid']}', style: TextStyle( fontSize: 14, fontWeight: FontWeight.bold),), - Text('๋‹˜์—๊ฒŒ', style: textStyle.bk14normal), - ], - ), - SizedBox(height: 5,), - if(parsedResponseHR[index]['isFromUserReadAnswer'] == 0)...[ - Text('๋„์›€์„ ๋ฐ›์•˜์Šต๋‹ˆ๋‹ค.', style: textStyle.bk14normal), - ] else if(parsedResponseHR[index]['isFromUserReadAnswer'] == 1)...[ - Text('๋ฐ›์€ ๋„์›€์„ ํ™•์ธํ•ด๋ณด์„ธ์š”!', style: textStyle.bk14normal), - ] else if(parsedResponseHR[index]['isFromUserReadAnswer'] == 2)...[ - Text('๋„์›€์„ ์š”์ฒญํ–ˆ์Šต๋‹ˆ๋‹ค.', style: textStyle.bk14normal), - ], - //Text('๋„์›€์„ ์š”์ฒญํ–ˆ์Šต๋‹ˆ๋‹ค', style: TextStyle(color: Color(0xff99A8CB), fontSize: 14),), - ], - ), - ), - - SizedBox(width: 15,), - Column(children: [ - // DateFormat("MM/dd hh:mm").format(parsedResponseHR[index]['createdAt']) - // DateFormat('dd/MM HH:mm').parse(parsedResponseHR[index]['createdAt']) - // DateFormat('MM/dd HH:mm').format(DateTime.parse(parsedResponseHR[index]['createdAt'])) - Text('${DateFormat('MM/dd HH:mm').format(DateTime.parse(parsedResponseHR[index]['createdAt']))}', style: TextStyle(color: Color(0xff99A8CB), fontSize: 10),), - SizedBox(height: 25,), - if(parsedResponseHR[index]['answeredAt'] == null)...[ - Container( + height: (parsedResponseHR.length >= 6)? parsedResponseHR.length * 104 : 600, + child: Column( + children: [ + Expanded( + child: Column( + children: [ + ListView.builder( + shrinkWrap: true, + padding: const EdgeInsets.all(0), + itemCount: parsedResponseHR.length, + itemBuilder: (BuildContext context, int index) { + return + Padding(padding: EdgeInsets.only(bottom: 9), + child: InkWell( + onTap: (){ + fromUsernickname = parsedResponseHR[index]['fromUserNickname']; + fromUserProfileImage = parsedResponseHR[index]['fromUserProfileImage'].toString(); + toUsernickname = parsedResponseHR[index]['toUserNickname']; + toUserProfileImage = parsedResponseHR[index]['toUserProfileImage'].toString(); + hid = parsedResponseHR[index]['id']; + setState(() { + + }); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => ReceivedHelpPage())); + }, + child: Container( + width: Get.width, + height: 89, + padding: const EdgeInsets.all(16), decoration: BoxDecoration( - color: Color(0xffFCCBCD), + color: Colors.white, borderRadius: BorderRadius.circular(16), ), - width: 49, - height: 18, - child: Center(child: Text('์š”์ฒญ์ค‘', style: TextStyle(fontSize: 12,color: Colors.white),),) - ) - ], - - ],) - - ], - ), - ), - ),); - }) + child: Row( + children: [ + if(parsedResponseHR[index]['toUserProfileImage'].toString() == "null")...[ + CircleAvatar( + minRadius: 28, + maxRadius: 28, + child: SvgPicture.asset('assets/images/user_null2.svg',), + ), + ]else...[ + CircleAvatar( + minRadius: 28, + maxRadius: 28, + backgroundImage: + NetworkImage(parsedResponseHR[index]['toUserProfileImage'].toString(), + ), + ), + ], + + SizedBox(width: 16,), + Container(width: 165, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox(height: 12,), + Row( + children: [ + Text('${parsedResponseHR[index]['toUserNickname']}', style: TextStyle( fontSize: 14, fontWeight: FontWeight.bold),), + Text('๋‹˜์—๊ฒŒ', style: textStyle.bk14normal), + ], + ), + SizedBox(height: 5,), + if(parsedResponseHR[index]['isFromUserReadAnswer'] == 0)...[ + Text('๋„์›€์„ ์š”์ฒญํ–ˆ์Šต๋‹ˆ๋‹ค.', style: textStyle.bk14normal), + ] else if(parsedResponseHR[index]['isFromUserReadAnswer'] == 1)...[ + Text('๋ฐ›์€ ๋„์›€์„ ํ™•์ธํ•ด๋ณด์„ธ์š”!', style: textStyle.bk14normal), + ] else if(parsedResponseHR[index]['isFromUserReadAnswer'] == 2)...[ + Text('๋„์›€์„ ๋ฐ›์•˜์Šต๋‹ˆ๋‹ค.', style: textStyle.bk14normal), + ], + //Text('๋„์›€์„ ์š”์ฒญํ–ˆ์Šต๋‹ˆ๋‹ค', style: TextStyle(color: Color(0xff99A8CB), fontSize: 14),), + ], + ), + ), + + SizedBox(width: 28,), + Column(children: [ + // DateFormat("MM/dd hh:mm").format(parsedResponseHR[index]['createdAt']) + // DateFormat('dd/MM HH:mm').parse(parsedResponseHR[index]['createdAt']) + // DateFormat('MM/dd HH:mm').format(DateTime.parse(parsedResponseHR[index]['createdAt'])) + Text('${DateFormat('MM/dd HH:mm').format(DateTime.parse(parsedResponseHR[index]['createdAt']))}', style: textStyle.bg10normal), + SizedBox(height: 25,), + if(parsedResponseHR[index]['answeredAt'] == null)...[ + Container( + decoration: BoxDecoration( + color: Color(0xffFCCBCD), + borderRadius: BorderRadius.circular(16), + ), + width: 49, + height: 18, + child: Center(child: Text('์š”์ฒญ์ค‘', style: textStyle.white12normal),) + ) + ], + + ],) + + ], + ), + ), + ),); + }), + ], + ) + ) + ], + ) ) ] - ] else if(sendHelp)...[ + ] + else if(sendHelp)...[ if(parsedResponseHA.length == 0)...[ SizedBox(height: 180,), Container( @@ -441,110 +555,137 @@ class _HelpMainPageState extends State { child: Column( children: [ SvgPicture.asset( - 'assets/images/help/no_send_help.svg', + 'assets/images/help/no_send.svg', + height: 140, + width: 128, ), SizedBox( - height: 15, + height: 16, ), - Text('๋„์›€์„ ์š”์ฒญ ๋ฐ›์€ ๋‚ด์—ญ์ด ์—†์Šต๋‹ˆ๋‹ค.'), + Text('๋„์›€์„ ์š”์ฒญ ๋ฐ›์€ ๋‚ด์—ญ์ด ์—†์Šต๋‹ˆ๋‹ค.', style: textStyle.bk16normal,), ], ), ), ) - ]else...[ + ] + else...[ Container( - height: Get.height - 300, - child: ListView.builder( - padding: const EdgeInsets.all(5), - itemCount: parsedResponseHA.length, - itemBuilder: (BuildContext context, int index) { - return - Padding(padding: EdgeInsets.only(bottom: 15), - child: InkWell( - onTap: (){ - hid = parsedResponseHA[index]['id']; - setState(() { - - }); - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => AnswerHelpRequestPage())); - }, - child: Container( - width: Get.width, - height: 88, - padding: const EdgeInsets.all(12), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(16), - ), - child: Row( - children: [ - CircleAvatar( - minRadius: 30, - maxRadius: 35, - backgroundImage: - NetworkImage(parsedResponse[index], - ), - ), - SizedBox(width: 15,), - Container(width: 165, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox(height: 15,), - Row( - children: [ - Text('${parsedResponseHA[index]['fromUserUid']}', style: TextStyle(fontSize: 14, fontWeight: FontWeight.bold),), - Text('๋‹˜์ด', style: textStyle.bk14normal), - ], + height: (parsedResponseHA.length >= 6)? parsedResponseHA.length * 104 : 600, + child: Column( + children: [ + Expanded( + child: Column( + children: [ + ListView.builder( + shrinkWrap: true, + padding: const EdgeInsets.all(0), + itemCount: parsedResponseHA.length, + itemBuilder: (BuildContext context, int index) { + return + Padding(padding: EdgeInsets.only(bottom: 9), + child: InkWell( + onTap: (){ + hid = parsedResponseHA[index]['id']; + fromUsernickname = parsedResponseHA[index]['fromUserNickname']; + fromUserProfileImage = parsedResponseHA[index]['fromUserProfileImage'].toString(); + toUsernickname = parsedResponseHA[index]['toUserNickname']; + toUserProfileImage = parsedResponseHA[index]['toUserProfileImage'].toString(); + setState(() { + + }); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => AnswerHelpRequestPage())); + }, + child: Container( + width: Get.width, + height: 89, + padding: const EdgeInsets.all(16), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(16), + ), + child: Row( + children: [ + if(parsedResponseHA[index]['fromUserProfileImage'].toString() == "null")...[ + CircleAvatar( + minRadius: 28, + maxRadius: 28, + child: SvgPicture.asset('assets/images/user_null2.svg',), + ), + ] else ...[ + CircleAvatar( + minRadius: 28, + maxRadius: 28, + backgroundImage: + NetworkImage( + parsedResponseHA[index]['fromUserProfileImage'].toString(), + ), + ), + ], + SizedBox(width: 16,), + Container(width: 165, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox(height: 12,), + Row( + children: [ + Text('${parsedResponseHA[index]['fromUserNickname']}', style: textStyle.bk14semibold), + Text('๋‹˜์ด', style: textStyle.bk14normal), + ], + ), + SizedBox(height: 5,), + Text('๋„์›€์„ ์š”์ฒญํ–ˆ์Šต๋‹ˆ๋‹ค.', style: textStyle.bk14normal), + ], + ), + ), + + SizedBox(width: 28,), + Column(children: [ + Text('${DateFormat('MM/dd HH:mm').format(DateTime.parse(parsedResponseHA[index]['createdAt']))}', style: textStyle.bg10normal,), + SizedBox(height: 25,), + if(parsedResponseHA[index]['answeredAt'] == null)...[ + Row(children: [ + SizedBox(width: 10,), + Container( + decoration: BoxDecoration( + color: Color(0xffFCCBCD), + borderRadius: BorderRadius.circular(16), + ), + width: 35, + height: 18, + child: Center(child: Text('์š”์ฒญ', style: textStyle.white12normal),) + ) + ],), + + ]else...[ + Row(children: [ + SizedBox(width: 10,), + Container( + decoration: BoxDecoration( + color: Color(0xffC0D2FC), + borderRadius: BorderRadius.circular(16), + ), + width: 35, + height: 18, + child: Center(child: Text('์™„๋ฃŒ', style: textStyle.white12normal,),) + ) + ],) + + ] + ],) + ], + ), ), - SizedBox(height: 5,), - Text('๋„์›€์„ ์š”์ฒญํ–ˆ์Šต๋‹ˆ๋‹ค.', style: textStyle.bk14normal), - ], - ), - ), - - SizedBox(width: 15,), - Column(children: [ - Text('${DateFormat('MM/dd HH:mm').format(DateTime.parse(parsedResponseHA[index]['createdAt']))}', style: TextStyle(color: Color(0xff99A8CB),fontSize: 10),), - SizedBox(height: 25,), - if(parsedResponseHA[index]['answeredAt'] == null)...[ - Row(children: [ - SizedBox(width: 10,), - Container( - decoration: BoxDecoration( - color: Color(0xffFCCBCD), - borderRadius: BorderRadius.circular(16), - ), - width: 35, - height: 18, - child: Center(child: Text('์š”์ฒญ', style: TextStyle(fontSize: 12,color: Colors.white),),) - ) - ],), - - ]else...[ - Row(children: [ - SizedBox(width: 10,), - Container( - decoration: BoxDecoration( - color: Color(0xffC0D2FC), - borderRadius: BorderRadius.circular(16), - ), - width: 35, - height: 18, - child: Center(child: Text('์™„๋ฃŒ', style: TextStyle(fontSize: 12,color: Colors.white),),) - ) - ],) - - ] - ],) - ], - ), - ), - ),); - }) + ),); + }), + ], + ) + ) + ], + ) ) ] ] diff --git a/client/lib/help/received_help.dart b/client/lib/help/received_help.dart index 68aac34..2c6d2c3 100644 --- a/client/lib/help/received_help.dart +++ b/client/lib/help/received_help.dart @@ -8,6 +8,8 @@ import 'package:flutter/services.dart'; import 'help_main.dart'as help ; import 'package:intl/intl.dart'; import 'package:http/http.dart' as http; +import 'package:client/sign/sign_in.dart' as sign_in; +import 'help_main.dart' as main; // ๋„์›€ ์š”์ฒญํ•˜๊ธฐ class ReceivedHelpPage extends StatefulWidget { @@ -21,6 +23,8 @@ class _ReceivedHelpPageState extends State { bool check = false; bool sent = true; + bool watchContent = true; + // ๋„์›€ ๋ณด๋‚ด๊ธฐ ์ˆ˜ int countHelp = 0; @@ -34,13 +38,13 @@ class _ReceivedHelpPageState extends State { late Map parsedResponseHR; // ๋„์›€ ์š”์ฒญ ๋‚ด์—ญ // ๋‚ด๊ฐ€ ๋ณด๋‚ธ "๋„์›€ ์š”์ฒญ" ๋‚ด์—ญ์—์„œ ๋‚ด๊ฐ€ ๋ณด๋‚ธ ์š”์ฒญ ์„ธ๋ถ€ ๋‚ด์šฉ ๋ถˆ๋Ÿฌ์˜ค๊ธฐ(GET) - void callHelpRequest(int id) async { + void callHelpRequest(int id, String aToken) async { // API ์—”๋“œํฌ์ธํŠธ URL String apiUrl = 'http://3.38.1.125:8080/community/help?hid=${id}'; // ์‹ค์ œ API ์—”๋“œํฌ์ธํŠธ๋กœ ๋ณ€๊ฒฝํ•˜์„ธ์š” // ํ—ค๋” ์ •๋ณด ์„ค์ • Map headers = { - 'Authorization': 'axNNnzcfJaSiTPI6kW23G2Vns9o1', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• + 'Authorization': 'Bearer $aToken', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• 'Content-Type': 'application/json', // ์˜ˆ: JSON ์š”์ฒญ์ธ ๊ฒฝ์šฐ ํ—ค๋” ์„ค์ • }; @@ -71,31 +75,54 @@ class _ReceivedHelpPageState extends State { void initState() { super.initState(); SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: [SystemUiOverlay.top]); - callHelpRequest(help.hid); + callHelpRequest(help.hid, sign_in.userAccessToken); } @override Widget build(BuildContext context) { + MediaQueryData deviceData = MediaQuery.of(context); + Size screenSize = deviceData.size; return Scaffold( - appBar: AppBar( - title: Center( - child: Padding(padding: EdgeInsets.only(right: 60), - child: Text('๋„์›€ ์š”์ฒญํ•˜๊ธฐ', style: textStyle.bk20bold,), - ) - ), - leading: IconButton( - icon: Icon(Icons.arrow_back_ios_rounded, color: Colors.black), - onPressed: () => Navigator.of(context).pop(), + appBar: + PreferredSize( + preferredSize: Size.fromHeight(72), + child:AppBar( + title: + Container( + height: 50, + width: screenSize.width, + child: Column( + children: [ + SizedBox(height: 24,), + Center( + child: Padding( + padding: EdgeInsets.only(right: 60), + child: Text( + '๋„์›€ ์š”์ฒญํ•˜๊ธฐ', + style: textStyle.bk20normal, + ), + )), + ], + ), + ), + leading: + Padding( + padding: EdgeInsets.only(top: 20), + child: IconButton( + icon: Icon(Icons.arrow_back_ios_rounded, color: Colors.black), + onPressed: () => Navigator.of(context).pop(), + ), + ), + backgroundColor: Colors.transparent, + elevation: 0.0, + iconTheme: IconThemeData(color: Colors.black), ), - backgroundColor: Colors.transparent, - elevation: 0.0, - iconTheme: IconThemeData(color: Colors.black), ), body: Container( //color: Color(0xffF3F3F3), width: Get.width, height: Get.height, - padding: EdgeInsets.only(left: 15, right: 15), + padding: EdgeInsets.only(left: 16, right: 16), child: SingleChildScrollView( padding: EdgeInsets.fromLTRB(0, 0, 0, 0), scrollDirection: Axis.vertical, @@ -103,30 +130,40 @@ class _ReceivedHelpPageState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ if(check)...[ - SizedBox(height: 15,), + SizedBox(height: 8,), Container( width: Get.width, height: 56, - padding: const EdgeInsets.all(15), + padding: const EdgeInsets.all(16), decoration: BoxDecoration( - color: receivedHelp? Color(0xffFCCBCD):Color(0xffF3F3F3), + color: receivedHelp? Color(0xffFCCBCD) : Color(0xffF3F3F3), borderRadius: BorderRadius.circular(16), ), child: Row( children: [ - CircleAvatar( - minRadius: 15, - maxRadius: 15, - backgroundImage: - NetworkImage(help.selectedProfile, + if(main.toUserProfileImage.toString() == "null")...[ + CircleAvatar( + radius: 12, + child: SvgPicture.asset('assets/images/user_null2.svg',), ), - ), - SizedBox(width: 10,), - Text('${parsedResponseHR['toUserUid']}๋‹˜์—๊ฒŒ ๋„์›€์„ ์š”์ฒญํ–ˆ์Šต๋‹ˆ๋‹ค.', style: textStyle.bk14normal,) + ]else...[ + CircleAvatar( + radius: 12, + backgroundImage: + NetworkImage(main.toUserProfileImage,), + ), + ], + + SizedBox(width: 8,), + Row(children: [ + Text('${main.toUsernickname}', style: textStyle.bk14semibold,), + Text('๋‹˜์—๊ฒŒ ๋„์›€์„ ์š”์ฒญํ–ˆ์Šต๋‹ˆ๋‹ค.', style: textStyle.bk14normal,) + ],) + ], ), ), - SizedBox(height: 10,), + SizedBox(height: 8,), Container( width: Get.width, child: @@ -139,40 +176,92 @@ class _ReceivedHelpPageState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - SizedBox(height: 5,), - Text('์ œ๋ชฉ', style: textStyle.bk14regular,), - SizedBox(height: 5,), - Text('${parsedResponseHR['title']}', style: textStyle.bk16normal,), - SizedBox(height: 5,), + SizedBox(height: 8,), + Text('์ œ๋ชฉ', style: textStyle.bk14midium,), + SizedBox(height: 8,), + Text('${parsedResponseHR['title']}', style: textStyle.bk16normalCon,), + SizedBox(height: 8,), ], ), ) ), //Image.network(parsedResponseCM[index]['image'], fit: BoxFit.cover,), ), - SizedBox(height: 10,), + SizedBox(height: 8,), - Container( - width: Get.width, - child: ClipRRect( - borderRadius: BorderRadius.only(bottomLeft: Radius.circular(16.0), bottomRight: Radius.circular(16.0)), - child: - Container( - color: Colors.white, - padding: const EdgeInsets.all(15), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text('๋‚ด์šฉ', style: textStyle.bk14regular,), - SizedBox(height: 5,), - Text('${parsedResponseHR['content']}', style: textStyle.bk16normal,) - ], - ), - ) + if(watchContent)...[ + Container( + width: Get.width, + child: ClipRRect( + borderRadius: BorderRadius.only(bottomLeft: Radius.circular(16.0), bottomRight: Radius.circular(16.0)), + child: + Container( + color: Colors.white, + padding: const EdgeInsets.only(top: 16, left: 16, bottom: 16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Text('๋‚ด์šฉ', style: textStyle.bk14midium,), + SizedBox(width: 263,), + Container( + height: 30, child: IconButton(onPressed: (){ + watchContent = false; + setState(() { + }); + }, icon: SvgPicture.asset( + 'assets/images/help/dropdown_up.svg', + ), + ) + ), + ], + ), + Text('${parsedResponseHR['content']}', style: textStyle.bk16normalCon,) + ], + ), + ) + ), ), - ), - SizedBox(height: 15,), + ]else...[ + Container( + width: Get.width, + child: ClipRRect( + borderRadius: BorderRadius.only(bottomLeft: Radius.circular(16.0), bottomRight: Radius.circular(16.0)), + child: + Container( + color: Colors.white, + padding: const EdgeInsets.only(top: 16, left: 16, bottom: 8), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Text('๋‚ด์šฉ', style: textStyle.bk14midium,), + SizedBox(width: 263,), + Container( + height: 30, child: IconButton(onPressed: (){ + watchContent = true; + setState(() { + }); + }, icon: SvgPicture.asset( + 'assets/images/help/dropdown_down.svg', + ), + ) + ), + + ], + ), + //SizedBox(height: 5,), + ], + ), + ) + ), + ), + ], + if(parsedResponseHR['answer'] != null)...[ + SizedBox(height: 24,), Container( width: Get.width, padding: const EdgeInsets.all(15), @@ -185,24 +274,36 @@ class _ReceivedHelpPageState extends State { children: [ Row( children: [ - CircleAvatar( - minRadius: 15, - maxRadius: 15, - backgroundImage: - NetworkImage(help.selectedProfile, + if(main.toUserProfileImage.toString() == "null")...[ + CircleAvatar( + radius: 12, + child: SvgPicture.asset('assets/images/user_null2.svg',), ), - ), + ]else...[ + CircleAvatar( + radius: 12, + backgroundImage: + NetworkImage(main.toUserProfileImage, + ), + ), + ], + SizedBox(width: 10,), - Text('${parsedResponseHR['toUserUid']}๋‹˜์ด ๋ณด๋‚ธ ๋„์›€'), - SizedBox(width: 110,), - Text(sentDate) + Container( + width: 180, + child: Text('${main.toUsernickname}๋‹˜์ด ๋ณด๋‚ธ ๋„์›€', style: textStyle.bk14midium,), + ), + SizedBox(width: 35,), + // + Text('${DateFormat('MM/dd HH:mm').format(DateTime.parse(parsedResponseHR['answeredAt']))}', style: textStyle.purple12normal,), ], ), - SizedBox(height: 5,), - Text('${parsedResponseHR['answer']}') + SizedBox(height: 10,), + Text('${parsedResponseHR['answer']}', style: textStyle.bk16normalCon,) ], ), ), + SizedBox(height: 16,), ], ] ], diff --git a/client/lib/home.dart b/client/lib/home.dart index 0165384..0b6b4e4 100644 --- a/client/lib/home.dart +++ b/client/lib/home.dart @@ -1,6 +1,36 @@ import 'dart:async'; import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:get/get.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:client/conversation/early_period/early_coach_mark.dart'; +import 'package:client/conversation/early_period/farewell.dart'; +import 'package:client/conversation/early_period/memory2.dart'; +import 'package:client/conversation/early_period/start_early.dart'; +import 'package:client/conversation/end_period/end.dart'; +import 'package:client/conversation/end_period/end2.dart'; +import 'package:client/conversation/intro/intro.dart'; +import 'dart:convert'; +import 'package:http/http.dart' as http; +import 'package:client/conversation/intro/intro_coach_mark.dart'; +import 'package:client/conversation/intro/intro_story.dart'; +import 'package:client/conversation/middle_period/sadness.dart'; +import 'package:client/style.dart'; +import 'conversation/early_period/memory.dart'; +import 'conversation/intro/intro2.dart'; +import 'conversation/late_period/late.dart'; +import 'conversation/middle_period/the_truth_untold.dart'; +import 'main.dart' as main; +import 'package:client/sign/sign_in.dart' as sign_in; +import 'help/help_main.dart'; +import 'package:client/conversation/early_period/start_early.dart' as constart; + +String puppy = ""; +String user = ""; +String userprof = ""; +String convs =""; class HomePage extends StatefulWidget { static Future navigatorPush(BuildContext context) async { @@ -18,9 +48,170 @@ class HomePage extends StatefulWidget { class _HomePageState extends State { + var now = DateTime.now(); // ๋Œ€ํ™”ํ•˜๊ธฐ ๋ฒ„ํŠผ - ํ˜„์žฌ์‹œ๊ฐ„๊ณผ DB์˜ ์‹œ๊ฐ„ ๊ณ„์‚ฐ + late DateTime conTime; // ๋Œ€ํ™” ์‹œ์ž‘ ์‹œ๊ฐ„ + + // ์ฐจ์ด์—์„œ ์‹œ๊ฐ„๊ณผ ๋ถ„ ์ถ”์ถœ + late Duration difference; + + bool nowCon = true; // ํ˜„์žฌ ๋Œ€ํ™” ๊ฐ€๋Šฅ ์‹œ๊ฐ„์ธ์ง€ ํ™•์ธ + + int hour = 0; + int minute = 0; + bool inHour = false; // 1์‹œ๊ฐ„ ๋‚ด ๋Œ€ํ™”๊ฐ€๋Šฅ์ธ์ง€ + + bool tap = false; + // ์‚ฌ์šฉ์ž ์ •๋ณด ์กฐํšŒ : ๋Œ€ํ™”ํ•˜๊ธฐ๊ฐ€ 1์ด๋ฉด ์ธํŠธ๋กœ ์•„๋‹ˆ๋ฉด ๊ทธ๋ƒฅ ํ™ˆ์œผ๋กœ ์ด๋™ + late Map parsedResponseUser; // ์‚ฌ์šฉ์ž ์ •๋ณด + bool checkUser = false; + void fetchUserInfo(String aToken) async { + // API ์—”๋“œํฌ์ธํŠธ URL + print("๋ฐ›ํ† :" + aToken); + String apiUrl = 'http://3.38.1.125:8080/user/info'; + + // ํ—ค๋” ์ •๋ณด ์„ค์ • + Map headers = { + 'Authorization': 'Bearer $aToken', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• + 'Content-Type': 'application/json', // ์˜ˆ: JSON ์š”์ฒญ์ธ ๊ฒฝ์šฐ ํ—ค๋” ์„ค์ • + }; + + // HTTP GET ์š”์ฒญ ๋ณด๋‚ด๊ธฐ + var response = await http.get( + Uri.parse(apiUrl), + headers: headers, // ํ—ค๋” ์ถ”๊ฐ€ + ); + + // HTTP ์‘๋‹ต ์ƒํƒœ ํ™•์ธ + if (response.statusCode == 200) { + // ์‘๋‹ต ๋ฐ์ดํ„ฐ ์ฒ˜๋ฆฌ + print('์„œ๋ฒ„๋กœ๋ถ€ํ„ฐ ๋ฐ›์€ ๋‚ด์šฉ ๋ฐ์ดํ„ฐ(์‚ฌ์šฉ์ž ์ •๋ณด): ${response.body}'); + var jsonResponse = utf8.decode(response.bodyBytes); + parsedResponseUser = json.decode(jsonResponse); + print("ํ™•์ธ"+parsedResponseUser["conversationStatus"].toString()); + checkUser = true; + convs = parsedResponseUser["conversationStatus"].toString(); + userprof = parsedResponseUser["profileImage"].toString(); + user = parsedResponseUser["nickname"]; + puppy = parsedResponseUser["puppyName"]; + conTime = DateTime.parse(parsedResponseUser["nextConversationAt"]); + + // ํ˜„์žฌ ์‹œ๊ฐ์ด ๋Œ€ํ™” ์‹œ์ž‘ ์‹œ๊ฐ„ ๋ณด๋‹ค ์ด์ „์ด๋ผ๋ฉด ๋Œ€ํ™”๊ฐ€ ๊ฐ€๋Šฅํ•จ + if(DateTime.now().isAfter(conTime)){ + nowCon = true; + print("๋Œ€ํ™”๊ฐ€๋Šฅ"); + print(DateTime.now().toString()); + difference = conTime.difference(DateTime.now()); + // ํ˜„์žฌ ์‹œ๊ฐ์ด ๋Œ€ํ™” ์‹œ์ž‘ ์‹œ๊ฐ„ ๋ณด๋‹ค ์ดํ›„๋ผ๋ฉด ๋Œ€ํ™”๊ฐ€ ๋ถˆ๊ฐ€๋Šฅ = ์•„์ง ๋Œ€ํ™” ์‹œ๊ฐ„์ด ์•ˆ ๋จ + } else{ + nowCon = false; + difference = conTime.difference(DateTime.now()); + //hour = DateTime.parse(difference.toString()).hour; + print("๋Œ€ํ™”๋ถˆ๊ฐ€"); + print(DateTime.now().toString()); + // ๋ฌธ์ž์—ด์„ Duration ๊ฐ์ฒด๋กœ ๋ณ€ํ™˜ + Duration duration = Duration( + hours: int.parse(difference.toString().split(":")[0]), + minutes: int.parse(difference.toString().split(":")[1]), + ); + // Duration์—์„œ ์‹œ๊ฐ„, ๋ถ„, ์ดˆ, ๋ฐ€๋ฆฌ์ดˆ ์ถ”์ถœ + hour = duration.inHours; + minute = duration.inMinutes % 60; + + if(hour == 0){ + inHour = true; + } + + print("์‹œ๊ฐ„ ์ฐจ์ด: " + hour.toString()); + print("๋ถ„ ์ฐจ์ด: " + minute.toString()); + } + print("์‹œ๊ฐ„ ์ฐจ์ด: " + difference.toString()); + // ๋Œ€ํ™”ํ•˜๊ธฐ ๋ฒ„ํŠผ ์ง€์ •์„ ์œ„ํ•œ ํ˜„์žฌ ์‹œ๊ฐ„๊ณผ DB ์‹œ๊ฐ„ ๊ณ„์‚ฐ + + + // ๋Œ€ํ™” ๋‹จ๊ณ„์— ๋”ฐ๋ผ ๋ฐฐ๊ฒฝ ์ƒ‰์„ ๋จผ์ € ์ง€์ • + if(convs.contains("0")){ + constart.backColor = "DDE7FD"; + constart.perc = 20; + }else if(convs.contains("-")){ + constart.backColor = "FCCBCD"; + constart.perc = 20; + }else if(convs.contains("1")){ + constart.backColor = "FCCBCD"; + constart.perc = 35; + }else if(convs.contains("2")){ + constart.backColor = "FBF3B8"; + constart.perc = 55; + }else if(convs.contains("3")){ + constart.backColor = "CEEEE9"; + constart.perc = 75; + }else if(convs.contains("4")){ + constart.backColor = "DDE7FD"; + constart.perc = 95; + } + + setState(() { + + }); + + + } else { + // ์š”์ฒญ์ด ์‹คํŒจํ•œ ๊ฒฝ์šฐ ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌ + print('HTTP ์š”์ฒญ ์‹คํŒจ: ${response.statusCode}'); + } + } + + late List parsedResponseHA; // ๋„์›€ ๋‹ต๋ณ€ ๋‚ด์—ญ + // ๋‚ด๊ฐ€ ๋ณด๋‚ธ "๋„์›€" ๋‚ด์—ญ ๋ถˆ๋Ÿฌ์˜ค๊ธฐ(GET) + void callHelpAnswer(String aToken) async { + // API ์—”๋“œํฌ์ธํŠธ URL + String apiUrl = 'http://3.38.1.125:8080/community/help/all?type=ans'; + + // ํ—ค๋” ์ •๋ณด ์„ค์ • + Map headers = { + 'Authorization': 'Bearer $aToken', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• + 'Content-Type': 'application/json', // ์˜ˆ: JSON ์š”์ฒญ์ธ ๊ฒฝ์šฐ ํ—ค๋” ์„ค์ • + }; + + // HTTP GET ์š”์ฒญ ๋ณด๋‚ด๊ธฐ + var response = await http.get( + Uri.parse(apiUrl), + headers: headers, // ํ—ค๋” ์ถ”๊ฐ€ + ); + + // HTTP ์‘๋‹ต ์ƒํƒœ ํ™•์ธ + if (response.statusCode == 200) { + // ์‘๋‹ต ๋ฐ์ดํ„ฐ ์ฒ˜๋ฆฌ + print('์„œ๋ฒ„๋กœ๋ถ€ํ„ฐ ๋ฐ›์€ ๋‚ด์šฉ ๋ฐ์ดํ„ฐ(๋‚ด๊ฐ€ ๋ณด๋‚ธ๋„์›€): ${response.body}'); + var jsonResponse = utf8.decode(response.bodyBytes); + + parsedResponseHA = json.decode(jsonResponse); + + print("๋ช‡๊ฐœ์ธ์ง€ ํ™•์ธ(๋‚ด๊ฐ€ ๋ณด๋‚ธ๋„์›€) "+parsedResponseHA.length.toString()); + + setState(() {}); + + } else { + // ์š”์ฒญ์ด ์‹คํŒจํ•œ ๊ฒฝ์šฐ ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌ + print('HTTP ์š”์ฒญ ์‹คํŒจ: ${response.statusCode}'); + } + } @override void initState() { + super.initState(); + SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: [SystemUiOverlay.top]); + + main.player.stop(); + + fetchUserInfo(sign_in.userAccessToken); + setState(() { + + }); + Timer(Duration(milliseconds: 500), () { + fetchUserInfo(sign_in.userAccessToken); + }); + callHelpAnswer(sign_in.userAccessToken); + } @override @@ -28,22 +219,7 @@ class _HomePageState extends State { super.dispose(); } - ListTile _tile(String title, String subtitle) => ListTile( - title: Text(title), - subtitle: Text(subtitle), - leading: Image.network("https://randomuser.me/api/portraits/women/10.jpg") - ); - - Widget _buildList() => ListView( - children: [ - _tile("์•ˆ๋…•ํ•˜์„ธ์š”", "๋ฐ˜๊ฐ€์›Œ์š”"), - ], - ); - - ClipRRect _userImage(String url) => ClipRRect( - borderRadius: BorderRadius.circular(100), - child:Image.network(url) - ); + bool time = false; @override Widget build(BuildContext context) { @@ -51,196 +227,403 @@ class _HomePageState extends State { Size screenSize = deviceData.size; return Container( - decoration: BoxDecoration( - image: DecorationImage( - fit: BoxFit.cover, - image: AssetImage('assets/images/background_test.png'), // ๋ฐฐ๊ฒฝ ์ด๋ฏธ์ง€ - ), - ), - child: Scaffold( - backgroundColor: Colors.transparent, - appBar: AppBar( - title: Image.asset('assets/images/pupmory_logo.png', height: 85, width: 95,), - backgroundColor: Colors.transparent, - elevation: 0.0, - ),extendBodyBehindAppBar: true, - body: Column( - children: [ - Padding( - padding: EdgeInsets.only(top: 65, right: 5), - child: Container( - height: 70, - width: screenSize.width, - child:Column( + color: Color(0xffDDE7FD), + child: GestureDetector( + onTap: (){ + SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: [SystemUiOverlay.top]); + }, + child: Scaffold( + backgroundColor: Colors.transparent, + appBar: AppBar( + title: + Container( + width: screenSize.width, + height: 46, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text( - "๋‚˜๋ผ๋‹˜์ด ์ดˆ์ฝ”๋ฅผ ๊ธฐ์–ตํ•œ์ง€\n1์ผ์งธ ์ž…๋‹ˆ๋‹ค." + SizedBox(height: 18,), + SvgPicture.asset( + 'assets/images/logo/pup_logo.svg', + height: 25.41, + width: 110.19, + fit: BoxFit.cover, ), ], - ) - ), - ), - Container( - alignment: Alignment.center, - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - InkWell( - onTap: (){ - //Navigator.push(context, MaterialPageRoute(builder: (context) => Conversation0_1())); - }, - child: Container( - width: 208, - height: 104, - decoration: BoxDecoration( - image: DecorationImage( - image: AssetImage('assets/images/con1_button.png') - ) - ), - ), - ), - InkWell( - onTap: (){ - //Navigator.push(context, MaterialPageRoute(builder: (context) => Conversation0_1())); - }, - child: Container( - width: 104, - height: 104, - decoration: BoxDecoration( - image: DecorationImage( - image: AssetImage('assets/images/help_request_button.png') - ) - ), - ), - ), - ], + ), ), + + backgroundColor: Colors.transparent, + elevation: 0.0, + automaticallyImplyLeading: false, ), + body: + Column( + children: [ + Padding( + padding: EdgeInsets.only(top: 35, bottom: 16), + child: Row( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children:[ + if(checkUser)...[ + Stack( + children: [ + Text( + "${parsedResponseUser["puppyName"]}๋ฅผ ๊ธฐ์–ตํ•œ์ง€", + textAlign: TextAlign.center, + style: TextStyle( + fontFamily: 'Cafe24SsurroundAir-v1.1', + //color: Color(0xff4B5396), + fontSize: 20, + foreground: Paint() + ..style = PaintingStyle.stroke + ..strokeWidth = 3 + ..color = Colors.white, + ), + ), + Text( + "${parsedResponseUser["puppyName"]}๋ฅผ ๊ธฐ์–ตํ•œ์ง€", + textAlign: TextAlign.center, + style: TextStyle( + fontFamily: 'Cafe24SsurroundAir-v1.1', + //color: Color(0xff4B5396), + fontSize: 20, + foreground: Paint() + ..style = PaintingStyle.stroke + ..strokeWidth = 0.7 + ..color = Color(0xff4B5396), + ), + ), + Text( + "${parsedResponseUser["puppyName"]}๋ฅผ ๊ธฐ์–ตํ•œ์ง€", + textAlign: TextAlign.center, + style: TextStyle( + fontFamily: 'Cafe24SsurroundAir-v1.1', + color: Color(0xff4B5396), + fontSize: 20, + ), + ), + ], + ), - Container( - alignment: Alignment.centerLeft, - width: 450, - height: 50, - child: InkWell( - onTap: (){ - //Navigator.push(context, MaterialPageRoute(builder: (context) => Conversation0_1())); - }, - child: - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text("ํ•˜๋งˆ๋‹˜์—๊ฒŒ ์ถ”์ฒœํ•˜๋Š” ๊ฒŒ์‹œ๊ธ€",style: TextStyle(fontSize: 16),), - Padding( - padding: EdgeInsets.only(left: 70), - child: Image(image: AssetImage('assets/images/home_right_arrow.png'), - width: 4, height: 8, - ), + ], + SizedBox(width: 4), + Row( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children:[ + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(2), + border: Border.all(color: Color(0xff4B5396), width: 2, ), + color: Color(0xffFCCBCD), + ), + padding: const EdgeInsets.symmetric(horizontal: 4, vertical: 2, ), + child: Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children:[ + if(checkUser)...[ + Stack( + children: [ + Text( + parsedResponseUser["memoryCount"].toString(), + style: TextStyle( + fontFamily: 'Cafe24SsurroundAir-v1.1', + foreground: Paint() + ..style = PaintingStyle.stroke + ..strokeWidth = 0.7 + ..color = Color(0xff4B5396), + fontSize: 20, + ), + ), + Text( + parsedResponseUser["memoryCount"].toString(), + textAlign: TextAlign.center, + style: TextStyle( + fontFamily: 'Cafe24SsurroundAir-v1.1', + color: Color(0xff4B5396), + fontSize: 20, + ), + ), + ],) + + ] + ], + ), + ), + SizedBox(width: 2), + Stack( + children: [ + Text( + "์ผ์งธ", + style: TextStyle( + fontFamily: 'Cafe24SsurroundAir-v1.1', + foreground: Paint() + ..style = PaintingStyle.stroke + ..strokeWidth = 3 + ..color = Colors.white, + fontSize: 20, + ), + ), + Text( + "์ผ์งธ", + style: TextStyle( + fontFamily: 'Cafe24SsurroundAir-v1.1', + foreground: Paint() + ..style = PaintingStyle.stroke + ..strokeWidth = 0.7 + ..color = Color(0xff4B5396), + fontSize: 20, + ), + ), + Text( + "์ผ์งธ", + style: TextStyle( + fontFamily: 'Cafe24SsurroundAir-v1.1', + color: Color(0xff4B5396), + fontSize: 20, + ), + ), + ], + ), + ], + ), + ], ) - ], ), - ), - ), - Container( - alignment: Alignment.center, - child: - SingleChildScrollView( - // scrollDirection: Axis.horizontal, - child: Row( - children: [ - Container( - margin: EdgeInsets.all(5), - width: 172, - height: 172, - child: InkWell( - child: Container( - width: 172, - height: 172, - decoration: BoxDecoration( - image: DecorationImage( - image: AssetImage('assets/images/proto_recommend1.png') - ) - ), + // SizedBox(height: 15,), + if(checkUser)...[ + Text("${parsedResponseUser["nickname"]}๋‹˜, ์˜ค๋Š˜๋„ ${parsedResponseUser["puppyName"]}์™€์˜ ๊ธฐ์–ต์„ ๋‚จ๊ฒจ์ฃผ์„ธ์š”!", style: TextStyle( + fontFamily: 'Pretendard', + fontWeight: FontWeight.w400, + color: Color(0xff333333), + fontSize: 16,),), + ], + SizedBox(height: 18,), + Container( + alignment: Alignment.center, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Container( + width: screenSize.width, + height: 348, + child: Stack( + children: [ + Row( + children: [ + SizedBox(width: 56,), + Image.asset('assets/images/home/home_muji2.gif', + fit: BoxFit.cover,), + + ], + ), + if(nowCon)...[ + Padding( + padding: EdgeInsets.only(top: 230,left: 134), + child: Container( + width: 150, + height: 44, + child: + InkWell( + child: Stack( + children: [ + Image.asset( + 'assets/images/home/con_btn2.png', + fit: BoxFit.contain, + ), + SvgPicture.asset( + 'assets/images/home/btnframe.svg', + fit: BoxFit.contain, + ), + Padding(padding: EdgeInsets.only(left: 22, top: 9), + child: + Stack( + children: [ + Text( + "๋Œ€ํ™”ํ•˜๊ธฐ", + textAlign: TextAlign.center, + style: TextStyle( + fontFamily: 'Cafe24SsurroundAir-v1.1', + //color: Color(0xff4B5396), + fontSize: 16, + foreground: Paint() + ..style = PaintingStyle.stroke + ..strokeWidth = 0.7 + ..color = Color(0xff222222), + ), + ), + Text( + "๋Œ€ํ™”ํ•˜๊ธฐ", + textAlign: TextAlign.center, + style: TextStyle( + fontFamily: 'Cafe24SsurroundAir-v1.1', + color: Color(0xff222222), + fontSize: 16, + ), + ), + ], + ), + ) + ], + ), + onTap: (){ + tap = true; + setState(() {}); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => StartEarlyPage())); + }, + ) + ), + ), + ] else...[ + Padding( + padding: EdgeInsets.only(top: 230,left: 119), + child: Container( + width: 150, + height: 44, + child: + InkWell( + child: Stack( + children: [ + // assets/images/home/con_btn.svg + SvgPicture.asset( + 'assets/images/home/after_con.svg', + fit: BoxFit.contain, + ), + Padding(padding:inHour? EdgeInsets.only(left: 18, top: 8):EdgeInsets.only(left: 18, top: 12), + child:Text( + inHour? + "${minute}๋ถ„ ๋’ค ๋งŒ๋‚˜์š”!":"${hour}์‹œ๊ฐ„ ๋’ค ๋งŒ๋‚˜์š”!", + textAlign: TextAlign.center, + style: TextStyle( + fontFamily: 'Cafe24SsurroundAir-v1.1', + color: Color(0xff222222), + fontSize: 16, + ), + ),) + + ], + ), + onTap: (){ + }, + ) + ), + ), + ] + ], + ) + ), + SizedBox(height: 8,), + Container( + padding: EdgeInsets.all(8), + width: 252, + height: 56, + decoration: BoxDecoration( + color: Color(0xff83A8FF).withOpacity(0.15), + borderRadius: BorderRadius.circular(37.5), + ), + child: Row( + children: [ + SizedBox(width: 2,), + if(parsedResponseHA.length<10)...[ + SvgPicture.asset('assets/images/home/lev1.svg',), + ] else if(parsedResponseHA.length<20)...[ + SvgPicture.asset('assets/images/home/lev2.svg',), + ] else if(parsedResponseHA.length<30)...[ + SvgPicture.asset('assets/images/home/lev3.svg',), + ] else if(parsedResponseHA.length<40)...[ + SvgPicture.asset('assets/images/home/lev4.svg',), + ] else if(parsedResponseHA.length >40)...[ + SvgPicture.asset('assets/images/home/lev4.svg',), + ], + SizedBox(width: 12,), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox(height: 4,), + Text("ํ˜„์žฌ ${parsedResponseHA.length.toString()}๋ฒˆ์˜ ๋„์›€์„ ๋ณด๋ƒˆ์–ด์š”.", style: textStyle.purple12light,), + SizedBox(height: 4,), + if(parsedResponseHA.length<10)...[ + Text("๋„์›€ ๋ณด๋‚ด๊ธฐ๋ฅผ 10๋ฒˆ ๋‹ฌ์„ฑํ•ด๋ณด์„ธ์š”!", style: textStyle.purple12light,), + ] else if(parsedResponseHA.length<20)...[ + Text("๋„์›€ ๋ณด๋‚ด๊ธฐ๋ฅผ 20๋ฒˆ ๋‹ฌ์„ฑํ•ด๋ณด์„ธ์š”!", style: textStyle.purple12light,), + ] else if(parsedResponseHA.length<30)...[ + Text("๋„์›€ ๋ณด๋‚ด๊ธฐ๋ฅผ 30๋ฒˆ ๋‹ฌ์„ฑํ•ด๋ณด์„ธ์š”!", style: textStyle.purple12light,), + ] else if(parsedResponseHA.length<40)...[ + Text("๋„์›€ ๋ณด๋‚ด๊ธฐ๋ฅผ 40๋ฒˆ ๋‹ฌ์„ฑํ•ด๋ณด์„ธ์š”!", style: textStyle.purple12light,), + ] else if(parsedResponseHA.length >40)...[ + Text("๋„์›€ ๋ณด๋‚ด๊ธฐ๋ฅผ 50๋ฒˆ ๋‹ฌ์„ฑํ•ด๋ณด์„ธ์š”!", style: textStyle.purple12light,), + ] + ], + ), + ], ), ), - ), - Container( - margin: EdgeInsets.all(5), - width: 172, - height: 172, - child: InkWell( + SizedBox(height: 24,), + InkWell( + onTap: (){ + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => HelpMainPage())); + }, child: Container( - width: 172, - height: 172, + padding: EdgeInsets.fromLTRB(16, 16, 0, 0), + width: Get.width - 32, + height: 89, decoration: BoxDecoration( - image: DecorationImage( - image: AssetImage('assets/images/proto_recommend1.png') + color: Colors.white, + borderRadius: BorderRadius.circular(16), + ), + child: Column( + children: [ + Row( + children: [ + SvgPicture.asset( + 'assets/images/home/help_main.svg', + width: 61, + height: 61, + fit: BoxFit.fill, + + ), + SizedBox(width: 5,), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text("๋‹ค๋ฅธ ๋ฐ˜๋ ค์ธ๋“ค๊ณผ ๋„์›€์„ ์ฃผ๊ณ  ๋ฐ›์•„๋ณด์„ธ์š”!", style: TextStyle(color: Color(0xff4B5396), fontFamily: 'Pretendard', + fontWeight: FontWeight.w400, fontSize: 12, letterSpacing: 0.5),), + SizedBox(height:8,), + Text("๋„์›€ ๋‚ด์—ญ ๋ณด๋Ÿฌ ๊ฐ€๊ธฐ", style: TextStyle(color: Color(0xff4B5396),fontSize: 16, fontFamily: 'Pretendard', + fontWeight: FontWeight.w600,),) + ], + ), + SizedBox(width:20,), + // assets/images/home/arrow.svg + SvgPicture.asset( + 'assets/images/home/arrow.svg', + ), + ], ) + ], ), ), ), - ), - ], - ) - ), - ), - Container( - alignment: Alignment.center, - child: - Padding(padding: EdgeInsets.only(top: 5,), - child: InkWell( - onTap: (){ - //Navigator.push(context, MaterialPageRoute(builder: (context) => Conversation0_1())); - }, - child: Container( - width: 330, - height: 160, - decoration: BoxDecoration( - image: DecorationImage( - image: AssetImage('assets/images/dog_gallery.png') - ) - ), + ], ), ), - ), + + ], ), - ], - ), - ) + ), + ) ); - - } -} - - -class RoundedButton extends StatelessWidget { - const RoundedButton({ - required this.child, - this.color, - this.disableColor, - this.elevation, - this.side = BorderSide.none, - this.onTap, - super.key, - }); - - final Widget child; - final Color? color; - final Color? disableColor; - final double? elevation; - final BorderSide side; - final VoidCallback? onTap; - - @override - Widget build(BuildContext context) { - return ElevatedButton( - style: ElevatedButton.styleFrom( - foregroundColor: color, - shape: const StadiumBorder().copyWith(side: side), - disabledBackgroundColor: disableColor ?? Colors.grey, - elevation: elevation, - ), - onPressed: onTap, - child: child, - ); } } diff --git a/client/lib/main.dart b/client/lib/main.dart index 7bbecf4..593b0a3 100644 --- a/client/lib/main.dart +++ b/client/lib/main.dart @@ -1,225 +1,223 @@ +/// main +import 'dart:async'; +import 'dart:convert'; +import 'package:flutter/services.dart'; +import 'package:http/http.dart' as http; +import 'package:firebase_core/firebase_core.dart'; import 'package:flutter/material.dart'; -import 'package:client/home.dart'; -import 'package:custom_navigation_bar/custom_navigation_bar.dart'; - - -void main() => runApp(const MyApp()); - -enum ThemeStyle { - BlurEffect, +import 'package:get/get.dart'; +import 'package:client/conversation/intro/intro.dart'; +import 'package:client/conversation/intro/intro_story.dart'; +import 'package:client/screen.dart'; +import 'package:client/sign/sign_in.dart' as sign_in; +import 'check_user.dart'; +import 'firebase_options.dart'; +import 'package:firebase_auth/firebase_auth.dart'; +import 'package:client/sign/sign_up.dart' as sign_up; +import 'package:just_audio/just_audio.dart'; + +import 'sign/sign_in.dart'; + +void main() async{ + WidgetsFlutterBinding.ensureInitialized(); + await Firebase.initializeApp( + options: DefaultFirebaseOptions.currentPlatform, + ); + runApp(MyApp()); // MyApp ํด๋ž˜์Šค ์‹คํ–‰ } +class MyApp extends StatefulWidget { + @override + _MyAppState createState() => _MyAppState(); +} -class MyApp extends StatelessWidget { - const MyApp({Key? key}) : super(key: key); - - static const String _title = 'Flutter Code Sample'; - @override - Widget build(BuildContext context) { - return const MaterialApp( - title: _title, - home: MyStatefulWidget(), - ); +bool play = false; // ๋ฐฐ๊ฒฝ์Œ์•… ์žฌ์ƒ +final player = AudioPlayer(); // ๋ฐฐ๊ฒฝ์Œ์•… ํ”Œ๋ ˆ์ด์–ด +String station = ""; // ๋Œ€ํ™”๋‹จ๊ณ„ +List musics =[ + "assets/musics/intro_music_1.mp3", "assets/musics/early_music.mp3", "assets/musics/middle_music.mp3", + "assets/musics/late_music.mp3", "assets/musics/end_music.mp3", +]; + +late Map parsedResponseAT; // ์•ก์„ธ์Šค ํ† ํฐ +// ๋กœ๊ทธ์ธ ํ† ํฐ ๋ฐœ๊ธ‰ํ•ด์˜ค๊ธฐ +Future fetchSignInToken(String fToken) async { + // API ์—”๋“œํฌ์ธํŠธ URL + print("๋ฐ›ํ† :" + fToken); + String apiUrl = 'http://3.38.1.125:8080/auth/signin'; // ์‹ค์ œ API ์—”๋“œํฌ์ธํŠธ๋กœ ๋ณ€๊ฒฝํ•˜์„ธ์š” + + // ํ—ค๋” ์ •๋ณด ์„ค์ • + Map headers = { + 'X-Firebase-Token': fToken, // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• + 'Content-Type': 'application/json', // ์˜ˆ: JSON ์š”์ฒญ์ธ ๊ฒฝ์šฐ ํ—ค๋” ์„ค์ • + 'Accept': '*/*' + }; + + // HTTP GET ์š”์ฒญ ๋ณด๋‚ด๊ธฐ + var response = await http.get( + Uri.parse(apiUrl), + headers: headers, // ํ—ค๋” ์ถ”๊ฐ€ + ); + + // HTTP ์‘๋‹ต ์ƒํƒœ ํ™•์ธ + if (response.statusCode == 200) { + // ์‘๋‹ต ๋ฐ์ดํ„ฐ ์ฒ˜๋ฆฌ + print('์„œ๋ฒ„๋กœ๋ถ€ํ„ฐ ๋ฐ›์€ ๋‚ด์šฉ ๋ฐ์ดํ„ฐ: ${response.body}'); + var jsonResponse = utf8.decode(response.bodyBytes); + + parsedResponseAT = json.decode(jsonResponse); + + sign_in.userAccessToken = parsedResponseAT['accessToken']; // ์•ก์„ธ์Šค ํ† ํฐ์„ ์ „์—ญ๋ณ€์ˆ˜์— ์ €์žฅ -> ๋‹ค๋ฅธ ํŒŒ์ผ์—์„œ๋„ ์‚ฌ์šฉ + print("accessToken:" + sign_in.userAccessToken); + + fetchUserInfo(sign_in.userAccessToken); + + } else { + // ์š”์ฒญ์ด ์‹คํŒจํ•œ ๊ฒฝ์šฐ ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌ + print('HTTP ์š”์ฒญ ์‹คํŒจ: ${response.statusCode}'); } } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({Key? key}) : super(key: key); +late Map parsedResponseUser; // ์‚ฌ์šฉ์ž ์ •๋ณด +bool userNew = false; + +// ์‚ฌ์šฉ์ž ์ •๋ณด ์กฐํšŒ : ๋Œ€ํ™”ํ•˜๊ธฐ๊ฐ€ 1์ด๋ฉด ์ธํŠธ๋กœ ์•„๋‹ˆ๋ฉด ๊ทธ๋ƒฅ ํ™ˆ์œผ๋กœ ์ด๋™ +void fetchUserInfo(String aToken) async { + // API ์—”๋“œํฌ์ธํŠธ URL + print("๋ฐ›ํ† :" + aToken); + String apiUrl = 'http://3.38.1.125:8080/user/info'; // ์‹ค์ œ API ์—”๋“œํฌ์ธํŠธ๋กœ ๋ณ€๊ฒฝํ•˜์„ธ์š” + + // ํ—ค๋” ์ •๋ณด ์„ค์ • + Map headers = { + 'Authorization': 'Bearer $aToken', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• + 'Content-Type': 'application/json', // ์˜ˆ: JSON ์š”์ฒญ์ธ ๊ฒฝ์šฐ ํ—ค๋” ์„ค์ • + }; + + // HTTP GET ์š”์ฒญ ๋ณด๋‚ด๊ธฐ + var response = await http.get( + Uri.parse(apiUrl), + headers: headers, // ํ—ค๋” ์ถ”๊ฐ€ + ); + + // HTTP ์‘๋‹ต ์ƒํƒœ ํ™•์ธ + if (response.statusCode == 200) { + // ์‘๋‹ต ๋ฐ์ดํ„ฐ ์ฒ˜๋ฆฌ + print('์„œ๋ฒ„๋กœ๋ถ€ํ„ฐ ๋ฐ›์€ ๋‚ด์šฉ ๋ฐ์ดํ„ฐ(์‚ฌ์šฉ์ž ์ •๋ณด~!): ${response.body}'); + var jsonResponse = utf8.decode(response.bodyBytes); + parsedResponseUser = json.decode(jsonResponse); + print("ํ™•์ธ"+parsedResponseUser["conversationStatus"].toString()); + + if(parsedResponseUser["conversationStatus"] == 0){ + print("์ธํŠธ๋กœ"); + userNew = true; + } else{ + print("๋ฉ”์ธํ™ˆ์œผ๋กœ ์ด๋™"); + } - @override - State createState() => _MyStatefulWidgetState(); + } else { + // ์š”์ฒญ์ด ์‹คํŒจํ•œ ๊ฒฝ์šฐ ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌ + print('HTTP ์š”์ฒญ ์‹คํŒจ: ${response.statusCode}'); + } } -class _MyStatefulWidgetState extends State { +class _MyAppState extends State { + // const MyApp({super.key}); - int _selectedIndex = 0; - int _currentIndex = 0; + @override + Widget build(BuildContext context) { + //SystemChrome.setEnabledSystemUIOverlays([]); + SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersive, overlays: []); + return GetMaterialApp( + builder: (BuildContext context, Widget? widget) { + ErrorWidget.builder = (FlutterErrorDetails errorDetails) { + return CustomError(errorDetails: errorDetails); + }; + return widget!; + }, + debugShowCheckedModeBanner: false, + home: + StreamBuilder( + stream: FirebaseAuth.instance.authStateChanges(), + builder: (context, snapshot) { + + if (snapshot.connectionState == ConnectionState.waiting) { + return CircularProgressIndicator(); // ๋กœ๋”ฉ ์Šคํ”ผ๋„ˆ ๋˜๋Š” ๋กœ๋”ฉ ํ™”๋ฉด์„ ๋ณด์—ฌ์ค„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. + } else if (snapshot.hasData && checkSignUp == false) { + // ์‚ฌ์šฉ์ž๊ฐ€ ๋กœ๊ทธ์ธํ•œ ๊ฒฝ์šฐ, ๋กœ๊ทธ์ธ๋œ ํ™”๋ฉด์œผ๋กœ ์ด๋™ + // ํ† ํฐ ํŒจ์น˜ + fetchSignInToken(FirebaseAuth.instance.currentUser!.uid); + if(play){ + if(station.contains("0")){ + player.setAsset(musics[0]); + player.play(); + } else if(station.contains("1")){ + player.setAsset(musics[0]); + player.play(); + } else if(station.contains("2")){ + player.setAsset(musics[0]); + player.play(); + } else if(station.contains("3")){ + player.setAsset(musics[0]); + player.play(); + } else if(station.contains("4")){ + player.setAsset(musics[0]); + player.play(); + } + } + //return userNew? MyScreenPage(title: 'ํ™ˆ') : IntroPage(); + //return CheckUserPage(title: "title"); + return MyScreenPage(title: 'ํ™ˆ'); + } else if(snapshot.hasData && checkSignUp == true){ + return IntroStoryPage(); + } + else { + // ์‚ฌ์šฉ์ž๊ฐ€ ๋กœ๊ทธ์ธํ•˜์ง€ ์•Š์€ ๊ฒฝ์šฐ, ๋กœ๊ทธ์ธ ํ™”๋ฉด์œผ๋กœ ์ด๋™ + print("๋กœ๊ทธ์ธ ์•ˆ ํ–ˆ๊ฑฐ๋‚˜ ์˜ˆ์™ธ์ˆ˜ ๋ฐœ๊ฒฌ"); + //print(sign_in.checkSignIn); + return sign_in.SignInPage(); + } + }, + ), - ThemeStyle _currentStyle = ThemeStyle.BlurEffect; - List _badgeCounts = List.generate(4, (index) => index); + //SignInPage(), + theme: ThemeData( + scaffoldBackgroundColor: Color(0xffDDE7FD), + bottomSheetTheme: BottomSheetThemeData( + backgroundColor: Colors.white.withOpacity(0) + ) + ), + // getPages: [ + // GetPage(name: '/login', page: () => LoginPage()), + // ], + ); + } +} - List _badgeShows = List.generate(4, (index) => true); - static const TextStyle optionStyle = - TextStyle(fontSize: 30, fontWeight: FontWeight.bold); - final List _widgetOptions = [ - HomePage(), - Text( - 'Index 1: Gallery', - style: optionStyle, - ), - Text( - 'Index 2: Comunity', - style: optionStyle, - ), - Text( - 'Index 3: Mypage', - style: optionStyle, - ), - ]; +class CustomError extends StatelessWidget { + final FlutterErrorDetails errorDetails; - void _onItemTapped(int index) { - setState(() { - _selectedIndex = index; - }); - } + const CustomError({ + Key? key, + required this.errorDetails, + }) : super(key: key); - // ๋ฉ”์ธ ์œ„์ ฏ @override Widget build(BuildContext context) { - MediaQueryData deviceData = MediaQuery.of(context); - Size screenSize = deviceData.size; - return Scaffold( - // extendBody for floating bar get better perfomance - extendBody: true, - backgroundColor: Colors.white, - body: Container( - width: screenSize.width, - //padding: EdgeInsets.only(bottom: 20), - child: _widgetOptions.elementAt(_selectedIndex), - ), - bottomNavigationBar: _buildBlurEffect(), - ); - } - - - Widget _buildBottomNavigationBar() { - switch (_currentStyle) { - case ThemeStyle.BlurEffect: - return _buildBlurEffect(); - default: - return _buildBlurEffect(); - } - } - - Widget _buildTitle() { - return CustomNavigationBar( - iconSize: 30.0, - selectedColor: Color(0xff040307), - strokeColor: Color(0x30040307), - unSelectedColor: Color(0xffacacac), backgroundColor: Colors.white, - items: [ - CustomNavigationBarItem( - icon: Icon(Icons.home), - title: Text("Home"), - ), - CustomNavigationBarItem( - icon: Icon(Icons.shopping_cart), - title: Text("Cart"), - ), - CustomNavigationBarItem( - icon: Icon(Icons.lightbulb_outline), - title: Text("Explore"), - ), - CustomNavigationBarItem( - icon: Icon(Icons.search), - title: Text("Search"), - ), - CustomNavigationBarItem( - icon: Icon(Icons.account_circle), - title: Text("Me"), - ), - ], - currentIndex: _currentIndex, - onTap: (index) { - setState(() { - _currentIndex = index; - }); - }, - ); - } + body: Padding( + padding: const EdgeInsets.all(16.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ - // Widget _buildBlurEffect() { - // print("notification"); - // return CustomNavigationBar( - // iconSize: 30.0, - // selectedColor: Color(0xff040307), - // strokeColor: Color(0x30040307), - // unSelectedColor: Color(0xffacacac), - // backgroundColor: Colors.white, - // items: [ - // CustomNavigationBarItem( - // icon: Icon(Icons.home), - // badgeCount: _badgeCounts[0], - // showBadge: _badgeShows[0], - // ), - // CustomNavigationBarItem( - // icon: Icon(Icons.shopping_bag), - // badgeCount: _badgeCounts[1], - // showBadge: _badgeShows[1], - // ), - // CustomNavigationBarItem( - // icon: Icon(Icons.lightbulb_outline), - // badgeCount: _badgeCounts[2], - // showBadge: _badgeShows[2], - // ), - // CustomNavigationBarItem( - // icon: Icon(Icons.search), - // badgeCount: _badgeCounts[3], - // showBadge: _badgeShows[3], - // ), - // CustomNavigationBarItem( - // icon: Icon(Icons.account_circle), - // badgeCount: _badgeCounts[4], - // showBadge: _badgeShows[4], - // ), - // ], - // currentIndex: _currentIndex, - // onTap: (index) { - // setState(() { - // _currentIndex = index; - // _badgeShows[index] = false; - // }); - // }, - // ); - // } - - Widget _buildBlurEffect() { - return CustomNavigationBar( - iconSize: 20.0, - selectedColor: Colors.deepPurpleAccent, - strokeColor: Colors.white, - unSelectedColor: Colors.grey[600], - backgroundColor: Colors.white, - borderRadius: Radius.circular(30.0), - blurEffect: true, - opacity: 0.7, - items: [ - CustomNavigationBarItem( - icon: Icon( - Icons.home, - ), - ), - CustomNavigationBarItem( - icon: Icon( - Icons.image, - ), - ), - CustomNavigationBarItem( - icon: Icon( - Icons.connect_without_contact_rounded, - ), + ], ), - CustomNavigationBarItem( - icon: Icon( - Icons.person, - ), - ), - ], - currentIndex: _currentIndex, - onTap: (index) { - setState(() { - _currentIndex = index; - }); - }, - isFloating: true, + ), ); } -} - - +} \ No newline at end of file diff --git a/client/lib/memorial/memorial_detail.dart b/client/lib/memorial/memorial_detail.dart index e85d40c..a7a0fc1 100644 --- a/client/lib/memorial/memorial_detail.dart +++ b/client/lib/memorial/memorial_detail.dart @@ -1,13 +1,18 @@ +import 'dart:async'; import 'dart:convert'; import 'package:flutter_svg/svg.dart'; import 'package:get/get.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +import 'package:client/screen.dart'; import 'package:client/style.dart'; import 'package:flutter/services.dart'; import 'package:intl/intl.dart'; import 'memorial_main.dart' as main; import 'package:http/http.dart' as http; +import 'package:client/sign/sign_in.dart' as sign_in; +import 'package:client/memorial/slide/flutter_image_slideshow.dart'; +import 'package:client/home.dart' as home; class MemorialDetailPage extends StatefulWidget { @override @@ -17,9 +22,11 @@ class MemorialDetailPage extends StatefulWidget { class _MemorialDetailPageState extends State { // ํ™”๋ฉด์— ๋ณด์ด๋Š” UI ์„ค์ • bool + bool fetchSuccess = false; bool askHelp = true; bool sendHelp = false; + bool addComment = false; // ๋ฐ”๋กœ ์ฝ”๋ฉ˜ํŠธ ๋ถ™์˜€์„ ๋•Œ bool isComment = false; // ์ฝ”๋ฉ˜ํŠธ ์ˆ˜์™€ ์ข‹์•„์š” ์ˆ˜ @@ -30,17 +37,19 @@ class _MemorialDetailPageState extends State { late List parsedResponseCM; // ๋Œ“๊ธ€ late bool myHeart; // ๋‚ด๊ฐ€ ์ข‹์•„์š” ๋ˆŒ๋ €๋Š”์ง€ + List parsedResponseIMGS = []; // ์ด๋ฏธ์ง€ ๊ฐœ์ˆ˜ + // ํ…์ŠคํŠธ์—๋””ํŒ…์ปจํŠธ๋กค๋Ÿฌ๋ฅผ ์ƒ์„ฑํ•˜์—ฌ ํ•„๋“œ์— ํ• ๋‹น final myController = TextEditingController(); // ๊ธ€๋‚ด์šฉ ๊ฐ€์ ธ์˜ค๊ธฐ - void fetchWithHeaders() async { + void fetchWithHeaders(String aToken) async { // API ์—”๋“œํฌ์ธํŠธ URL String apiUrl = 'http://3.38.1.125:8080/memorial?postId=${main.postId.toString()}'; // ์‹ค์ œ API ์—”๋“œํฌ์ธํŠธ๋กœ ๋ณ€๊ฒฝํ•˜์„ธ์š” // ํ—ค๋” ์ •๋ณด ์„ค์ • Map headers = { - 'Authorization': 'axNNnzcfJaSiTPI6kW23G2Vns9o1', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• + 'Authorization': 'Bearer $aToken', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• 'Content-Type': 'application/json', // ์˜ˆ: JSON ์š”์ฒญ์ธ ๊ฒฝ์šฐ ํ—ค๋” ์„ค์ • }; @@ -53,22 +62,66 @@ class _MemorialDetailPageState extends State { // HTTP ์‘๋‹ต ์ƒํƒœ ํ™•์ธ if (response.statusCode == 200) { // ์‘๋‹ต ๋ฐ์ดํ„ฐ ์ฒ˜๋ฆฌ + fetchSuccess = true; + setState(() {}); print('์„œ๋ฒ„๋กœ๋ถ€ํ„ฐ ๋ฐ›์€ ๋‚ด์šฉ ๋ฐ์ดํ„ฐ: ${response.body}'); var jsonResponse = utf8.decode(response.bodyBytes); parsedResponseCN = json.decode(jsonResponse); + // List ํ˜•์‹ + print("image test" + parsedResponseCN['imageList'][0].toString()); + + hearts = parsedResponseCN['likes']; + setState(() { + + }); + + for(int i = 0; i headers = { + 'Authorization': 'Bearer $aToken', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• + 'Content-Type': 'application/json', // ์˜ˆ: JSON ์š”์ฒญ์ธ ๊ฒฝ์šฐ ํ—ค๋” ์„ค์ • + }; + + // HTTP GET ์š”์ฒญ ๋ณด๋‚ด๊ธฐ + var response = await http.delete( + Uri.parse(apiUrl), + headers: headers, // ํ—ค๋” ์ถ”๊ฐ€ + ); + + ///var jsonResponse = utf8.decode(response.bodyBytes); + // HTTP ์‘๋‹ต ์ƒํƒœ ํ™•์ธ + if (response.statusCode == 200) { + // ์‘๋‹ต ๋ฐ์ดํ„ฐ๋ฅผ JSON ํ˜•์‹์œผ๋กœ ๋””์ฝ”๋”ฉ + print("์‚ญ์ œ์„ฑ๊ณต"); + setState(() { + }); + } else { + // ์š”์ฒญ์ด ์‹คํŒจํ•œ ๊ฒฝ์šฐ ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌ + print('HTTP ์š”์ฒญ ์‹คํŒจ: ${response.statusCode}'); + } + } - void fetchData() async { + void fetchData(String aToken) async { // API ์—”๋“œํฌ์ธํŠธ URL - String apiUrl = 'http://3.38.1.125:8080/memorial?postId=${main.postId.toString()}'; /// postId=1 ์ถ”ํ›„์— ๋ฐ”๊ฟ”์ฃผ๊ธฐ + String apiUrl = 'http://3.38.1.125:8080/memorial?postId=${main.postId.toString()}'; // HTTP GET ์š”์ฒญ ๋ณด๋‚ด๊ธฐ var response = await http.get(Uri.parse(apiUrl)); @@ -128,7 +181,7 @@ class _MemorialDetailPageState extends State { } // ๋Œ“๊ธ€ ์ €์žฅํ•˜๊ธฐ (POST) - void saveComment(String content) async { + void saveComment(String aToken, String content) async { // ์š”์ฒญ ๋ณธ๋ฌธ ๋ฐ์ดํ„ฐ var data = { @@ -137,7 +190,7 @@ class _MemorialDetailPageState extends State { // ํ—ค๋” ์ •๋ณด ์„ค์ • Map headers = { - 'Authorization': 'axNNnzcfJaSiTPI6kW23G2Vns9o1', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• + 'Authorization': 'Bearer $aToken', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• 'Content-Type': 'application/json', // ์˜ˆ: JSON ์š”์ฒญ์ธ ๊ฒฝ์šฐ ํ—ค๋” ์„ค์ • }; @@ -165,7 +218,6 @@ class _MemorialDetailPageState extends State { setState(() { }); - print('API ํ˜ธ์ถœ ์„ฑ๊ณต!!: ${response.statusCode}'); } else { // ์š”์ฒญ ์‹คํŒจ ์‹œ์˜ ์ฒ˜๋ฆฌ @@ -177,8 +229,121 @@ class _MemorialDetailPageState extends State { } } + int comIndex = 0; // ์‚ญ์ œํ•  ๋Œ“๊ธ€ ์ธ๋ฑ์Šค + + // ๋Œ“๊ธ€ ์‚ญ์ œํ•˜๊ธฐ + void deleteComment(String aToken, int commentId) async { + // API ์—”๋“œํฌ์ธํŠธ URL + String apiUrl = 'http://3.38.1.125:8080/memorial/comment?commentId=${commentId}'; + + // ํ—ค๋” ์ •๋ณด ์„ค์ • + Map headers = { + 'Authorization': 'Bearer $aToken', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• + 'Content-Type': 'application/json', // ์˜ˆ: JSON ์š”์ฒญ์ธ ๊ฒฝ์šฐ ํ—ค๋” ์„ค์ • + }; + + // HTTP GET ์š”์ฒญ ๋ณด๋‚ด๊ธฐ + var response = await http.delete( + Uri.parse(apiUrl), + headers: headers, // ํ—ค๋” ์ถ”๊ฐ€ + ); + + ///var jsonResponse = utf8.decode(response.bodyBytes); + // HTTP ์‘๋‹ต ์ƒํƒœ ํ™•์ธ + if (response.statusCode == 200) { + // ์‘๋‹ต ๋ฐ์ดํ„ฐ๋ฅผ JSON ํ˜•์‹์œผ๋กœ ๋””์ฝ”๋”ฉ + print("์‚ญ์ œ์„ฑ๊ณต"); + setState(() { + }); + + } else { + // ์š”์ฒญ์ด ์‹คํŒจํ•œ ๊ฒฝ์šฐ ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌ + print('HTTP ์š”์ฒญ ์‹คํŒจ: ${response.statusCode}'); + } + } + + // ๋Œ“๊ธ€ ์‚ญ์ œ ํŒ์—… + void FlutterDialog2() { + showDialog( + context: context, + builder: (_) => new AlertDialog( + shape: RoundedRectangleBorder( + borderRadius: + BorderRadius.all( + Radius.circular(12.0))), + content: Builder( + builder: (context) { + + return Container( + height: 298, + width: 412, + child: + Padding(padding: EdgeInsets.all(0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SizedBox(height: 12,), + Container( + width: 125, + height: 117, + child: SvgPicture.asset( + 'assets/images/no_result.svg', + width: 132, + height: 123, + fit: BoxFit.contain, + ), + ), + SizedBox(height: 32,), + Text("๋Œ“๊ธ€์„ ์‚ญ์ œ ํ•˜์‹œ๊ฒ ์–ด์š”?",style: textStyle.bk16bold,), + SizedBox(height: 8,), + Text("์‚ญ์ œํ•œ ํ›„, ๋‚ด์šฉ์ด ๋ณต๊ตฌ๋˜์ง€ ์•Š์•„์š”!", style: textStyle.bk14normal,), + SizedBox(height: 32,), + Row( + children: [ + Container( + height: 40, + width: 120, + child: ElevatedButton( + child: new Text("์ทจ์†Œ", style: textStyle.purple16midium), + style: buttonChart().purplebtn3, + onPressed: () { + Navigator.pop(context); + }, + ), + ), + SizedBox(width: 16,), + Container( + height: 40, + width: 120, + child: ElevatedButton( + child: new Text("์‚ญ์ œํ•˜๊ธฐ", style: textStyle.white16semibold), + style: buttonChart().purplebtn, + onPressed: () { + + // ์„œ๋ฒ„์— ์ „์†ก + deleteComment(sign_in.userAccessToken, comIndex); + setState(() {}); + Timer(Duration(milliseconds: 500), () { + fetchDataComment(); + }); + + Navigator.pop(context); + }, + ), + ), + ], + ) + ], + ),) + ); + }, + ), + ) + ); + } + // ์ข‹์•„์š” ๋ˆ„๋ฅด๊ธฐ(POST) - void sendPostRequest() async { + void sendPostRequest(String aToken) async { // API ์—”๋“œํฌ์ธํŠธ URL String apiUrl = 'http://3.38.1.125:8080/memorial/like?postId=${main.postId.toString()}'; // ์‹ค์ œ API ์—”๋“œํฌ์ธํŠธ๋กœ ๋ณ€๊ฒฝํ•˜์„ธ์š” @@ -186,7 +351,7 @@ class _MemorialDetailPageState extends State { var response = await http.post( Uri.parse(apiUrl), headers: { - 'Authorization': 'axNNnzcfJaSiTPI6kW23G2Vns9o1', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• + 'Authorization': 'Bearer $aToken', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• 'Content-Type': 'application/json', // ์˜ˆ: JSON ์š”์ฒญ์ธ ๊ฒฝ์šฐ ํ—ค๋” ์„ค์ • //'Content-Type': 'application/json', }, // ์š”์ฒญ ํ—ค๋”์— Content-Type ์„ค์ • @@ -208,13 +373,13 @@ class _MemorialDetailPageState extends State { // ์ข‹์•„์š” ๊ฐ€์ ธ์˜ค๊ธฐ- ํด๋ฆญ์—ฌ๋ถ€ ํ™•์ธ(GET) - void fetchDataLike() async { + void fetchDataLike(String aToken) async { // API ์—”๋“œํฌ์ธํŠธ URL String apiUrl = 'http://3.38.1.125:8080/memorial/like?postId=${main.postId.toString()}'; /// postId=1 ์ถ”ํ›„์— ๋ฐ”๊ฟ”์ฃผ๊ธฐ // ํ—ค๋” ์ •๋ณด ์„ค์ • Map headers = { - 'Authorization': 'axNNnzcfJaSiTPI6kW23G2Vns9o1', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• + 'Authorization': 'Bearer $aToken', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• 'Content-Type': 'application/json', // ์˜ˆ: JSON ์š”์ฒญ์ธ ๊ฒฝ์šฐ ํ—ค๋” ์„ค์ • }; @@ -234,12 +399,17 @@ class _MemorialDetailPageState extends State { myHeart = json.decode(jsonResponse); // ๋ฐ์ดํ„ฐ ์ฒ˜๋ฆฌ - print('์ข‹์•„์š”~: $myHeart'); - if(myHeart == true){ - hearts = 1; - } else{ - hearts = 0; - } + print('์ข‹์•„์š”: $myHeart'); + // if(myHeart == true){ + // hearts++; + // } else{ + // if(hearts>=1){ + // hearts--; + // }else{ + // + // } + // + // } setState(() { }); @@ -250,7 +420,6 @@ class _MemorialDetailPageState extends State { } } - /// ์˜๋ฌธ: ์ข‹์•„์š” ์ˆ˜๋Š” ์–ด๋–ป๊ฒŒ ๊ฐ€์ ธ์˜ค์ง€?? @override void initState() { @@ -258,38 +427,221 @@ class _MemorialDetailPageState extends State { SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: [SystemUiOverlay.top]); print("test" + main.postId.toString()); //fetchData(); - fetchWithHeaders(); + fetchWithHeaders(sign_in.userAccessToken); fetchDataComment(); - fetchDataLike(); + fetchDataLike(sign_in.userAccessToken); setState(() { - }); } + // ๋Œ“๊ธ€ ์œ„์ ฏ + Widget listview_builder(){ + return ListView.builder( + shrinkWrap: true, + scrollDirection: Axis.vertical, + padding: EdgeInsets.all(0), + physics: NeverScrollableScrollPhysics(), + itemCount: parsedResponseCM.length, + itemBuilder: (BuildContext context, int index){ + return Column( + children: [ + Container( + padding: EdgeInsets.fromLTRB(16, 16, 0, 16), + height: 104, + width: Get.width, + decoration: BoxDecoration( + color: Colors.white, + //borderRadius: BorderRadius.circular(16), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + if(parsedResponseCM[index]['profileImage'].toString() == "null")...[ + CircleAvatar( + radius: 10, + child: SvgPicture.asset('assets/images/user_null2.svg',), + ), + ]else...[ + CircleAvatar( + radius: 10, + backgroundImage: NetworkImage(parsedResponseCM[index]['profileImage'].toString()), + ), + ], + SizedBox(width: 8,), + Container(width: 55, + child: Text(parsedResponseCM[index]['nickname'], style: textStyle.bk12normal,),), + SizedBox(width: 204,), + Container(width: 78, height: 32, + child: TextButton(onPressed: (){ + comIndex = parsedResponseCM[index]['id']; + setState(() { + }); + FlutterDialog2(); + }, child: Row( + children: [ + Text("์‚ญ์ œํ•˜๊ธฐ", style: textStyle.grey12normal,), + SvgPicture.asset('assets/images/memorial/deletecom.svg',), + ], + ) + ), + ), + ], + ), + SizedBox(height: 6,), + Text(parsedResponseCM[index]['content'], style: textStyle.bk12normal,), + SizedBox(height: 6,), + Text(DateFormat('MM/dd HH:mm').format(DateTime.parse(parsedResponseCM[index]['createdAt'])).toString(), style: TextStyle(fontSize: 10, color: Color(0xffAAAAAA)),) + + //DateFormat('yy/MM/dd - HH:mm:ss').format(parsedResponse[0]['createdAt']) + ], + ), + ), + SizedBox(height: 4,), + ], + ); + + } + ); + } + + double calculateListViewHeight() { + // ๋ฆฌ์ŠคํŠธ๋ทฐ์˜ ์•„์ดํ…œ ์ˆ˜ + int itemCount = parsedResponseCM.length; + + // ๋ฆฌ์ŠคํŠธ๋ทฐ์˜ ์—ด ์ˆ˜ (3๊ฐœ์˜ ์•„์ดํ…œ์ด ํ•œ ํ–‰์— ์žˆ์„ ๋•Œ) + int columnCount = 1; + + // ์•„์ดํ…œ์˜ ๋†’์ด (๊ฐ€๋กœ:์„ธ๋กœ ๋น„์œจ์„ ์„ค์ •ํ•  ์ˆ˜ ์žˆ์Œ) + double itemHeight = 90; // ์ด ๊ฐ’์€ ์ ์ ˆํžˆ ์กฐ์ • + + // ์•„์ดํ…œ ๊ฐ„์˜ ์ˆ˜์ง ๊ฐ„๊ฒฉ + double crossAxisSpacing = 8.0; + + // ๋ฆฌ์ŠคํŠธ๋ทฐ์˜ ๋†’์ด ๊ณ„์‚ฐ + double listHeight = ((itemCount / columnCount).ceil() * itemHeight) + + ((itemCount / columnCount - 1).ceil() * crossAxisSpacing); + + return listHeight; + } + + // ๊ธ€ ์‚ญ์ œ ํŒ์—… + void FlutterDialog() { + showDialog( + context: context, + builder: (_) => new AlertDialog( + shape: RoundedRectangleBorder( + borderRadius: + BorderRadius.all( + Radius.circular(12.0))), + content: Builder( + builder: (context) { + + return Container( + height: 298, + width: 412, + child: + Padding(padding: EdgeInsets.all(0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SizedBox(height: 12,), + Container( + width: 125, + height: 117, + child: SvgPicture.asset( + 'assets/images/no_result.svg', + width: 132, + height: 123, + fit: BoxFit.contain, + ), + ), + SizedBox(height: 32,), + Text("๊ธ€์„ ์‚ญ์ œ ํ•˜์‹œ๊ฒ ์–ด์š”?",style: textStyle.bk16bold,), + SizedBox(height: 8,), + Text("์‚ญ์ œํ•œ ํ›„, ๋‚ด์šฉ์ด ๋ณต๊ตฌ๋˜์ง€ ์•Š์•„์š”!", style: textStyle.bk14normal,), + SizedBox(height: 32,), + Row( + children: [ + Container( + height: 40, + width: 120, + child: ElevatedButton( + child: new Text("์ทจ์†Œ", style: textStyle.purple16midium), + style: buttonChart().purplebtn3, + onPressed: () { + Navigator.pop(context); + }, + ), + ), + SizedBox(width: 16,), + Container( + height: 40, + width: 120, + child: ElevatedButton( + child: new Text("์‚ญ์ œํ•˜๊ธฐ", style: textStyle.white16semibold), + style: buttonChart().purplebtn, + onPressed: () { + + // ์„œ๋ฒ„์— ์ „์†ก + deleteContent(sign_in.userAccessToken); + setState(() {}); + + // ์ด ์‚ฌ์šฉ์ž์˜ ํ•จ๊ป˜ํ• ๊ฐœ ํ™ˆ์œผ๋กœ ๋Œ์•„๊ฐ€์•ผํ•จ + Navigator.pop(context); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => MyScreenPage(title: 'ํ™ˆํŽ˜์ด์ง€ ์ด๋™'))); + }, + ), + ), + ], + ) + ], + ),) + ); + }, + ), + ) + ); + } + @override Widget build(BuildContext context) { return Scaffold( - appBar: AppBar( - leading: IconButton( - icon: Icon(Icons.arrow_back_ios_rounded, color: Colors.black), - onPressed: () => Navigator.of(context).pop(), + appBar: PreferredSize( + preferredSize: Size.fromHeight(72), + child: AppBar( + actions: [ + Padding(padding: EdgeInsets.only(top:15), + child: new IconButton( + icon:SvgPicture.asset( + 'assets/images/memorial/delete.svg',), + onPressed: (){ + // ์‚ญ์ œ ํŒ์—… + FlutterDialog(); + }, + ), + ), + + ], + leading: Padding( + padding: EdgeInsets.only(top: 20), + child: IconButton( + icon: Icon(Icons.arrow_back_ios_rounded, color: Colors.black), + onPressed: () => Navigator.of(context).pop(), + ), + ), + backgroundColor: Color(0xffDDE7FD), + elevation: 0.0, + iconTheme: IconThemeData(color: Colors.black), ), - backgroundColor: Color(0xffF3F3F3), - elevation: 0.0, - iconTheme: IconThemeData(color: Colors.black), - actions: [ - IconButton(onPressed: (){ - print("refresh~"); - fetchDataComment(); - fetchDataLike(); - setState(() { - }); - }, icon: Icon(Icons.menu)) - ], ), body: Container( - color: Color(0xffF3F3F3), + color: Color(0xffDDE7FD), width: Get.width, height: Get.height, child: SingleChildScrollView( @@ -300,231 +652,275 @@ class _MemorialDetailPageState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Container( - width: Get.width, - //height: 576, - color: Colors.white, - child: - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding(padding: EdgeInsets.all(10), - child: Column( - children: [ - Container( - width: Get.width, - height: Get.width, - child: ClipRRect( - borderRadius: BorderRadius.circular(16.0), - child: Image.network(main.selectedImage, fit: BoxFit.cover,), - ), - ), - SizedBox(height: 15,), - Row( + if(fetchSuccess)...[ + ClipRRect( + borderRadius: BorderRadius.only(topLeft: Radius.circular(16.0), topRight: Radius.circular(16.0)), + child: Container( + width: Get.width, + //height: 576, + color: Colors.white, + child: + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding(padding: EdgeInsets.all(16), + child: Column( children: [ Container( - width: 120, - height: 30, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text("${parsedResponseCN['date']}์˜ ๊ธฐ์–ต", style: textStyle.grey12normal,), - SizedBox(height: 3,), - Text(parsedResponseCN['place'], style: textStyle.grey12normal) - ], + width: Get.width, + height: Get.width -32, + child: ClipRRect( + borderRadius: BorderRadius.circular(16.0), + child: + ImageSlideshow( + indicatorColor: Color(0xffFEFBAC), + onPageChanged: (value) { + debugPrint('Page changed: $value'); + }, + //autoPlayInterval: 3000, + isLoop: false, + children: [ + for(int i= 0; i= 1)...[ - Container( - width: 24, - height: 24, - child: InkWell( - onTap: (){ - // ์ข‹์•„์š” ๋ˆ„๋ฅด๊ธฐ - sendPostRequest(); - fetchDataLike(); - //hearts= 0; - setState(() { - }); - }, - child: SvgPicture.asset( - 'assets/images/memorial/heart-fill.svg', - ), - ),), - ] else...[ - Container( - width: 24, - height: 24, - child: InkWell( - onTap: (){ - // ์ข‹์•„์š” ๋ˆ„๋ฅด๊ธฐ - sendPostRequest(); - fetchDataLike(); - setState(() { - }); - }, - child: SvgPicture.asset( - 'assets/images/memorial/heart-empty.svg', - ), - ), + width: 145, + height: 32, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text("${parsedResponseCN['date']}์˜ ๊ธฐ์–ต", style: textStyle.grey12normal,), + SizedBox(height: 4,), + Text(parsedResponseCN['place'], style: textStyle.grey12normal) + ], ), - ], - SizedBox( width: 3,), - Text('${hearts}'), - ], - ) - - - ], - ), - SizedBox(height: 15,), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text(parsedResponseCN['title'],style: textStyle.bk16bold,), - SizedBox(height: 5,), - Container(width: Get.width, - //height: 30, - child: Text(parsedResponseCN['content'], style: textStyle.bk14normal,), - ), - SizedBox(height: 5,), - Container(width: Get.width, - height: 10, - child: Text('#${parsedResponseCN['hashtag']}', style: textStyle.grey12normal), - ), - SizedBox(height: 5,), - ], - ), - ], - ),), + ), + SizedBox(width: 125,), + Row( + children: [ + Container( + width: 19, + height: 19, + child: InkWell( + onTap: (){}, + child: SvgPicture.asset( + 'assets/images/memorial/comments.svg', + ), + ),), + SizedBox( width: 3,), + Text('${comments}'), + SizedBox( width: 10,), + if(hearts >= 1)...[ + Container( + child: InkWell( + onTap: (){ + // ์ข‹์•„์š” ๋ˆ„๋ฅด๊ธฐ + sendPostRequest(sign_in.userAccessToken); + //fetchDataLike(sign_in.userAccessToken); + hearts--; + setState(() { + }); + }, + child: SvgPicture.asset( + 'assets/images/memorial/heart-fill.svg', + ), + ),), + ] else...[ + SizedBox(width: 2,), + Container( + child: InkWell( + onTap: (){ + // ์ข‹์•„์š” ๋ˆ„๋ฅด๊ธฐ + sendPostRequest(sign_in.userAccessToken); + //fetchDataLike(sign_in.userAccessToken); + hearts++; + setState(() { + }); + }, + child: SvgPicture.asset( + 'assets/images/memorial/heart-empty.svg', + ), + ), + ), + ], + SizedBox( width: 3,), + Text('${hearts}'), + ], + ) - ], - ), - ), - SizedBox(height: 15,), - Container( - height: 200, - child: SingleChildScrollView( - scrollDirection: Axis.vertical, - child: Column( - children: [ - if(isComment)...[ - for(int i=0; i[ - Container( - width: Get.width, - height: 40, - decoration: BoxDecoration( - color: Colors.white, - border: Border.all(color: Color(colorChart.blue)), - borderRadius: BorderRadius.circular(30), + Container( + color: Color(0xffF2F4F6), + height: 48, + child: Padding( + padding: const EdgeInsets.only(bottom: 8.0, top: 8.0, left: 16,right: 16), + child: Stack( + children: [ + Container( + width: Get.width, + height: 48, + decoration: BoxDecoration( + color: Colors.white, + border: Border.all(color: addComment? Color(colorChart.blue):Color(0xffC0D2FC)), + borderRadius: BorderRadius.circular(30), + ), ), - ), - Positioned( - left: 20, - right: 30, - bottom: 1, - top: 1, - child: TextField( - controller: myController, - decoration: InputDecoration( - border: InputBorder.none, hintText: '๋Œ“๊ธ€์„ ์ž…๋ ฅํ•˜๋ ค๋ฉด ์—ฌ๊ธฐ๋ฅผ ํƒญํ•˜์„ธ์š”.'), - onChanged: (s) { - //text = s; - }, - onTap: (){ - - }, - ), - ), - Positioned( - left: Get.width - 78, - //right: 30, - bottom: 3, - top: 3, - child: ElevatedButton( - onPressed: () { - saveComment(myController.text); + Positioned( + left: 15, + right: 30, + bottom:-4, + child: TextField( + textAlignVertical: TextAlignVertical.center, + maxLines: 1, + controller: myController, + style: textStyle.bk14normal, + decoration: InputDecoration( + hintStyle: textStyle.grey14normal, + border: InputBorder.none, hintText: '๋Œ“๊ธ€์„ ์ž…๋ ฅํ•˜๋ ค๋ฉด ์—ฌ๊ธฐ๋ฅผ ํƒญํ•˜์„ธ์š”.'), + onChanged: (s) { + //text = s; + addComment = true; setState(() { + }); - myController.clear(); }, - style: ElevatedButton.styleFrom( - backgroundColor: Color(colorChart.blue), - fixedSize: const Size(23, 23), - shape: const CircleBorder(), - ), - child:Icon(Icons.arrow_upward, color: Colors.white,) + onTap: (){ + + }, + ), ), - ), - ], + Positioned( + left: Get.width - 81, + //right: 30, + bottom: 3, + top: 3, + child: ElevatedButton( + onPressed: () { + if(addComment){ + saveComment(sign_in.userAccessToken, myController.text); + } + addComment = false; + setState(() { + }); + myController.clear(); + Timer(Duration(milliseconds: 500), () { + fetchDataComment(); + }); + setState(() { + }); + }, + style: ElevatedButton.styleFrom( + backgroundColor: addComment?Color(colorChart.blue):Color(0xffDDE7FD), + fixedSize: const Size(23, 23), + shape: const CircleBorder(), + ), + child:Icon(Icons.arrow_upward, color: Colors.white,size: 16,) + ), + ), + ], + ), ), - ), + ) ], ), ) diff --git a/client/lib/memorial/memorial_main.dart b/client/lib/memorial/memorial_main.dart index 6141b3d..ff542b0 100644 --- a/client/lib/memorial/memorial_main.dart +++ b/client/lib/memorial/memorial_main.dart @@ -1,8 +1,11 @@ import 'dart:convert'; +import 'dart:async'; import 'package:flutter_svg/svg.dart'; import 'package:get/get.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +import 'package:client/conversation/intro/intro_memorial.dart'; +import 'package:client/memorial/modify_profile.dart'; import 'package:client/memorial/write_memorial.dart'; import 'package:client/style.dart'; import 'package:flutter/services.dart'; @@ -10,35 +13,23 @@ import 'package:image_picker/image_picker.dart'; import 'package:http/http.dart' as http; import 'memorial_detail.dart'; import 'watch_others.dart'; +import 'write_memorial.dart'; +import 'package:client/sign/sign_in.dart' as sign_in; -class MemorialMain0919Page extends StatefulWidget { +class MemorialMainPage extends StatefulWidget { @override - State createState() => _MemorialMain0919PageState(); + State createState() => _MemorialMainPageState(); } String selectedImage = ""; int postId = 0; +bool inUser = false; +String _dataFromPage = ''; - -class Todos { - String? posts; - - Todos({this.posts}); - - Todos.fromJson(Map json) { - posts = json['posts']; - } - - Map toJson() { - final Map data = new Map(); - data['posts'] = this.posts; - return data; - } -} - -class _MemorialMain0919PageState extends State { +class _MemorialMainPageState extends State { // ํ™”๋ฉด์— ๋ณด์ด๋Š” UI ์„ค์ • bool + bool fetchDataSuccess = false; bool askHelp = true; bool sendHelp = false; @@ -46,70 +37,18 @@ class _MemorialMain0919PageState extends State { List con0Text =[]; - void _callAPI2() async { - var url = Uri.parse( - 'http://3.38.1.125:8080/memorial/all', - ); - var response = await http.get(url); - print('Response status: ${response.statusCode}'); - print('Response body: ${response.body}'); - - // url = Uri.parse('https://reqbin.com/sample/post/json'); - // response = await http.post(url, body: { - // 'key': 'value', - // }); - // print('Response status: ${response.statusCode}'); - // print('Response body: ${response.body}'); - } - - - Future> fetchTodos() async { - final response = await http.get( - Uri.parse('http://3.38.1.125:8080/memorial/all') - ); - - if(response.statusCode == 255){ - return (jsonDecode(response.body) as List) - .map((e) => Todos.fromJson(e)) - .toList(); - } else { - throw Exception('Failed to load album'); - } - } - - void fetchData() async { - // API ์—”๋“œํฌ์ธํŠธ URL - String apiUrl = 'http://3.38.1.125:8080/memorial/comment?postId=2'; // ์‹ค์ œ API ์—”๋“œํฌ์ธํŠธ๋กœ ๋ณ€๊ฒฝํ•˜์„ธ์š” - - // HTTP GET ์š”์ฒญ ๋ณด๋‚ด๊ธฐ - var response = await http.get(Uri.parse(apiUrl)); - - ///var jsonResponse = utf8.decode(response.bodyBytes); - // HTTP ์‘๋‹ต ์ƒํƒœ ํ™•์ธ - if (response.statusCode == 200) { - // ์‘๋‹ต ๋ฐ์ดํ„ฐ๋ฅผ JSON ํ˜•์‹์œผ๋กœ ๋””์ฝ”๋”ฉ - var data = json.decode(response.body); - var jsonResponse = utf8.decode(response.bodyBytes); - - // ๋ฐ์ดํ„ฐ ์ฒ˜๋ฆฌ - print('์„œ๋ฒ„๋กœ๋ถ€ํ„ฐ ๋ฐ›์€ ๋ฐ์ดํ„ฐ: $jsonResponse'); - } else { - // ์š”์ฒญ์ด ์‹คํŒจํ•œ ๊ฒฝ์šฐ ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌ - print('HTTP ์š”์ฒญ ์‹คํŒจ: ${response.statusCode}'); - } - } - late Map parsedResponseCN; // ๊ธ€ ๋‚ด์šฉ late List postsList; // ํฌ์ŠคํŠธ ํ•˜๋‚˜ ๋‚ด์šฉ - void fetchWithHeaders() async { + void fetchWithHeaders(String aToken) async { + // API ์—”๋“œํฌ์ธํŠธ URL String apiUrl = 'http://3.38.1.125:8080/memorial/all'; // ์‹ค์ œ API ์—”๋“œํฌ์ธํŠธ๋กœ ๋ณ€๊ฒฝํ•˜์„ธ์š” // ํ—ค๋” ์ •๋ณด ์„ค์ • Map headers = { - 'Authorization': 'axNNnzcfJaSiTPI6kW23G2Vns9o1', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• + 'Authorization': 'Bearer $aToken', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• 'Content-Type': 'application/json', // ์˜ˆ: JSON ์š”์ฒญ์ธ ๊ฒฝ์šฐ ํ—ค๋” ์„ค์ • }; @@ -122,6 +61,7 @@ class _MemorialMain0919PageState extends State { // HTTP ์‘๋‹ต ์ƒํƒœ ํ™•์ธ if (response.statusCode == 200) { // ์‘๋‹ต ๋ฐ์ดํ„ฐ ์ฒ˜๋ฆฌ + fetchDataSuccess = true; print('์„œ๋ฒ„๋กœ๋ถ€ํ„ฐ ๋ฐ›์€ ๋‚ด์šฉ ๋ฐ์ดํ„ฐ: ${response.body}'); var jsonResponse = utf8.decode(response.bodyBytes); @@ -154,71 +94,6 @@ class _MemorialMain0919PageState extends State { } } - void _callAPI() async { - - // ์š”์ฒญ ๋ณธ๋ฌธ ๋ฐ์ดํ„ฐ - var data = { - "Authorization" : "axNNnzcfJaSiTPI6kW23G2Vns9o1", - }; - - var url = Uri.parse('http://3.38.1.125:8080/memorial/all'); // ์—”๋“œํฌ์ธํŠธ URL ์„ค์ • - - try { - var response = await http.post( - url, - body: json.encode(data), // ์š”์ฒญ ๋ณธ๋ฌธ์— ๋ฐ์ดํ„ฐ๋ฅผ JSON ํ˜•์‹์œผ๋กœ ์ธ์ฝ”๋”ฉํ•˜์—ฌ ์ „๋‹ฌ - headers: {'Content-Type': 'application/json',}, // ์š”์ฒญ ํ—ค๋”์— Content-Type ์„ค์ • - ); - - if (response.statusCode == 200) { - // ์‘๋‹ต ์„ฑ๊ณต ์‹œ์˜ ์ฒ˜๋ฆฌ - - var jsonResponse = utf8.decode(response.bodyBytes); // ์‘๋‹ต ๋ณธ๋ฌธ์„ JSON ํ˜•์‹์œผ๋กœ ๋””์ฝ”๋”ฉ - // JSON ๊ฐ’์„ ํ™œ์šฉํ•œ ์›ํ•˜๋Š” ๋™์ž‘ ์ˆ˜ํ–‰ - //utf8.decode(jsonResponse); - print(jsonResponse); - - List contentList = []; - - List parsedResponse = json.decode(jsonResponse); - - setState(() { - for (var item in parsedResponse) { - if (item['content'] != null) { - con0Text.add(item['content']); - } - } - }); - - - print(con0Text); - - print('API ํ˜ธ์ถœ ์„ฑ๊ณต: ${response.statusCode}'); - } else { - // ์š”์ฒญ ์‹คํŒจ ์‹œ์˜ ์ฒ˜๋ฆฌ - print('API ํ˜ธ์ถœ ์‹คํŒจ: ${response.statusCode}'); - } - } catch (e) { - // ์˜ˆ์™ธ ๋ฐœ์ƒ ์‹œ์˜ ์ฒ˜๋ฆฌ - print('API ํ˜ธ์ถœ ์ค‘ ์˜ˆ์™ธ ๋ฐœ์ƒ: $e'); - } - } - - List parsedResponse = [ - 'https://images.unsplash.com/photo-1589965716319-4a041b58fa8a?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1974&q=80', - 'https://images.unsplash.com/photo-1546975490-a79abdd54533?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1887&q=80', - 'https://images.unsplash.com/photo-1628344806892-11873eba7974?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1887&q=80', - 'https://images.unsplash.com/photo-1618901277211-00af8265a94d?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1974&q=80', - 'https://images.unsplash.com/photo-1561852184-92b9bb821045?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=2073&q=80', - 'https://images.unsplash.com/photo-1636910825807-171715240043?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1992&q=80', - 'https://images.unsplash.com/photo-1546975554-31053113e977?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=2071&q=80', - 'https://images.unsplash.com/photo-1634635880938-d81e973bcd6c?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1935&q=80', - 'https://images.unsplash.com/photo-1534176043700-789edb4e2f91?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=2070&q=80', - 'https://images.unsplash.com/photo-1549950844-e6a5d47f8324?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=2071&q=80', - 'https://images.unsplash.com/photo-1636910824730-4eaf1603a3e4?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1950&q=80', - 'https://images.unsplash.com/photo-1636910824657-4be41fdf713a?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1935&q=80' - ]; - XFile? _image; //์ด๋ฏธ์ง€๋ฅผ ๋‹ด์„ ๋ณ€์ˆ˜ ์„ ์–ธ final ImagePicker picker = ImagePicker(); //ImagePicker ์ดˆ๊ธฐํ™” @@ -233,89 +108,224 @@ class _MemorialMain0919PageState extends State { } } - late Future> futureTodos; @override void initState() { super.initState(); SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: [SystemUiOverlay.top]); - fetchWithHeaders(); + fetchWithHeaders(sign_in.userAccessToken); + + Timer(Duration(milliseconds: 500), () { + fetchWithHeaders(sign_in.userAccessToken); + }); + } + + double calculateGridViewHeight() { + // ๊ทธ๋ฆฌ๋“œ๋ทฐ์˜ ์•„์ดํ…œ ์ˆ˜ + int itemCount = postsList.length; + + // ๊ทธ๋ฆฌ๋“œ๋ทฐ์˜ ์—ด ์ˆ˜ (3๊ฐœ์˜ ์•„์ดํ…œ์ด ํ•œ ํ–‰์— ์žˆ์„ ๋•Œ) + int columnCount = 3; + + // ์•„์ดํ…œ์˜ ๋†’์ด (๊ฐ€๋กœ:์„ธ๋กœ ๋น„์œจ์„ ์„ค์ •ํ•  ์ˆ˜ ์žˆ์Œ) + double itemHeight = 104.0; // ์ด ๊ฐ’์€ ์ ์ ˆํžˆ ์กฐ์ • + + // ์•„์ดํ…œ ๊ฐ„์˜ ์ˆ˜์ง ๊ฐ„๊ฒฉ + double crossAxisSpacing = 8.0; + + // ๊ทธ๋ฆฌ๋“œ๋ทฐ์˜ ๋†’์ด ๊ณ„์‚ฐ + double gridHeight = ((itemCount / columnCount).ceil() * itemHeight) + + ((itemCount / columnCount - 1).ceil() * crossAxisSpacing); + + return gridHeight; } @override Widget build(BuildContext context) { + MediaQueryData deviceData = MediaQuery.of(context); + Size screenSize = deviceData.size; return Scaffold( appBar: AppBar( - title: SvgPicture.asset( - 'assets/images/home/home_main_logo.svg', + title: + Container( + width: screenSize.width, + height: 46, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox(height: 18,), + SvgPicture.asset( + 'assets/images/logo/pup_logo.svg', + height: 25.41, + width: 110.19, + fit: BoxFit.cover, + ), + ], + ), ), + // SvgPicture.asset( + // 'assets/images/home/home_main_logo.svg', + // ), + actions: [ + Padding(padding: EdgeInsets.only(right: 15), + child: Padding( + padding: EdgeInsets.only(top:16), + child: Row( + children: [ + Stack( + children: [ + Text("${postsList.length.toInt()}๊ฐœ์˜ ๊ธฐ์–ต",style: TextStyle( + fontFamily: 'Bameuihaebyun', + foreground: Paint() + ..style = PaintingStyle.stroke + ..strokeWidth = 2 + ..color = Colors.white, + fontSize: 14, + ),), + Text("${postsList.length.toInt()}๊ฐœ์˜ ๊ธฐ์–ต",style: TextStyle( + fontFamily: 'Bameuihaebyun', + color: Color(0xff4B5396), + fontSize: 14, + ),), + ], + ), + SizedBox(width: 8,), + SvgPicture.asset( + 'assets/images/memorial/cloud.svg', + ), + ], + ), + ) + ) + ], automaticallyImplyLeading: false, backgroundColor: Color(0xffDDE7FD), elevation: 0.0, ), body: Container( color: Color(0xffDDE7FD), - width: Get.width, - height: Get.height, + // width: Get.width, + // height: Get.height, child: SingleChildScrollView( scrollDirection: Axis.vertical, child: Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ if(checkCN)...[ + SizedBox(height: 16,), Row( children: [ - SizedBox(width: 15,), - CircleAvatar( - backgroundColor: Colors.white, - radius: 65, - // minRadius: 50, - // maxRadius: 55, - //backgroundImage: NetworkImage(parsedResponseCN['profileImage']), - child: CircleAvatar( - radius: 55, - backgroundImage: NetworkImage(parsedResponseCN['profileImage']), - ), - ), - SizedBox(width: 20,), - Column( - crossAxisAlignment: CrossAxisAlignment.start, + SizedBox(width: 16,), + Stack( children: [ - Text("${parsedResponseCN['nickname']}๋‹˜์˜ ๋ฐ˜๋ ค๊ฒฌ", style: textStyle.bk20bold,), - SizedBox(height: 5,), - Text("${parsedResponseCN['puppyName']}(${parsedResponseCN['puppyType']}, ${parsedResponseCN['puppyAge']}์‚ด)", style: textStyle.bk16normal,), + if(parsedResponseCN['profileImage'].toString() == "null")...[ + CircleAvatar( + backgroundColor: Colors.white, + radius: 59.5, + // minRadius: 50, + // maxRadius: 55, + //backgroundImage: NetworkImage(parsedResponseCN['profileImage']), + child: CircleAvatar( + child: SvgPicture.asset('assets/images/user_null2.svg', + width: 110, + height: 110, + fit: BoxFit.fill,), + radius: 54.5, + ), + ), + ]else...[ + CircleAvatar( + backgroundColor: Colors.white, + radius: 59.5, + // minRadius: 50, + // maxRadius: 55, + //backgroundImage: NetworkImage(parsedResponseCN['profileImage']), + child: CircleAvatar( + radius: 54.5, + backgroundImage: NetworkImage(parsedResponseCN['profileImage'].toString()), + ), + ), + ], + + Padding(padding: EdgeInsets.fromLTRB(80, 80, 15, 15), + child: SvgPicture.asset('assets/images/memorial/foot.svg'),) ], ), - SizedBox(width: 20,), + SizedBox(width: 8,), + Padding(padding: EdgeInsets.only(bottom:22), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Text("${parsedResponseCN['nickname']}", style: TextStyle(fontFamily: 'Pretendard', + fontWeight: FontWeight.w600, fontSize: 20),), + Text("๋‹˜์˜ ๋ฐ˜๋ ค๊ฒฌ", style: TextStyle(fontFamily: 'Pretendard', + fontWeight: FontWeight.w500, fontSize: 16),), + ], + ), + SizedBox(height: 4,), + Row( + children: [ + Text("${parsedResponseCN['puppyName']}", style: TextStyle(fontFamily: 'Pretendard', + fontWeight: FontWeight.w600, fontSize: 20),), + Text("(${parsedResponseCN['puppyType']}, ${parsedResponseCN['puppyAge']}์‚ด)", style: TextStyle(fontFamily: 'Pretendard', + fontWeight: FontWeight.w500, fontSize: 16),), + ], + ), + ], + ),), + ], ), - SizedBox(height: 15,), + SizedBox(height: 14,), Row( children: [ - SizedBox(width: 15,), + SizedBox(width: 16,), Container( width: 115, height: 40, child: ElevatedButton( - style: buttonChart().bluebtn2, - child: Text('ํ”„๋กœํ•„ ์‚ฌ์ง„'), + style: buttonChart().whitebtn2, + child: Text('ํ”„๋กœํ•„ ์ˆ˜์ •', style: TextStyle(fontFamily: 'Pretendard', + fontWeight: FontWeight.w500, fontSize: 16),), onPressed: (){ - + final result = Navigator.push( + context, + MaterialPageRoute(builder: (context) => ModifyProfilePage()), + ); + // pop()์œผ๋กœ ๋Œ์•„์˜จ ๊ฒฐ๊ณผ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ setState ํ˜ธ์ถœ + if (result != null) { + setState(() { + //_dataFromPage = result as String; + + Timer(Duration(milliseconds: 800), () { + fetchWithHeaders(sign_in.userAccessToken); + }); + // fetchWithHeaders(sign_in.userAccessToken); + print("์„ฑ๊ณต"); + }); + } + // Navigator.push( + // context, + // MaterialPageRoute( + // builder: (context) => ModifyProfilePage())); }, ), ), - SizedBox(width: 15,), + SizedBox(width: 8,), Container( - width: 205, + width: 230, height: 40, child: ElevatedButton( - style: buttonChart().whitebtn, + style: buttonChart().purplebtn, child: Row(children: [ - SizedBox(width: 35,), - Text('๋ฉ”๋ชจ๋ฆฌ์–ผ ์˜ฌ๋ฆฌ๊ธฐ'), + SizedBox(width: 52,), + Text('๊ธฐ์–ต ๋‚จ๊ธฐ๊ธฐ', style: TextStyle(fontFamily: 'Pretendard', + fontWeight: FontWeight.w600, fontSize: 16, color: Color(0xffF2F6FF)),), SizedBox(width: 5,), SvgPicture.asset( - 'assets/images/memorial/upload_icon.svg', + 'assets/images/memorial/upload_icon2.svg', ), ],), onPressed: (){ @@ -327,32 +337,36 @@ class _MemorialMain0919PageState extends State { ), ), ],), - SizedBox(height: 30,), + SizedBox(height: 24,), Container( color: Color(0xffF2F4F6), - padding: EdgeInsets.fromLTRB(15, 0, 15, 15), + padding: EdgeInsets.fromLTRB(16, 0, 16, 16), width: Get.width, - height: Get.height, + //height: 650, child: Column( children: [ - SizedBox(height: 30,), + SizedBox(height: 24,), + // Expanded(child: child), Container( - width: 400, - height: 480, + width: Get.width, + //height: 318, + height: (postsList.length<7) ? 302 : calculateGridViewHeight() + 48, color: Color(0xffF2F4F6), child: GridView.builder( + shrinkWrap: true, // ๊ทธ๋ฆฌ๋“œ๋ทฐ๊ฐ€ ์ž์‹ ์˜ ๋‚ด์šฉ์— ๋งž๊ฒŒ ํฌ๊ธฐ๋ฅผ ์กฐ์ ˆํ•˜๋„๋ก ํ•จ + physics: NeverScrollableScrollPhysics(), itemCount:postsList.length, gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 3, //1 ๊ฐœ์˜ ํ–‰์— ๋ณด์—ฌ์ค„ item ๊ฐœ์ˆ˜ childAspectRatio: 1 / 1, //item ์˜ ๊ฐ€๋กœ 1, ์„ธ๋กœ 2 ์˜ ๋น„์œจ - mainAxisSpacing: 8, //์ˆ˜ํ‰ Padding - crossAxisSpacing: 8, //์ˆ˜์ง Padding + mainAxisSpacing: 10, //์ˆ˜ํ‰ Padding + crossAxisSpacing: 10, //์ˆ˜์ง Padding ), itemBuilder: (BuildContext context, int index){ return Container( - width: 120, - height: 120, + width: 114, + height: 114, child: Stack( children: [ InkWell( @@ -365,18 +379,27 @@ class _MemorialMain0919PageState extends State { builder: (context) => MemorialDetailPage())); }, child: Container( - width: 120, - height: 120, + width: 114, + height: 114, child: ClipRRect( borderRadius: BorderRadius.circular(16.0), - child: Image.network(postsList[index]['image'], fit: BoxFit.cover,), + child: Image( + image: NetworkImage(postsList[index]['image'], ), + fit: BoxFit.cover, + errorBuilder: (context, error, stackTrace) { + // ์˜ค๋ฅ˜ ๋ฐœ์ƒ ์‹œ ๋Œ€์ฒด ์ด๋ฏธ์ง€๋ฅผ ํ‘œ์‹œ + return SvgPicture.asset( + 'assets/images/no_result.svg',); + }, + ) + //Image.network(postsList[index]['image'], fit: BoxFit.cover,), ), ), ), if(postsList[index]['private'] == true)...[ Row(children: [ - SizedBox(width: 90,), + SizedBox(width: 80,), Padding(padding: EdgeInsets.only(top:10), child: SvgPicture.asset( 'assets/images/memorial/private.svg', @@ -389,46 +412,68 @@ class _MemorialMain0919PageState extends State { ) ); - }) + }), ), - Container( - padding: EdgeInsets.fromLTRB(20, 30, 10, 15), - width: Get.width, - height: 98, - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(16), - ), - child: Column( - children: [ - Row( - children: [ - Container( - width: 41, - height: 41, - child: Image.asset('assets/images/memorial/more_memorial.png'),), - SizedBox(width: 10,), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text("๋‹ค๋ฅธ ๋ฐ˜๋ ค์ธ๋“ค์˜ ๋ฉ”๋ชจ๋ฆฌ์–ผ์„ ๊ตฌ๊ฒฝํ•ด๋ณด์„ธ์š”!",style: TextStyle(color: Color(0xff4B5396),fontSize: 14),), - SizedBox(height:3,), - Text("๋ฉ”๋ชจ๋ฆฌ์–ผ ๊ตฌ๊ฒฝํ•˜๋Ÿฌ ๊ฐ€๊ธฐ",style: TextStyle(color: Color(0xff4B5396),fontSize: 18, fontWeight: FontWeight.bold),) - ], - ), - SizedBox(width: 37,), - IconButton(onPressed: (){ - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => WatchOthersPage())); - }, icon: Icon(Icons.arrow_forward_ios_rounded), color: Color(0xff627DBB),) - ], - ) - ], + //SizedBox(height: 8,), + InkWell( + onTap: (){ + inUser = true; + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => WatchOthersPage())); + }, + child: Container( + padding: EdgeInsets.fromLTRB(24, 24, 0, 0), + width: Get.width, + height: 89, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(16), + ), + child: Column( + children: [ + Row( + children: [ + // Container( + // width: 41, + // height: 41, + // child: SvgPicture.asset( + // 'assets/images/memorial/more_memorial.svg', + // ), + // ), + + SvgPicture.asset( + 'assets/images/memorial/more_memorial.svg', + width: 41, + height: 41, + fit: BoxFit.fill, + ), + + SizedBox(width: 15,), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text("๋‹ค๋ฅธ ๋ฐ˜๋ ค์ธ๋“ค์˜ ๋ฉ”๋ชจ๋ฆฌ์–ผ์„ ๊ตฌ๊ฒฝํ•ด๋ณด์„ธ์š”!",style: TextStyle(color: Color(0xff4B5396), fontFamily: 'Pretendard', + fontWeight: FontWeight.w400, fontSize: 12, letterSpacing: 0.5),), + SizedBox(height:6,), + Text("๋ฉ”๋ชจ๋ฆฌ์–ผ ๊ตฌ๊ฒฝํ•˜๋Ÿฌ ๊ฐ€๊ธฐ",style: TextStyle(color: Color(0xff4B5396),fontSize: 16, fontFamily: 'Pretendard', + fontWeight: FontWeight.w600,),) + + ], + ), + SizedBox(width:15,), + // assets/images/home/arrow.svg + SvgPicture.asset( + 'assets/images/home/arrow.svg', + ), + ], + ) + ], + ), ), ), - + SizedBox(height: 12,), ], ), @@ -438,31 +483,13 @@ class _MemorialMain0919PageState extends State { ), ), ), + // floatingActionButton: SizedBox( + // height: 56, + // width: extended ? 120 : 56, + // child: extendButton(), + // ), + // floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat, ); } - - bool extended = false; - - FloatingActionButton extendButton() { - return FloatingActionButton.extended( - onPressed: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => WriteMemorialPage())); - }, - label: const Text(""), - isExtended: extended, - icon: const Icon( - Icons.add, - size: 30, - ), - shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(50)), - - /// ํ…์ŠคํŠธ ์ปฌ๋Ÿฌ - foregroundColor: Color(0xffFCCBCD), - backgroundColor: Color(0xff83A8FF), - ); - } } \ No newline at end of file diff --git a/client/lib/memorial/memorial_search.dart b/client/lib/memorial/memorial_search.dart new file mode 100644 index 0000000..cd78342 --- /dev/null +++ b/client/lib/memorial/memorial_search.dart @@ -0,0 +1,369 @@ +import 'dart:convert'; +import 'package:flutter_svg/svg.dart'; +import 'package:get/get.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:client/memorial/watch_others_memorial_detail.dart'; +import 'package:client/style.dart'; +import 'package:http/http.dart' as http; +import 'package:client/sign/sign_in.dart' as sign_in; +import 'memorial_search_result.dart'; + +String searchKeyword = ""; + +class MemorialSearchPage extends StatefulWidget { + @override + State createState() => _MemorialSearchPageState(); +} + +class _MemorialSearchPageState extends State { + + // ํ…์ŠคํŠธ์—๋””ํŒ…์ปจํŠธ๋กค๋Ÿฌ๋ฅผ ์ƒ์„ฑํ•˜์—ฌ ํ•„๋“œ์— ํ• ๋‹น + final myController = TextEditingController(); + + // ์ตœ๊ทผ ๊ฒ€์ƒ‰์–ด ์กฐํšŒ(GET) + late List parsedResponseRS; // ์ตœ๊ทผ ๊ฒ€์ƒ‰์–ด + bool recentKeyword = false; + + void fetchDataRecentSearch(String aToken) async { + // API ์—”๋“œํฌ์ธํŠธ URL + String apiUrl = 'http://3.38.1.125:8080/search/history'; + + // ํ—ค๋” ์ •๋ณด ์„ค์ • + Map headers = { + 'Authorization': 'Bearer $aToken', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• + 'Content-Type': 'application/json', // ์˜ˆ: JSON ์š”์ฒญ์ธ ๊ฒฝ์šฐ ํ—ค๋” ์„ค์ • + }; + + // HTTP GET ์š”์ฒญ ๋ณด๋‚ด๊ธฐ + var response = await http.get( + Uri.parse(apiUrl), + headers: headers, // ํ—ค๋” ์ถ”๊ฐ€ + ); + + ///var jsonResponse = utf8.decode(response.bodyBytes); + // HTTP ์‘๋‹ต ์ƒํƒœ ํ™•์ธ + if (response.statusCode == 200) { + // ์‘๋‹ต ๋ฐ์ดํ„ฐ๋ฅผ JSON ํ˜•์‹์œผ๋กœ ๋””์ฝ”๋”ฉ + var data = json.decode(response.body); + var jsonResponse = utf8.decode(response.bodyBytes); + + parsedResponseRS = json.decode(jsonResponse); + + // ๋ฐ์ดํ„ฐ ์ฒ˜๋ฆฌ + print('์„œ๋ฒ„๋กœ๋ถ€ํ„ฐ ๋ฐ›์€ ๋ฐ์ดํ„ฐS: $jsonResponse'); + + recentKeyword = true; + setState(() { + }); + + } else { + // ์š”์ฒญ์ด ์‹คํŒจํ•œ ๊ฒฝ์šฐ ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌ + print('HTTP ์š”์ฒญ ์‹คํŒจ: ${response.statusCode}'); + } + } + + // ์ถ”์ฒœ ๊ฒ€์ƒ‰์–ด ์กฐํšŒ(GET) + late List parsedResponseSR; // ์ตœ๊ทผ ๊ฒ€์ƒ‰์–ด + bool rankKeyword = false; + void fetchDataSearchRank() async { + // API ์—”๋“œํฌ์ธํŠธ URL + String apiUrl = 'http://3.38.1.125:8080/search/rank'; + + // HTTP GET ์š”์ฒญ ๋ณด๋‚ด๊ธฐ + var response = await http.get( + Uri.parse(apiUrl), + ); + + // HTTP ์‘๋‹ต ์ƒํƒœ ํ™•์ธ + if (response.statusCode == 200) { + // ์‘๋‹ต ๋ฐ์ดํ„ฐ๋ฅผ JSON ํ˜•์‹์œผ๋กœ ๋””์ฝ”๋”ฉ + var data = json.decode(response.body); + var jsonResponse = utf8.decode(response.bodyBytes); + + parsedResponseSR = json.decode(jsonResponse); + + // ๋ฐ์ดํ„ฐ ์ฒ˜๋ฆฌ + print('์„œ๋ฒ„๋กœ๋ถ€ํ„ฐ ๋ฐ›์€ ๋ฐ์ดํ„ฐ: $jsonResponse'); + + rankKeyword = true; + setState(() { + }); + + } else { + // ์š”์ฒญ์ด ์‹คํŒจํ•œ ๊ฒฝ์šฐ ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌ + print('HTTP ์š”์ฒญ ์‹คํŒจ: ${response.statusCode}'); + } + } + + // ๊ฒ€์ƒ‰์–ด ์ „์ฒด ์‚ญ์ œ + void deleteAllSearch(String aToken) async { + // API ์—”๋“œํฌ์ธํŠธ URL + String apiUrl = 'http://3.38.1.125:8080/search/history/all'; + + // ํ—ค๋” ์ •๋ณด ์„ค์ • + Map headers = { + 'Authorization': 'Bearer $aToken', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• + 'Content-Type': 'application/json', // ์˜ˆ: JSON ์š”์ฒญ์ธ ๊ฒฝ์šฐ ํ—ค๋” ์„ค์ • + }; + + // HTTP GET ์š”์ฒญ ๋ณด๋‚ด๊ธฐ + var response = await http.delete( + Uri.parse(apiUrl), + headers: headers, // ํ—ค๋” ์ถ”๊ฐ€ + ); + + ///var jsonResponse = utf8.decode(response.bodyBytes); + // HTTP ์‘๋‹ต ์ƒํƒœ ํ™•์ธ + if (response.statusCode == 200) { + // ์‘๋‹ต ๋ฐ์ดํ„ฐ๋ฅผ JSON ํ˜•์‹์œผ๋กœ ๋””์ฝ”๋”ฉ + print("์‚ญ์ œ์„ฑ๊ณต"); + setState(() { + }); + + } else { + // ์š”์ฒญ์ด ์‹คํŒจํ•œ ๊ฒฝ์šฐ ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌ + print('HTTP ์š”์ฒญ ์‹คํŒจ: ${response.statusCode}'); + } + } + + // ์ตœ๊ทผ ๊ฒ€์ƒ‰์–ด ์‚ญ์ œ + void deleteDataSearch(String aToken, String search) async { + // API ์—”๋“œํฌ์ธํŠธ URL + String apiUrl = 'http://3.38.1.125:8080/search/history?keyword=${search}'; + + // ํ—ค๋” ์ •๋ณด ์„ค์ • + Map headers = { + 'Authorization': 'Bearer $aToken', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• + 'Content-Type': 'application/json', // ์˜ˆ: JSON ์š”์ฒญ์ธ ๊ฒฝ์šฐ ํ—ค๋” ์„ค์ • + }; + + // HTTP GET ์š”์ฒญ ๋ณด๋‚ด๊ธฐ + var response = await http.delete( + Uri.parse(apiUrl), + headers: headers, // ํ—ค๋” ์ถ”๊ฐ€ + ); + + ///var jsonResponse = utf8.decode(response.bodyBytes); + // HTTP ์‘๋‹ต ์ƒํƒœ ํ™•์ธ + if (response.statusCode == 200) { + // ์‘๋‹ต ๋ฐ์ดํ„ฐ๋ฅผ JSON ํ˜•์‹์œผ๋กœ ๋””์ฝ”๋”ฉ + print("์‚ญ์ œ์„ฑ๊ณต"); + setState(() { + }); + + } else { + // ์š”์ฒญ์ด ์‹คํŒจํ•œ ๊ฒฝ์šฐ ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌ + print('HTTP ์š”์ฒญ ์‹คํŒจ: ${response.statusCode}'); + } + } + + + + @override + void initState() { + super.initState(); + SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: [SystemUiOverlay.top]); + fetchDataRecentSearch(sign_in.userAccessToken); + fetchDataSearchRank(); + } + + + @override + Widget build(BuildContext context) { + MediaQueryData deviceData = MediaQuery.of(context); + Size screenSize = deviceData.size; + return Scaffold( + appBar: PreferredSize( + preferredSize: Size.fromHeight(72), + child: AppBar( + leading: + Padding( + padding: EdgeInsets.only(top: 20), + child: IconButton( + icon: Icon(Icons.arrow_back_ios_rounded, color: Colors.black), + onPressed: () => Navigator.of(context).pop(), + ), + ), + title: + Container( + height: 50, + width: screenSize.width, + child: Column( + children: [ + SizedBox(height: 24,), + Center( + child: Padding( + padding: EdgeInsets.only(right: 60), + child: Text( + 'ํ•จ๊ป˜ํ• ๊ฐœ', + style: textStyle.bk20normal, + ), + )), + ],) + ), + + backgroundColor: Color(0xffF3F3F3), + elevation: 0.0, + iconTheme: IconThemeData(color: Colors.black), + ), + ), + body: Container( + color: Color(0xffF3F3F3), + padding: EdgeInsets.only(left: 15, right: 15 ), + width: Get.width, + height: Get.height, + child: SingleChildScrollView( + padding: EdgeInsets.fromLTRB(0, 0, 0, 0), + scrollDirection: Axis.vertical, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox(height: 8,), + Padding( + padding: const EdgeInsets.all(0.0), + child: Stack( + children: [ + Container( + width: Get.width- 25, + height: 32, + decoration: BoxDecoration( + color: Colors.white, + border: Border.all(color: Color(0xff99A8CB),), + borderRadius: BorderRadius.circular(8), + ), + ), + Positioned( + left: 34, + right: 80, + bottom: 0, + top: 15, + child: TextField( + controller: myController, + decoration: InputDecoration( + border: InputBorder.none, + hintText: '๊ฒ€์ƒ‰', + hintStyle: textStyle.grey16normal), + onChanged: (s) { + //text = s; + }, + onTap: (){ + + }, + ), + ), + Positioned( + right: Get.width - 75, + //right: 30, + bottom: 7, + top: -3, + child: IconButton( + onPressed: (){ + searchKeyword = myController.text; + setState(() { + }); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => MemorialSearchResultPage())); + }, + icon: Icon(Icons.search, color: Color(0xff99A8CB),), + ) + ), + ], + ), + ), + SizedBox(height: 8,), + Row( + children: [ + Text('์ตœ๊ทผ ๊ฒ€์ƒ‰์–ด', style: TextStyle(color: Color(0xff4B5396), fontSize: 14, fontFamily: 'Pretendard',fontWeight: FontWeight.w500,),), + SizedBox(width: 225, ), + TextButton( + onPressed: (){ + deleteAllSearch(sign_in.userAccessToken); + }, + child: Text('์ „์ฒด ์‚ญ์ œ', style: TextStyle(color: Color(0xff4B5396), fontSize: 12, fontFamily: 'Pretendard',fontWeight: FontWeight.w500,),), + ) + ], + ), + Container( + width: Get.width, + height: 350, + child:Column( + children: [ + if(recentKeyword)...[ + for(int i=0; i MemorialSearchResultPage())); + }, + child: Text('${parsedResponseSR[index]['keyword']}', style: TextStyle(color: Color(0xff333333),fontSize: 14, fontFamily: 'Pretendard', + fontWeight: FontWeight.w300,),), + ); + + }) + ), + ], + + + ], + ), + + ), + ), + + ); + } +} \ No newline at end of file diff --git a/client/lib/memorial/memorial_search_result.dart b/client/lib/memorial/memorial_search_result.dart new file mode 100644 index 0000000..781ebc6 --- /dev/null +++ b/client/lib/memorial/memorial_search_result.dart @@ -0,0 +1,328 @@ +import 'dart:convert'; +import 'package:get/get.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:client/memorial/memorial_search_result_detail.dart'; +import 'package:client/memorial/watch_others_memorial_detail.dart'; +import 'package:client/style.dart'; +import 'package:http/http.dart' as http; +import 'memorial_search.dart'as search; +import 'package:flutter_svg/flutter_svg.dart'; +import 'memorial_search.dart'; +import 'package:client/sign/sign_in.dart' as sign_in; +import 'others_memorial_main.dart'; + +String selectedOthersImage = ""; +String selectedOthersProfileImage = ""; +String selectedOthersNickaname = ""; +String selectedUser = ""; +int selectedPostId = 0; + +class MemorialSearchResultPage extends StatefulWidget { + @override + State createState() => _MemorialSearchResultPageState(); +} + +class _MemorialSearchResultPageState extends State { + + // ํ…์ŠคํŠธ์—๋””ํŒ…์ปจํŠธ๋กค๋Ÿฌ๋ฅผ ์ƒ์„ฑํ•˜์—ฌ ํ•„๋“œ์— ํ• ๋‹น + final myController = TextEditingController(); + + // ๊ฒ€์ƒ‰์–ด ์กฐํšŒ(GET) + late List parsedResponseSR; // ๊ฒ€์ƒ‰ ๊ฒฐ๊ณผ + bool result = false; + + void fetchDataSearchResult(String aToken) async { + // API ์—”๋“œํฌ์ธํŠธ URL + String apiUrl = 'http://3.38.1.125:8080/search?keyword=${search.searchKeyword}'; + + // ํ—ค๋” ์ •๋ณด ์„ค์ • + Map headers = { + 'Authorization': 'Bearer $aToken', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• + 'Content-Type': 'application/json', // ์˜ˆ: JSON ์š”์ฒญ์ธ ๊ฒฝ์šฐ ํ—ค๋” ์„ค์ • + }; + + // HTTP GET ์š”์ฒญ ๋ณด๋‚ด๊ธฐ + var response = await http.get( + Uri.parse(apiUrl), + headers: headers, // ํ—ค๋” ์ถ”๊ฐ€ + ); + + ///var jsonResponse = utf8.decode(response.bodyBytes); + // HTTP ์‘๋‹ต ์ƒํƒœ ํ™•์ธ + if (response.statusCode == 200) { + // ์‘๋‹ต ๋ฐ์ดํ„ฐ๋ฅผ JSON ํ˜•์‹์œผ๋กœ ๋””์ฝ”๋”ฉ + var data = json.decode(response.body); + var jsonResponse = utf8.decode(response.bodyBytes); + + parsedResponseSR = json.decode(jsonResponse); + + // ๋ฐ์ดํ„ฐ ์ฒ˜๋ฆฌ + print('์„œ๋ฒ„๋กœ๋ถ€ํ„ฐ ๋ฐ›์€ ๋ฐ์ดํ„ฐS: $jsonResponse'); + + result = true; + setState(() { + }); + + } else { + // ์š”์ฒญ์ด ์‹คํŒจํ•œ ๊ฒฝ์šฐ ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌ + print('HTTP ์š”์ฒญ ์‹คํŒจ: ${response.statusCode}'); + } + } + + + @override + void initState() { + super.initState(); + SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: [SystemUiOverlay.top]); + fetchDataSearchResult(sign_in.userAccessToken); + } + + + @override + Widget build(BuildContext context) { + MediaQueryData deviceData = MediaQuery.of(context); + Size screenSize = deviceData.size; + return Scaffold( + appBar: PreferredSize( + preferredSize: Size.fromHeight(72), + child: AppBar( + actions: [ + Padding( + padding: EdgeInsets.only(top: 15), + child: IconButton( + icon: Icon(Icons.search), + onPressed: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + MemorialSearchPage())); // ๊ฒ€์ƒ‰ํŽ˜์ด์ง€๋กœ ์ด๋™ + }, + ), + ), + ], + leading: + Padding( + padding: EdgeInsets.only(top: 20), + child: IconButton( + icon: Icon(Icons.arrow_back_ios_rounded, color: Colors.black), + onPressed: () => Navigator.of(context).pop(), + ), + ), + title: Container( + height: 50, + width: screenSize.width, + child: Column( + children: [ + SizedBox(height: 24,), + Center( + child: Padding( + padding: EdgeInsets.only(right: 60), + child: Text( + 'ํ•จ๊ป˜ํ• ๊ฐœ', + style: textStyle.bk20bold, + ), + )), + ], + )), + backgroundColor: Colors.transparent, + elevation: 0.0, + iconTheme: IconThemeData(color: Colors.black), + ), + ), + body: Container( + color: Color(0xffDDE7FD), + //padding: EdgeInsets.only(left: 16, right: 16 ), + width: Get.width, + height: Get.height, + child: SingleChildScrollView( + padding: EdgeInsets.fromLTRB(0, 0, 0, 0), + scrollDirection: Axis.vertical, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + ClipRRect( + borderRadius: BorderRadius.only(topLeft: Radius.circular(16.0), topRight: Radius.circular(16.0)), + child: Container( + padding: EdgeInsets.all(16), + width: Get.width, + color: Color(0xffF1F5FE), + child: Column(children: [ + SizedBox(height: 8,), + Row(children: [ + Text('"${search.searchKeyword}" ', style: textStyle.bk16semibold), + Text('${parsedResponseSR.length}๊ฑด์˜ ๊ฒฐ๊ณผ ', style: textStyle.bk16normal), + ],), + SizedBox(height: 20,), + + if(parsedResponseSR.length == 0)...[ + Column( + children: [ + SizedBox(height: 200,), + SvgPicture.asset( + 'assets/images/no_result.svg', + height: 124, + ), + SizedBox(height: 16,), + Text("์ผ์น˜ํ•˜๋Š” ๋‚ด์šฉ์ด ์—†์Šต๋‹ˆ๋‹ค.", style: textStyle.bk16normal,) + ], + ), + ], + + + if(result && parsedResponseSR != "[]")...[ + Container( + width: Get.width, + height: 760, + color: Color(0xffF1F5FE), + child: GridView.builder( + itemCount:parsedResponseSR.length, + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 2, //1 ๊ฐœ์˜ ํ–‰์— ๋ณด์—ฌ์ค„ item ๊ฐœ์ˆ˜ + childAspectRatio: 1.56 / 2.04, //item ์˜ ๊ฐ€๋กœ 1, ์„ธ๋กœ 2 ์˜ ๋น„์œจ + mainAxisSpacing: 16, //์ˆ˜ํ‰ Padding + crossAxisSpacing: 16, //์ˆ˜์ง Padding + ), + itemBuilder: (BuildContext context, int index){ + return + InkWell( + onTap: (){ + selectedOthersImage = parsedResponseSR[index]['image']; + //selectedOthersImage = parsedResponseSR[index]['image']; + selectedOthersProfileImage = parsedResponseSR[index]['profileImage'].toString(); + selectedOthersNickaname = parsedResponseSR[index]['nickname']; + selectedUser = parsedResponseSR[index]['userUid']; + selectedPostId = parsedResponseSR[index]['id']; + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => MemorialSearchResultDetailPage())); + }, + child: Container( + // width: 200, + // height: 200, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(16), + ), + child:Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // SizedBox(height: 5,), + // SizedBox(height: 2,), + Container( + height: 166, + width: 204, + child: + Stack( + children: [ + Container( + height: 204, + width: 204, + child: + ClipRRect( + borderRadius: BorderRadius.only(topLeft: Radius.circular(16.0), topRight: Radius.circular(16.0)), + child: Image.network(parsedResponseSR[index]['image'], fit: BoxFit.cover,), + ) + + + ), + InkWell( + onTap: (){ + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => OthersMemorialMainPage())); + }, + child: Padding( + padding: EdgeInsets.only(left: 10, top: 10), + child: Container( + decoration: BoxDecoration( + color: Colors.black.withOpacity(0.2), + borderRadius: BorderRadius.circular(32), + ), + // color: Colors.white.withOpacity(0.7), + width: 81, + height: 32, + child: Row( + children: [ + SizedBox(width: 10,), + CircleAvatar( + backgroundColor: Colors.white, + radius: 10, + child: CircleAvatar( + radius: 9, + backgroundImage: NetworkImage(parsedResponseSR[index]['profileImage']), + ), + ), + + // CircleAvatar( + // minRadius: 10, + // maxRadius: 15, + // backgroundImage: + // NetworkImage(parsedResponseSR[index]['profileImage'], + // ), + // ), + SizedBox(width: 5,), + Text(parsedResponseSR[index]['nickname'], style: TextStyle(color: Colors.white, fontSize: 14, fontFamily: 'Pretendard',fontWeight: FontWeight.w600,),), + Container( + width: 20, + child: + Icon(Icons.arrow_forward_ios_rounded, color: Colors.white,size: 12,) + //Image.asset('assets/images/memorial/look_others_arrow.png'), + ) + ], + ), + ), + ), + ) + ],), + + ), + SizedBox(height: 8,), + Container( + height: 16, + width: 155, + child: Row( + children: [ + SizedBox(width: 10,), + Container( + width: 145, + height: 65, + child: Text(parsedResponseSR[index]['title'],style: TextStyle(color: Color(0xff333333), fontSize: 13.5, fontFamily: 'Pretendard',fontWeight: FontWeight.w400,), ), + ), + //Text(parsedResponseSR[index]['title'],style: TextStyle(color: Color(0xff333333), fontSize: 14.5, fontFamily: 'Pretendard',fontWeight: FontWeight.w400,),) + ], + ), + ), + // Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // + // ], + // ) + + ], + ) + + ), + ); + + }) + ), + ] + ], + ),),), + + + + ], + ), + + ), + ), + + ); + } +} \ No newline at end of file diff --git a/client/lib/memorial/memorial_search_result_detail.dart b/client/lib/memorial/memorial_search_result_detail.dart new file mode 100644 index 0000000..56db5cb --- /dev/null +++ b/client/lib/memorial/memorial_search_result_detail.dart @@ -0,0 +1,726 @@ +import 'dart:async'; +import 'dart:convert'; +import 'package:flutter_svg/svg.dart'; +import 'package:get/get.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:client/memorial/others_memorial_main.dart'; +import 'package:client/style.dart'; +import 'package:intl/intl.dart'; +import 'memorial_search_result.dart' as watchmain; +import 'package:http/http.dart' as http; +import 'package:client/sign/sign_in.dart' as sign_in; +import 'package:client/memorial/slide/flutter_image_slideshow.dart'; + +class MemorialSearchResultDetailPage extends StatefulWidget { + @override + State createState() => _MemorialSearchResultDetailPageState(); +} + +class _MemorialSearchResultDetailPageState extends State { + + //watchmain.selectedPostId.toString() + + // ํ™”๋ฉด์— ๋ณด์ด๋Š” UI ์„ค์ • bool + bool askHelp = true; + bool sendHelp = false; + + bool fetchSuccess = false; + + // ํ…์ŠคํŠธ์—๋””ํŒ…์ปจํŠธ๋กค๋Ÿฌ๋ฅผ ์ƒ์„ฑํ•˜์—ฌ ํ•„๋“œ์— ํ• ๋‹น + final myController = TextEditingController(); + + late Map parsedResponseCN; // ๊ธ€ ๋‚ด์šฉ + late List parsedResponseCM; // ๋Œ“๊ธ€ + + List parsedResponseIMGS = []; // ์ด๋ฏธ์ง€ ๊ฐœ์ˆ˜ + + bool addComment = false; // ๋ฐ”๋กœ ์ฝ”๋ฉ˜ํŠธ ๋ถ™์˜€์„ ๋•Œ + bool isComment = false; + + // ์ฝ”๋ฉ˜ํŠธ ์ˆ˜์™€ ์ข‹์•„์š” ์ˆ˜ + int comments = 0; + int hearts = 0; + + late bool myHeart; + + // ๊ธ€๋‚ด์šฉ ๊ฐ€์ ธ์˜ค๊ธฐ + void fetchWithHeaders(String aToken) async { + // API ์—”๋“œํฌ์ธํŠธ URL + String apiUrl = 'http://3.38.1.125:8080/memorial?postId=${watchmain.selectedPostId.toString()}'; // ์‹ค์ œ API ์—”๋“œํฌ์ธํŠธ๋กœ ๋ณ€๊ฒฝํ•˜์„ธ์š” + + print("๋ช‡๋ฒˆ์ด์•ผ? "+watchmain.selectedPostId.toString()); + // ํ—ค๋” ์ •๋ณด ์„ค์ • + Map headers = { + 'Authorization': 'Bearer $aToken', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• + 'Content-Type': 'application/json', // ์˜ˆ: JSON ์š”์ฒญ์ธ ๊ฒฝ์šฐ ํ—ค๋” ์„ค์ • + }; + + // HTTP GET ์š”์ฒญ ๋ณด๋‚ด๊ธฐ + var response = await http.get( + Uri.parse(apiUrl), + headers: headers, // ํ—ค๋” ์ถ”๊ฐ€ + ); + + // HTTP ์‘๋‹ต ์ƒํƒœ ํ™•์ธ + if (response.statusCode == 200) { + // ์‘๋‹ต ๋ฐ์ดํ„ฐ ์ฒ˜๋ฆฌ + fetchSuccess = true; + setState(() {}); + print('์„œ๋ฒ„๋กœ๋ถ€ํ„ฐ ๋ฐ›์€ ๋‚ด์šฉ ๋ฐ์ดํ„ฐ(๊ธ€ ๋‚ด์šฉ): ${response.body}'); + var jsonResponse = utf8.decode(response.bodyBytes); + + parsedResponseCN = json.decode(jsonResponse); + + // List ํ˜•์‹ + print("image test" + parsedResponseCN['imageList'][0].toString()); + + for(int i = 0; i headers = { + 'Authorization': 'Bearer $aToken', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• + 'Content-Type': 'application/json', // ์˜ˆ: JSON ์š”์ฒญ์ธ ๊ฒฝ์šฐ ํ—ค๋” ์„ค์ • + }; + + var url = Uri.parse('http://3.38.1.125:8080/memorial/comment?postId=${watchmain.selectedPostId.toString()}'); // ์—”๋“œํฌ์ธํŠธ URL ์„ค์ • + + try { + var response = await http.post( + url, + body: json.encode(data), // ์š”์ฒญ ๋ณธ๋ฌธ์— ๋ฐ์ดํ„ฐ๋ฅผ JSON ํ˜•์‹์œผ๋กœ ์ธ์ฝ”๋”ฉํ•˜์—ฌ ์ „๋‹ฌ + headers: headers, // ํ—ค๋” ์ถ”๊ฐ€ + ); + + if (response.statusCode == 200) { + // ์‘๋‹ต ์„ฑ๊ณต ์‹œ์˜ ์ฒ˜๋ฆฌ + + var jsonResponse = utf8.decode(response.bodyBytes); // ์‘๋‹ต ๋ณธ๋ฌธ์„ JSON ํ˜•์‹์œผ๋กœ ๋””์ฝ”๋”ฉ + // JSON ๊ฐ’์„ ํ™œ์šฉํ•œ ์›ํ•˜๋Š” ๋™์ž‘ ์ˆ˜ํ–‰ + //utf8.decode(jsonResponse); + print(jsonResponse); + + List contentList = []; + + List parsedResponse = json.decode(jsonResponse); + + setState(() { + }); + + + print('API ํ˜ธ์ถœ ์„ฑ๊ณต!!: ${response.statusCode}'); + } else { + // ์š”์ฒญ ์‹คํŒจ ์‹œ์˜ ์ฒ˜๋ฆฌ + print('API ํ˜ธ์ถœ ์‹คํŒจ!!: ${response.statusCode}'); + } + } catch (e) { + // ์˜ˆ์™ธ ๋ฐœ์ƒ ์‹œ์˜ ์ฒ˜๋ฆฌ + print('API ํ˜ธ์ถœ ์ค‘ ์˜ˆ์™ธ ๋ฐœ์ƒ: $e'); + } + } + + // ์ข‹์•„์š” ๋ˆ„๋ฅด๊ธฐ(POST) + void sendPostRequest(String aToken) async { + // API ์—”๋“œํฌ์ธํŠธ URL + String apiUrl = 'http://3.38.1.125:8080/memorial/like?postId=${watchmain.selectedPostId.toString()}'; // ์‹ค์ œ API ์—”๋“œํฌ์ธํŠธ๋กœ ๋ณ€๊ฒฝํ•˜์„ธ์š” + + // POST ์š”์ฒญ ๋ณด๋‚ด๊ธฐe + var response = await http.post( + Uri.parse(apiUrl), + headers: { + 'Authorization': 'Bearer $aToken', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• + 'Content-Type': 'application/json', // ์˜ˆ: JSON ์š”์ฒญ์ธ ๊ฒฝ์šฐ ํ—ค๋” ์„ค์ • + //'Content-Type': 'application/json', + }, // ์š”์ฒญ ํ—ค๋”์— Content-Type ์„ค์ • + ); + + // HTTP ์‘๋‹ต ์ƒํƒœ ํ™•์ธ + if (response.statusCode == 200) { + // ์‘๋‹ต ๋ฐ์ดํ„ฐ ์ฒ˜๋ฆฌ + print('์„œ๋ฒ„๋กœ๋ถ€ํ„ฐ ๋ฐ›์€ ๋‚ด์šฉ ๋ฐ์ดํ„ฐ: ${response.body}'); + var jsonResponse = utf8.decode(response.bodyBytes); + + setState(() {}); + // print('์„œ๋ฒ„๋กœ๋ถ€ํ„ฐ ๋ฐ›์€ ๋ฐ์ดํ„ฐ: ${response.body}'); + } else { + // ์š”์ฒญ์ด ์‹คํŒจํ•œ ๊ฒฝ์šฐ ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌ + print('HTTP ์š”์ฒญ ์‹คํŒจ: ${response.statusCode}'); + } + } + + // ์ข‹์•„์š” ๊ฐ€์ ธ์˜ค๊ธฐ- ํด๋ฆญ์—ฌ๋ถ€ ํ™•์ธ(GET) + void fetchDataLike(String aToken) async { + // API ์—”๋“œํฌ์ธํŠธ URL + String apiUrl = 'http://3.38.1.125:8080/memorial/like?postId=${watchmain.selectedPostId.toString()}'; /// postId=1 ์ถ”ํ›„์— ๋ฐ”๊ฟ”์ฃผ๊ธฐ + + // ํ—ค๋” ์ •๋ณด ์„ค์ • + Map headers = { + 'Authorization': 'Bearer $aToken', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• + 'Content-Type': 'application/json', // ์˜ˆ: JSON ์š”์ฒญ์ธ ๊ฒฝ์šฐ ํ—ค๋” ์„ค์ • + }; + + // HTTP GET ์š”์ฒญ ๋ณด๋‚ด๊ธฐ + var response = await http.get( + Uri.parse(apiUrl), + headers: headers, // ํ—ค๋” ์ถ”๊ฐ€ + ); + + ///var jsonResponse = utf8.decode(response.bodyBytes); + // HTTP ์‘๋‹ต ์ƒํƒœ ํ™•์ธ + if (response.statusCode == 200) { + // ์‘๋‹ต ๋ฐ์ดํ„ฐ๋ฅผ JSON ํ˜•์‹์œผ๋กœ ๋””์ฝ”๋”ฉ + var data = json.decode(response.body); + var jsonResponse = utf8.decode(response.bodyBytes); + + myHeart = json.decode(jsonResponse); + + // ๋ฐ์ดํ„ฐ ์ฒ˜๋ฆฌ + print('์ข‹์•„์š”~: $myHeart'); + if(myHeart == true){ + hearts = 1; + } else{ + hearts = 0; + } + + setState(() { + }); + + } else { + // ์š”์ฒญ์ด ์‹คํŒจํ•œ ๊ฒฝ์šฐ ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌ + print('HTTP ์š”์ฒญ ์‹คํŒจ: ${response.statusCode}'); + } + } + + + @override + void initState() { + super.initState(); + SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: [SystemUiOverlay.top]); + fetchWithHeaders(sign_in.userAccessToken); + fetchDataLike(sign_in.userAccessToken); + + print("test" + watchmain.selectedPostId.toString()); + fetchDataComment(); + setState(() { + + }); + } + + // ๋Œ“๊ธ€ ์œ„์ ฏ + Widget listview_builder(){ + return ListView.builder( + shrinkWrap: true, + scrollDirection: Axis.vertical, + padding: EdgeInsets.all(0), + physics: NeverScrollableScrollPhysics(), + itemCount: parsedResponseCM.length, + itemBuilder: (BuildContext context, int index){ + return Column( + children: [ + Container( + padding: EdgeInsets.fromLTRB(16, 16, 16, 16), + height: 90, + width: Get.width, + decoration: BoxDecoration( + color: Colors.white, + //borderRadius: BorderRadius.circular(16), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + if(parsedResponseCM[index]['profileImage'].toString() == "null")...[ + CircleAvatar( + radius: 10, + child: SvgPicture.asset('assets/images/user_null2.svg',), + ), + ]else...[ + CircleAvatar( + radius: 10, + backgroundImage: NetworkImage(parsedResponseCM[index]['profileImage'].toString()), + ), + ], + SizedBox(width: 8,), + Text(parsedResponseCM[index]['nickname'], style: textStyle.bk12normal,), + ], + ), + SizedBox(height: 6,), + Text(parsedResponseCM[index]['content'], style: textStyle.bk12normal,), + SizedBox(height: 6,), + Text(DateFormat('MM/dd HH:mm').format(DateTime.parse(parsedResponseCM[index]['createdAt'])).toString(), style: TextStyle(fontSize: 10, color: Color(0xffAAAAAA)),) + + //DateFormat('yy/MM/dd - HH:mm:ss').format(parsedResponse[0]['createdAt']) + ], + ), + ), + SizedBox(height: 4,), + ], + ); + + } + ); + } + + double calculateListViewHeight() { + // ๋ฆฌ์ŠคํŠธ๋ทฐ์˜ ์•„์ดํ…œ ์ˆ˜ + int itemCount = parsedResponseCM.length; + + // ๋ฆฌ์ŠคํŠธ๋ทฐ์˜ ์—ด ์ˆ˜ (3๊ฐœ์˜ ์•„์ดํ…œ์ด ํ•œ ํ–‰์— ์žˆ์„ ๋•Œ) + int columnCount = 1; + + // ์•„์ดํ…œ์˜ ๋†’์ด (๊ฐ€๋กœ:์„ธ๋กœ ๋น„์œจ์„ ์„ค์ •ํ•  ์ˆ˜ ์žˆ์Œ) + double itemHeight = 90; // ์ด ๊ฐ’์€ ์ ์ ˆํžˆ ์กฐ์ • + + // ์•„์ดํ…œ ๊ฐ„์˜ ์ˆ˜์ง ๊ฐ„๊ฒฉ + double crossAxisSpacing = 8.0; + + // ๋ฆฌ์ŠคํŠธ๋ทฐ์˜ ๋†’์ด ๊ณ„์‚ฐ + double listHeight = ((itemCount / columnCount).ceil() * itemHeight) + + ((itemCount / columnCount - 1).ceil() * crossAxisSpacing); + + return listHeight; + } + + + @override + Widget build(BuildContext context) { + MediaQueryData deviceData = MediaQuery.of(context); + Size screenSize = deviceData.size; + return Scaffold( + appBar: PreferredSize( + preferredSize: Size.fromHeight(72), + child: AppBar( + leading: + Padding( + padding: EdgeInsets.only(top: 20), + child: IconButton( + icon: Icon(Icons.arrow_back_ios_rounded, color: Colors.black), + onPressed: () => Navigator.of(context).pop(), + ), + ), + backgroundColor: Color(0xffDDE7FD), + elevation: 0.0, + title: + Container( + height: 50, + width: screenSize.width, + child: Column( + children: [ + SizedBox(height: 24,), + Center( + child: Padding( + padding: EdgeInsets.only(right: 60), + child: Text( + 'ํ•จ๊ป˜ํ• ๊ฐœ', + style: textStyle.bk20normal, + ), + )), + ], + )), + iconTheme: IconThemeData(color: Colors.black), + ), + ), + body: Container( + color: Color(0xffDDE7FD), + width: Get.width, + height: Get.height, + child: SingleChildScrollView( + padding: EdgeInsets.fromLTRB(0, 0, 0, 0), + scrollDirection: Axis.vertical, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + if(fetchSuccess)...[ + ClipRRect( + borderRadius: BorderRadius.only(topLeft: Radius.circular(16.0), topRight: Radius.circular(16.0)), + child: Container( + width: Get.width, + //height: 578, + color: Colors.white, + child: + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding(padding: EdgeInsets.all(16), + child: Column( + children: [ + Container( + width: Get.width, + height: Get.width - 32, + child: Stack( + children: [ + Container( + width: Get.width, + height: Get.width - 32, + child: + ClipRRect( + borderRadius: BorderRadius.circular(16.0), + child: + ImageSlideshow( + indicatorColor: Color(0xffFEFBAC), + onPageChanged: (value) { + debugPrint('Page changed: $value'); + }, + //autoPlayInterval: 3000, + isLoop: false, + children: [ + for(int i= 0; i OthersMemorialMainPage())); + }, + child: Padding( + padding: EdgeInsets.only(left: 10, top: 10), + child: Container( + decoration: BoxDecoration( + color: Colors.black.withOpacity(0.2), + borderRadius: BorderRadius.circular(32), + ), + // color: Colors.white.withOpacity(0.7), + width: 90, + height: 32, + child: Row( + children: [ + SizedBox(width: 6,), + if(watchmain.selectedOthersProfileImage.toString() == "null")...[ + CircleAvatar( + backgroundColor: Colors.white, + radius: 10, + child: CircleAvatar( + child: SvgPicture.asset('assets/images/user_null2.svg',), + radius: 9, + ), + ), + ]else...[ + CircleAvatar( + backgroundColor: Colors.white, + radius: 10, + child: CircleAvatar( + radius: 9, + backgroundImage: NetworkImage(watchmain.selectedOthersProfileImage.toString()), + ), + ), + ], + // CircleAvatar( + // backgroundColor: Colors.white, + // radius: 10, + // child: CircleAvatar( + // radius: 9, + // backgroundImage: NetworkImage(watchmain.selectedOthersProfileImage.toString(),), + // ), + // ), + + SizedBox(width: 5,), + Container( + width: 37, + child:Text(watchmain.selectedOthersNickaname, + overflow: TextOverflow.ellipsis, // "..."์œผ๋กœ ํ‘œ์‹œ + maxLines: 1, // ์›ํ•˜๋Š” ์ค„ ์ˆ˜๋กœ ์„ค์ • + style: TextStyle(color: Colors.white, fontSize: 14, fontFamily: 'Pretendard',fontWeight: FontWeight.w600,),), + ), + SizedBox(width: 5,), + Container( + width: 11, + child: + Icon(Icons.arrow_forward_ios_rounded, color: Colors.white,size: 12,), + // SvgPicture.asset( + // 'assets/images/memorial/blue_arrow.svg', + // //fit: BoxFit.cover, + // ), + ) + ], + ), + ), + ), + ) + ], + ), + ), + SizedBox(height: 15,), + Row( + children: [ + Container( + width: 120, + height: 32, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text("${parsedResponseCN['date']}์˜ ๊ธฐ์–ต", style: textStyle.grey12normal,), + SizedBox(height: 4,), + Text(parsedResponseCN['place'], style: textStyle.grey12normal) + ], + ), + ), + SizedBox(width: 150,), + Row( + children: [ + Container( + width: 19, + height: 19, + child: InkWell( + onTap: (){}, + child: SvgPicture.asset( + 'assets/images/memorial/comments.svg', + ), + ),), + SizedBox( width: 3,), + Text('${comments}'), + SizedBox( width: 10,), + if(hearts >= 1)...[ + Container( + // width: 22, + // height: 22, + child: InkWell( + onTap: (){ + // ์ข‹์•„์š” ๋ˆ„๋ฅด๊ธฐ + sendPostRequest(sign_in.userAccessToken); + // fetchDataLike(sign_in.userAccessToken); + hearts= 0; + setState(() { + }); + }, + child: SvgPicture.asset( + 'assets/images/memorial/heart-fill.svg', + ), + ),), + ] else...[ + SizedBox(width: 2,), + Container( + // width: 22, + // height: 22, + child: InkWell( + onTap: (){ + // ์ข‹์•„์š” ๋ˆ„๋ฅด๊ธฐ + sendPostRequest(sign_in.userAccessToken); + // fetchDataLike(sign_in.userAccessToken); + hearts= 1; + setState(() { + }); + }, + child: SvgPicture.asset( + 'assets/images/memorial/heart-empty.svg', + ), + ), + ), + ], + SizedBox( width: 3,), + Text('${hearts}'), + ], + ) + + ], + ), + SizedBox(height: 15,), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text(parsedResponseCN['title'],style: textStyle.bk16semibold,), + SizedBox(height: 8,), + Container(width: Get.width, + //height: 50, + child: Text(parsedResponseCN['content'], style: textStyle.bk14normal,), + ), + SizedBox(height: 8,), + Container(width: Get.width, + height: 12, + child: Text('#${parsedResponseCN['hashtag']}', style: textStyle.grey12normal), + ), + SizedBox(height: 5,), + ], + ), + ], + ),), + + ], + ), + + ), + ), + + SizedBox(height: 4,), + Container( + width: Get.width, + height: calculateListViewHeight() + 64, + child: Column( + children: [ + Expanded( + child: Column( + children: [ + listview_builder(), + ], + ) + ), + ], + ) + ), + + ], + + ], + ), + ), + ), + bottomSheet: Padding( + padding: EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom * 0.001), + child: Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.end, + children:[ + Container( + color:Color(0xffF2F4F6), + height: 48, + child: Padding( + padding: const EdgeInsets.only(bottom: 8.0, top: 8.0, left: 16,right: 16), + child: Stack( + children: [ + Container( + width: Get.width, + height: 32, + decoration: BoxDecoration( + color: Colors.white, + border: Border.all(color: addComment? Color(colorChart.blue):Color(0xffC0D2FC)), + borderRadius: BorderRadius.circular(30), + ), + ), + Positioned( + left: 15, + right: 30, + bottom: -1, + top: 1, + child: TextField( + controller: myController, + style: textStyle.bk14normal, + decoration: InputDecoration( + hintStyle: textStyle.grey14normal, + border: InputBorder.none, hintText: '๋Œ“๊ธ€์„ ์ž…๋ ฅํ•˜๋ ค๋ฉด ์—ฌ๊ธฐ๋ฅผ ํƒญํ•˜์„ธ์š”.'), + onChanged: (s) { + //text = s; + addComment = true; + setState(() { + + }); + }, + onTap: (){ + + }, + ), + ), + Positioned( + left: Get.width - 81, + //right: 30, + bottom: 3, + top: 3, + child: ElevatedButton( + onPressed: () { + saveComment(sign_in.userAccessToken, myController.text); + setState(() { + }); + addComment = false; + myController.clear(); + Timer(Duration(milliseconds: 500), () { + fetchDataComment(); + }); + }, + style: ElevatedButton.styleFrom( + backgroundColor: addComment?Color(colorChart.blue):Color(0xffDDE7FD), + fixedSize: const Size(23, 23), + shape: const CircleBorder(), + ), + child:Icon(Icons.arrow_upward, color: Colors.white,size: 16,) + ), + ), + ], + ), + ), + ), + ], + ), + ) + ); + } +} \ No newline at end of file diff --git a/client/lib/memorial/modify_profile.dart b/client/lib/memorial/modify_profile.dart new file mode 100644 index 0000000..0bfb344 --- /dev/null +++ b/client/lib/memorial/modify_profile.dart @@ -0,0 +1,1338 @@ +import 'dart:async'; +import 'dart:io'; +import 'package:flutter/material.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter_svg/svg.dart'; +//import 'package:get/get.dart'; +import 'package:image_picker/image_picker.dart'; +import 'package:client/memorial/memorial_main.dart'; +import 'package:client/screen.dart'; +import 'package:client/style.dart'; +import 'package:intl/intl.dart'; +import 'dart:convert'; +import 'package:flutter/services.dart'; +import 'package:exif/exif.dart'; +import 'package:http/http.dart' as http; +import 'package:http_parser/http_parser.dart'; +import 'package:dio/dio.dart'; +import 'package:http_parser/http_parser.dart'; +import 'package:client/sign/sign_in.dart' as sign_in; +import 'dart:ui' as ui; +import 'dart:typed_data'; +import 'package:path_provider/path_provider.dart'; + +/// ํ”„๋กœํ•„ ์ˆ˜์ • +class ModifyProfilePage extends StatefulWidget { + static Future navigatorPush(BuildContext context) async { + return Navigator.push( + context, + MaterialPageRoute( + builder: (_) => ModifyProfilePage(), + ), + ); + } + + @override + _ModifyProfilePageState createState() => _ModifyProfilePageState(); +} + +class _ModifyProfilePageState extends State { + + Future urlToXFile(String imageUrl) async { + try { + http.Response response = await http.get(Uri.parse(imageUrl)); + if (response.statusCode == 200) { + Uint8List bytes = response.bodyBytes; + + ui.Image image = await decodeImageFromList(bytes); + + // Use getTemporaryDirectory() from path_provider to get the temporary directory + final tempDir = await getTemporaryDirectory(); + + // Save the Image to a file in the temporary directory + final file = File('${tempDir.path}/temp_image.jpg'); + await file.writeAsBytes(bytes); + + return XFile(file.path); + } else { + return null; + } + } catch (e) { + return null; + } + } + + bool takeUser = false; // ์œ ์ €์ •๋ณด๋ฅผ ๊ฐ€์ ธ์™”๋Š”์ง€ ํ™•์ธ + + // ํ…์ŠคํŠธ์—๋””ํŒ…์ปจํŠธ๋กค๋Ÿฌ๋ฅผ ์ƒ์„ฑํ•˜์—ฌ ํ•„๋“œ์— ํ• ๋‹น + final userNameController = TextEditingController(); // ์‚ฌ์šฉ์ž ๋‹‰๋„ค์ž„ + final dogNameController = TextEditingController(); // ๋ฐ˜๋ ค๊ฒฌ ์ด๋ฆ„ + final dogAgeController = TextEditingController(); // ๋ฐ˜๋ ค๊ฒฌ ๋‚˜์ด + final dogTypeController = TextEditingController(); // ๋ฐ˜๋ ค๊ฒฌ ์ข… + + // ์ˆ˜์ • ๋ฒ„ํŠผ์„ ๋ˆŒ๋ €๋Š”์ง€? + bool modiUserName = false; + bool modiDogName = false; + bool modiDogAge = false; + bool modiDogType = false; + + bool modiImage = false; + + // ์ˆ˜์ • possible? + bool possUserName = false; + bool possDogName = false; + bool possDogAge = false; + bool possDogType = false; + bool userwriteType = false; + + String setedDogType = ""; + String setedUserName = ""; + String setedDogName = ""; + int setedDogAge = 0; + String setedDogImage = ""; + + + String newDogType = ""; + String newUserName = ""; + String newDogName = ""; + int newDogAge = 0; + String newDogImage = ""; + + + + List dogType_ = [ + "๋น„์ˆ‘ ํ”„๋ฆฌ์ œ", "ํฌ๋ฉ”๋ผ๋‹ˆ์•ˆ", "ํ”„๋ Œ์น˜ ๋ถˆ๋…","์น˜์™€์™€", "๋ชฐํ‹ฐ์ฆˆ","ํ† ์ด ํ‘ธ๋“ค","๋ผ๋ธŒ๋ผ๋„ ๋ฆฌํŠธ๋ฆฌ๋ฒ„","์ง„๋—๊ฐœ","์ดํƒˆ๋ฆฌ์•ˆ ๊ทธ๋ ˆ์ดํ•˜์šด๋“œ","์›ฐ์‹œ์ฝ”๊ธฐ","๋ถˆ๋…","์…”ํ‹€๋žœ๋“œ ์‰ฝ๋…", + "์‹œ๋ฐ”๊ฒฌ", "๊ณจ๋“  ๋ฆฌํŠธ๋ฆฌ๋ฒ„", "๋กœํŠธ์™€์ผ๋Ÿฌ", "์ผ€์ธ ์ฝ”๋ฅด์†Œ", "ํผ๊ทธ", "๋ฒ ๋“ค๋งํ„ด ํ…Œ๋ฆฌ์–ด", "์ €๋จผ ์…ฐํผ๋“œ", "๋ฏธ๋‹ˆ์–ด์ฒ˜ ๋‹ฅ์Šคํ›ˆํŠธ", "์ฐจ์šฐ์ฐจ์šฐ", "๋„๋ฒ ๋ฅด๋งŒ", "์•„๋ฉ”๋ฆฌ์นธ ์ฝ”์นด ์ŠคํŒŒ๋‹ˆ์—˜", "์นด๋ฐ”๋ฆฌ์— ํ‚น ์ฐฐ์Šค ์ŠคํŒŒ๋‹ˆ์—˜", + "ํŽ˜ํ‚ค๋‹ˆ์ฆˆ", "์ฝ”์นด์‹œ์•ˆ ์˜ค๋ธŒ์ฐจ์นด", "์Šคํƒ ๋‹ค๋“œ ํ‘ธ๋“ค","์š”ํฌ์…” ํ…Œ๋ฆฌ์–ด", "์‚ฌ๋ชจ์˜ˆ๋“œ", "์„ผํŠธ๋Ÿด ์•„์‹œ์•ˆ ์˜ค๋ธŒ์ฐจ์นด", "์‹œ๋ฒ ๋ฆฌ์•ˆ ํ—ˆ์Šคํ‚ค", "ํœ˜ํ•", "์•„๋ฉ”๋ฆฌ์นธ ์•„ํ‚คํƒ€", "๋น ๋น„์šฉ", "๋ณด๋”์ฝœ๋ฆฌ", "๊ผฌ๋™ ๋“œ ํˆด๋ ˆ์•„", + "๋ฏธ๋‹ˆ์–ด์ฒ˜ ๋ณผ ํ…Œ๋ฆฌ์–ด", "๋ฏธ๋‹ˆ์–ด์ฒ˜ ์Šˆ๋‚˜์šฐ์ €", "์•„ํ”„๊ฐ„ ํ•˜์šด๋“œ","๋„๊ณ ์•„๋ฅดํ—จํ‹ฐ๋…ธ", "ํ‹ฐ๋ฒ ํƒ„ ๋งˆ์Šคํ‹ฐํ”„","๋ฒจ์ง€์•ˆ ์…ฐํผ๋“œ","์žญ ๋Ÿฌ์ŽŒ ํ…Œ๋ฆฌ์–ด","๋ฏธ๋‹ˆ์–ด์ฒ˜ ํ‘ธ๋“ค","๋ฏธ๋””์—„ ํ‘ธ๋“ค","์‹œ์ธ„","๋ž˜๋น— ๋‹ฅ์Šคํ›ˆํŠธ","๋น„๊ธ€", "์ฐพ๋Š” ์ข…์ด ์—†๋‹ค๋ฉด ์ง์ ‘ ์ž…๋ ฅํ•ด๋ณด์„ธ์š”!" + ]; + + bool isPicSelected = false; // ์‚ฌ์ง„์ด ๋“ค์–ด๊ฐ€๋Š”์ง€ ํ™•์ธํ•˜๋Š” ์ฝ”๋“œ -> UI ๋ฐ”๋€œ + // final ImagePicker _picker = ImagePicker(); + // final List _pickedImages = []; + + XFile? _image; //์ด๋ฏธ์ง€๋ฅผ ๋‹ด์„ ๋ณ€์ˆ˜ ์„ ์–ธ + final ImagePicker picker = ImagePicker(); //ImagePicker ์ดˆ๊ธฐํ™” + + //์ด๋ฏธ์ง€๋ฅผ ๊ฐ€์ ธ์˜ค๋Š” ํ•จ์ˆ˜ + Future getImage(ImageSource imageSource) async { + //pickedFile์— ImagePicker๋กœ ๊ฐ€์ ธ์˜จ ์ด๋ฏธ์ง€๊ฐ€ ๋‹ด๊ธด๋‹ค. + final XFile? pickedFile = await picker.pickImage(source: imageSource); + if (pickedFile != null) { + setState(() { + modiImage= true; + _image = XFile(pickedFile.path); //๊ฐ€์ ธ์˜จ ์ด๋ฏธ์ง€๋ฅผ _image์— ์ €์žฅ + //changeUserImage(sign_in.userAccessToken, _image as List); + }); + } + } + + late Map parsedResponseUser; // ์‚ฌ์šฉ์ž ์ •๋ณด + + // ์‚ฌ์šฉ์ž ์ •๋ณด ์กฐํšŒ + void fetchUserInfo(String aToken) async { + // API ์—”๋“œํฌ์ธํŠธ URL + print("๋ฐ›ํ† :" + aToken); + String apiUrl = 'http://3.38.1.125:8080/user/info'; // ์‹ค์ œ API ์—”๋“œํฌ์ธํŠธ๋กœ ๋ณ€๊ฒฝํ•˜์„ธ์š” + + // ํ—ค๋” ์ •๋ณด ์„ค์ • + Map headers = { + 'Authorization': 'Bearer $aToken', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• + 'Content-Type': 'application/json', // ์˜ˆ: JSON ์š”์ฒญ์ธ ๊ฒฝ์šฐ ํ—ค๋” ์„ค์ • + }; + + // HTTP GET ์š”์ฒญ ๋ณด๋‚ด๊ธฐ + var response = await http.get( + Uri.parse(apiUrl), + headers: headers, // ํ—ค๋” ์ถ”๊ฐ€ + ); + + // HTTP ์‘๋‹ต ์ƒํƒœ ํ™•์ธ + if (response.statusCode == 200) { + // ์‘๋‹ต ๋ฐ์ดํ„ฐ ์ฒ˜๋ฆฌ + print('์„œ๋ฒ„๋กœ๋ถ€ํ„ฐ ๋ฐ›์€ ๋‚ด์šฉ ๋ฐ์ดํ„ฐ(์‚ฌ์šฉ์ž ์ •๋ณด-ํ”„๋กœํ•„): ${response.body}'); + var jsonResponse = utf8.decode(response.bodyBytes); + + parsedResponseUser = json.decode(jsonResponse); + takeUser = true; + + setedUserName = parsedResponseUser['nickname']; + setedDogName = parsedResponseUser['puppyName']; + setedDogAge = parsedResponseUser['puppyAge']; + setedDogType = parsedResponseUser['puppyType']; + //setedDogImage = parsedResponseUser['profileImage']; + + setState(() { + + }); + + } else { + // ์š”์ฒญ์ด ์‹คํŒจํ•œ ๊ฒฝ์šฐ ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌ + print('HTTP ์š”์ฒญ ์‹คํŒจ: ${response.statusCode}'); + } + } + + + // ์‚ฌ์šฉ์ž ์ •๋ณด ๋ณ€๊ฒฝ + void changeUserName(String aToken, String nickname) async { + + try { + var dio = Dio(); // Dio ์ธ์Šคํ„ด์Šค ์ƒ์„ฑ + + // JSON ๋ฐ์ดํ„ฐ ์ถ”๊ฐ€ + final jsonData = { + "nickname": nickname, + "puppyName": setedDogName, + "puppyAge": setedDogAge, + "puppyType": setedDogType, + //"profileImage" : setedDogImage, + }; + + // JSON ๋ฐ์ดํ„ฐ๋ฅผ ๋ฌธ์ž์—ด๋กœ ์ธ์ฝ”๋”ฉ + final jsonString = jsonEncode(jsonData); + + // final List _files2 = images + // .map((img) => MultipartFile.fromFileSync(img.path, + // contentType: MediaType("image", "jpeg"))) + // .toList(); + + //final List _files = images.map((img) => MultipartFile.fromFileSync(img!.path, contentType: new MediaType("image", "jpg"))).toList(); + + //print('Content-Type: ${_files.contentType}'); + + + final data = FormData.fromMap({ + "image": "", + "json": await MultipartFile.fromString( + jsonString, + contentType: MediaType.parse('application/json'), + ), + }, + ); + + + //dio.options.contentType = 'multipart/form-data'; + + // http://3.38.1.125:8080/memorial + // POST ์š”์ฒญ ๋ณด๋‚ด๊ธฐ + var response = await dio.post( + 'http://3.38.1.125:8080/user/info', // ์„œ๋ฒ„ ์—”๋“œํฌ์ธํŠธ ๊ฒฝ๋กœ ์„ค์ • + data: data, + options: Options( + method: 'POST', + headers: { + 'Content-Type': 'multipart/form-data', // Content-Type ์„ค์ • + 'Authorization': 'Bearer $aToken', + }, + //responseType: ResponseType.plain + ), + ); + + // ์‘๋‹ต ์ฒ˜๋ฆฌ + if (response.statusCode == 200) { + print('์ด๋ฏธ์ง€ ์—…๋กœ๋“œ ์„ฑ๊ณต'); + // ์‘๋‹ต ๋ฐ์ดํ„ฐ ์ฝ๊ธฐ + final responseJson = json.decode(response.data); + print('์„œ๋ฒ„ ์‘๋‹ต ๋ฐ์ดํ„ฐ: $responseJson'); + } else { + print('์ด๋ฏธ์ง€ ์—…๋กœ๋“œ ์‹คํŒจ. HTTP ์—๋Ÿฌ ์ฝ”๋“œ: ${response.statusCode}'); + } + } catch (e) { + if (e is DioError) { + if (e.response != null) { + print('์„œ๋ฒ„ ์‘๋‹ต ์—๋Ÿฌ ๋ฐ์ดํ„ฐ: ${e.response?.data}'); + } else { + print('Dio ์—๋Ÿฌ: ${e.message}'); + } + } else { + print('์—๋Ÿฌ ๋ฐœ์ƒ: $e'); + } + } + } + + // ๋ฐ˜๋ ค๊ฒฌ ์ด๋ฆ„ ๋ณ€๊ฒฝ + void changePuppyName(String aToken, String puppyName) async { + try { + var dio = Dio(); // Dio ์ธ์Šคํ„ด์Šค ์ƒ์„ฑ + + // JSON ๋ฐ์ดํ„ฐ ์ถ”๊ฐ€ + final jsonData = { + "nickname" : setedUserName, + "puppyName" : puppyName, + "puppyAge" : setedDogAge, + "puppyType" : setedDogType, + //"profileImage" : setedDogImage, + }; + + // JSON ๋ฐ์ดํ„ฐ๋ฅผ ๋ฌธ์ž์—ด๋กœ ์ธ์ฝ”๋”ฉ + final jsonString = jsonEncode(jsonData); + + // final List _files2 = images + // .map((img) => MultipartFile.fromFileSync(img.path, + // contentType: MediaType("image", "jpeg"))) + // .toList(); + + //final List _files = images.map((img) => MultipartFile.fromFileSync(img!.path, contentType: new MediaType("image", "jpg"))).toList(); + + //print('Content-Type: ${_files.contentType}'); + + + final data = FormData.fromMap({ + "image": "", + "json": await MultipartFile.fromString( + jsonString, + contentType: MediaType.parse('application/json'), + ), + }, + ); + + + //dio.options.contentType = 'multipart/form-data'; + + // http://3.38.1.125:8080/memorial + // POST ์š”์ฒญ ๋ณด๋‚ด๊ธฐ + var response = await dio.post( + 'http://3.38.1.125:8080/user/info', // ์„œ๋ฒ„ ์—”๋“œํฌ์ธํŠธ ๊ฒฝ๋กœ ์„ค์ • + data: data, + options: Options( + method: 'POST', + headers: { + 'Content-Type': 'multipart/form-data', // Content-Type ์„ค์ • + 'Authorization': 'Bearer $aToken', + }, + //responseType: ResponseType.plain + ), + ); + + // ์‘๋‹ต ์ฒ˜๋ฆฌ + if (response.statusCode == 200) { + print('์ด๋ฏธ์ง€ ์—…๋กœ๋“œ ์„ฑ๊ณต'); + // ์‘๋‹ต ๋ฐ์ดํ„ฐ ์ฝ๊ธฐ + final responseJson = json.decode(response.data); + print('์„œ๋ฒ„ ์‘๋‹ต ๋ฐ์ดํ„ฐ: $responseJson'); + } else { + print('์ด๋ฏธ์ง€ ์—…๋กœ๋“œ ์‹คํŒจ. HTTP ์—๋Ÿฌ ์ฝ”๋“œ: ${response.statusCode}'); + } + } catch (e) { + if (e is DioError) { + if (e.response != null) { + print('์„œ๋ฒ„ ์‘๋‹ต ์—๋Ÿฌ ๋ฐ์ดํ„ฐ: ${e.response?.data}'); + } else { + print('Dio ์—๋Ÿฌ: ${e.message}'); + } + } else { + print('์—๋Ÿฌ ๋ฐœ์ƒ: $e'); + } + } + } + + // ๋ฐ˜๋ ค๊ฒฌ ๋‚˜์ด ๋ณ€๊ฒฝ + void changePuppyAgeInfo(String aToken, int puppyAge) async { + try { + var dio = Dio(); // Dio ์ธ์Šคํ„ด์Šค ์ƒ์„ฑ + + // JSON ๋ฐ์ดํ„ฐ ์ถ”๊ฐ€ + final jsonData = { + "nickname" : setedUserName, + "puppyName" : setedDogName, + "puppyAge" : puppyAge, + "puppyType" : setedDogType, + //"profileImage" : setedDogImage, + }; + + // JSON ๋ฐ์ดํ„ฐ๋ฅผ ๋ฌธ์ž์—ด๋กœ ์ธ์ฝ”๋”ฉ + final jsonString = jsonEncode(jsonData); + + // final List _files2 = images + // .map((img) => MultipartFile.fromFileSync(img.path, + // contentType: MediaType("image", "jpeg"))) + // .toList(); + + //final List _files = images.map((img) => MultipartFile.fromFileSync(img!.path, contentType: new MediaType("image", "jpg"))).toList(); + + //print('Content-Type: ${_files.contentType}'); + + + final data = FormData.fromMap({ + "image": "", + "json": await MultipartFile.fromString( + jsonString, + contentType: MediaType.parse('application/json'), + ), + }, + ); + + + //dio.options.contentType = 'multipart/form-data'; + + // http://3.38.1.125:8080/memorial + // POST ์š”์ฒญ ๋ณด๋‚ด๊ธฐ + var response = await dio.post( + 'http://3.38.1.125:8080/user/info', // ์„œ๋ฒ„ ์—”๋“œํฌ์ธํŠธ ๊ฒฝ๋กœ ์„ค์ • + data: data, + options: Options( + method: 'POST', + headers: { + 'Content-Type': 'multipart/form-data', // Content-Type ์„ค์ • + 'Authorization': 'Bearer $aToken', + }, + //responseType: ResponseType.plain + ), + ); + + // ์‘๋‹ต ์ฒ˜๋ฆฌ + if (response.statusCode == 200) { + print('์ด๋ฏธ์ง€ ์—…๋กœ๋“œ ์„ฑ๊ณต'); + // ์‘๋‹ต ๋ฐ์ดํ„ฐ ์ฝ๊ธฐ + final responseJson = json.decode(response.data); + print('์„œ๋ฒ„ ์‘๋‹ต ๋ฐ์ดํ„ฐ: $responseJson'); + } else { + print('์ด๋ฏธ์ง€ ์—…๋กœ๋“œ ์‹คํŒจ. HTTP ์—๋Ÿฌ ์ฝ”๋“œ: ${response.statusCode}'); + } + } catch (e) { + if (e is DioError) { + if (e.response != null) { + print('์„œ๋ฒ„ ์‘๋‹ต ์—๋Ÿฌ ๋ฐ์ดํ„ฐ: ${e.response?.data}'); + } else { + print('Dio ์—๋Ÿฌ: ${e.message}'); + } + } else { + print('์—๋Ÿฌ ๋ฐœ์ƒ: $e'); + } + } + } + + // ๋ฐ˜๋ ค๊ฒฌ ์ข… ๋ณ€๊ฒฝ + void changePuppyTypeInfo(String aToken, String puppyType) async { + try { + var dio = Dio(); // Dio ์ธ์Šคํ„ด์Šค ์ƒ์„ฑ + + // JSON ๋ฐ์ดํ„ฐ ์ถ”๊ฐ€ + final jsonData = { + "nickname" : setedUserName, + "puppyName" : setedDogName, + "puppyAge" : setedDogAge, + "puppyType" : puppyType, + }; + + // JSON ๋ฐ์ดํ„ฐ๋ฅผ ๋ฌธ์ž์—ด๋กœ ์ธ์ฝ”๋”ฉ + final jsonString = jsonEncode(jsonData); + + // final List _files2 = images + // .map((img) => MultipartFile.fromFileSync(img.path, + // contentType: MediaType("image", "jpeg"))) + // .toList(); + + //final List _files = images.map((img) => MultipartFile.fromFileSync(img!.path, contentType: new MediaType("image", "jpg"))).toList(); + + //print('Content-Type: ${_files.contentType}'); + + + final data = FormData.fromMap({ + "image": "", + "json": await MultipartFile.fromString( + jsonString, + contentType: MediaType.parse('application/json'), + ), + }, + ); + + + //dio.options.contentType = 'multipart/form-data'; + + // http://3.38.1.125:8080/memorial + // POST ์š”์ฒญ ๋ณด๋‚ด๊ธฐ + var response = await dio.post( + 'http://3.38.1.125:8080/user/info', // ์„œ๋ฒ„ ์—”๋“œํฌ์ธํŠธ ๊ฒฝ๋กœ ์„ค์ • + data: data, + options: Options( + method: 'POST', + headers: { + 'Content-Type': 'multipart/form-data', // Content-Type ์„ค์ • + 'Authorization': 'Bearer $aToken', + }, + //responseType: ResponseType.plain + ), + ); + + // ์‘๋‹ต ์ฒ˜๋ฆฌ + if (response.statusCode == 200) { + print('์ด๋ฏธ์ง€ ์—…๋กœ๋“œ ์„ฑ๊ณต'); + // ์‘๋‹ต ๋ฐ์ดํ„ฐ ์ฝ๊ธฐ + final responseJson = json.decode(response.data); + print('์„œ๋ฒ„ ์‘๋‹ต ๋ฐ์ดํ„ฐ: $responseJson'); + } else { + print('์ด๋ฏธ์ง€ ์—…๋กœ๋“œ ์‹คํŒจ. HTTP ์—๋Ÿฌ ์ฝ”๋“œ: ${response.statusCode}'); + } + } catch (e) { + if (e is DioError) { + if (e.response != null) { + print('์„œ๋ฒ„ ์‘๋‹ต ์—๋Ÿฌ ๋ฐ์ดํ„ฐ: ${e.response?.data}'); + } else { + print('Dio ์—๋Ÿฌ: ${e.message}'); + } + } else { + print('์—๋Ÿฌ ๋ฐœ์ƒ: $e'); + } + } + } + + // ํ”„๋กœํ•„ ์‚ฌ์ง„ ๋ณ€๊ฒฝ + void changeUserImage(String aToken, XFile images) async { + // ์š”์ฒญ ๋ณธ๋ฌธ ๋ฐ์ดํ„ฐ + try { + var dio = Dio(); // Dio ์ธ์Šคํ„ด์Šค ์ƒ์„ฑ + // XFile์—์„œ ํ•„์š”ํ•œ ์ •๋ณด ์ถ”์ถœ + List imageBytes = await images.readAsBytes(); + String base64Image = base64Encode(imageBytes); + + // JSON ๋ฐ์ดํ„ฐ ์ถ”๊ฐ€ + final jsonData = { + "nickname" : setedUserName, + "puppyName" : setedDogName, + "puppyAge" : setedDogAge, + "puppyType" : setedDogType, + }; + + // JSON ๋ฐ์ดํ„ฐ๋ฅผ ๋ฌธ์ž์—ด๋กœ ์ธ์ฝ”๋”ฉ + final jsonString = jsonEncode(jsonData); + + final data = FormData.fromMap({ + "image": MultipartFile.fromFileSync( + images.path, + contentType: MediaType("image", "jpeg"), + ), + "json": await MultipartFile.fromString( + jsonString, + contentType: MediaType.parse('application/json'), + ), + }, + ); + + + //dio.options.contentType = 'multipart/form-data'; + + // http://3.38.1.125:8080/memorial + // POST ์š”์ฒญ ๋ณด๋‚ด๊ธฐ + var response = await dio.post( + 'http://3.38.1.125:8080/user/info', // ์„œ๋ฒ„ ์—”๋“œํฌ์ธํŠธ ๊ฒฝ๋กœ ์„ค์ • + data: data, + options: Options( + method: 'POST', + headers: { + 'Content-Type': 'multipart/form-data', // Content-Type ์„ค์ • + 'Authorization': 'Bearer $aToken', + }, + //responseType: ResponseType.plain + ), + ); + + // ์‘๋‹ต ์ฒ˜๋ฆฌ + if (response.statusCode == 200) { + print('์ด๋ฏธ์ง€ ์—…๋กœ๋“œ ์„ฑ๊ณต'); + // ์‘๋‹ต ๋ฐ์ดํ„ฐ ์ฝ๊ธฐ + final responseJson = json.decode(response.data); + print('์„œ๋ฒ„ ์‘๋‹ต ๋ฐ์ดํ„ฐ: $responseJson'); + } else { + print('์ด๋ฏธ์ง€ ์—…๋กœ๋“œ ์‹คํŒจ. HTTP ์—๋Ÿฌ ์ฝ”๋“œ: ${response.statusCode}'); + } + } catch (e) { + if (e is DioError) { + if (e.response != null) { + print('์„œ๋ฒ„ ์‘๋‹ต ์—๋Ÿฌ ๋ฐ์ดํ„ฐ: ${e.response?.data}'); + } else { + print('Dio ์—๋Ÿฌ: ${e.message}'); + } + } else { + print('์—๋Ÿฌ ๋ฐœ์ƒ: $e'); + } + } + } + + // ์ˆ˜์ • ์ค‘ ๋‚˜๊ฐˆ ์‹œ ํŒ์—… + void FlutterDialog() { + showDialog( + context: context, + builder: (_) => new AlertDialog( + shape: RoundedRectangleBorder( + borderRadius: + BorderRadius.all( + Radius.circular(12.0))), + content: Builder( + builder: (context) { + + return Container( + height: 298, + width: 412, + child: + Padding(padding: EdgeInsets.all(0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SizedBox(height: 12,), + Container( + width: 125, + height: 117, + child: SvgPicture.asset( + 'assets/images/no_result.svg', + width: 132, + height: 123, + fit: BoxFit.contain, + ), + ), + SizedBox(height: 32,), + Text("์ˆ˜์ • ๋‚ด์šฉ์„ ์‚ญ์ œ ํ•˜์‹œ๊ฒ ์–ด์š”?",style: textStyle.bk16bold,), + SizedBox(height: 8,), + Text("์ง€๊ธˆ ๋Œ์•„๊ฐ€๋ฉด ์ˆ˜์ • ๋‚ด์šฉ์ด ์‚ญ์ œ๋ผ์š”!", style: textStyle.bk14normal,), + SizedBox(height: 32,), + Row( + children: [ + Container( + height: 40, + width: 120, + child: ElevatedButton( + child: new Text("์ˆ˜์ • ๊ณ„์†", style: textStyle.purple16midium), + style: buttonChart().purplebtn3, + onPressed: () { + Navigator.pop(context); + }, + ), + ), + SizedBox(width: 16,), + Container( + height: 40, + width: 120, + child: ElevatedButton( + child: new Text("์ˆ˜์ • ์ทจ์†Œ", style: textStyle.white16semibold), + style: buttonChart().purplebtn, + onPressed: () { + // ํ•จ๊ป˜ํ• ๊ฐœ ํ™”๋ฉด์œผ๋กœ ๋Œ์•„๊ฐ€๊ธฐ + Navigator.pop(context); + Navigator.pop(context); + }, + ), + ), + ], + ) + ], + ),) + ); + }, + ), + ) + ); + } + + + bool ch = false; + + @override + void initState() { + super.initState(); + fetchUserInfo(sign_in.userAccessToken); // ์‚ฌ์šฉ์ž ์ •๋ณด ๊ฐ€์ ธ์˜ค๊ธฐ + } + + @override + void dispose() async { + super.dispose(); + } + + double calculateListViewHeight() { + // ๋ฆฌ์ŠคํŠธ๋ทฐ์˜ ์•„์ดํ…œ ์ˆ˜ + int itemCount = dogType_.length; + + // ๋ฆฌ์ŠคํŠธ๋ทฐ์˜ ์—ด ์ˆ˜ (3๊ฐœ์˜ ์•„์ดํ…œ์ด ํ•œ ํ–‰์— ์žˆ์„ ๋•Œ) + int columnCount = 1; + + // ์•„์ดํ…œ์˜ ๋†’์ด (๊ฐ€๋กœ:์„ธ๋กœ ๋น„์œจ์„ ์„ค์ •ํ•  ์ˆ˜ ์žˆ์Œ) + double itemHeight = 38; // ์ด ๊ฐ’์€ ์ ์ ˆํžˆ ์กฐ์ • + + // ์•„์ดํ…œ ๊ฐ„์˜ ์ˆ˜์ง ๊ฐ„๊ฒฉ + double crossAxisSpacing = 8.0; + + // ๋ฆฌ์ŠคํŠธ๋ทฐ์˜ ๋†’์ด ๊ณ„์‚ฐ + double listHeight = ((itemCount / columnCount).ceil() * itemHeight) + + ((itemCount / columnCount - 1).ceil() * crossAxisSpacing); + + return listHeight; + } + + + @override + Widget build(BuildContext context) { + MediaQueryData deviceData = MediaQuery.of(context); + Size screenSize = deviceData.size; + + // ๊ฐ•์•„์ง€ ์ข…๋ฅ˜ ์œ„์ ฏ + Widget listview_builder(){ + return ListView.builder( + shrinkWrap: true, + scrollDirection: Axis.vertical, + padding: EdgeInsets.all(0), + physics: NeverScrollableScrollPhysics(), + itemCount: dogType_.length, + itemBuilder: (BuildContext context, int index){ + return Container( + padding: EdgeInsets.all(8), + height: 45, + child: InkWell( + child: Row( + children: [ + SizedBox(width: 8,), + SvgPicture.asset( + 'assets/images/memorial/paw.svg', + ), + SizedBox(width: 16,), + Text(dogType_[index]), + ], + ), + onTap: (){ + print("test"); + if(index == 48){ + userwriteType = true; + }else{ + setedDogType = dogType_[index]; + newDogType = dogType_[index]; + possDogType = true; + } + + setState(() {}); + }, + ), + ); + + } + ); + } + return + Scaffold( + backgroundColor: Color(0xffF2F4F6), + appBar: PreferredSize( + preferredSize: Size.fromHeight(72), + child: AppBar( + title: + Container( + height: 50, + width: screenSize.width, + child: Column( + children: [ + SizedBox(height: 24,), + Center( + child: Padding( + padding: EdgeInsets.only(right: 60), + child: Text( + 'ํ”„๋กœํ•„ ์ˆ˜์ •', + style: textStyle.bk20normal, + ), + )), + ], + )), + + backgroundColor: Colors.transparent, + elevation: 0.0, + iconTheme: IconThemeData(color: Colors.black), + centerTitle: true, + leading: + Padding( + padding: EdgeInsets.only(top: 20), + child: IconButton( + icon: Icon(Icons.arrow_back_ios_rounded, color: Colors.black), + onPressed: () { + if(modiDogAge || modiDogName || modiDogType || modiUserName || modiImage || + possDogAge || possDogName || possDogType || possUserName){ + FlutterDialog(); + }else{ + Navigator.pop(context, 'Data from Second Page'); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => MyScreenPage(title: 'ํ™ˆํŽ˜์ด์ง€ ์ด๋™'))); + } + + }, + ), + ), + ), + ), + //extendBodyBehindAppBar: true, + body: Container( + // width: screenSize.width, + // height: screenSize.height, + child: SingleChildScrollView( + padding: EdgeInsets.fromLTRB(16, 16, 16, 16), + scrollDirection: Axis.vertical, + child: + Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + if(takeUser)...[ + if(modiImage|| ch)...[ + // Image.file(File(_image!.path)), + Container( + height: 104, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(40), + ), + child: + CircleAvatar( + radius: 104, + backgroundImage: Image.file( + File(_image!.path), + fit: BoxFit.fill, + ).image, + ) + ), + + ]else...[ + if(parsedResponseUser['profileImage'].toString() == "null")...[ + CircleAvatar( + child: SvgPicture.asset('assets/images/user_null2.svg',), + radius: 52, + ), + ]else...[ + CircleAvatar( + radius: 52, + // https://postfiles.pstatic.net/MjAyMzExMTJfMjEg/MDAxNjk5Nzc3NzE5NjIy.cSRDBIZh3A6YNZ_o2sk1PoXzLYppEITLa9k-TSb3t1Ug.9_txCKXoYkH4_TuOKIQbEShHgBz7DDKkfB0becw6lIUg.JPEG.hongyejin4/Group_1078.jpg?type=w966 + backgroundImage: NetworkImage(parsedResponseUser['profileImage'].toString()), + ), + ] + ], + SizedBox(height: 32,), + if(modiImage == false || ch) ...[ + Container( + height: 40, + width: 115, + child: ElevatedButton( + onPressed: (){ + getImage(ImageSource.gallery); + modiImage = true; + setState(() { + }); + }, + style: buttonChart().whitebtn2, + child: Text("์‚ฌ์ง„ ์ˆ˜์ •", style: textStyle.bk16normal,) + ),), + ] else...[ + Container( + height: 40, + width: 125, + child: ElevatedButton( + onPressed: (){ + changeUserImage(sign_in.userAccessToken, _image!); + modiImage = false; + ch = true; + //modiImage = true; + setState(() { + }); + }, + style: buttonChart().whitebtn2, + child: Text("์‚ฌ์ง„ ์ˆ˜์ • ์™„๋ฃŒ", style: textStyle.bk16normal,) + ),), + ], + + + SizedBox(height: 32,), + + Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(16), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + alignment: Alignment.topLeft, + child: Padding(padding: EdgeInsets.only(top:10,left: 20, right:20), + child: Text("๋‹‰๋„ค์ž„", style: textStyle.bk14normal,), + ), + ), + Padding(padding: EdgeInsets.only(top:8, left: 20, right:20, bottom: 8), + child: + Row(children: [ + Container( + width: 220, + child: modiUserName? + Container( + height: 25, + child: TextField( + controller: userNameController, + decoration: InputDecoration( + contentPadding: EdgeInsets.only(bottom:13, left: 0), + hintStyle: textStyle.grey16normal, + border: InputBorder.none, + focusedBorder: InputBorder.none, + hintText: '์ด๋ฆ„์„ ์ž…๋ ฅํ•˜์„ธ์š”.'), + onChanged: (text){ + if(text != setedUserName){ + possUserName = true; + setState(() {}); + } else{ + possUserName = false; + setState(() {}); + } + }, + onTap: (){ + if(userNameController.text != setedUserName){ + print(userNameController.text); + possUserName = true; + setState(() {}); + } else{ + possUserName = false; + setState(() {}); + } + }, + ),) + : Text( setedUserName, style: textStyle.bk16normal,), + ), + if(possUserName == false)...[ + if(modiUserName == false)...[ + SizedBox(width: 27,), + Container( + height: 24, + width: 60, + child: ElevatedButton( + onPressed: (){ + modiUserName = true; + setState(() { + }); + }, + style: buttonChart().pinkbtn2, + child: Text("์ˆ˜์ •", style: textStyle.white16midium,) + ),) + ]else...[ + SizedBox(width: 27,), + Container( + height: 24, + width: 60, + child: ElevatedButton( + onPressed: (){ + modiUserName = false; + setState(() { + }); + }, + style: buttonChart().bluebtn, + child: Text("์ทจ์†Œ", style: textStyle.white16midium,) + ),) + ] + + ]else...[ + Container( + height: 24, + width: 92, + child: ElevatedButton( + onPressed: (){ + //changeUserInfo(sign_in.userAccessToken,"nickname", userNameController.text.toString()); + newUserName = userNameController.text; + changeUserName(sign_in.userAccessToken, newUserName); + setedUserName = newUserName; + possUserName = false; + modiUserName = false; + setState(() { + }); + }, + style: buttonChart().bluebtn3, + child: Text("์ˆ˜์ • ์™„๋ฃŒ", style: textStyle.white16midium,) + ),) + ] + + + ],), + ), + SizedBox(height: 6,), + ], + ), + ), + + SizedBox(height: 8,), + + Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(16), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + alignment: Alignment.topLeft, + child: Padding(padding: EdgeInsets.only(top:10,left: 20, right:20), + child: Text("๋ฐ˜๋ ค๊ฒฌ ์ด๋ฆ„", style: textStyle.bk14normal,), + ), + ), + Padding(padding: EdgeInsets.only(top:8, left: 20, right:20, bottom: 8), + child: + Row(children: [ + Container( + width: 220, + child: modiDogName? + Container(height: 25, + child: TextField( + controller: dogNameController, + decoration: InputDecoration( + contentPadding: EdgeInsets.only(bottom:13, left: 0), + hintStyle: textStyle.grey16normal, + border: InputBorder.none, + focusedBorder: InputBorder.none, + hintText: '๋ฐ˜๋ ค๊ฒฌ ์ด๋ฆ„์„ ์ž…๋ ฅํ•˜์„ธ์š”.'), + onChanged: (text){ + if(text != setedDogName){ + possDogName = true; + setState(() {}); + } else{ + possDogName = false; + setState(() {}); + } + }, + onTap: (){ + if(dogNameController.text != setedDogName){ + print(dogNameController.text); + possDogName = true; + setState(() {}); + } else{ + possDogName = false; + setState(() {}); + } + }, + ),) + : Text( setedDogName, style: textStyle.bk16normal,), + ), + if(possDogName == false)...[ + if(modiDogName == false)...[ + SizedBox(width: 27,), + Container( + height: 24, + width: 60, + child: ElevatedButton( + onPressed: (){ + modiDogName = true; + setState(() { + }); + }, + style: buttonChart().pinkbtn2, + child: Text("์ˆ˜์ •", style: textStyle.white16midium,) + ),) + ]else...[ + SizedBox(width: 27,), + Container( + height: 24, + width: 60, + child: ElevatedButton( + onPressed: (){ + modiDogName = false; + setState(() { + }); + }, + style: buttonChart().bluebtn, + child: Text("์ทจ์†Œ", style: textStyle.white16midium,) + ),) + ] + + ]else...[ + Container( + height: 24, + width: 92, + child: ElevatedButton( + onPressed: (){ + //modiUserName = true; + newDogName = dogNameController.text; + changePuppyName(sign_in.userAccessToken, newDogName); + setedDogName = newDogName; + possDogName = false; + modiDogName = false; + //changeUserInfo(sign_in.userAccessToken,"puppynName", dogNameController.text.toString()); + setState(() { + }); + }, + style: buttonChart().bluebtn3, + child: Text("์ˆ˜์ • ์™„๋ฃŒ", style: textStyle.white16midium,) + ),) + ] + ],), + ), + SizedBox(height: 6,), + ], + ), + ), + + SizedBox(height: 8,), + + Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(16), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + alignment: Alignment.topLeft, + child: Padding(padding: EdgeInsets.only(top:10,left: 20, right:20), + child: Text("๋ฐ˜๋ ค๊ฒฌ ๋‚˜์ด", style: textStyle.bk14normal,), + ), + ), + Padding(padding: EdgeInsets.only(top:8, left: 20, right:20, bottom: 8), + child: + Row(children: [ + Container( + width: 220, + child: modiDogAge? + Container( + height: 25, + child: TextField( + controller: dogAgeController, + keyboardType: TextInputType.number, + inputFormatters: [FilteringTextInputFormatter.allow(RegExp('[0-9]'))], + decoration: InputDecoration( + contentPadding: EdgeInsets.only(bottom:13, left: 0), + hintStyle: textStyle.grey16normal, + border: InputBorder.none, + focusedBorder: InputBorder.none, + hintText: '๋‚˜์ด๋ฅผ ์ž…๋ ฅํ•˜์„ธ์š”.'), + onChanged: (text){ + if(text != setedDogAge.toString()){ + possDogAge = true; + setState(() {}); + } else{ + possDogAge = false; + setState(() {}); + } + }, + onTap: (){ + if(dogAgeController.text != setedDogAge.toString()){ + print(dogAgeController.text); + possDogAge = true; + setState(() {}); + } else{ + possDogAge = false; + setState(() {}); + } + }, + ), + + ) + : Text( "${setedDogAge}์‚ด", style: textStyle.bk16normal,), + ), + if(possDogAge == false)...[ + if(modiDogAge == false)...[ + SizedBox(width: 27,), + Container( + height: 24, + width: 60, + child: ElevatedButton( + onPressed: (){ + modiDogAge = true; + setState(() { + }); + }, + style: buttonChart().pinkbtn2, + child: Text("์ˆ˜์ •", style: textStyle.white16midium,) + ),) + ]else...[ + SizedBox(width: 27,), + Container( + height: 24, + width: 60, + child: ElevatedButton( + onPressed: (){ + modiDogAge = false; + setState(() { + }); + }, + style: buttonChart().bluebtn, + child: Text("์ทจ์†Œ", style: textStyle.white16midium,) + ),) + ] + + ]else...[ + Container( + height: 24, + width: 92, + child: ElevatedButton( + onPressed: (){ + //modiUserName = true; + // ๋‚˜์ด๋Š” int๋กœ ๋ณ€๊ฒฝ. ๋‹ค์‹œ ์ž‘์„ฑ + newDogAge = int.parse(dogAgeController.text); + setedDogAge = newDogAge; + changePuppyAgeInfo(sign_in.userAccessToken, newDogAge); + possDogAge = false; + modiDogAge = false; + //changePuppyAgeInfo(sign_in.userAccessToken, int.parse(dogAgeController.text)); + setState(() { + }); + }, + style: buttonChart().bluebtn3, + child: Text("์ˆ˜์ • ์™„๋ฃŒ", style: textStyle.white16midium,) + ),) + ] + + ],), + ), + SizedBox(height: 6,), + ], + ), + ), + + SizedBox(height: 8,), + + Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(16), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + alignment: Alignment.topLeft, + child: Padding(padding: EdgeInsets.only(top:10,left: 20, right:20), + child: Text("๋ฐ˜๋ ค๊ฒฌ ์ข…", style: textStyle.bk14normal,), + ), + ), + Padding(padding: EdgeInsets.only(top:8, left: 20, right:20, bottom: 8), + child: + Row(children: [ + Container( + width: 220, + child: modiDogType? + Column( + children: [ + if(userwriteType)...[ + Container( + height: 25, + child: TextField( + controller: dogTypeController, + decoration: InputDecoration( + contentPadding: EdgeInsets.only(bottom:13, left: 0), + hintStyle: textStyle.grey16normal, + border: InputBorder.none, + focusedBorder: InputBorder.none, + hintText: '์ข…์„ ์ž…๋ ฅํ•˜์„ธ์š”.'), + onChanged: (text){ + if(text != setedDogType){ + possDogType = true; + setState(() {}); + } else{ + possDogType = false; + setState(() {}); + } + }, + onTap: (){ + if(dogTypeController.text != setedDogType){ + print(dogTypeController.text); + possDogType = true; + setState(() {}); + } else{ + possDogType = false; + setState(() {}); + } + }, + ), + ) + ] + else...[ + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text("${setedDogType}", style: textStyle.bk16normal,) + ], + ) + ] + ], + ) + : Text( setedDogType, style: textStyle.bk16normal,), + ), + if(possDogType == false)...[ + if(modiDogType == false)...[ + SizedBox(width: 27,), + Container( + height: 24, + width: 60, + child: ElevatedButton( + onPressed: (){ + modiDogType = true; + setState(() { + }); + }, + style: buttonChart().pinkbtn2, + child: Text("๊ฒ€์ƒ‰", style: textStyle.white16midium,) + ),) + ]else...[ + SizedBox(width: 27,), + Container( + height: 24, + width: 60, + child: ElevatedButton( + onPressed: (){ + modiDogType = false; + setState(() { + }); + }, + style: buttonChart().bluebtn, + child: Text("์ทจ์†Œ", style: textStyle.white16midium,) + ),) + ] + ]else...[ + Container( + height: 24, + width: 92, + child: ElevatedButton( + onPressed: (){ + //modiUserName = true; + modiDogType = false; + possDogType = false; + if(userwriteType){ + newDogType = dogTypeController.text; + setedDogType = newDogType; + } + setedDogType = newDogType; + changePuppyTypeInfo(sign_in.userAccessToken, newDogType); + + //changeUserInfo(sign_in.userAccessToken,"puppyType", dogTypeController.text.toString()); + setState(() { + }); + }, + style: buttonChart().bluebtn3, + child: Text("์ˆ˜์ • ์™„๋ฃŒ", style: textStyle.white16midium,) + ),) + ] + + ],), + ), + SizedBox(height: 6,), + ], + ), + ), + SizedBox(height: 8,), + if(modiDogType)...[ + Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(16), + ), + width: screenSize.width, + height: calculateListViewHeight(), + child: Column( + children: [ + Expanded( + child: Column( + children: [ + listview_builder() + ], + )) + ], + ) + ) + + ] + ] + + ], + ), + ), + ) + + ); + + } +} diff --git a/client/lib/memorial/others_memorial_detail.dart b/client/lib/memorial/others_memorial_detail.dart new file mode 100644 index 0000000..4804f9a --- /dev/null +++ b/client/lib/memorial/others_memorial_detail.dart @@ -0,0 +1,794 @@ +import 'dart:async'; +import 'dart:convert'; +import 'package:flutter_svg/svg.dart'; +import 'package:get/get.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:client/style.dart'; +import 'package:flutter/services.dart'; +import 'package:intl/intl.dart'; +import 'others_memorial_main.dart' as main; +import 'package:http/http.dart' as http; +import 'package:client/sign/sign_in.dart' as sign_in; +import 'package:client/memorial/slide/flutter_image_slideshow.dart'; +import 'package:client/home.dart' as home; + +class OthersMemorialDetailPage extends StatefulWidget { + @override + State createState() => _OthersMemorialDetailPageState(); +} + +class _OthersMemorialDetailPageState extends State { + + // ํ™”๋ฉด์— ๋ณด์ด๋Š” UI ์„ค์ • bool + bool fetchSuccess = false; + bool askHelp = true; + bool sendHelp = false; + + bool addComment = false; // ๋ฐ”๋กœ ์ฝ”๋ฉ˜ํŠธ ๋ถ™์˜€์„ ๋•Œ + bool isComment = false; + + // ์ฝ”๋ฉ˜ํŠธ ์ˆ˜์™€ ์ข‹์•„์š” ์ˆ˜ + int comments = 0; + int hearts = 0; + + int comIndex = 0; // ์‚ญ์ œํ•  ๋Œ“๊ธ€ ์ธ๋ฑ์Šค + + late Map parsedResponseCN; // ๊ธ€ ๋‚ด์šฉ + late List parsedResponseCM; // ๋Œ“๊ธ€ + late bool myHeart; // ๋‚ด๊ฐ€ ์ข‹์•„์š” ๋ˆŒ๋ €๋Š”์ง€ + + List parsedResponseIMGS = []; // ์ด๋ฏธ์ง€ ๊ฐœ์ˆ˜ + + // ํ…์ŠคํŠธ์—๋””ํŒ…์ปจํŠธ๋กค๋Ÿฌ๋ฅผ ์ƒ์„ฑํ•˜์—ฌ ํ•„๋“œ์— ํ• ๋‹น + final myController = TextEditingController(); + + // ๊ธ€๋‚ด์šฉ ๊ฐ€์ ธ์˜ค๊ธฐ + void fetchWithHeaders(String aToken) async { + // API ์—”๋“œํฌ์ธํŠธ URL + String apiUrl = 'http://3.38.1.125:8080/memorial?postId=${main.postId.toString()}'; // ์‹ค์ œ API ์—”๋“œํฌ์ธํŠธ๋กœ ๋ณ€๊ฒฝํ•˜์„ธ์š” + + // ํ—ค๋” ์ •๋ณด ์„ค์ • + Map headers = { + 'Authorization': 'Bearer $aToken', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• + 'Content-Type': 'application/json', // ์˜ˆ: JSON ์š”์ฒญ์ธ ๊ฒฝ์šฐ ํ—ค๋” ์„ค์ • + }; + + // HTTP GET ์š”์ฒญ ๋ณด๋‚ด๊ธฐ + var response = await http.get( + Uri.parse(apiUrl), + headers: headers, // ํ—ค๋” ์ถ”๊ฐ€ + ); + + // HTTP ์‘๋‹ต ์ƒํƒœ ํ™•์ธ + if (response.statusCode == 200) { + // ์‘๋‹ต ๋ฐ์ดํ„ฐ ์ฒ˜๋ฆฌ + fetchSuccess = true; + setState(() {}); + print('์„œ๋ฒ„๋กœ๋ถ€ํ„ฐ ๋ฐ›์€ ๋‚ด์šฉ ๋ฐ์ดํ„ฐ: ${response.body}'); + var jsonResponse = utf8.decode(response.bodyBytes); + + parsedResponseCN = json.decode(jsonResponse); + + // List ํ˜•์‹ + print("image test" + parsedResponseCN['imageList'][0].toString()); + + hearts = parsedResponseCN['likes']; + setState(() { + + }); + + for(int i = 0; i headers = { + 'Authorization': 'Bearer $aToken', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• + 'Content-Type': 'application/json', // ์˜ˆ: JSON ์š”์ฒญ์ธ ๊ฒฝ์šฐ ํ—ค๋” ์„ค์ • + }; + + var url = Uri.parse('http://3.38.1.125:8080/memorial/comment?postId=${main.postId.toString()}'); // ์—”๋“œํฌ์ธํŠธ URL ์„ค์ • + + try { + var response = await http.post( + url, + body: json.encode(data), // ์š”์ฒญ ๋ณธ๋ฌธ์— ๋ฐ์ดํ„ฐ๋ฅผ JSON ํ˜•์‹์œผ๋กœ ์ธ์ฝ”๋”ฉํ•˜์—ฌ ์ „๋‹ฌ + headers: headers, // ํ—ค๋” ์ถ”๊ฐ€ + ); + + if (response.statusCode == 200) { + // ์‘๋‹ต ์„ฑ๊ณต ์‹œ์˜ ์ฒ˜๋ฆฌ + + var jsonResponse = utf8.decode(response.bodyBytes); // ์‘๋‹ต ๋ณธ๋ฌธ์„ JSON ํ˜•์‹์œผ๋กœ ๋””์ฝ”๋”ฉ + // JSON ๊ฐ’์„ ํ™œ์šฉํ•œ ์›ํ•˜๋Š” ๋™์ž‘ ์ˆ˜ํ–‰ + //utf8.decode(jsonResponse); + print(jsonResponse); + + List contentList = []; + + List parsedResponse = json.decode(jsonResponse); + + setState(() { + }); + + + print('API ํ˜ธ์ถœ ์„ฑ๊ณต!!: ${response.statusCode}'); + } else { + // ์š”์ฒญ ์‹คํŒจ ์‹œ์˜ ์ฒ˜๋ฆฌ + print('API ํ˜ธ์ถœ ์‹คํŒจ!!: ${response.statusCode}'); + } + } catch (e) { + // ์˜ˆ์™ธ ๋ฐœ์ƒ ์‹œ์˜ ์ฒ˜๋ฆฌ + print('API ํ˜ธ์ถœ ์ค‘ ์˜ˆ์™ธ ๋ฐœ์ƒ: $e'); + } + } + + // ์ข‹์•„์š” ๋ˆ„๋ฅด๊ธฐ(POST) + void sendPostRequest(String aToken) async { + // API ์—”๋“œํฌ์ธํŠธ URL + String apiUrl = 'http://3.38.1.125:8080/memorial/like?postId=${main.postId.toString()}'; // ์‹ค์ œ API ์—”๋“œํฌ์ธํŠธ๋กœ ๋ณ€๊ฒฝํ•˜์„ธ์š” + + // POST ์š”์ฒญ ๋ณด๋‚ด๊ธฐe + var response = await http.post( + Uri.parse(apiUrl), + headers: { + 'Authorization': 'Bearer $aToken', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• + 'Content-Type': 'application/json', // ์˜ˆ: JSON ์š”์ฒญ์ธ ๊ฒฝ์šฐ ํ—ค๋” ์„ค์ • + //'Content-Type': 'application/json', + }, // ์š”์ฒญ ํ—ค๋”์— Content-Type ์„ค์ • + ); + + // HTTP ์‘๋‹ต ์ƒํƒœ ํ™•์ธ + if (response.statusCode == 200) { + // ์‘๋‹ต ๋ฐ์ดํ„ฐ ์ฒ˜๋ฆฌ + print('์„œ๋ฒ„๋กœ๋ถ€ํ„ฐ ๋ฐ›์€ ๋‚ด์šฉ ๋ฐ์ดํ„ฐ: ${response.body}'); + var jsonResponse = utf8.decode(response.bodyBytes); + + setState(() {}); + // print('์„œ๋ฒ„๋กœ๋ถ€ํ„ฐ ๋ฐ›์€ ๋ฐ์ดํ„ฐ: ${response.body}'); + } else { + // ์š”์ฒญ์ด ์‹คํŒจํ•œ ๊ฒฝ์šฐ ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌ + print('HTTP ์š”์ฒญ ์‹คํŒจ: ${response.statusCode}'); + } + } + + + // ์ข‹์•„์š” ๊ฐ€์ ธ์˜ค๊ธฐ- ํด๋ฆญ์—ฌ๋ถ€ ํ™•์ธ(GET) + void fetchDataLike(String aToken) async { + // API ์—”๋“œํฌ์ธํŠธ URL + String apiUrl = 'http://3.38.1.125:8080/memorial/like?postId=${main.postId.toString()}'; /// postId=1 ์ถ”ํ›„์— ๋ฐ”๊ฟ”์ฃผ๊ธฐ + + // ํ—ค๋” ์ •๋ณด ์„ค์ • + Map headers = { + 'Authorization': 'Bearer $aToken', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• + 'Content-Type': 'application/json', // ์˜ˆ: JSON ์š”์ฒญ์ธ ๊ฒฝ์šฐ ํ—ค๋” ์„ค์ • + }; + + // HTTP GET ์š”์ฒญ ๋ณด๋‚ด๊ธฐ + var response = await http.get( + Uri.parse(apiUrl), + headers: headers, // ํ—ค๋” ์ถ”๊ฐ€ + ); + + ///var jsonResponse = utf8.decode(response.bodyBytes); + // HTTP ์‘๋‹ต ์ƒํƒœ ํ™•์ธ + if (response.statusCode == 200) { + // ์‘๋‹ต ๋ฐ์ดํ„ฐ๋ฅผ JSON ํ˜•์‹์œผ๋กœ ๋””์ฝ”๋”ฉ + var data = json.decode(response.body); + var jsonResponse = utf8.decode(response.bodyBytes); + + myHeart = json.decode(jsonResponse); + + // ๋ฐ์ดํ„ฐ ์ฒ˜๋ฆฌ + print('์ข‹์•„์š”~: $myHeart'); + // if(myHeart == true){ + // hearts = 1; + // } else{ + // hearts = 0; + // } + + setState(() { + }); + + } else { + // ์š”์ฒญ์ด ์‹คํŒจํ•œ ๊ฒฝ์šฐ ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌ + print('HTTP ์š”์ฒญ ์‹คํŒจ: ${response.statusCode}'); + } + } + + // ๋Œ“๊ธ€ ์‚ญ์ œํ•˜๊ธฐ + void deleteComment(String aToken, int commentId) async { + // API ์—”๋“œํฌ์ธํŠธ URL + String apiUrl = 'http://3.38.1.125:8080/memorial/comment?commentId=${commentId}'; + + // ํ—ค๋” ์ •๋ณด ์„ค์ • + Map headers = { + 'Authorization': 'Bearer $aToken', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• + 'Content-Type': 'application/json', // ์˜ˆ: JSON ์š”์ฒญ์ธ ๊ฒฝ์šฐ ํ—ค๋” ์„ค์ • + }; + + // HTTP GET ์š”์ฒญ ๋ณด๋‚ด๊ธฐ + var response = await http.delete( + Uri.parse(apiUrl), + headers: headers, // ํ—ค๋” ์ถ”๊ฐ€ + ); + + ///var jsonResponse = utf8.decode(response.bodyBytes); + // HTTP ์‘๋‹ต ์ƒํƒœ ํ™•์ธ + if (response.statusCode == 200) { + // ์‘๋‹ต ๋ฐ์ดํ„ฐ๋ฅผ JSON ํ˜•์‹์œผ๋กœ ๋””์ฝ”๋”ฉ + print("์‚ญ์ œ์„ฑ๊ณต"); + setState(() { + }); + + } else { + // ์š”์ฒญ์ด ์‹คํŒจํ•œ ๊ฒฝ์šฐ ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌ + print('HTTP ์š”์ฒญ ์‹คํŒจ: ${response.statusCode}'); + } + } + + // ๋Œ“๊ธ€ ์‚ญ์ œ ํŒ์—… + void FlutterDialog() { + showDialog( + context: context, + builder: (_) => new AlertDialog( + shape: RoundedRectangleBorder( + borderRadius: + BorderRadius.all( + Radius.circular(12.0))), + content: Builder( + builder: (context) { + + return Container( + height: 298, + width: 412, + child: + Padding(padding: EdgeInsets.all(0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SizedBox(height: 12,), + Container( + width: 125, + height: 117, + child: SvgPicture.asset( + 'assets/images/no_result.svg', + width: 132, + height: 123, + fit: BoxFit.contain, + ), + ), + SizedBox(height: 32,), + Text("๋Œ“๊ธ€์„ ์‚ญ์ œ ํ•˜์‹œ๊ฒ ์–ด์š”?",style: textStyle.bk16bold,), + SizedBox(height: 8,), + Text("์‚ญ์ œํ•œ ํ›„, ๋‚ด์šฉ์ด ๋ณต๊ตฌ๋˜์ง€ ์•Š์•„์š”!", style: textStyle.bk14normal,), + SizedBox(height: 32,), + Row( + children: [ + Container( + height: 40, + width: 120, + child: ElevatedButton( + child: new Text("์ทจ์†Œ", style: textStyle.purple16midium), + style: buttonChart().purplebtn3, + onPressed: () { + Navigator.pop(context); + }, + ), + ), + SizedBox(width: 16,), + Container( + height: 40, + width: 120, + child: ElevatedButton( + child: new Text("์‚ญ์ œํ•˜๊ธฐ", style: textStyle.white16semibold), + style: buttonChart().purplebtn, + onPressed: () { + + // ์„œ๋ฒ„์— ์ „์†ก + deleteComment(sign_in.userAccessToken, comIndex); + setState(() {}); + Timer(Duration(milliseconds: 500), () { + fetchDataComment(); + }); + + Navigator.pop(context); + }, + ), + ), + ], + ) + ], + ),) + ); + }, + ), + ) + ); + } + + @override + void initState() { + super.initState(); + SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: [SystemUiOverlay.top]); + print("test" + main.postId.toString()); + //fetchData(); + fetchWithHeaders(sign_in.userAccessToken); + fetchDataComment(); + fetchDataLike(sign_in.userAccessToken); + setState(() { + + }); + } + + // ๋Œ“๊ธ€ ์œ„์ ฏ + Widget listview_builder(){ + return ListView.builder( + shrinkWrap: true, + scrollDirection: Axis.vertical, + padding: EdgeInsets.all(0), + physics: NeverScrollableScrollPhysics(), + itemCount: parsedResponseCM.length, + itemBuilder: (BuildContext context, int index){ + return Column( + children: [ + Container( + padding: EdgeInsets.fromLTRB(16, 16, 0, 16), + height: 104, + width: Get.width, + decoration: BoxDecoration( + color: Colors.white, + //borderRadius: BorderRadius.circular(16), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + if(parsedResponseCM[index]['profileImage'].toString() == "null")...[ + CircleAvatar( + radius: 10, + child: SvgPicture.asset('assets/images/user_null2.svg',), + ), + ]else...[ + CircleAvatar( + radius: 10, + backgroundImage: NetworkImage(parsedResponseCM[index]['profileImage'].toString()), + ), + ], + SizedBox(width: 8,), + Container(width: 55, + child: Text(parsedResponseCM[index]['nickname'], style: textStyle.bk12normal,),), + SizedBox(width: 204,), + if(parsedResponseCM[index]['nickname'] == home.user)...[ + Container(width: 78, height: 32, + child: TextButton(onPressed: (){ + comIndex = parsedResponseCM[index]['id']; + setState(() { + }); + FlutterDialog(); + }, child: Row( + children: [ + Text("์‚ญ์ œํ•˜๊ธฐ", style: textStyle.grey12normal,), + SvgPicture.asset('assets/images/memorial/deletecom.svg',), + ], + ) + + ), + ), + + ], + + + ], + ), + SizedBox(height: 6,), + Text(parsedResponseCM[index]['content'], style: textStyle.bk12normal,), + SizedBox(height: 6,), + Text(DateFormat('MM/dd HH:mm').format(DateTime.parse(parsedResponseCM[index]['createdAt'])).toString(), style: TextStyle(fontSize: 10, color: Color(0xffAAAAAA)),) + + //DateFormat('yy/MM/dd - HH:mm:ss').format(parsedResponse[0]['createdAt']) + ], + ), + ), + SizedBox(height: 4,), + ], + ); + + } + ); + } + + double calculateListViewHeight() { + // ๋ฆฌ์ŠคํŠธ๋ทฐ์˜ ์•„์ดํ…œ ์ˆ˜ + int itemCount = parsedResponseCM.length; + + // ๋ฆฌ์ŠคํŠธ๋ทฐ์˜ ์—ด ์ˆ˜ (3๊ฐœ์˜ ์•„์ดํ…œ์ด ํ•œ ํ–‰์— ์žˆ์„ ๋•Œ) + int columnCount = 1; + + // ์•„์ดํ…œ์˜ ๋†’์ด (๊ฐ€๋กœ:์„ธ๋กœ ๋น„์œจ์„ ์„ค์ •ํ•  ์ˆ˜ ์žˆ์Œ) + double itemHeight = 90; // ์ด ๊ฐ’์€ ์ ์ ˆํžˆ ์กฐ์ • + + // ์•„์ดํ…œ ๊ฐ„์˜ ์ˆ˜์ง ๊ฐ„๊ฒฉ + double crossAxisSpacing = 8.0; + + // ๋ฆฌ์ŠคํŠธ๋ทฐ์˜ ๋†’์ด ๊ณ„์‚ฐ + double listHeight = ((itemCount / columnCount).ceil() * itemHeight) + + ((itemCount / columnCount - 1).ceil() * crossAxisSpacing); + + return listHeight; + } + + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: PreferredSize( + preferredSize: Size.fromHeight(72), + child: AppBar( + leading: Padding( + padding: EdgeInsets.only(top: 20), + child: IconButton( + icon: Icon(Icons.arrow_back_ios_rounded, color: Colors.black), + onPressed: () => Navigator.of(context).pop(), + ), + ), + backgroundColor: Color(0xffDDE7FD), + elevation: 0.0, + iconTheme: IconThemeData(color: Colors.black), + ), + ), + body: Container( + color: Color(0xffDDE7FD), + width: Get.width, + height: Get.height, + child: SingleChildScrollView( + physics: const AlwaysScrollableScrollPhysics( + ), + padding: EdgeInsets.fromLTRB(0, 0, 0, 0), + scrollDirection: Axis.vertical, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + if(fetchSuccess)...[ + ClipRRect( + borderRadius: BorderRadius.only(topLeft: Radius.circular(16.0), topRight: Radius.circular(16.0)), + child: Container( + width: Get.width, + //height: 576, + color: Colors.white, + child: + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding(padding: EdgeInsets.all(16), + child: Column( + children: [ + Container( + width: Get.width, + height: Get.width - 32, + child: ClipRRect( + borderRadius: BorderRadius.circular(16.0), + child: + ImageSlideshow( + indicatorColor: Color(0xffFEFBAC), + onPageChanged: (value) { + debugPrint('Page changed: $value'); + }, + //autoPlayInterval: 3000, + isLoop: false, + children: [ + for(int i= 0; i= 1)...[ + Container( + child: InkWell( + onTap: (){ + // ์ข‹์•„์š” ๋ˆ„๋ฅด๊ธฐ + sendPostRequest(sign_in.userAccessToken); + //fetchDataLike(sign_in.userAccessToken); + hearts--; + setState(() { + }); + }, + child: SvgPicture.asset( + 'assets/images/memorial/heart-fill.svg', + ), + ),), + ] else...[ + SizedBox(width: 2,), + Container( + child: InkWell( + onTap: (){ + // ์ข‹์•„์š” ๋ˆ„๋ฅด๊ธฐ + sendPostRequest(sign_in.userAccessToken); + //fetchDataLike(sign_in.userAccessToken); + hearts++; + setState(() { + }); + }, + child: SvgPicture.asset( + 'assets/images/memorial/heart-empty.svg', + ), + ), + ), + ], + SizedBox( width: 3,), + Text('${hearts}'), + ], + ) + ], + ), + SizedBox(height: 15,), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text(parsedResponseCN['title'],style: textStyle.bk16semibold,), + SizedBox(height: 8,), + Container(width: Get.width, + //height: 30, + child: Text(parsedResponseCN['content'], style: textStyle.bk14normal,), + ), + SizedBox(height: 8,), + Container(width: Get.width, + height: 12, + child: Text('#${parsedResponseCN['hashtag']}', style: textStyle.grey12normal), + ), + SizedBox(height: 5,), + ], + ), + ], + ),), + + ], + ), + + ), + ), + + SizedBox(height: 4,), + Container( + width: Get.width, + height: calculateListViewHeight() + 86, + child: Column( + children: [ + Expanded( + child: Column( + children: [ + listview_builder() + ], + ) + ), + ], + ) + ), + ] + + ], + ), + ), + ), + bottomSheet: Padding( + padding: EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom * 0.001), + child: Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.end, + children:[ + Container( + color:Color(0xffF2F4F6), + height: 48, + child: Padding( + padding: const EdgeInsets.only(bottom: 8.0, top: 8.0, left: 16,right: 16), + child: Stack( + children: [ + Container( + width: Get.width, + height: 48, + decoration: BoxDecoration( + color: Colors.white, + border: Border.all(color: addComment? Color(colorChart.blue):Color(0xffC0D2FC)), + borderRadius: BorderRadius.circular(30), + ), + ), + Positioned( + left: 15, + right: 30, + bottom:-4, + child: TextField( + textAlignVertical: TextAlignVertical.center, + maxLines: 1, + controller: myController, + style: textStyle.bk14normal, + decoration: InputDecoration( + hintStyle: textStyle.grey14normal, + border: InputBorder.none, hintText: '๋Œ“๊ธ€์„ ์ž…๋ ฅํ•˜๋ ค๋ฉด ์—ฌ๊ธฐ๋ฅผ ํƒญํ•˜์„ธ์š”.'), + onChanged: (s) { + //text = s; + addComment = true; + setState(() { + + }); + }, + onTap: (){ + + }, + ), + ), + Positioned( + left: Get.width - 81, + //right: 30, + bottom: 3, + top: 3, + child: ElevatedButton( + onPressed: () { + if(addComment){ + saveComment(sign_in.userAccessToken, myController.text); + } + addComment = false; + + setState(() { + }); + myController.clear(); + Timer(Duration(milliseconds: 500), () { + fetchDataComment(); + }); + setState(() { + }); + }, + style: ElevatedButton.styleFrom( + backgroundColor: addComment?Color(colorChart.blue):Color(0xffDDE7FD), + fixedSize: const Size(23, 23), + shape: const CircleBorder(), + ), + child:Icon(Icons.arrow_upward, color: Colors.white,size: 16,) + ), + ), + ], + ), + ), + ) + ], + ), + ) + ); + } +} \ No newline at end of file diff --git a/client/lib/memorial/others_memorial_main.dart b/client/lib/memorial/others_memorial_main.dart new file mode 100644 index 0000000..09897db --- /dev/null +++ b/client/lib/memorial/others_memorial_main.dart @@ -0,0 +1,773 @@ +import 'dart:convert'; +import 'package:get/get.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:client/memorial/others_memorial_detail.dart'; +import 'package:client/style.dart'; +import 'package:image_picker/image_picker.dart'; +import 'package:http/http.dart' as http; +import '../help/write_help_request.dart'; +import 'memorial_detail.dart'; +import 'package:flutter_svg/svg.dart'; +import 'package:word_cloud/word_cloud_data.dart'; +import 'package:flutter_scatter/flutter_scatter.dart'; +import '../flutter_hashtags.dart'; +import 'package:client/sign/sign_in.dart' as sign_in; +import 'package:client/memorial/watch_others.dart' as watchmain; + +String selectedImage = ""; +String proImage = ""; +int postId = 0; +String userUid = ""; +String userName = ""; + +class OthersMemorialMainPage extends StatefulWidget { + @override + State createState() => _OthersMemorialMainPageState(); +} + + +class _OthersMemorialMainPageState extends State { + + // ํ™”๋ฉด์— ๋ณด์ด๋Š” UI ์„ค์ • bool + bool fetchDataSuccess = false; + bool memorial = true; + bool wordCloud = false; + bool helpList = false; + + + void fetchWithHeaders(String aToken, String targetUid) async { + // API ์—”๋“œํฌ์ธํŠธ URL + String apiUrl = 'http://3.38.1.125:8080/memorial/guest/all?targetUid=${targetUid}'; // ์‹ค์ œ API ์—”๋“œํฌ์ธํŠธ๋กœ ๋ณ€๊ฒฝํ•˜์„ธ์š” + + // ํ—ค๋” ์ •๋ณด ์„ค์ • + Map headers = { + 'Authorization': 'Bearer $aToken', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• + 'Content-Type': 'application/json', // ์˜ˆ: JSON ์š”์ฒญ์ธ ๊ฒฝ์šฐ ํ—ค๋” ์„ค์ • + }; + + // HTTP GET ์š”์ฒญ ๋ณด๋‚ด๊ธฐ + var response = await http.get( + Uri.parse(apiUrl), + headers: headers, // ํ—ค๋” ์ถ”๊ฐ€ + ); + + // HTTP ์‘๋‹ต ์ƒํƒœ ํ™•์ธ + if (response.statusCode == 200) { + // ์‘๋‹ต ๋ฐ์ดํ„ฐ ์ฒ˜๋ฆฌ + fetchDataSuccess = true; + print('์„œ๋ฒ„๋กœ๋ถ€ํ„ฐ ๋ฐ›์€ ๋‚ด์šฉ ๋ฐ์ดํ„ฐ: ${response.body}'); + var jsonResponse = utf8.decode(response.bodyBytes); + + parsedResponseCN = json.decode(jsonResponse); + + userName = parsedResponseCN['nickname']; + + proImage = parsedResponseCN['profileImage'].toString(); + + // JSON ๋ฌธ์ž์—ด์„ Map์œผ๋กœ ํŒŒ์‹ฑ + Map data = json.decode(jsonResponse); + + // "posts" ๋ฐฐ์—ด์˜ ๋‚ด์šฉ์„ ์ถ”์ถœ + //List postsList = data["posts"]; + postsList = data["posts"]; + + print(postsList); + + // ์ถ”์ถœ๋œ "posts" ๋ฐฐ์—ด์˜ ๋‚ด์šฉ ์ถœ๋ ฅ + postsList.forEach((post) { + print('๊ฒŒ์‹œ๋ฌผ ID: ${post["id"]}'); + print('๊ฒŒ์‹œ๋ฌผ ์ œ๋ชฉ: ${post["title"]}'); + print('๊ฒŒ์‹œ๋ฌผ ๋‚ด์šฉ: ${post["content"]}'); + // ํ•„์š”ํ•œ ๋‹ค๋ฅธ ์ •๋ณด๋„ ์ถœ๋ ฅํ•˜๊ฑฐ๋‚˜ ์ฒ˜๋ฆฌํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. + }); + + checkCN = true; + setState(() { + }); + + } else { + // ์š”์ฒญ์ด ์‹คํŒจํ•œ ๊ฒฝ์šฐ ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌ + print('HTTP ์š”์ฒญ ์‹คํŒจ: ${response.statusCode}'); + } + } + + + late Map parsedResponseCN; // ๊ธ€ ๋‚ด์šฉ + bool checkCN = false; + late List postsList; // ํฌ์ŠคํŠธ ํ•˜๋‚˜ ๋‚ด์šฉ + + + // ์›Œ๋“œ ํด๋ผ์šฐ๋“œ + // ์ตœ๊ทผ ๊ฒ€์ƒ‰์–ด ์กฐํšŒ(GET) + late List parsedResponseRS; // ์ตœ๊ทผ ๊ฒ€์ƒ‰์–ด + bool recentKeyword = false; + // http://3.38.1.125:8080/community/wcloud + + List kFlutterHashtags2 = []; + + void fetchDataWordCloud(String aToken, String targetUid) async { + // API ์—”๋“œํฌ์ธํŠธ URL + String apiUrl = 'http://3.38.1.125:8080/community/wcloud?targetUid=${targetUid}'; + + // ํ—ค๋” ์ •๋ณด ์„ค์ • + Map headers = { + 'Authorization': 'Bearer $aToken', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• + 'Content-Type': 'application/json', // ์˜ˆ: JSON ์š”์ฒญ์ธ ๊ฒฝ์šฐ ํ—ค๋” ์„ค์ • + }; + + // HTTP GET ์š”์ฒญ ๋ณด๋‚ด๊ธฐ + var response = await http.get( + Uri.parse(apiUrl), + headers: headers, // ํ—ค๋” ์ถ”๊ฐ€ + ); + + ///var jsonResponse = utf8.decode(response.bodyBytes); + // HTTP ์‘๋‹ต ์ƒํƒœ ํ™•์ธ + if (response.statusCode == 200) { + // ์‘๋‹ต ๋ฐ์ดํ„ฐ๋ฅผ JSON ํ˜•์‹์œผ๋กœ ๋””์ฝ”๋”ฉ + var data = json.decode(response.body); + var jsonResponse = utf8.decode(response.bodyBytes); + + parsedResponseRS = json.decode(jsonResponse); + + // ๋ฐ์ดํ„ฐ ์ฒ˜๋ฆฌ + print('์„œ๋ฒ„๋กœ๋ถ€ํ„ฐ ๋ฐ›์€ ๋ฐ์ดํ„ฐS: $jsonResponse'); + + print("ํ™•์ธ~~~"+parsedResponseRS.length.toString()); + + if(parsedResponseRS.length<10){ + for(int i=0; i parsedResponseH; // ๋Œ“๊ธ€ + + void fetchHelp(String aToken, String targetUid) async { + // API ์—”๋“œํฌ์ธํŠธ URL + String apiUrl = 'http://3.38.1.125:8080/community/help/log?targetUid=${targetUid}'; + + // ํ—ค๋” ์ •๋ณด ์„ค์ • + Map headers = { + 'Authorization': 'Bearer $aToken', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• + 'Content-Type': 'application/json', // ์˜ˆ: JSON ์š”์ฒญ์ธ ๊ฒฝ์šฐ ํ—ค๋” ์„ค์ • + }; + + // HTTP GET ์š”์ฒญ ๋ณด๋‚ด๊ธฐ + var response = await http.get( + Uri.parse(apiUrl), + headers: headers, // ํ—ค๋” ์ถ”๊ฐ€ + ); + + ///var jsonResponse = utf8.decode(response.bodyBytes); + // HTTP ์‘๋‹ต ์ƒํƒœ ํ™•์ธ + if (response.statusCode == 200) { + // ์‘๋‹ต ๋ฐ์ดํ„ฐ๋ฅผ JSON ํ˜•์‹์œผ๋กœ ๋””์ฝ”๋”ฉ + var data = json.decode(response.body); + var jsonResponse = utf8.decode(response.bodyBytes); + + parsedResponseH = json.decode(jsonResponse); + + // ๋ฐ์ดํ„ฐ ์ฒ˜๋ฆฌ + print('์„œ๋ฒ„๋กœ๋ถ€ํ„ฐ ๋ฐ›์€ ๋ฐ์ดํ„ฐS: $jsonResponse'); + + setState(() { + }); + + } else { + // ์š”์ฒญ์ด ์‹คํŒจํ•œ ๊ฒฝ์šฐ ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌ + print('HTTP ์š”์ฒญ ์‹คํŒจ: ${response.statusCode}'); + } + } + + + @override + void initState() { + super.initState(); + SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: [SystemUiOverlay.top]); + + fetchWithHeaders(sign_in.userAccessToken, watchmain.selectedUser); + fetchDataWordCloud(sign_in.userAccessToken, watchmain.selectedUser); + fetchHelp(sign_in.userAccessToken, watchmain.selectedUser); + //mydata.addData(String word, Double value); + } + + double calculateGridViewHeight() { + // ๊ทธ๋ฆฌ๋“œ๋ทฐ์˜ ์•„์ดํ…œ ์ˆ˜ + int itemCount = postsList.length; + + // ๊ทธ๋ฆฌ๋“œ๋ทฐ์˜ ์—ด ์ˆ˜ (3๊ฐœ์˜ ์•„์ดํ…œ์ด ํ•œ ํ–‰์— ์žˆ์„ ๋•Œ) + int columnCount = 3; + + // ์•„์ดํ…œ์˜ ๋†’์ด (๊ฐ€๋กœ:์„ธ๋กœ ๋น„์œจ์„ ์„ค์ •ํ•  ์ˆ˜ ์žˆ์Œ) + double itemHeight = 104.0; // ์ด ๊ฐ’์€ ์ ์ ˆํžˆ ์กฐ์ • + + // ์•„์ดํ…œ ๊ฐ„์˜ ์ˆ˜์ง ๊ฐ„๊ฒฉ + double crossAxisSpacing = 8.0; + + // ๊ทธ๋ฆฌ๋“œ๋ทฐ์˜ ๋†’์ด ๊ณ„์‚ฐ + double gridHeight = ((itemCount / columnCount).ceil() * itemHeight) + + ((itemCount / columnCount - 1).ceil() * crossAxisSpacing); + + return gridHeight; + } + + @override + Widget build(BuildContext context) { + MediaQueryData deviceData = MediaQuery.of(context); + Size screenSize = deviceData.size; + + List widgets = []; + for (var i = 0; i < kFlutterHashtags2.length; i++) { + widgets.add(ScatterItem(kFlutterHashtags2[i], i)); + } + return Scaffold( + appBar: PreferredSize( + preferredSize: Size.fromHeight(72), + child: AppBar( + leading: + Padding( + padding: EdgeInsets.only(top: 20), + child: IconButton( + icon: Icon(Icons.arrow_back_ios_rounded, color: Colors.black), + onPressed: () => Navigator.of(context).pop(), + ), + ), + backgroundColor: Color(0xffDDE7FD), + elevation: 0.0, + title: + Container( + height: 50, + width: screenSize.width, + child: + Column( + children: [ + SizedBox(height: 24,), + Center( + child: Padding( + padding: EdgeInsets.only(right: 60), + child: Text( + 'ํ•จ๊ป˜ํ• ๊ฐœ', + style: textStyle.bk20normal, + ), + )), + ], + ) + ), + iconTheme: IconThemeData(color: Colors.black), + ), + ), + body: Container( + color: Color(0xffDDE7FD), + width: Get.width, + height: Get.height, + child: SingleChildScrollView( + padding: EdgeInsets.fromLTRB(0, 0, 0, 0), + scrollDirection: Axis.vertical, + child: + Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + //SizedBox(height: 16,), + Row( + children: [ + SizedBox(width: 16,), + Stack( + children: [ + if(parsedResponseCN['profileImage'].toString() == "null")...[ + CircleAvatar( + backgroundColor: Colors.white, + radius: 59.5, + child: CircleAvatar( + radius: 54.5, + child: SvgPicture.asset('assets/images/user_null2.svg',width: 110, + height: 110, + fit: BoxFit.fill,), + ), + ), + ]else...[ + CircleAvatar( + backgroundColor: Colors.white, + radius: 59.5, + child: CircleAvatar( + radius: 54.5, + backgroundImage: NetworkImage(parsedResponseCN['profileImage'].toString()), + ), + ), + ], + + Padding(padding: EdgeInsets.fromLTRB(80, 80, 15, 15), + child: SvgPicture.asset('assets/images/memorial/foot.svg'),) + ], + ), + + + SizedBox(width: 8,), + Padding(padding: EdgeInsets.only(bottom:22), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Text("${parsedResponseCN['nickname']}", style: TextStyle(fontFamily: 'Pretendard', + fontWeight: FontWeight.w700, fontSize: 20),), + Text("๋‹˜์˜ ๋ฐ˜๋ ค๊ฒฌ,", style: TextStyle(fontFamily: 'Pretendard', + fontWeight: FontWeight.w500, fontSize: 16),), + ], + ), + SizedBox(height: 4,), + Row( + children: [ + Text("${parsedResponseCN['puppyName']}", style: TextStyle(fontFamily: 'Pretendard', + fontWeight: FontWeight.w700, fontSize: 20),), + Text("(${parsedResponseCN['puppyType']}, ${parsedResponseCN['puppyAge']}์‚ด)", style: TextStyle(fontFamily: 'Pretendard', + fontWeight: FontWeight.w500, fontSize: 16),), + ], + ), + ], + )) + ], + ), + SizedBox(height: 12,), + + Container( + width: screenSize.width - 32, + height: 40, + decoration: BoxDecoration( + color: Color(0xffF2F6FF), + borderRadius: BorderRadius.circular(16), + ), + child: Row( + children: [ + SizedBox(width: 5,), + if(memorial && wordCloud == false && helpList == false)...[ + Container( + decoration: BoxDecoration( + color: Color(0xffC0D2FC), + borderRadius: BorderRadius.circular(14), + ), + width: 98, + height: 32, + child: Center(child: Text("๊ธฐ์–ตํ• ๊ฐœ",style: TextStyle(color: Color(0xff4B5396), fontFamily: 'Pretendard', fontWeight: FontWeight.w600, fontSize: 16)) + ,) + ), + SizedBox(width: 24,), + TextButton(onPressed: (){ + memorial = false; + wordCloud = true; + helpList = false; + setState(() {}); + }, child: Text("์›Œ๋“œํด๋ผ์šฐ๋“œ", style: textStyle.bk16normal,)), + SizedBox(width: 32,), + TextButton(onPressed: (){ + memorial = false; + wordCloud = false; + helpList = true; + setState(() {}); + }, child: Text("๋„์›€์ด๋ ฅ", style: textStyle.bk16normal,)), + + ]else if(memorial == false && wordCloud && helpList == false)...[ + SizedBox(width: 5,), + Container(width: 88, + height: 38, + child: TextButton(onPressed: (){ + memorial = true; + wordCloud = false; + helpList = false; + setState(() {}); + }, child: Text("๊ธฐ์–ตํ• ๊ฐœ", style: textStyle.bk16normal,)), + ), + SizedBox(width: 10,), + Container( + decoration: BoxDecoration( + color: Color(0xffC0D2FC), + borderRadius: BorderRadius.circular(13), + ), + width: 136, + height: 32, + child: Center(child: Text("์›Œ๋“œํด๋ผ์šฐ๋“œ", style: TextStyle(color: Color(0xff4B5396), fontFamily: 'Pretendard', fontWeight: FontWeight.w600, fontSize: 16)),) + ), + + SizedBox(width: 14,), + TextButton(onPressed: (){ + memorial = false; + wordCloud = false; + helpList = true; + setState(() {}); + }, child: Text("๋„์›€์ด๋ ฅ", style: textStyle.bk16normal,)), + ] else if(memorial == false && wordCloud == false && helpList)...[ + SizedBox(width: 5,), + Container( + width: 88, + child: TextButton(onPressed: (){ + memorial = true; + wordCloud = false; + helpList = false; + setState(() {}); + }, child: Text("๊ธฐ์–ตํ• ๊ฐœ", style: textStyle.bk16normal,)), + ), + SizedBox(width: 18,), + Container( + width: 120, + child: TextButton(onPressed: (){ + memorial = false; + wordCloud = true; + helpList = false; + setState(() {}); + }, child: Text("์›Œ๋“œํด๋ผ์šฐ๋“œ", style: textStyle.bk16normal,)), + ), + SizedBox(width: 5,), + Container( + decoration: BoxDecoration( + color: Color(0xffC0D2FC), + borderRadius: BorderRadius.circular(13), + ), + width: 106, + height: 32, + child: Center(child: Text("๋„์›€์ด๋ ฅ",style: TextStyle(color: Color(0xff4B5396), fontFamily: 'Pretendard', fontWeight: FontWeight.w600, fontSize: 16)),) + ), + // Column( + // mainAxisAlignment: MainAxisAlignment.center, + // children: [ + // TextButton(onPressed: (){ + // memorial = false; + // wordCloud = false; + // helpList = true; + // setState(() {}); + // }, child: Text("๋„์›€ ์ด๋ ฅ", style: textStyle.bk16bold,)), + // Container( + // color: Colors.black, + // width: 100, + // height: 2, + // ) + // ], + // ), + ] + ], + ), + ), + + SizedBox(height: 18,), + + Container( + //padding: EdgeInsets.fromLTRB(15, 15, 15, 15), + width: Get.width, + //height: Get.height, + color: Color(0xffF2F4F6), + child: + Column( + children: [ + if(memorial)...[ + Container( + padding: EdgeInsets.only(top: 16, left: 16, right: 16), + width: Get.width, + height: (postsList.length < 13)? 524 :calculateGridViewHeight() + 195, + child: GridView.builder( + shrinkWrap: true, // ๊ทธ๋ฆฌ๋“œ๋ทฐ๊ฐ€ ์ž์‹ ์˜ ๋‚ด์šฉ์— ๋งž๊ฒŒ ํฌ๊ธฐ๋ฅผ ์กฐ์ ˆํ•˜๋„๋ก ํ•จ + physics: NeverScrollableScrollPhysics(), + itemCount:postsList.length, + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 3, //1 ๊ฐœ์˜ ํ–‰์— ๋ณด์—ฌ์ค„ item ๊ฐœ์ˆ˜ + childAspectRatio: 1 / 1, //item ์˜ ๊ฐ€๋กœ 1, ์„ธ๋กœ 2 ์˜ ๋น„์œจ + mainAxisSpacing: 10, //์ˆ˜ํ‰ Padding + crossAxisSpacing: 10, //์ˆ˜์ง Padding + ), + itemBuilder: (BuildContext context, int index){ + return + InkWell( + onTap: (){ + postId = postsList[index]['id']; + selectedImage = postsList[index]['image']; + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => OthersMemorialDetailPage())); + }, + child: Container( + width: 114, + height: 114, + child: + ClipRRect( + borderRadius: BorderRadius.circular(16.0), + child: Image.network(postsList[index]['image'], fit: BoxFit.cover, + errorBuilder: (context, error, stackTrace) { + // ์˜ค๋ฅ˜ ๋ฐœ์ƒ ์‹œ ๋Œ€์ฒด ์ด๋ฏธ์ง€๋ฅผ ํ‘œ์‹œ + return SvgPicture.asset( + 'assets/images/no_result.svg',); + }, + ), + ), + // Image.network( + // parsedResponse[index], + // //'https://images.unsplash.com/photo-1519098901909-b1553a1190af?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1974&q=80', + // fit: BoxFit.cover, + // ), + ), + ); + + }) + ), + ] else if(helpList)...[ + if(parsedResponseH.length > 0)...[ + SizedBox(height: 4,), + Center( + child: Container( + padding: EdgeInsets.all(16), + width: Get.width, + height: 524, + // color: Colors.white, + child: GridView.builder( + itemCount:parsedResponseH.length, + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 3, //1 ๊ฐœ์˜ ํ–‰์— ๋ณด์—ฌ์ค„ item ๊ฐœ์ˆ˜ + childAspectRatio: 1 / 1, //item ์˜ ๊ฐ€๋กœ 1, ์„ธ๋กœ 2 ์˜ ๋น„์œจ + mainAxisSpacing: 16, //์ˆ˜ํ‰ Padding + crossAxisSpacing: 16, //์ˆ˜์ง Padding + ), + itemBuilder: (BuildContext context, int index){ + return + Container( + width: 96, + height: 96, + child: Stack( + children: [ + + if(parsedResponseH[index]['profileImage'].toString() == "null")...[ + CircleAvatar( + radius: 56, + child: SvgPicture.asset('assets/images/user_null2.svg',), + ), + ]else...[ + CircleAvatar( + radius: 56, + backgroundImage: NetworkImage(parsedResponseH[index]['profileImage'].toString()), + ), + ], + Container( + decoration: BoxDecoration( + color: Colors.black.withOpacity(0.4), + borderRadius: BorderRadius.circular(100), + ), + ), + Center( + child: Text("${parsedResponseH[index]['nickname']}", style: textStyle.white14normal), + ) + ], + ), + ); + }) + ), + ), + ]else...[ + Container( + padding: + EdgeInsets.only(top: 16, left: 16, right: 16), + width: Get.width, + height: 524, + child: Padding( + padding: EdgeInsets.only(top: 136), + child: Column( + children: [ + SvgPicture.asset( + 'assets/images/no_result.svg', + ), + SizedBox( + height: 16, + ), + Text( + "๋„์›€์ด๋ ฅ ์ •๋ณด๊ฐ€ ์—†์–ด์š”!", + style: textStyle.bk16normal, + ) + ], + ), + )), + ] + ]else if(wordCloud)...[ + if(recentKeyword && parsedResponseRS.length > 0)...[ + Container( + padding: EdgeInsets.all(16.0), + width: screenSize.width, + height: 524, + // color: Colors.black, + child: Stack( + children: [ + Container( + decoration: BoxDecoration( + color: Color(0xffFFFFFF), + borderRadius: BorderRadius.circular(16), + ), + width: screenSize.width, + height: 414, + ), + Container( + padding: EdgeInsets.only(top: 66, bottom: 16, left: 16, right: 16), + width: Get.width, + //height: , + child: FittedBox( + child: Scatter( + fillGaps: true, + delegate: ArchimedeanSpiralScatterDelegate(ratio: 17 / 15), + children: widgets, + ), + ) + ), + // FittedBox( + // child: Scatter( + // fillGaps: true, + // delegate: ArchimedeanSpiralScatterDelegate(ratio: Get.width / Get.height), + // children: widgets, + // ), + // ), + ], + ), + ) + + ] else if(recentKeyword == false)...[ + Container( + padding: + EdgeInsets.only(top: 16, left: 16, right: 16), + width: Get.width, + height: 524, + child: Padding( + padding: EdgeInsets.only(top: 136), + child: Column( + children: [ + SvgPicture.asset( + 'assets/images/no_result.svg', + ), + SizedBox( + height: 16, + ), + Text( + "์›Œ๋“œํด๋ผ์šฐ๋“œ ์ •๋ณด๊ฐ€ ์—†์–ด์š”!", + style: textStyle.bk16normal, + ) + ], + ), + )), + ], + + //SizedBox(height: 65,), + ], + ], + ) + ), + + + ], + ), + ), + ), + floatingActionButton: + Padding( + padding: EdgeInsets.only(bottom:10), + child: SizedBox( + height: 44, + width: 153, + child: extendButton(), + ),) + , + floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat, + ); + } + + FloatingActionButton extendButton() { + return FloatingActionButton.extended( + onPressed: () { + userUid = watchmain.selectedUser; + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => WriteHelpRequestPage())); + }, + label: Row(children: [ + Text("๋„์›€ ์š”์ฒญํ•˜๊ธฐ", style: textStyle.white16bold,), + SizedBox(width: 5), + SvgPicture.asset( + 'assets/images/memorial/help_btn2.svg', + ), + + ],), + //icon: ImageIcon(AssetImage('assets/images/memorial/white_heart.png'),color: Colors.white,), + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(50)), + + /// ํ…์ŠคํŠธ ์ปฌ๋Ÿฌ + foregroundColor: Colors.black, + backgroundColor: Color(0xffEFA1B6), + ); + } +} + +class ScatterItem extends StatelessWidget { + ScatterItem(this.hashtag, this.index); + final FlutterHashtag hashtag; + final int index; + + @override + Widget build(BuildContext context) { + // final TextStyle style = Theme.of(context).textTheme.body1.copyWith( + // fontSize: hashtag.size.toDouble(), + // color: hashtag.color, + // ); + final TextStyle style = Theme.of(context).textTheme.bodySmall!.copyWith( + fontSize: hashtag.size.toDouble(), + fontFamily: 'Cafe24SsurroundAir-v1.1', + color: hashtag.color, + ); + + final TextStyle style2 = Theme.of(context).textTheme.bodySmall!.copyWith( + fontSize: hashtag.size.toDouble(), + fontFamily: 'Cafe24SsurroundAir-v1.1', + foreground: Paint() + ..style = PaintingStyle.stroke + ..strokeWidth = 1.4 + ..color = hashtag.color, + ); + + return RotatedBox( + quarterTurns: hashtag.rotated ? 1 : 0, + child: Stack( + children: [ + Text( + hashtag.hashtag, + textAlign: TextAlign.center, + style: style2, + ), + Text( + hashtag.hashtag, + style: style, + ), + ], + ) + ); + } +} \ No newline at end of file diff --git a/client/lib/memorial/slide/flutter_image_slideshow.dart b/client/lib/memorial/slide/flutter_image_slideshow.dart new file mode 100644 index 0000000..7d41dba --- /dev/null +++ b/client/lib/memorial/slide/flutter_image_slideshow.dart @@ -0,0 +1 @@ +export 'image_slideshow.dart'; \ No newline at end of file diff --git a/client/lib/memorial/slide/image_slideshow.dart b/client/lib/memorial/slide/image_slideshow.dart new file mode 100644 index 0000000..a11d157 --- /dev/null +++ b/client/lib/memorial/slide/image_slideshow.dart @@ -0,0 +1,195 @@ +import 'dart:async'; + +import 'package:flutter/gestures.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_image_slideshow/src/indicator.dart'; + +class ImageSlideshow extends StatefulWidget { + const ImageSlideshow({ + Key? key, + required this.children, + this.width = double.infinity, + this.height = 200, + this.initialPage = 0, + this.indicatorColor, + this.indicatorBackgroundColor = const Color(0xffCCCCCC), + this.onPageChanged, + this.autoPlayInterval, + this.isLoop = false, + this.indicatorRadius = 3, + this.indicatorPadding = 4, + this.indicatorBottomPadding = 10, + this.disableUserScrolling = false, + }) : super(key: key); + + /// The widgets to display in the [ImageSlideshow]. + /// + /// Mainly intended for image widget, but other widgets can also be used. + final List children; + + /// Width of the [ImageSlideshow]. + final double width; + + /// Height of the [ImageSlideshow]. + final double height; + + /// The page to show when first creating the [ImageSlideshow]. + final int initialPage; + + /// The color to paint the indicator. + final Color? indicatorColor; + + /// The color to paint behind th indicator. + final Color? indicatorBackgroundColor; + + /// Called whenever the page in the center of the viewport changes. + final ValueChanged? onPageChanged; + + /// Auto scroll interval. + /// + /// Do not auto scroll when you enter null or 0. + final int? autoPlayInterval; + + /// Loops back to first slide. + final bool isLoop; + + /// Radius of CircleIndicator. + final double indicatorRadius; + + /// Padding of CircleIndicator. + final double indicatorPadding; + + /// BottomPadding to Indicator. + final double indicatorBottomPadding; + + /// Disable page changes by the user. + final bool disableUserScrolling; + + @override + ImageSlideshowState createState() => ImageSlideshowState(); +} + +class ImageSlideshowState extends State { + late final ValueNotifier _currentPageNotifier; + late final PageController _pageController; + late final ScrollBehavior _scrollBehavior; + Timer? _timer; + + void _onPageChanged(int index) { + _currentPageNotifier.value = index; + if (widget.onPageChanged != null) { + final correctIndex = index % widget.children.length; + widget.onPageChanged!(correctIndex); + } + } + + void _autoPlayTimerStart() { + _timer?.cancel(); + _timer = Timer.periodic( + Duration(milliseconds: widget.autoPlayInterval!), + (timer) { + int nextPage; + if (widget.isLoop) { + nextPage = _currentPageNotifier.value + 1; + } else { + if (_currentPageNotifier.value < widget.children.length - 1) { + nextPage = _currentPageNotifier.value + 1; + } else { + return; + } + } + + goToPage(nextPage); + }, + ); + } + + void goToPage(int index) { + if (_pageController.hasClients) { + _pageController.animateToPage( + index, + duration: const Duration(milliseconds: 350), + curve: Curves.easeIn, + ); + } + } + + void stopAutoPlay() { + _timer?.cancel(); + } + + @override + void initState() { + _scrollBehavior = widget.disableUserScrolling + ? const ScrollBehavior().copyWith( + scrollbars: false, + dragDevices: {}, + ) + : const ScrollBehavior().copyWith( + scrollbars: false, + dragDevices: { + PointerDeviceKind.touch, + PointerDeviceKind.mouse, + }, + ); + + _pageController = PageController( + initialPage: widget.initialPage, + ); + + _currentPageNotifier = ValueNotifier(widget.initialPage); + + if (widget.autoPlayInterval != null && widget.autoPlayInterval != 0) { + _autoPlayTimerStart(); + } + super.initState(); + } + + @override + void dispose() { + _pageController.dispose(); + _currentPageNotifier.dispose(); + _timer?.cancel(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return SizedBox( + width: widget.width, + height: widget.height, + child: Stack( + children: [ + PageView.builder( + scrollBehavior: _scrollBehavior, + onPageChanged: _onPageChanged, + itemCount: widget.isLoop ? null : widget.children.length, + controller: _pageController, + itemBuilder: (context, index) { + final correctIndex = index % widget.children.length; + return widget.children[correctIndex]; + }, + ), + Positioned( + left: 0, + right: 0, + bottom: widget.indicatorBottomPadding, + child: ValueListenableBuilder( + valueListenable: _currentPageNotifier, + builder: (context, value, child) { + return Indicator( + count: widget.children.length, + currentIndex: value % widget.children.length, + activeColor: widget.indicatorColor, + backgroundColor: widget.indicatorBackgroundColor, + radius: widget.indicatorRadius, + padding: widget.indicatorPadding, + ); + }, + ), + ), + ], + ), + ); + } +} \ No newline at end of file diff --git a/client/lib/memorial/slide/indicator.dart b/client/lib/memorial/slide/indicator.dart new file mode 100644 index 0000000..c660d61 --- /dev/null +++ b/client/lib/memorial/slide/indicator.dart @@ -0,0 +1,39 @@ +import 'package:flutter/material.dart'; + +class Indicator extends StatelessWidget { + const Indicator({ + Key? key, + required this.count, + required this.currentIndex, + this.activeColor, + this.backgroundColor, + required this.padding, + required this.radius, + }) : super(key: key); + + final int count; + final int currentIndex; + final Color? activeColor; + final Color? backgroundColor; + final double padding; + final double radius; + + @override + Widget build(BuildContext context) { + return Wrap( + spacing: padding, + runSpacing: padding, + alignment: WrapAlignment.center, + children: List.generate( + count, + (index) { + return CircleAvatar( + radius: radius, + backgroundColor: + currentIndex == index ? activeColor : backgroundColor, + ); + }, + ), + ); + } +} \ No newline at end of file diff --git a/client/lib/memorial/watch_others.dart b/client/lib/memorial/watch_others.dart new file mode 100644 index 0000000..a315da3 --- /dev/null +++ b/client/lib/memorial/watch_others.dart @@ -0,0 +1,668 @@ +import 'dart:convert'; +import 'package:flutter_svg/svg.dart'; +import 'package:get/get.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:client/memorial/watch_others_memorial_detail.dart'; +import 'package:client/style.dart'; +import 'package:http/http.dart' as http; +import 'memorial_search.dart'; +import 'others_memorial_main.dart'; +import 'package:client/sign/sign_in.dart' as sign_in; +import 'memorial_main.dart' as userMain; + +String selectedOthersImage = ""; +String selectedOthersProfileImage = ""; +String selectedOthersNickaname = ""; +String selectedUser = ""; +int selectedPostId = 0; + +class WatchOthersPage extends StatefulWidget { + @override + State createState() => _WatchOthersPageState(); +} + +class _WatchOthersPageState extends State { + + late List parsedResponseCM; // ์‹ค์‹œ๊ฐ„ ํ”ผ๋“œ + late List parsedResponseFC; // ์‹ค์‹œ๊ฐ„ ํ”ผ๋“œ_ํ•„ํ„ฐ์ ์šฉ + + bool checkUser = false; + bool isLastest = false; + + String dogType = ""; // ๊ฐ•์•„์ง€ ํƒ€์ž… + String dogAge = ""; // ๊ฐ•์•„์ง€ ๋‚˜์ด + + // ํ•„ํ„ฐ๋ง ์„ ํƒ ๋‚˜์ด or ๊ฒฌ์ข… + bool selectType = false; + bool selectAge = false; + + List parsedResponseIMGS = []; // ์ด๋ฏธ์ง€ ๊ฐœ์ˆ˜ + + // ๋‚ด์šฉ ์ตœ์‹  ํ”ผ๋“œ ๋ถˆ๋Ÿฌ์˜ค๊ธฐ(GET) + void fetchWithHeaders(String aToken) async { + // API ์—”๋“œํฌ์ธํŠธ URL + String apiUrl = 'http://3.38.1.125:8080/memorial/feed?filter=false'; // ์‹ค์ œ API ์—”๋“œํฌ์ธํŠธ๋กœ ๋ณ€๊ฒฝํ•˜์„ธ์š” + + // ํ—ค๋” ์ •๋ณด ์„ค์ • + Map headers = { + 'Authorization': 'Bearer $aToken', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• + 'Content-Type': 'application/json', // ์˜ˆ: JSON ์š”์ฒญ์ธ ๊ฒฝ์šฐ ํ—ค๋” ์„ค์ • + }; + + // HTTP GET ์š”์ฒญ ๋ณด๋‚ด๊ธฐ + var response = await http.get( + Uri.parse(apiUrl), + headers: headers, // ํ—ค๋” ์ถ”๊ฐ€ + ); + + // HTTP ์‘๋‹ต ์ƒํƒœ ํ™•์ธ + if (response.statusCode == 200) { + // ์‘๋‹ต ๋ฐ์ดํ„ฐ ์ฒ˜๋ฆฌ + print('์„œ๋ฒ„๋กœ๋ถ€ํ„ฐ ๋ฐ›์€ ๋‚ด์šฉ ๋ฐ์ดํ„ฐ: ${response.body}'); + var jsonResponse = utf8.decode(response.bodyBytes); + + parsedResponseCM = json.decode(jsonResponse); + + + isLastest = true; + setState(() {}); + + } else { + // ์š”์ฒญ์ด ์‹คํŒจํ•œ ๊ฒฝ์šฐ ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌ + print('HTTP ์š”์ฒญ ์‹คํŒจ: ${response.statusCode}'); + } + } + + void sendPostRequest(String aToken) async { + // API ์—”๋“œํฌ์ธํŠธ URL + String apiUrl = 'http://3.38.1.125:8080/memorial/feed?filter=false'; // ์‹ค์ œ API ์—”๋“œํฌ์ธํŠธ๋กœ ๋ณ€๊ฒฝํ•˜์„ธ์š” + + // POST ์š”์ฒญ ๋ณด๋‚ด๊ธฐ + var response = await http.post( + Uri.parse(apiUrl), + headers: { + 'Authorization': 'Bearer $aToken', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• + 'Content-Type': 'application/json', // ์˜ˆ: JSON ์š”์ฒญ์ธ ๊ฒฝ์šฐ ํ—ค๋” ์„ค์ • + //'Content-Type': 'application/json', + }, // ์š”์ฒญ ํ—ค๋”์— Content-Type ์„ค์ • + ); + + // HTTP ์‘๋‹ต ์ƒํƒœ ํ™•์ธ + if (response.statusCode == 200) { + // ์‘๋‹ต ๋ฐ์ดํ„ฐ ์ฒ˜๋ฆฌ + print('์„œ๋ฒ„๋กœ๋ถ€ํ„ฐ ๋ฐ›์€ ๋‚ด์šฉ ๋ฐ์ดํ„ฐ: ${response.body}'); + var jsonResponse = utf8.decode(response.bodyBytes); + + parsedResponseCM = json.decode(jsonResponse); + + print("๊ฐฏ์ˆ˜:" + parsedResponseCM.length.toString()); + + isLastest = true; + setState(() {}); + // print('์„œ๋ฒ„๋กœ๋ถ€ํ„ฐ ๋ฐ›์€ ๋ฐ์ดํ„ฐ: ${response.body}'); + } else { + // ์š”์ฒญ์ด ์‹คํŒจํ•œ ๊ฒฝ์šฐ ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌ + print('HTTP ์š”์ฒญ ์‹คํŒจ: ${response.statusCode}'); + } + } + + late Map parsedResponseUser; // ์‚ฌ์šฉ์ž ์ •๋ณด + + // ํ•„ํ„ฐ๋ง ์ ์šฉ์„ ์œ„ํ•œ ์‚ฌ์šฉ์ž ์ •๋ณด ๊ฐ€์ ธ์˜ค๊ธฐ + void fetchUserInfo(String aToken) async { + // API ์—”๋“œํฌ์ธํŠธ URL + print("๋ฐ›ํ† :" + aToken); + String apiUrl = 'http://3.38.1.125:8080/user/info'; // ์‹ค์ œ API ์—”๋“œํฌ์ธํŠธ๋กœ ๋ณ€๊ฒฝํ•˜์„ธ์š” + + // ํ—ค๋” ์ •๋ณด ์„ค์ • + Map headers = { + 'Authorization': 'Bearer $aToken', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• + 'Content-Type': 'application/json', // ์˜ˆ: JSON ์š”์ฒญ์ธ ๊ฒฝ์šฐ ํ—ค๋” ์„ค์ • + }; + + // HTTP GET ์š”์ฒญ ๋ณด๋‚ด๊ธฐ + var response = await http.get( + Uri.parse(apiUrl), + headers: headers, // ํ—ค๋” ์ถ”๊ฐ€ + ); + + // HTTP ์‘๋‹ต ์ƒํƒœ ํ™•์ธ + if (response.statusCode == 200) { + // ์‘๋‹ต ๋ฐ์ดํ„ฐ ์ฒ˜๋ฆฌ + print('์„œ๋ฒ„๋กœ๋ถ€ํ„ฐ ๋ฐ›์€ ๋‚ด์šฉ ๋ฐ์ดํ„ฐ(์‚ฌ์šฉ์ž ์ •๋ณด): ${response.body}'); + var jsonResponse = utf8.decode(response.bodyBytes); + + parsedResponseUser = json.decode(jsonResponse); + + } else { + // ์š”์ฒญ์ด ์‹คํŒจํ•œ ๊ฒฝ์šฐ ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌ + print('HTTP ์š”์ฒญ ์‹คํŒจ: ${response.statusCode}'); + } + } + + void sendPostRequestFilter(String aToken, String type) async { + + // ์š”์ฒญ ๋ณธ๋ฌธ ๋ฐ์ดํ„ฐ + var data = { + "type" : type, + }; + // API ์—”๋“œํฌ์ธํŠธ URL + String apiUrl = 'http://3.38.1.125:8080/memorial/feed?filter=true'; + + // POST ์š”์ฒญ ๋ณด๋‚ด๊ธฐ + var response = await http.post( + Uri.parse(apiUrl), + body: json.encode(data), // ์š”์ฒญ ๋ณธ๋ฌธ์— ๋ฐ์ดํ„ฐ๋ฅผ JSON ํ˜•์‹์œผ๋กœ ์ธ์ฝ”๋”ฉํ•˜์—ฌ ์ „๋‹ฌ + headers: { + 'Authorization': 'Bearer $aToken', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• + 'Content-Type': 'application/json', // ์˜ˆ: JSON ์š”์ฒญ์ธ ๊ฒฝ์šฐ ํ—ค๋” ์„ค์ • + //'Content-Type': 'application/json', + }, // ์š”์ฒญ ํ—ค๋”์— Content-Type ์„ค์ • + ); + + // HTTP ์‘๋‹ต ์ƒํƒœ ํ™•์ธ + if (response.statusCode == 200) { + // ์‘๋‹ต ๋ฐ์ดํ„ฐ ์ฒ˜๋ฆฌ + print('์„œ๋ฒ„๋กœ๋ถ€ํ„ฐ ๋ฐ›์€ ๋‚ด์šฉ ๋ฐ์ดํ„ฐ: ${response.body}'); + var jsonResponse = utf8.decode(response.bodyBytes); + + parsedResponseCM = json.decode(jsonResponse); + + // isLastest = true; + setState(() {}); + // print('์„œ๋ฒ„๋กœ๋ถ€ํ„ฐ ๋ฐ›์€ ๋ฐ์ดํ„ฐ: ${response.body}'); + } else { + // ์š”์ฒญ์ด ์‹คํŒจํ•œ ๊ฒฝ์šฐ ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌ + print('HTTP ์š”์ฒญ ์‹คํŒจ: ${response.statusCode}'); + } + } + + void sendPostRequestFilter2(String aToken ,String age) async { + + // ์š”์ฒญ ๋ณธ๋ฌธ ๋ฐ์ดํ„ฐ + var data = { + "age" : age, + }; + // API ์—”๋“œํฌ์ธํŠธ URL + String apiUrl = 'http://3.38.1.125:8080/memorial/feed?filter=true'; + + // POST ์š”์ฒญ ๋ณด๋‚ด๊ธฐ + var response = await http.post( + Uri.parse(apiUrl), + body: json.encode(data), // ์š”์ฒญ ๋ณธ๋ฌธ์— ๋ฐ์ดํ„ฐ๋ฅผ JSON ํ˜•์‹์œผ๋กœ ์ธ์ฝ”๋”ฉํ•˜์—ฌ ์ „๋‹ฌ + headers: { + 'Authorization': 'Bearer $aToken', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• + 'Content-Type': 'application/json', // ์˜ˆ: JSON ์š”์ฒญ์ธ ๊ฒฝ์šฐ ํ—ค๋” ์„ค์ • + //'Content-Type': 'application/json', + }, // ์š”์ฒญ ํ—ค๋”์— Content-Type ์„ค์ • + ); + + // HTTP ์‘๋‹ต ์ƒํƒœ ํ™•์ธ + if (response.statusCode == 200) { + // ์‘๋‹ต ๋ฐ์ดํ„ฐ ์ฒ˜๋ฆฌ + print('์„œ๋ฒ„๋กœ๋ถ€ํ„ฐ ๋ฐ›์€ ๋‚ด์šฉ ๋ฐ์ดํ„ฐ: ${response.body}'); + var jsonResponse = utf8.decode(response.bodyBytes); + + parsedResponseCM = json.decode(jsonResponse); + + selectAge = true; + // isLastest = true; + setState(() {}); + // print('์„œ๋ฒ„๋กœ๋ถ€ํ„ฐ ๋ฐ›์€ ๋ฐ์ดํ„ฐ: ${response.body}'); + } else { + // ์š”์ฒญ์ด ์‹คํŒจํ•œ ๊ฒฝ์šฐ ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌ + print('HTTP ์š”์ฒญ ์‹คํŒจ: ${response.statusCode}'); + } + } + + // ๋‘๊ฐœ ๋‹ค ์„ ํƒ + void sendPostRequestFilter3(String aToken, String age, String type) async { + + // ์š”์ฒญ ๋ณธ๋ฌธ ๋ฐ์ดํ„ฐ + var data = { + "age" : age, + "type" : type, + }; + // API ์—”๋“œํฌ์ธํŠธ URL + String apiUrl = 'http://3.38.1.125:8080/memorial/feed?filter=true'; + + // POST ์š”์ฒญ ๋ณด๋‚ด๊ธฐ + var response = await http.post( + Uri.parse(apiUrl), + body: json.encode(data), // ์š”์ฒญ ๋ณธ๋ฌธ์— ๋ฐ์ดํ„ฐ๋ฅผ JSON ํ˜•์‹์œผ๋กœ ์ธ์ฝ”๋”ฉํ•˜์—ฌ ์ „๋‹ฌ + headers: { + 'Authorization': 'Bearer $aToken', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• + 'Content-Type': 'application/json', // ์˜ˆ: JSON ์š”์ฒญ์ธ ๊ฒฝ์šฐ ํ—ค๋” ์„ค์ • + //'Content-Type': 'application/json', + }, // ์š”์ฒญ ํ—ค๋”์— Content-Type ์„ค์ • + ); + + // HTTP ์‘๋‹ต ์ƒํƒœ ํ™•์ธ + if (response.statusCode == 200) { + // ์‘๋‹ต ๋ฐ์ดํ„ฐ ์ฒ˜๋ฆฌ + print('์„œ๋ฒ„๋กœ๋ถ€ํ„ฐ ๋ฐ›์€ ๋‚ด์šฉ ๋ฐ์ดํ„ฐ: ${response.body}'); + var jsonResponse = utf8.decode(response.bodyBytes); + + parsedResponseCM = json.decode(jsonResponse); + + selectAge = true; + // isLastest = true; + setState(() {}); + // print('์„œ๋ฒ„๋กœ๋ถ€ํ„ฐ ๋ฐ›์€ ๋ฐ์ดํ„ฐ: ${response.body}'); + } else { + // ์š”์ฒญ์ด ์‹คํŒจํ•œ ๊ฒฝ์šฐ ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌ + print('HTTP ์š”์ฒญ ์‹คํŒจ: ${response.statusCode}'); + } + } + + // ํ…์ŠคํŠธ์—๋””ํŒ…์ปจํŠธ๋กค๋Ÿฌ๋ฅผ ์ƒ์„ฑํ•˜์—ฌ ํ•„๋“œ์— ํ• ๋‹น + final myController = TextEditingController(); + + @override + void initState() { + super.initState(); + SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: [SystemUiOverlay.top]); + //fetchWithHeaders(); + + fetchUserInfo(sign_in.userAccessToken); + //_callAPI(); + sendPostRequest(sign_in.userAccessToken); + } + + double calculateGridViewHeight() { + // ๊ทธ๋ฆฌ๋“œ๋ทฐ์˜ ์•„์ดํ…œ ์ˆ˜ + int itemCount = parsedResponseCM.length; + + // ๊ทธ๋ฆฌ๋“œ๋ทฐ์˜ ์—ด ์ˆ˜ (3๊ฐœ์˜ ์•„์ดํ…œ์ด ํ•œ ํ–‰์— ์žˆ์„ ๋•Œ) + int columnCount = 2; + + // ์•„์ดํ…œ์˜ ๋†’์ด (๊ฐ€๋กœ:์„ธ๋กœ ๋น„์œจ์„ ์„ค์ •ํ•  ์ˆ˜ ์žˆ์Œ) + double itemHeight = 204; // ์ด ๊ฐ’์€ ์ ์ ˆํžˆ ์กฐ์ • + + // ์•„์ดํ…œ ๊ฐ„์˜ ์ˆ˜์ง ๊ฐ„๊ฒฉ + double crossAxisSpacing = 8.0; + + // ๊ทธ๋ฆฌ๋“œ๋ทฐ์˜ ๋†’์ด ๊ณ„์‚ฐ + double gridHeight = ((itemCount / columnCount).ceil() * itemHeight) + + ((itemCount / columnCount - 1).ceil() * crossAxisSpacing); + + return gridHeight; + } + + @override + Widget build(BuildContext context) { + MediaQueryData deviceData = MediaQuery.of(context); + Size screenSize = deviceData.size; + return Scaffold( + appBar: PreferredSize( + preferredSize: Size.fromHeight(72), + child: AppBar( + actions: [ + Padding(padding: EdgeInsets.only(top:15), + child: new IconButton( + icon:Icon(Icons.search, size: 24,), + onPressed: (){ + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => MemorialSearchPage())); // ๊ฒ€์ƒ‰ํŽ˜์ด์ง€๋กœ ์ด๋™ + }, + ), + ), + + ], + automaticallyImplyLeading: userMain.inUser? true : false, + leading: + Padding(padding: EdgeInsets.only(top:20), + child: userMain.inUser? IconButton( + icon: Icon(Icons.arrow_back_ios_rounded, color: Colors.black), + onPressed: (){ + userMain.inUser = false; + setState(() { + }); + Navigator.of(context).pop(); + }, + ):SizedBox(width: 1,), + ), + + title: + Container( + height: 50, + width: screenSize.width, + child: Column( + children: [ + SizedBox(height: 24,), + Center( + child: Padding(padding: EdgeInsets.only(right: 0), + child: Text('ํ•จ๊ป˜ํ• ๊ฐœ', style: textStyle.bk20normal,), + ) + ), + ], + ), + ), + backgroundColor: Color(0xffDDE7FD), + elevation: 0.0, + iconTheme: IconThemeData(color: Colors.black), + ), + ), + body: + Container( + //color: Color(0xffDDE7FD), + //width: Get.width, + //height: Get.height, + child: SingleChildScrollView( + //padding: EdgeInsets.fromLTRB(16, 16, 16, 16), + scrollDirection: Axis.vertical, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + if(isLastest)...[ + ClipRRect( + borderRadius: BorderRadius.only(topLeft: Radius.circular(16.0), topRight: Radius.circular(16.0)), + child: Container( + padding: EdgeInsets.all(16), + width: Get.width, + color: Color(0xffF1F5FE), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding(padding: EdgeInsets.only(bottom: 22, left: 0), + child: Row( + children: [ + if(selectType)...[ + Container( + height: 28, + width: 119, + child: ElevatedButton(onPressed: (){ + dogType = "${parsedResponseUser['puppyType']}"; + selectType = false; + if(selectAge){ + sendPostRequestFilter2(sign_in.userAccessToken,parsedResponseUser['puppyAge'].toString()); + }else{ + sendPostRequest(sign_in.userAccessToken); + } + setState(() {}); + //sendPostRequestFilter(sign_in.userAccessToken); + }, + style: buttonChart().whitebtn4, + child: Text("${parsedResponseUser['puppyType']}", style: textStyle.wo16semibold,) + ), + ), + ]else...[ + Container( + height: 28, + width: 119, + child: ElevatedButton(onPressed: (){ + dogType = "${parsedResponseUser['puppyType']}"; + selectType = true; + setState(() {}); + if(selectAge){ + sendPostRequestFilter3(sign_in.userAccessToken, parsedResponseUser['puppyAge'].toString() ,parsedResponseUser['puppyType']); + }else{ + sendPostRequestFilter(sign_in.userAccessToken, parsedResponseUser['puppyType']); + } + }, + style: buttonChart().whitebtn3, + child: Text("${parsedResponseUser['puppyType']}", style: textStyle.bk16light,) + ), + ), + ], + + SizedBox(width: 16,), + if(selectAge)...[ + Container( + height: 28, + width: 63, + child: ElevatedButton(onPressed: (){ + dogAge = "${parsedResponseUser['puppyAge']}์‚ด"; + selectAge = false; + setState(() {}); + if(selectType){ + sendPostRequestFilter(sign_in.userAccessToken, parsedResponseUser['puppyType']); + }else{ + sendPostRequest(sign_in.userAccessToken); + } + }, + style: buttonChart().whitebtn4, + child: Text("${parsedResponseUser['puppyAge']}์‚ด", style: textStyle.wo16semibold,) + ), + ), + ] + else...[ + Container( + height: 28, + width: 63, + child: ElevatedButton(onPressed: (){ + dogAge = "${parsedResponseUser['puppyAge']}์‚ด"; + selectAge = true; + setState(() {}); + if(selectType){ + sendPostRequestFilter3(sign_in.userAccessToken, parsedResponseUser['puppyAge'].toString() ,parsedResponseUser['puppyType']); + }else{ + sendPostRequestFilter2(sign_in.userAccessToken,parsedResponseUser['puppyAge'].toString()); + } + }, + style: buttonChart().whitebtn3, + child: Text("${parsedResponseUser['puppyAge']}์‚ด", style: textStyle.bk16light,) + ), + ), + ], + SizedBox(width: 16,), + Container( + height: 28, + width: 52, + child: ElevatedButton(onPressed: (){ + setState(() {}); + selectAge = false; + selectType = false; + sendPostRequest(sign_in.userAccessToken); + }, + style: buttonChart().whitebtn3, + child: SvgPicture.asset( + 'assets/images/memorial/reset.svg', + ), + ), + ) + ], + ), + ), + Container( + //padding: EdgeInsets.all(8.0), + width: Get.width, + height: (parsedResponseCM.length) == 0? Get.height - 234 : calculateGridViewHeight() + 188, + color: Color(0xffF1F5FE), + child: + Column( + children: [ + Expanded( + child: Column( + children: [ + (parsedResponseCM.length) != 0? + GridView.builder( + shrinkWrap: true, // ๊ทธ๋ฆฌ๋“œ๋ทฐ๊ฐ€ ์ž์‹ ์˜ ๋‚ด์šฉ์— ๋งž๊ฒŒ ํฌ๊ธฐ๋ฅผ ์กฐ์ ˆํ•˜๋„๋ก ํ•จ + physics: NeverScrollableScrollPhysics(), + itemCount:parsedResponseCM.length, + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 2, //1 ๊ฐœ์˜ ํ–‰์— ๋ณด์—ฌ์ค„ item ๊ฐœ์ˆ˜ + childAspectRatio: 1.56 / 2.04, //item ์˜ ๊ฐ€๋กœ 1, ์„ธ๋กœ 2 ์˜ ๋น„์œจ + mainAxisSpacing: 16, //์ˆ˜ํ‰ Padding + crossAxisSpacing: 16, //์ˆ˜์ง Padding + ), + itemBuilder: (BuildContext context, int index){ + return + InkWell( + onTap: (){ + selectedOthersImage = parsedResponseCM[index]['image']; + selectedOthersProfileImage = parsedResponseCM[index]['profileImage'].toString(); + selectedOthersNickaname = parsedResponseCM[index]['nickname']; + selectedUser = parsedResponseCM[index]['userUid']; + selectedPostId = parsedResponseCM[index]['id']; + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => WatchOthersMemorialDetailPage())); + }, + child: Container( + // width: 156, + // height: 204, + padding: EdgeInsets.all(1.0), + decoration: BoxDecoration( + boxShadow: [ + BoxShadow( + color: Colors.black.withOpacity(0.05), + blurRadius: 10.0, + spreadRadius: 0.0, + offset: const Offset(0,7), + ) + ], + color: Colors.white, + borderRadius: BorderRadius.circular(16), + ), + child:Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + height: 166, + width: 204, + child: + Stack( + children: [ + Container( + height: 204, + width: 204, + child: + ClipRRect( + borderRadius: BorderRadius.only(topLeft: Radius.circular(16.0), topRight: Radius.circular(16.0)), + child: + Image( + image: NetworkImage(parsedResponseCM[index]['image'],), + fit: BoxFit.cover, + errorBuilder: (context, error, stackTrace) { + // ์˜ค๋ฅ˜ ๋ฐœ์ƒ ์‹œ ๋Œ€์ฒด ์ด๋ฏธ์ง€๋ฅผ ํ‘œ์‹œ + return SvgPicture.asset( + 'assets/images/no_result.svg',); + }, + ) + //Image.network(parsedResponseCM[index]['image'], fit: BoxFit.cover,), + ), + //Image.network(parsedResponseCM[index]['image'], fit: BoxFit.cover,), + ), + + Padding(padding: EdgeInsets.only(left: 8, top:8), + child: InkWell( + onTap: (){ + selectedUser = parsedResponseCM[index]['userUid']; + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => OthersMemorialMainPage())); + }, + child: + Container( + decoration: BoxDecoration( + color: Colors.black.withOpacity(0.2), + borderRadius: BorderRadius.circular(32), + ), + // color: Colors.white.withOpacity(0.7), + width: 86, + height: 32, + child: Row( + children: [ + SizedBox(width: 5,), + if(parsedResponseCM[index]['profileImage'].toString() == "null")...[ + CircleAvatar( + backgroundColor: Colors.white, + radius: 10, + child: CircleAvatar( + child: SvgPicture.asset('assets/images/user_null2.svg',), + radius: 9, + ), + ), + ]else...[ + CircleAvatar( + backgroundColor: Colors.white, + radius: 10, + child: CircleAvatar( + radius: 9, + backgroundImage: NetworkImage(parsedResponseCM[index]['profileImage'].toString()), + ), + ), + ], + + SizedBox(width: 5,), + Container( + width: 37, + child:Text(parsedResponseCM[index]['nickname'], + overflow: TextOverflow.ellipsis, // "..."์œผ๋กœ ํ‘œ์‹œ + maxLines: 1, // ์›ํ•˜๋Š” ์ค„ ์ˆ˜๋กœ ์„ค์ • + style: TextStyle(color: Colors.white, fontSize: 14, fontFamily: 'Pretendard',fontWeight: FontWeight.w600,),), + ), + SizedBox(width: 1,), + Container( + width: 11, + child: + Icon(Icons.arrow_forward_ios_rounded, color: Colors.white,size: 12,) + // SvgPicture.asset( + // 'assets/images/memorial/blue_arrow.svg', + // //fit: BoxFit.cover,), + ) + ], + ), + ), + ), + ), + ],), + ), + SizedBox(height: 8,), + Container( + height: 16, + width: 150, + child: Row( + children: [ + SizedBox(width: 10,), + Container( + width: 140, + height: 65, + child: Text(parsedResponseCM[index]['title'],style: TextStyle(color: Color(0xff333333), fontSize: 13.5, fontFamily: 'Pretendard',fontWeight: FontWeight.w400,), ), + ), + ], + ), + ), + ], + ) + ), + ); + + }): + Padding(padding: EdgeInsets.only(top: 200), + child: Column( + children: [ + SvgPicture.asset( + 'assets/images/no_result.svg', + height: 124, + ), + SizedBox(height: 16,), + Text("์ผ์น˜ํ•˜๋Š” ๋‚ด์šฉ์ด ์—†์Šต๋‹ˆ๋‹ค.", style: textStyle.bk16normal,) + ], + ) + ) + ], + ) + ) + ], + ) + ), + ], + ), + ), + ), + ], + ], + ), + ), + ), + + ); + } +} \ No newline at end of file diff --git a/client/lib/memorial/watch_others_memorial_detail.dart b/client/lib/memorial/watch_others_memorial_detail.dart new file mode 100644 index 0000000..f8b0262 --- /dev/null +++ b/client/lib/memorial/watch_others_memorial_detail.dart @@ -0,0 +1,871 @@ +import 'dart:async'; +import 'dart:convert'; +import 'package:flutter_svg/svg.dart'; +import 'package:get/get.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:client/memorial/others_memorial_main.dart'; +import 'package:client/style.dart'; +import 'package:intl/intl.dart'; +import 'package:client/memorial/watch_others.dart' as watchmain; +import 'package:http/http.dart' as http; +import 'package:client/sign/sign_in.dart' as sign_in; +import 'package:client/memorial/slide/flutter_image_slideshow.dart'; +import 'package:client/home.dart' as home; + +class WatchOthersMemorialDetailPage extends StatefulWidget { + @override + State createState() => _WatchOthersMemorialDetailPageState(); +} + +class _WatchOthersMemorialDetailPageState extends State { + + //watchmain.selectedPostId.toString() + + // ํ™”๋ฉด์— ๋ณด์ด๋Š” UI ์„ค์ • bool + bool askHelp = true; + bool sendHelp = false; + + bool fetchSuccess = false; + + // ํ…์ŠคํŠธ์—๋””ํŒ…์ปจํŠธ๋กค๋Ÿฌ๋ฅผ ์ƒ์„ฑํ•˜์—ฌ ํ•„๋“œ์— ํ• ๋‹น + final myController = TextEditingController(); + + late Map parsedResponseCN; // ๊ธ€ ๋‚ด์šฉ + late List parsedResponseCM; // ๋Œ“๊ธ€ + + List parsedResponseIMGS = []; // ์ด๋ฏธ์ง€ ๊ฐœ์ˆ˜ + + bool addComment = false; // ๋ฐ”๋กœ ์ฝ”๋ฉ˜ํŠธ ๋ถ™์˜€์„ ๋•Œ + bool isComment = false; + + // ์ฝ”๋ฉ˜ํŠธ ์ˆ˜์™€ ์ข‹์•„์š” ์ˆ˜ + int comments = 0; + int hearts = 0; + + late bool myHeart; + + // ๊ธ€๋‚ด์šฉ ๊ฐ€์ ธ์˜ค๊ธฐ + void fetchWithHeaders(String aToken) async { + // API ์—”๋“œํฌ์ธํŠธ URL + String apiUrl = 'http://3.38.1.125:8080/memorial?postId=${watchmain.selectedPostId.toString()}'; // ์‹ค์ œ API ์—”๋“œํฌ์ธํŠธ๋กœ ๋ณ€๊ฒฝํ•˜์„ธ์š” + + print("๋ช‡๋ฒˆ? "+watchmain.selectedPostId.toString()); + // ํ—ค๋” ์ •๋ณด ์„ค์ • + Map headers = { + 'Authorization': 'Bearer $aToken', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• + 'Content-Type': 'application/json', // ์˜ˆ: JSON ์š”์ฒญ์ธ ๊ฒฝ์šฐ ํ—ค๋” ์„ค์ • + }; + + // HTTP GET ์š”์ฒญ ๋ณด๋‚ด๊ธฐ + var response = await http.get( + Uri.parse(apiUrl), + headers: headers, // ํ—ค๋” ์ถ”๊ฐ€ + ); + + // HTTP ์‘๋‹ต ์ƒํƒœ ํ™•์ธ + if (response.statusCode == 200) { + // ์‘๋‹ต ๋ฐ์ดํ„ฐ ์ฒ˜๋ฆฌ + fetchSuccess = true; + setState(() {}); + print('์„œ๋ฒ„๋กœ๋ถ€ํ„ฐ ๋ฐ›์€ ๋‚ด์šฉ ๋ฐ์ดํ„ฐ(๊ธ€ ๋‚ด์šฉ): ${response.body}'); + var jsonResponse = utf8.decode(response.bodyBytes); + + parsedResponseCN = json.decode(jsonResponse); + + // List ํ˜•์‹ + print("image test" + parsedResponseCN['imageList'][0].toString()); + + hearts = parsedResponseCN['likes']; + setState(() { + + }); + + for(int i = 0; i headers = { + 'Authorization': 'Bearer $aToken', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• + 'Content-Type': 'application/json', // ์˜ˆ: JSON ์š”์ฒญ์ธ ๊ฒฝ์šฐ ํ—ค๋” ์„ค์ • + }; + + var url = Uri.parse('http://3.38.1.125:8080/memorial/comment?postId=${watchmain.selectedPostId.toString()}'); // ์—”๋“œํฌ์ธํŠธ URL ์„ค์ • + + try { + var response = await http.post( + url, + body: json.encode(data), // ์š”์ฒญ ๋ณธ๋ฌธ์— ๋ฐ์ดํ„ฐ๋ฅผ JSON ํ˜•์‹์œผ๋กœ ์ธ์ฝ”๋”ฉํ•˜์—ฌ ์ „๋‹ฌ + headers: headers, // ํ—ค๋” ์ถ”๊ฐ€ + ); + + if (response.statusCode == 200) { + // ์‘๋‹ต ์„ฑ๊ณต ์‹œ์˜ ์ฒ˜๋ฆฌ + + var jsonResponse = utf8.decode(response.bodyBytes); // ์‘๋‹ต ๋ณธ๋ฌธ์„ JSON ํ˜•์‹์œผ๋กœ ๋””์ฝ”๋”ฉ + // JSON ๊ฐ’์„ ํ™œ์šฉํ•œ ์›ํ•˜๋Š” ๋™์ž‘ ์ˆ˜ํ–‰ + //utf8.decode(jsonResponse); + print(jsonResponse); + + List contentList = []; + + List parsedResponse = json.decode(jsonResponse); + + setState(() { + }); + + + print('API ํ˜ธ์ถœ ์„ฑ๊ณต!!: ${response.statusCode}'); + } else { + // ์š”์ฒญ ์‹คํŒจ ์‹œ์˜ ์ฒ˜๋ฆฌ + print('API ํ˜ธ์ถœ ์‹คํŒจ!!: ${response.statusCode}'); + } + } catch (e) { + // ์˜ˆ์™ธ ๋ฐœ์ƒ ์‹œ์˜ ์ฒ˜๋ฆฌ + print('API ํ˜ธ์ถœ ์ค‘ ์˜ˆ์™ธ ๋ฐœ์ƒ: $e'); + } + } + + // ์ข‹์•„์š” ๋ˆ„๋ฅด๊ธฐ(POST) + void sendPostRequest(String aToken) async { + // API ์—”๋“œํฌ์ธํŠธ URL + String apiUrl = 'http://3.38.1.125:8080/memorial/like?postId=${watchmain.selectedPostId.toString()}'; // ์‹ค์ œ API ์—”๋“œํฌ์ธํŠธ๋กœ ๋ณ€๊ฒฝํ•˜์„ธ์š” + + // POST ์š”์ฒญ ๋ณด๋‚ด๊ธฐe + var response = await http.post( + Uri.parse(apiUrl), + headers: { + 'Authorization': 'Bearer $aToken', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• + 'Content-Type': 'application/json', // ์˜ˆ: JSON ์š”์ฒญ์ธ ๊ฒฝ์šฐ ํ—ค๋” ์„ค์ • + //'Content-Type': 'application/json', + }, // ์š”์ฒญ ํ—ค๋”์— Content-Type ์„ค์ • + ); + + // HTTP ์‘๋‹ต ์ƒํƒœ ํ™•์ธ + if (response.statusCode == 200) { + // ์‘๋‹ต ๋ฐ์ดํ„ฐ ์ฒ˜๋ฆฌ + print('์„œ๋ฒ„๋กœ๋ถ€ํ„ฐ ๋ฐ›์€ ๋‚ด์šฉ ๋ฐ์ดํ„ฐ: ${response.body}'); + var jsonResponse = utf8.decode(response.bodyBytes); + + setState(() {}); + // print('์„œ๋ฒ„๋กœ๋ถ€ํ„ฐ ๋ฐ›์€ ๋ฐ์ดํ„ฐ: ${response.body}'); + } else { + // ์š”์ฒญ์ด ์‹คํŒจํ•œ ๊ฒฝ์šฐ ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌ + print('HTTP ์š”์ฒญ ์‹คํŒจ: ${response.statusCode}'); + } + } + + // ์ข‹์•„์š” ๊ฐ€์ ธ์˜ค๊ธฐ- ํด๋ฆญ์—ฌ๋ถ€ ํ™•์ธ(GET) + void fetchDataLike(String aToken) async { + // API ์—”๋“œํฌ์ธํŠธ URL + String apiUrl = 'http://3.38.1.125:8080/memorial/like?postId=${watchmain.selectedPostId.toString()}'; /// postId=1 ์ถ”ํ›„์— ๋ฐ”๊ฟ”์ฃผ๊ธฐ + + // ํ—ค๋” ์ •๋ณด ์„ค์ • + Map headers = { + 'Authorization': 'Bearer $aToken', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• + 'Content-Type': 'application/json', // ์˜ˆ: JSON ์š”์ฒญ์ธ ๊ฒฝ์šฐ ํ—ค๋” ์„ค์ • + }; + + // HTTP GET ์š”์ฒญ ๋ณด๋‚ด๊ธฐ + var response = await http.get( + Uri.parse(apiUrl), + headers: headers, // ํ—ค๋” ์ถ”๊ฐ€ + ); + + ///var jsonResponse = utf8.decode(response.bodyBytes); + // HTTP ์‘๋‹ต ์ƒํƒœ ํ™•์ธ + if (response.statusCode == 200) { + // ์‘๋‹ต ๋ฐ์ดํ„ฐ๋ฅผ JSON ํ˜•์‹์œผ๋กœ ๋””์ฝ”๋”ฉ + var data = json.decode(response.body); + var jsonResponse = utf8.decode(response.bodyBytes); + + myHeart = json.decode(jsonResponse); + + // ๋ฐ์ดํ„ฐ ์ฒ˜๋ฆฌ + print('์ข‹์•„์š”: $myHeart'); + // if(myHeart == true){ + // hearts = 1; + // } else{ + // hearts = 0; + // } + + setState(() { + }); + + } else { + // ์š”์ฒญ์ด ์‹คํŒจํ•œ ๊ฒฝ์šฐ ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌ + print('HTTP ์š”์ฒญ ์‹คํŒจ: ${response.statusCode}'); + } + } + + // ๋Œ“๊ธ€ ์‚ญ์ œํ•˜๊ธฐ + void deleteComment(String aToken, int commentId) async { + // API ์—”๋“œํฌ์ธํŠธ URL + String apiUrl = 'http://3.38.1.125:8080/memorial/comment?commentId=${commentId}'; + + // ํ—ค๋” ์ •๋ณด ์„ค์ • + Map headers = { + 'Authorization': 'Bearer $aToken', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• + 'Content-Type': 'application/json', // ์˜ˆ: JSON ์š”์ฒญ์ธ ๊ฒฝ์šฐ ํ—ค๋” ์„ค์ • + }; + + // HTTP GET ์š”์ฒญ ๋ณด๋‚ด๊ธฐ + var response = await http.delete( + Uri.parse(apiUrl), + headers: headers, // ํ—ค๋” ์ถ”๊ฐ€ + ); + + ///var jsonResponse = utf8.decode(response.bodyBytes); + // HTTP ์‘๋‹ต ์ƒํƒœ ํ™•์ธ + if (response.statusCode == 200) { + // ์‘๋‹ต ๋ฐ์ดํ„ฐ๋ฅผ JSON ํ˜•์‹์œผ๋กœ ๋””์ฝ”๋”ฉ + print("์‚ญ์ œ์„ฑ๊ณต"); + setState(() { + }); + + } else { + // ์š”์ฒญ์ด ์‹คํŒจํ•œ ๊ฒฝ์šฐ ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌ + print('HTTP ์š”์ฒญ ์‹คํŒจ: ${response.statusCode}'); + } + } + + int comIndex = 0; // ์‚ญ์ œํ•  ๋Œ“๊ธ€ ์ธ๋ฑ์Šค + + // ๋Œ“๊ธ€ ์‚ญ์ œ ํŒ์—… + void FlutterDialog() { + showDialog( + context: context, + builder: (_) => new AlertDialog( + shape: RoundedRectangleBorder( + borderRadius: + BorderRadius.all( + Radius.circular(12.0))), + content: Builder( + builder: (context) { + + return Container( + height: 298, + width: 412, + child: + Padding(padding: EdgeInsets.all(0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SizedBox(height: 12,), + Container( + width: 125, + height: 117, + child: SvgPicture.asset( + 'assets/images/no_result.svg', + width: 132, + height: 123, + fit: BoxFit.contain, + ), + ), + SizedBox(height: 32,), + Text("๋Œ“๊ธ€์„ ์‚ญ์ œ ํ•˜์‹œ๊ฒ ์–ด์š”?",style: textStyle.bk16bold,), + SizedBox(height: 8,), + Text("์‚ญ์ œํ•œ ํ›„, ๋‚ด์šฉ์ด ๋ณต๊ตฌ๋˜์ง€ ์•Š์•„์š”!", style: textStyle.bk14normal,), + SizedBox(height: 32,), + Row( + children: [ + Container( + height: 40, + width: 120, + child: ElevatedButton( + child: new Text("์ทจ์†Œ", style: textStyle.purple16midium), + style: buttonChart().purplebtn3, + onPressed: () { + Navigator.pop(context); + }, + ), + ), + SizedBox(width: 16,), + Container( + height: 40, + width: 120, + child: ElevatedButton( + child: new Text("์‚ญ์ œํ•˜๊ธฐ", style: textStyle.white16semibold), + style: buttonChart().purplebtn, + onPressed: () { + + // ์„œ๋ฒ„์— ์ „์†ก + deleteComment(sign_in.userAccessToken, comIndex); + setState(() {}); + Timer(Duration(milliseconds: 500), () { + fetchDataComment(); + }); + + Navigator.pop(context); + }, + ), + ), + ], + ) + ], + ),) + ); + }, + ), + ) + ); + } + + + @override + void initState() { + super.initState(); + SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: [SystemUiOverlay.top]); + fetchWithHeaders(sign_in.userAccessToken); + fetchDataLike(sign_in.userAccessToken); + + print("test" + watchmain.selectedPostId.toString()); + fetchDataComment(); + setState(() { + + }); + } + + // ๋Œ“๊ธ€ ์œ„์ ฏ + Widget listview_builder(){ + return ListView.builder( + shrinkWrap: true, + scrollDirection: Axis.vertical, + padding: EdgeInsets.all(0), + physics: NeverScrollableScrollPhysics(), + itemCount: parsedResponseCM.length, + itemBuilder: (BuildContext context, int index){ + return Column( + children: [ + Container( + padding: EdgeInsets.fromLTRB(16, 16, 0, 16), + height: 104, + width: Get.width, + decoration: BoxDecoration( + color: Colors.white, + //borderRadius: BorderRadius.circular(16), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + if(parsedResponseCM[index]['profileImage'].toString() == "null")...[ + CircleAvatar( + radius: 10, + child: SvgPicture.asset('assets/images/user_null2.svg',), + ), + ]else...[ + CircleAvatar( + radius: 10, + backgroundImage: NetworkImage(parsedResponseCM[index]['profileImage'].toString()), + ), + ], + SizedBox(width: 8,), + Container(width: 55, + child: Text(parsedResponseCM[index]['nickname'], style: textStyle.bk12normal,),), + SizedBox(width: 204,), + if(parsedResponseCM[index]['nickname'] == home.user)...[ + Container(width: 78, height: 32, + child: TextButton(onPressed: (){ + comIndex = parsedResponseCM[index]['id']; + setState(() { + }); + FlutterDialog(); + }, child: Row( + children: [ + Text("์‚ญ์ œํ•˜๊ธฐ", style: textStyle.grey12normal,), + SvgPicture.asset('assets/images/memorial/deletecom.svg',), + ], + ) + + ), + ), + + ], + + + ], + ), + SizedBox(height: 6,), + Text(parsedResponseCM[index]['content'], style: textStyle.bk12normal,), + SizedBox(height: 6,), + Text(DateFormat('MM/dd HH:mm').format(DateTime.parse(parsedResponseCM[index]['createdAt'])).toString(), style: TextStyle(fontSize: 10, color: Color(0xffAAAAAA)),) + + //DateFormat('yy/MM/dd - HH:mm:ss').format(parsedResponse[0]['createdAt']) + ], + ), + ), + SizedBox(height: 4,), + ], + ); + + } + ); + } + + double calculateListViewHeight() { + // ๋ฆฌ์ŠคํŠธ๋ทฐ์˜ ์•„์ดํ…œ ์ˆ˜ + int itemCount = parsedResponseCM.length; + + // ๋ฆฌ์ŠคํŠธ๋ทฐ์˜ ์—ด ์ˆ˜ (3๊ฐœ์˜ ์•„์ดํ…œ์ด ํ•œ ํ–‰์— ์žˆ์„ ๋•Œ) + int columnCount = 1; + + // ์•„์ดํ…œ์˜ ๋†’์ด (๊ฐ€๋กœ:์„ธ๋กœ ๋น„์œจ์„ ์„ค์ •ํ•  ์ˆ˜ ์žˆ์Œ) + double itemHeight = 90; // ์ด ๊ฐ’์€ ์ ์ ˆํžˆ ์กฐ์ • + + // ์•„์ดํ…œ ๊ฐ„์˜ ์ˆ˜์ง ๊ฐ„๊ฒฉ + double crossAxisSpacing = 8.0; + + // ๋ฆฌ์ŠคํŠธ๋ทฐ์˜ ๋†’์ด ๊ณ„์‚ฐ + double listHeight = ((itemCount / columnCount).ceil() * itemHeight) + + ((itemCount / columnCount - 1).ceil() * crossAxisSpacing); + + return listHeight; + } + + + @override + Widget build(BuildContext context) { + MediaQueryData deviceData = MediaQuery.of(context); + Size screenSize = deviceData.size; + return Scaffold( + appBar: PreferredSize( + preferredSize: Size.fromHeight(72), + child: AppBar( + leading: + Padding( + padding: EdgeInsets.only(top: 20), + child: IconButton( + icon: Icon(Icons.arrow_back_ios_rounded, color: Colors.black), + onPressed: () => Navigator.of(context).pop(), + ), + ), + backgroundColor: Color(0xffDDE7FD), + elevation: 0.0, + title: + Container( + height: 50, + width: screenSize.width, + child: Column( + children: [ + SizedBox(height: 24,), + Center( + child: Padding( + padding: EdgeInsets.only(right: 60), + child: Text( + 'ํ•จ๊ป˜ํ• ๊ฐœ', + style: textStyle.bk20normal, + ), + )), + ], + )), + iconTheme: IconThemeData(color: Colors.black), + ), + ), + body: Container( + color: Color(0xffDDE7FD), + width: Get.width, + height: Get.height, + child: SingleChildScrollView( + padding: EdgeInsets.fromLTRB(0, 0, 0, 0), + scrollDirection: Axis.vertical, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + if(fetchSuccess)...[ + ClipRRect( + borderRadius: BorderRadius.only(topLeft: Radius.circular(16.0), topRight: Radius.circular(16.0)), + child: Container( + width: Get.width, + //height: 578, + color: Colors.white, + child: + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding(padding: EdgeInsets.all(16), + child: Column( + children: [ + Container( + width: Get.width, + height: Get.width - 32, + child: Stack( + children: [ + Container( + width: Get.width, + height: Get.width - 32, + child: + ClipRRect( + borderRadius: BorderRadius.circular(16.0), + child: + ImageSlideshow( + indicatorColor: Color(0xffFEFBAC), + onPageChanged: (value) { + debugPrint('Page changed: $value'); + }, + //autoPlayInterval: 3000, + isLoop: false, + children: [ + for(int i= 0; i OthersMemorialMainPage())); + }, + child: Padding( + padding: EdgeInsets.only(left: 10, top: 10), + child: Container( + decoration: BoxDecoration( + color: Colors.black.withOpacity(0.2), + borderRadius: BorderRadius.circular(32), + ), + // color: Colors.white.withOpacity(0.7), + width: 90, + height: 32, + child: Row( + children: [ + SizedBox(width: 6,), + if(watchmain.selectedOthersProfileImage.toString() == "null")...[ + CircleAvatar( + backgroundColor: Colors.white, + radius: 10, + child: CircleAvatar( + child: SvgPicture.asset('assets/images/user_null2.svg',), + radius: 9, + ), + ), + ]else...[ + CircleAvatar( + backgroundColor: Colors.white, + radius: 10, + child: CircleAvatar( + radius: 9, + backgroundImage: NetworkImage(watchmain.selectedOthersProfileImage.toString()), + ), + ), + ], + // CircleAvatar( + // backgroundColor: Colors.white, + // radius: 10, + // child: CircleAvatar( + // radius: 9, + // backgroundImage: NetworkImage(watchmain.selectedOthersProfileImage.toString(),), + // ), + // ), + + SizedBox(width: 5,), + Container( + width: 37, + child:Text(watchmain.selectedOthersNickaname, + overflow: TextOverflow.ellipsis, // "..."์œผ๋กœ ํ‘œ์‹œ + maxLines: 1, // ์›ํ•˜๋Š” ์ค„ ์ˆ˜๋กœ ์„ค์ • + style: TextStyle(color: Colors.white, fontSize: 14, fontFamily: 'Pretendard',fontWeight: FontWeight.w600,),), + ), + SizedBox(width: 5,), + Container( + width: 11, + child: + Icon(Icons.arrow_forward_ios_rounded, color: Colors.white,size: 12,), + // SvgPicture.asset( + // 'assets/images/memorial/blue_arrow.svg', + // //fit: BoxFit.cover, + // ), + ) + ], + ), + ), + ), + ) + ], + ), + ), + SizedBox(height: 15,), + Row( + children: [ + Container( + width: 120, + height: 32, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text("${parsedResponseCN['date']}์˜ ๊ธฐ์–ต", style: textStyle.grey12normal,), + SizedBox(height: 4,), + Text(parsedResponseCN['place'], style: textStyle.grey12normal) + ], + ), + ), + SizedBox(width: 150,), + Row( + children: [ + Container( + width: 19, + height: 19, + child: InkWell( + onTap: (){}, + child: SvgPicture.asset( + 'assets/images/memorial/comments.svg', + ), + ),), + SizedBox( width: 3,), + Text('${comments}'), + SizedBox( width: 10,), + if(hearts >= 1)...[ + Container( + // width: 22, + // height: 22, + child: InkWell( + onTap: (){ + // ์ข‹์•„์š” ๋ˆ„๋ฅด๊ธฐ + sendPostRequest(sign_in.userAccessToken); + // fetchDataLike(sign_in.userAccessToken); + hearts--; + setState(() { + }); + }, + child: SvgPicture.asset( + 'assets/images/memorial/heart-fill.svg', + ), + ),), + ] else...[ + SizedBox(width: 2,), + Container( + // width: 22, + // height: 22, + child: InkWell( + onTap: (){ + // ์ข‹์•„์š” ๋ˆ„๋ฅด๊ธฐ + sendPostRequest(sign_in.userAccessToken); + // fetchDataLike(sign_in.userAccessToken); + hearts++; + setState(() { + }); + }, + child: SvgPicture.asset( + 'assets/images/memorial/heart-empty.svg', + ), + ), + ), + ], + SizedBox( width: 3,), + Text('${hearts}'), + ], + ) + + ], + ), + SizedBox(height: 15,), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text(parsedResponseCN['title'],style: textStyle.bk16semibold,), + SizedBox(height: 8,), + Container(width: Get.width, + //height: 50, + child: Text(parsedResponseCN['content'], style: textStyle.bk14normal,), + ), + SizedBox(height: 8,), + Container(width: Get.width, + height: 12, + child: Text('#${parsedResponseCN['hashtag']}', style: textStyle.grey12normal), + ), + SizedBox(height: 5,), + ], + ), + ], + ),), + + ], + ), + + ), + ), + + SizedBox(height: 4,), + Container( + width: Get.width, + height: calculateListViewHeight() + 86, + child: Column( + children: [ + Expanded( + child: Column( + children: [ + listview_builder(), + ], + ) + ), + ], + ) + ), + + ], + + ], + ), + ), + ), + bottomSheet: Padding( + padding: EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom * 0.001), + child: Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.end, + children:[ + Container( + color:Color(0xffF2F4F6), + height: 48, + child: Padding( + padding: const EdgeInsets.only(bottom: 8.0, top: 8.0, left: 16,right: 16), + child: Stack( + children: [ + Container( + width: Get.width, + height: 48, + decoration: BoxDecoration( + color: Colors.white, + border: Border.all(color: Color(colorChart.blue)), + borderRadius: BorderRadius.circular(30), + ), + ), + Positioned( + left: 15, + right: 30, + bottom:-4, + child: TextField( + textAlignVertical: TextAlignVertical.center, + maxLines: 1, + controller: myController, + style: textStyle.bk14normal, + decoration: InputDecoration( + hintStyle: textStyle.grey14normal, + border: InputBorder.none, hintText: '๋Œ“๊ธ€์„ ์ž…๋ ฅํ•˜๋ ค๋ฉด ์—ฌ๊ธฐ๋ฅผ ํƒญํ•˜์„ธ์š”.'), + onChanged: (s) { + //text = s; + addComment = true; + setState(() { + + }); + }, + onTap: (){ + + }, + ), + ), + Positioned( + left: Get.width - 81, + //right: 30, + bottom: 3, + top: 3, + child: ElevatedButton( + onPressed: () { + if(addComment){ + saveComment(sign_in.userAccessToken, myController.text); + } + addComment = false; + setState(() { + }); + + myController.clear(); + Timer(Duration(milliseconds: 500), () { + fetchDataComment(); + }); + }, + style: ElevatedButton.styleFrom( + backgroundColor: addComment?Color(colorChart.blue):Color(0xffDDE7FD), + fixedSize: const Size(23, 23), + shape: const CircleBorder(), + ), + child:Icon(Icons.arrow_upward, color: Colors.white,size: 16,) + ), + ), + ], + ), + ), + ), + ], + ), + ) + ); + } +} \ No newline at end of file diff --git a/client/lib/memorial/write_memorial.dart b/client/lib/memorial/write_memorial.dart new file mode 100644 index 0000000..df744d2 --- /dev/null +++ b/client/lib/memorial/write_memorial.dart @@ -0,0 +1,1051 @@ +import 'dart:async'; +import 'dart:io'; +import 'package:flutter/material.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter_svg/svg.dart'; +//import 'package:get/get.dart'; +import 'package:image_picker/image_picker.dart'; +import 'package:client/screen.dart'; +import 'package:client/style.dart'; +import 'package:intl/intl.dart'; +import 'dart:convert'; +import 'package:flutter/services.dart'; +import 'package:exif/exif.dart'; +import 'package:http/http.dart' as http; +import 'package:http_parser/http_parser.dart'; +import 'package:dio/dio.dart'; +import 'package:http_parser/http_parser.dart'; +import 'package:client/sign/sign_in.dart' as sign_in; + +/// ์ถ”์–ต ์ž‘์„ฑํ•˜๊ธฐ +class WriteMemorialPage extends StatefulWidget { + static Future navigatorPush(BuildContext context) async { + return Navigator.push( + context, + MaterialPageRoute( + builder: (_) => WriteMemorialPage(), + ), + ); + } + + @override + _WriteMemorialPageState createState() => _WriteMemorialPageState(); +} + +class _WriteMemorialPageState extends State { + + String _imageDate = "์‚ฌ์ง„์„ ์ถ”๊ฐ€ํ•ด์ฃผ์„ธ์š”."; + + // ํ…์ŠคํŠธ์—๋””ํŒ…์ปจํŠธ๋กค๋Ÿฌ๋ฅผ ์ƒ์„ฑํ•˜์—ฌ ํ•„๋“œ์— ํ• ๋‹น + final titleController = TextEditingController(); + final dateController = TextEditingController(); + final locationController = TextEditingController(); + final contentController = TextEditingController(); + final hashtagController = TextEditingController(); + + // ๋‚ ์งœ๋ฅผ ์ง์ ‘ ์กฐ์ •์ธ์ง€ ํ™•์ธ + bool modiDate = false; + + // ๊ณต๊ฐœ ๋น„๊ณต๊ฐœ: ์ฒ˜์Œ์—๋Š” ๊ณต๊ฐœ๋กœ ์„ค์ •๋˜์–ด ์žˆ์Œ + String isPrivate = "False"; + bool private = false; + + bool setTitle = false; + bool setContent = false; + bool setPlace = false; + bool setHashTag = false; + + bool isPicSelected = false; // ์‚ฌ์ง„์ด ๋“ค์–ด๊ฐ€๋Š”์ง€ ํ™•์ธํ•˜๋Š” ์ฝ”๋“œ -> UI ๋ฐ”๋€œ + final ImagePicker _picker = ImagePicker(); + final List _pickedImages = []; + + // ์ด๋ฏธ์ง€ ์—ฌ๋Ÿฌ๊ฐœ ๋ถˆ๋Ÿฌ์˜ค๊ธฐ + void getMultiImage() async { + final List? images = await _picker.pickMultiImage(); + + if (images != null) { + setState(() async { + print("check it"); + //_picker.pickMultiImage().printInfo(); + _pickedImages.addAll(images); + print("??: "+ images[0].path); + + // /(?20(?:0|1|2)\d{1})(?:-|\.|_)?(?\d{2})(?:-|\.|_)?(?\d{2})(?:-|_|\.|\s)?(?\d{2})(?:-|\.|_)?(?\d{2})(?:-|\.|_)?(?\d{2})/ + final dateMatch = RegExp(r'(\d{4})(\d{2})(\d{2})').firstMatch(images[0].path); + + if (dateMatch != null) { + final year = dateMatch.group(1); + final month = dateMatch.group(2); + final day = dateMatch.group(3); + + setState(() { + _imageDate = '$year-$month-$day'; + + print("ํ™•์ธ ๋ถ€ํƒ" + _imageDate.toString()); + }); + } + + isPicSelected = true; + setState(() { + + }); + + }); + } + } + + Future uploadImagesAndData2(String aToken, List images, String title, String date, String place, String content, String hashtag, String isPrivate) async { + print('test'); + try { + var dio = Dio(); // Dio ์ธ์Šคํ„ด์Šค ์ƒ์„ฑ + + // JSON ๋ฐ์ดํ„ฐ ์ถ”๊ฐ€ + final jsonData = { + "title": title, + "date":date, + "place": place, + "content": content, + "hashtag": hashtag, + "isPrivate": isPrivate + }; + + // JSON ๋ฐ์ดํ„ฐ๋ฅผ ๋ฌธ์ž์—ด๋กœ ์ธ์ฝ”๋”ฉ + final jsonString = jsonEncode(jsonData); + + final List _files2 = images + .map((img) => MultipartFile.fromFileSync(img.path, + contentType: MediaType("image", "jpeg"))) + .toList(); + + //final List _files = images.map((img) => MultipartFile.fromFileSync(img!.path, contentType: new MediaType("image", "jpg"))).toList(); + + //print('Content-Type: ${_files.contentType}'); + + + final data = FormData.fromMap({ + "image": _files2, + "json": await MultipartFile.fromString( + jsonString, + contentType: MediaType.parse('application/json'), + ), + }, + ); + + + //dio.options.contentType = 'multipart/form-data'; + + // http://3.38.1.125:8080/memorial + // POST ์š”์ฒญ ๋ณด๋‚ด๊ธฐ + var response = await dio.post( + 'http://3.38.1.125:8080/memorial', // ์„œ๋ฒ„ ์—”๋“œํฌ์ธํŠธ ๊ฒฝ๋กœ ์„ค์ • + data: data, + options: Options( + method: 'POST', + headers: { + 'Content-Type': 'multipart/form-data', // Content-Type ์„ค์ • + 'Authorization': 'Bearer $aToken', + }, + //responseType: ResponseType.plain + ), + ); + + // ์‘๋‹ต ์ฒ˜๋ฆฌ + if (response.statusCode == 200) { + print('์ด๋ฏธ์ง€ ์—…๋กœ๋“œ ์„ฑ๊ณต'); + // ์‘๋‹ต ๋ฐ์ดํ„ฐ ์ฝ๊ธฐ + final responseJson = json.decode(response.data); + print('์„œ๋ฒ„ ์‘๋‹ต ๋ฐ์ดํ„ฐ: $responseJson'); + } else { + print('์ด๋ฏธ์ง€ ์—…๋กœ๋“œ ์‹คํŒจ. HTTP ์—๋Ÿฌ ์ฝ”๋“œ: ${response.statusCode}'); + } + } catch (e) { + if (e is DioError) { + if (e.response != null) { + print('์„œ๋ฒ„ ์‘๋‹ต ์—๋Ÿฌ ๋ฐ์ดํ„ฐ: ${e.response?.data}'); + } else { + print('Dio ์—๋Ÿฌ: ${e.message}'); + } + } else { + print('์—๋Ÿฌ ๋ฐœ์ƒ: $e'); + } + } + } + + + @override + void initState() { + super.initState(); + + } + + @override + void dispose() async { + super.dispose(); + } + + @override + Widget build(BuildContext context) { + MediaQueryData deviceData = MediaQuery.of(context); + Size screenSize = deviceData.size; + return + Container( + child: Scaffold( + backgroundColor: Color(0xffF2F4F6), + appBar: PreferredSize( + preferredSize: Size.fromHeight(72), + child: AppBar( + actions: [ + Padding( + padding: EdgeInsets.only(top:20, right: 15), + child: Row( + children: [ + SizedBox( + width: 8, + ), + InkWell( + onTap: () { + // ์—ฌ๊ธฐ์— db๋กœ image path๋„ ๋ณด๋‚ด๊ธฐ + //uploadImages(_pickedImages); + print("test: " + _pickedImages.toString()); + //List images, String title, String place, String content, String hashtag, String isPrivate + if(setContent && setHashTag && setPlace && setTitle){ + uploadImagesAndData2( + sign_in.userAccessToken, + _pickedImages, + titleController.text.toString(), + _imageDate, + locationController.text.toString(), + contentController.text.toString(), + hashtagController.text.toString(), + isPrivate); + Navigator.pop(this.context); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => MyScreenPage(title: 'ํ™ˆํŽ˜์ด์ง€ ์ด๋™'))); + } + }, + child: SvgPicture.asset( + 'assets/images/memorial/upload_button.svg', + ), + ), + ], + ), + ) + ], + // actions: [ + // new IconButton( + // icon: Container( + // child: SvgPicture.asset( + // 'assets/images/memorial/upload_button.svg', + // ),), + // onPressed: (){ + // // ์—ฌ๊ธฐ์— db๋กœ image path๋„ ๋ณด๋‚ด๊ธฐ + // //uploadImages(_pickedImages); + // print("test: "+_pickedImages.toString()); + // //List images, String title, String place, String content, String hashtag, String isPrivate + // uploadImagesAndData2(sign_in.userAccessToken, _pickedImages,titleController.text.toString(),_imageDate,locationController.text.toString(), + // contentController.text.toString(), hashtagController.text.toString(), isPrivate); + // Navigator.pop(this.context); + // }, + // ), + // ], + title: Container( + height: 50, + width: screenSize.width, + child: Column( + children: [ + SizedBox( + height: 24, + ), + Center( + child: Padding( + padding: EdgeInsets.only(right: 0), + child: Text( + '๊ธฐ์–ต ๋‚จ๊ธฐ๊ธฐ', + style: textStyle.bk20normal, + ), + )), + ], + )), + + backgroundColor: Colors.transparent, + elevation: 0.0, + iconTheme: IconThemeData(color: Colors.black), + centerTitle: true, + leading: Padding( + padding: EdgeInsets.only(top: 20), + child: IconButton( + icon: + Icon(Icons.arrow_back_ios_rounded, color: Colors.black), + onPressed: () => Navigator.of(context).pop(), + ), + ), + ), + ), + body: Container( + // width: screenSize.width, + // height: screenSize.height, + child: SingleChildScrollView( + padding: EdgeInsets.fromLTRB(16, 16, 16, 16), + //scrollDirection: Axis.vertical, + child: + Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Container( + padding: EdgeInsets.all(16), + width: screenSize.width, + height: screenSize.width - 28, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(16), + ), + child: GridView.builder( + itemCount:9, + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 3, //1 ๊ฐœ์˜ ํ–‰์— ๋ณด์—ฌ์ค„ item ๊ฐœ์ˆ˜ + childAspectRatio: 1 / 1, //item ์˜ ๊ฐ€๋กœ 1, ์„ธ๋กœ 1 ์˜ ๋น„์œจ + mainAxisSpacing: 16, //์ˆ˜ํ‰ Padding + crossAxisSpacing: 16, //์ˆ˜์ง Padding + ), + itemBuilder: (BuildContext context, int index){ + return + Stack( + children: [ + SvgPicture.asset( + 'assets/images/memorial/memorial_img.svg', + width: 128, + height: 128, + ), + if(isPicSelected && index == 0 && _pickedImages.length >= 1)...[ + Container( + width: 128, + height: 128, + child: + ClipRRect( + borderRadius: BorderRadius.circular(16.0), + child: Image.file(File(_pickedImages![index]!.path), fit: BoxFit.cover,), + ), + ), + Row( + children: [ + SizedBox(width: 72,), + Container( + width: 24, + height: 24, + child:InkWell( + child: SvgPicture.asset( + 'assets/images/memorial/delete_bt.svg', + ), + onTap: (){ + _pickedImages.removeAt(index); + setState(() {}); + print("remove"); + }, + ) + ), + ], + ), + + ], + if(isPicSelected && index == 1 && _pickedImages.length >= 2)...[ + Container( + width: 128, + height: 128, + child: + ClipRRect( + borderRadius: BorderRadius.circular(16.0), + child: Image.file(File(_pickedImages![index]!.path), fit: BoxFit.cover,), + ), + ), + Row( + children: [ + SizedBox(width: 72,), + Container( + width: 24, + height: 24, + child:InkWell( + child: SvgPicture.asset( + 'assets/images/memorial/delete_bt.svg', + ), + onTap: (){ + _pickedImages.removeAt(index); + setState(() {}); + print("remove"); + }, + ) + ), + ], + ), + ], + if(isPicSelected && index == 2 && _pickedImages.length >= 3)...[ + Container( + width: 128, + height: 128, + child: + ClipRRect( + borderRadius: BorderRadius.circular(16.0), + child: Image.file(File(_pickedImages![index]!.path), fit: BoxFit.cover,), + ), + ), + Row( + children: [ + SizedBox(width: 72,), + Container( + width: 24, + height: 24, + child:InkWell( + child: SvgPicture.asset( + 'assets/images/memorial/delete_bt.svg', + ), + onTap: (){ + _pickedImages.removeAt(index); + setState(() {}); + print("remove"); + }, + ) + ), + ], + ), + ], + if(isPicSelected && index == 3 && _pickedImages.length >= 4)...[ + Container( + width: 128, + height: 128, + child: + ClipRRect( + borderRadius: BorderRadius.circular(16.0), + child: Image.file(File(_pickedImages![index]!.path), fit: BoxFit.cover,), + ), + ), + Row( + children: [ + SizedBox(width: 72,), + Container( + width: 24, + height: 24, + child:InkWell( + child: SvgPicture.asset( + 'assets/images/memorial/delete_bt.svg', + ), + onTap: (){ + _pickedImages.removeAt(index); + setState(() {}); + print("remove"); + }, + ) + ), + ], + ), + ], + if(isPicSelected && index == 4 && _pickedImages.length >= 5)...[ + Container( + width: 128, + height: 128, + child: + ClipRRect( + borderRadius: BorderRadius.circular(16.0), + child: Image.file(File(_pickedImages![index]!.path), fit: BoxFit.cover,), + ), + ), + Row( + children: [ + SizedBox(width: 72,), + Container( + width: 24, + height: 24, + child:InkWell( + child: SvgPicture.asset( + 'assets/images/memorial/delete_bt.svg', + ), + onTap: (){ + _pickedImages.removeAt(index); + setState(() {}); + print("remove"); + }, + ) + ), + ], + ), + ], + if(isPicSelected && index == 5 && _pickedImages.length >= 6)...[ + Container( + width: 128, + height: 128, + child: + ClipRRect( + borderRadius: BorderRadius.circular(16.0), + child: Image.file(File(_pickedImages![index]!.path), fit: BoxFit.cover,), + ), + ), + Row( + children: [ + SizedBox(width: 72,), + Container( + width: 24, + height: 24, + child:InkWell( + child: SvgPicture.asset( + 'assets/images/memorial/delete_bt.svg', + ), + onTap: (){ + _pickedImages.removeAt(index); + setState(() {}); + print("remove"); + }, + ) + ), + ], + ), + ], + if(isPicSelected && index == 6 && _pickedImages.length >= 7)...[ + Container( + width: 128, + height: 128, + child: + ClipRRect( + borderRadius: BorderRadius.circular(16.0), + child: Image.file(File(_pickedImages![index]!.path), fit: BoxFit.cover,), + ), + ), + Row( + children: [ + SizedBox(width: 72,), + Container( + width: 24, + height: 24, + child:InkWell( + child: SvgPicture.asset( + 'assets/images/memorial/delete_bt.svg', + ), + onTap: (){ + _pickedImages.removeAt(index); + setState(() {}); + print("remove"); + }, + ) + ), + ], + ), + ], + if(isPicSelected && index == 7 && _pickedImages.length >= 8)...[ + Container( + width: 128, + height: 128, + child: + ClipRRect( + borderRadius: BorderRadius.circular(16.0), + child: Image.file(File(_pickedImages![index]!.path), fit: BoxFit.cover,), + ), + ), + Row( + children: [ + SizedBox(width: 72,), + Container( + width: 24, + height: 24, + child:InkWell( + child: SvgPicture.asset( + 'assets/images/memorial/delete_bt.svg', + ), + onTap: (){ + _pickedImages.removeAt(index); + setState(() {}); + print("remove"); + }, + ) + ), + ], + ), + ], + if(isPicSelected && index == 8 && _pickedImages.length >= 9)...[ + Container( + width: 128, + height: 128, + child: + ClipRRect( + borderRadius: BorderRadius.circular(16.0), + child: Image.file(File(_pickedImages![index]!.path), fit: BoxFit.cover,), + ), + ), + Row( + children: [ + SizedBox(width: 72,), + Container( + width: 24, + height: 24, + child:InkWell( + child: SvgPicture.asset( + 'assets/images/memorial/delete_bt.svg', + ), + onTap: (){ + _pickedImages.removeAt(index); + setState(() {}); + print("remove"); + }, + ) + ), + ], + ), + ], + // Row( + // children: [ + // SizedBox(width: 70,), + // Container( + // width: 20, + // height: 20, + // child: IconButton( + // onPressed: (){ + // _pickedImages.removeAt(index); + // setState(() {}); + // print("remove"); + // }, icon: Icon(Icons.cancel, color: Colors.black,)), + // ), + // ],), + if(index == 0 && _pickedImages.length >= 1)...[ + Padding(padding: EdgeInsets.only(top: 70, left: 5), + child: SvgPicture.asset( + 'assets/images/memorial/image_rep.svg', + ), + ), + ], + + if(index == 8 && _pickedImages.length < 9)...[ + Center( + child: IconButton( + onPressed: (){ + getMultiImage(); + }, + icon: Image.asset('assets/images/memorial/memorial_upload.png'), + )) + ], + + ], + ); + + }), + ), + + // if(isPicSelected == false || _pickedImages.length <1)...[ + // Container( + // width: screenSize.width, + // height: 328, + // child: Stack( + // children: [ + // Container( + // width: screenSize.width, + // height: 328, + // decoration: BoxDecoration( + // color: Colors.white, + // borderRadius: BorderRadius.circular(16), + // ), + // //color: Colors.white, + // ), + // Align( + // alignment: Alignment.center, + // child: InkWell( + // onTap: (){ + // getMultiImage(); + // //selectImages(); + // }, + // child: Container( + // width: 60, + // height: 60, + // decoration: BoxDecoration( + // image: DecorationImage( + // image: AssetImage('assets/images/memorial/memorial_upload.png') + // ), + // borderRadius: BorderRadius.circular(8), + // ), + // ), + // ), + // ), + // Column(children: [ + // SizedBox(height: 220,), + // Align(alignment: Alignment.center, + // child:Text( + // "๊ฐค๋Ÿฌ๋ฆฌ์—์„œ ์ตœ๋Œ€ 9์žฅ์˜ ์‚ฌ์ง„์„ ์„ ํƒํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.\n์‚ฌ์ง„์„ ์„ ํƒํ•˜๋ ค๋ฉด ์ด๊ณณ์„ ํƒญํ•˜์„ธ์š”.", + // textAlign: TextAlign.center, + // style: TextStyle( + // color: Color(0xff99A8CB), + // fontSize: 14, + // ), + // ), + // ), + // ],), + // ], + // ), + // ), + // ] else if(isPicSelected)...[ + // Container( + // padding: EdgeInsets.fromLTRB(15, 15, 15, 15), + // width: screenSize.width, + // height: screenSize.width, + // decoration: BoxDecoration( + // color: Colors.white, + // borderRadius: BorderRadius.circular(16), + // ), + // child: GridView.builder( + // itemCount:_pickedImages.length, + // gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + // crossAxisCount: 3, //1 ๊ฐœ์˜ ํ–‰์— ๋ณด์—ฌ์ค„ item ๊ฐœ์ˆ˜ + // childAspectRatio: 1 / 1, //item ์˜ ๊ฐ€๋กœ 1, ์„ธ๋กœ 1 ์˜ ๋น„์œจ + // mainAxisSpacing: 15, //์ˆ˜ํ‰ Padding + // crossAxisSpacing: 15, //์ˆ˜์ง Padding + // ), + // itemBuilder: (BuildContext context, int index){ + // return + // Stack( + // children: [ + // Container( + // width: 128, + // height: 128, + // child: + // ClipRRect( + // borderRadius: BorderRadius.circular(16.0), + // child: Image.file(File(_pickedImages![index]!.path), fit: BoxFit.cover,), + // ), + // ), + // Row( + // children: [ + // SizedBox(width: 70,), + // Container( + // width: 20, + // height: 20, + // child: IconButton( + // onPressed: (){ + // _pickedImages.removeAt(index); + // setState(() {}); + // print("remove"); + // }, icon: Icon(Icons.cancel, color: Colors.black,)), + // ), + // ],), + // if(index == 0)...[ + // Padding(padding: EdgeInsets.only(top: 85, left: 5), + // child: SvgPicture.asset( + // 'assets/images/memorial/image_rep.svg', + // ), + // ), + // ] + // + // ], + // ); + // + // }) + // ), + // SizedBox(height: 15,), + // ElevatedButton(onPressed: (){ + // getMultiImage(); + // }, + // style: buttonChart().bluebtn, + // child: Row(children: [ + // SizedBox(width: 115,), + // Image.asset('assets/images/memorial/upload_icon.png'), + // SizedBox(width: 10,), + // Text('์‚ฌ์ง„ ๋” ์ถ”๊ฐ€ํ•˜๊ธฐ', style: textStyle.white16normal,) + // ],) + // ) + // ], + SizedBox( + height: 8, + ), + Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(16), + ), + child: Column( + children: [ + Container( + alignment: Alignment.topLeft, + child: Padding(padding: EdgeInsets.only(top:16, left: 16, right:16), + child: Text("์ œ๋ชฉ",style: textStyle.bk14midium,), + ), + ), + Padding(padding: EdgeInsets.only(top:0,left: 20, right:20), + child: TextField( + controller: titleController, + onChanged: (text){ + setTitle = true; + }, + decoration: InputDecoration( + contentPadding: EdgeInsets.only(top:3, left: 0), + hintStyle: textStyle.grey16normal, + border: InputBorder.none, + focusedBorder: InputBorder.none, + hintText: '์ œ๋ชฉ์„ ์ž…๋ ฅํ•˜์„ธ์š”.'),), + ), + ], + ), + ), + SizedBox( + height: 8, + ), + + Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(16), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + alignment: Alignment.topLeft, + child: Padding(padding: EdgeInsets.only(top:16,left: 16, right:16), + child: Text("๋‚ ์งœ", style: textStyle.bk14midium,), + ), + ), + SizedBox(height: 8,), + Padding(padding: EdgeInsets.only(top:0, left: 16, right:16, bottom: 8), + child: + Row(children: [ + Container( + width: 225, + child: modiDate? + Container( + height: 20, + child: TextField( + controller: dateController, + decoration: InputDecoration( + contentPadding: EdgeInsets.only(bottom:13), + hintStyle: textStyle.grey16normal, + border: InputBorder.none, + focusedBorder: InputBorder.none, + hintText: '2023-10-28'), + onTap: (){ + + }, + ),) + + : Text( "${_imageDate}", style: textStyle.bk16normal,), + ), + if(modiDate == false)...[ + SizedBox(width: 30,), + Container( + height: 24, + width: 62, + child: ElevatedButton( + onPressed: (){ + modiDate = true; + setState(() { + }); + }, + style: buttonChart().pinkbtn2, + child: Text("์ˆ˜์ •", style: textStyle.white16midium,) + ),) + ]else...[ + SizedBox(width: 30,), + Container( + height: 24, + width: 62, + child: ElevatedButton( + onPressed: (){ + modiDate = false; + _imageDate = dateController.text; + setState(() { + }); + }, + style: buttonChart().bluebtn, + child: Text("์™„๋ฃŒ", style: textStyle.white16midium,) + ),) + ] + + + ],), + ), + SizedBox(height: 6,), + ], + ), + ), + SizedBox( + height: 8, + ), + + Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(16), + ), + child: Column( + children: [ + Container( + alignment: Alignment.topLeft, + child: Padding(padding: EdgeInsets.only(top:16,left: 16, right:16), + child: Text("์œ„์น˜",style: textStyle.bk14midium,), + ), + ), + Padding(padding: EdgeInsets.only(top:0,left: 16, right:16), + child: + Row(children: [ + Container(width: 255, + child: TextField( + controller: locationController, + onChanged: (text){ + setPlace = true; + }, + decoration: InputDecoration( + contentPadding: EdgeInsets.only(top:3, left: 0), + hintStyle: textStyle.grey16normal, + border: InputBorder.none, + focusedBorder: InputBorder.none, + hintText: '์œ„์น˜๋ฅผ ์ ๊ฑฐ๋‚˜ ์ž…๋ ฅํ•ด์ฃผ์„ธ์š”.'),), + ), + // Container( + // height: 25, + // width: 57, + // child: ElevatedButton( + // onPressed: (){ + // }, + // style: buttonChart().pinkbtn2, + // child: Text("๊ฒ€์ƒ‰", style: textStyle.white16midium,) + // ),) + ],), + + ), + ], + ), + ), + SizedBox( + height: 8, + ), + + Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(16), + ), + child: Column( + children: [ + Container( + alignment: Alignment.topLeft, + child: Padding(padding: EdgeInsets.only(top:16,left: 16, right:16), + child: Text("๋‚ด์šฉ", style: textStyle.bk14midium,), + ), + ), + Padding( + padding: + EdgeInsets.only(top: 0, left: 16, right: 16, bottom: 16), + child: TextField( + controller: contentController, + onChanged: (text){ + setContent = true; + }, + decoration: InputDecoration( + contentPadding: EdgeInsets.only(top:3, left:0), + hintStyle: textStyle.grey16normal, + border: InputBorder.none, + focusedBorder: InputBorder.none, + hintText: '๊ทธ๋‚ ์˜ ์ด์•ผ๊ธฐ๋ฅผ ์ ์–ด์ฃผ์„ธ์š”.'), + maxLines: null, + ), + ), + ], + ), + ), + + SizedBox( + height: 8, + ), + + Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(16), + ), + child: Column( + children: [ + Container( + alignment: Alignment.topLeft, + child: Padding(padding: EdgeInsets.only(top:16,left: 16, right:16), + child: Text("ํ•ด์‹œํƒœ๊ทธ", style: textStyle.bk14midium,), + ), + ), + Padding( + padding: EdgeInsets.only(top:0,left: 16, right:16), + child: TextField( + controller: hashtagController, + onChanged: (text){ + setHashTag = true; + }, + decoration: InputDecoration( + contentPadding: EdgeInsets.only(top:3, left: 0), + hintStyle: textStyle.grey16normal, + border: InputBorder.none, + focusedBorder: InputBorder.none, + hintText: '#ํ•ด์‹œํƒœ๊ทธ๋ฅผ ์‚ฌ์šฉํ•ด๋ณด์„ธ์š”.'),), + ), + ], + ), + ), + SizedBox(height: 8,), + + Container( + padding: EdgeInsets.all(16), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(16), + ), + child: Column( + children: [ + Container( + alignment: Alignment.topLeft, + child: Padding(padding: EdgeInsets.only(top:0), + child: Text("๊ณต๊ฐœ ์„ค์ •",style: textStyle.bk14midium), + ), + ), + SizedBox(height: 8,), + Container( + alignment: Alignment.topLeft, + child: Padding(padding: EdgeInsets.only(top:8), + child: Text("์ด ๋ฉ”๋ชจ๋ฆฌ์–ผ์„ ๊ณต๊ฐœํ•˜๋ฉด ๋‹ค๋ฅธ ๋ฐ˜๋ ค์ธ๋“ค์˜ '๊ตฌ๊ฒฝํ•˜๊ธฐ'ํŽ˜์ด์ง€์— ๊ณต์œ ๋ฉ๋‹ˆ๋‹ค.",style: TextStyle(fontSize: 11, color: Color(0xff555555)),), + ), + ), + SizedBox(height: 16,), + Row( + children: [ + //SizedBox(width: 20,), + Container( + height: 26, + width: 100, + child: ElevatedButton(onPressed: (){ + isPrivate = "False"; + private = false; + setState(() { + }); + }, + style: private? buttonChart().bluebtn4 : buttonChart().bluebtn2, + child: Text("๊ณต๊ฐœ", style: private? textStyle.bk14light :textStyle.bk14midium,) + ), + ), + SizedBox(width: 8,), + Container( + height: 26, + width: 100, + child: ElevatedButton(onPressed: (){ + isPrivate = "True"; + private = true; + setState(() { + }); + }, + style: private? buttonChart().bluebtn2 : buttonChart().bluebtn4, + child: Text("๋น„๊ณต๊ฐœ", style: private? textStyle.bk14midium :textStyle.bk14light,) + ), + ), + ], + ) + ], + ) + ), + + ], + ), + ), + ) + + ) + ); + + } +} diff --git a/client/lib/mypage/account_manage_main.dart b/client/lib/mypage/account_manage_main.dart new file mode 100644 index 0000000..85e7a71 --- /dev/null +++ b/client/lib/mypage/account_manage_main.dart @@ -0,0 +1,341 @@ +import 'dart:async'; +import 'dart:io'; +import 'package:firebase_core/firebase_core.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter_svg/svg.dart'; +//import 'package:get/get.dart'; +import 'package:image_picker/image_picker.dart'; +import 'package:client/mypage/delete_account.dart'; +import 'package:client/sign/password_reset.dart'; +import 'package:client/style.dart'; +import 'package:intl/intl.dart'; +import 'dart:convert'; +import 'package:flutter/services.dart'; +import 'package:exif/exif.dart'; +import 'package:http/http.dart' as http; +import 'package:http_parser/http_parser.dart'; +import 'package:dio/dio.dart'; +import 'package:http_parser/http_parser.dart'; +import 'package:client/sign/sign_in.dart' as sign_in; +import 'package:firebase_auth/firebase_auth.dart'; + +/// ๊ณ„์ • ๊ด€๋ฆฌ +class AccountManageMainPage extends StatefulWidget { + static Future navigatorPush(BuildContext context) async { + return Navigator.push( + context, + MaterialPageRoute( + builder: (_) => AccountManageMainPage(), + ), + ); + } + + @override + _AccountManageMainPageState createState() => _AccountManageMainPageState(); +} + +class _AccountManageMainPageState extends State { + + late Map parsedResponseUser; // ์‚ฌ์šฉ์ž ์ •๋ณด + bool takeUser = false; + + // ์‚ฌ์šฉ์ž ์ •๋ณด ์กฐํšŒ + void fetchUserInfo(String aToken) async { + // API ์—”๋“œํฌ์ธํŠธ URL + print("๋ฐ›ํ† :" + aToken); + String apiUrl = 'http://3.38.1.125:8080/user/info'; // ์‹ค์ œ API ์—”๋“œํฌ์ธํŠธ๋กœ ๋ณ€๊ฒฝํ•˜์„ธ์š” + + // ํ—ค๋” ์ •๋ณด ์„ค์ • + Map headers = { + 'Authorization': 'Bearer $aToken', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• + 'Content-Type': 'application/json', // ์˜ˆ: JSON ์š”์ฒญ์ธ ๊ฒฝ์šฐ ํ—ค๋” ์„ค์ • + }; + + // HTTP GET ์š”์ฒญ ๋ณด๋‚ด๊ธฐ + var response = await http.get( + Uri.parse(apiUrl), + headers: headers, // ํ—ค๋” ์ถ”๊ฐ€ + ); + + // HTTP ์‘๋‹ต ์ƒํƒœ ํ™•์ธ + if (response.statusCode == 200) { + // ์‘๋‹ต ๋ฐ์ดํ„ฐ ์ฒ˜๋ฆฌ + print('์„œ๋ฒ„๋กœ๋ถ€ํ„ฐ ๋ฐ›์€ ๋‚ด์šฉ ๋ฐ์ดํ„ฐ(์‚ฌ์šฉ์ž ์ •๋ณด): ${response.body}'); + var jsonResponse = utf8.decode(response.bodyBytes); + + parsedResponseUser = json.decode(jsonResponse); + takeUser = true; + + setState(() { + + }); + + } else { + // ์š”์ฒญ์ด ์‹คํŒจํ•œ ๊ฒฝ์šฐ ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌ + print('HTTP ์š”์ฒญ ์‹คํŒจ: ${response.statusCode}'); + } + } + + // ๋กœ๊ทธ์•„์›ƒ(์ด๋ฉ”์ผ, ๊ตฌ๊ธ€ ๋‘˜๋‹ค ํฌํ•จ) + Future signOut() async { + await Firebase.initializeApp(); + + try { + await FirebaseAuth.instance.signOut(); + print("Log-Out Success"); + sign_in.userAccessToken = ""; + setState(() { + + }); + } catch (e) { + print(e.toString()); + } + } + + // ๋กœ๊ทธ์•„์›ƒ ๋‹ค์ด์–ผ๋กœ๊ทธ + void LogOutDialog() { + showDialog( + context: context, + builder: (_) => new AlertDialog( + shape: RoundedRectangleBorder( + borderRadius: + BorderRadius.all( + Radius.circular(30.0))), + content: Builder( + builder: (context) { + + return Container( + height: 296, + width: 292, + child: + Padding(padding: EdgeInsets.all(0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SizedBox(height: 20,), + Container( + width: 125, + height: 117, + child: SvgPicture.asset( + 'assets/images/no_result.svg', + width: 132, + height: 123, + fit: BoxFit.contain, + ), + ), + SizedBox(height: 40,), + Text("๋กœ๊ทธ์•„์›ƒ ํ•˜์‹œ๊ฒ ์–ด์š”?",style: textStyle.bk16bold,), + SizedBox(height: 40,), + Row( + children: [ + Container(width: 120, + child: ElevatedButton( + child: new Text("์ทจ์†Œ", style: textStyle.purple16midium), + style: buttonChart().purplebtn3, + onPressed: () { + Navigator.pop(context); + }, + ), + ), + SizedBox(width: 10,), + Container(width: 124, + child: ElevatedButton( + child: new Text("๋กœ๊ทธ์•„์›ƒ", style: textStyle.white16semibold), + style: buttonChart().purplebtn, + onPressed: () { + signOut(); + Navigator.popUntil(context, ModalRoute.withName("/")); + //Navigator.popUntil(context, ModalRoute.withName(Navigator.defaultRouteName)); + }, + ), + ), + ], + ) + ], + ),) + ); + }, + ), + ) + ); + } + + + @override + void initState() { + super.initState(); + fetchUserInfo(sign_in.userAccessToken); // ์‚ฌ์šฉ์ž ์ •๋ณด ๊ฐ€์ ธ์˜ค๊ธฐ + } + + @override + void dispose() async { + super.dispose(); + } + + @override + Widget build(BuildContext context) { + MediaQueryData deviceData = MediaQuery.of(context); + Size screenSize = deviceData.size; + return + Scaffold( + backgroundColor: Color(0xffF2F4F6), + appBar: PreferredSize( + preferredSize: Size.fromHeight(72), + child: AppBar( + title: + Container( + height: 50, + width: screenSize.width, + child: Column( + children: [ + SizedBox(height: 24,), + Center( + child: Padding( + padding: EdgeInsets.only(right: 60), + child: Text( + '๊ณ„์ • ๊ด€๋ฆฌ', + style: textStyle.bk20normal, + ), + )), + ],) + ), + backgroundColor: Colors.transparent, + elevation: 0.0, + iconTheme: IconThemeData(color: Colors.black), + centerTitle: true, + leading: Padding( + padding: EdgeInsets.only(top: 20), + child: IconButton( + icon: Icon(Icons.arrow_back_ios_rounded, color: Colors.black), + onPressed: () => Navigator.of(context).pop(), + ), + ), + ), + ), + extendBodyBehindAppBar: false, + body: Container( + width: screenSize.width, + height: screenSize.height, + child: SingleChildScrollView( + padding: EdgeInsets.fromLTRB(16, 0, 16, 16), + scrollDirection: Axis.vertical, + child: + Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + if(takeUser)...[ + SizedBox(height: 4,), + Container( + padding: EdgeInsets.all(16), + height: 81, + width: screenSize.width, + decoration: BoxDecoration( + color: Color(0xffF2F6FF), + borderRadius: BorderRadius.circular(16), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text('์ด๋ฉ”์ผ ์ฃผ์†Œ',style: textStyle.bk14midium,), + SizedBox(height: 8,), + Text('${parsedResponseUser['email']}',style: textStyle.bk16normal,), + ], + ) + ), + SizedBox(height: 16,), + + ], + Container( + padding: EdgeInsets.all(16), + height: 49, + width: screenSize.width, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(16), + ), + child: InkWell( + onTap: (){ + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => PasswordResetPage())); + }, + child: Row( + children: [ + Container(width: 310, + child: Text('๋น„๋ฐ€๋ฒˆํ˜ธ ์žฌ์„ค์ •',style: textStyle.bk14normal,), + ), + SvgPicture.asset( + 'assets/images/memorial/blue_arrow.svg', + //fit: BoxFit.cover, + ), + ], + ) + ), + ), + SizedBox(height: 16,), + Container( + padding: EdgeInsets.all(16), + height: 49, + width: screenSize.width, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(16), + ), + child: InkWell( + onTap: (){ + LogOutDialog(); + }, + child: Row( + children: [ + Container(width: 310, + child: Text('๋กœ๊ทธ์•„์›ƒ',style: textStyle.bk14normal,), + ), + SvgPicture.asset( + 'assets/images/memorial/blue_arrow.svg', + //fit: BoxFit.cover, + ), + ], + ) + ), + ), + SizedBox(height: 16,), + Container( + padding: EdgeInsets.all(16), + height: 49, + width: screenSize.width, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(16), + ), + child: InkWell( + onTap: (){ + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => DeleteAccountPage())); + }, + child: Row( + children: [ + Container(width: 310, + child: Text('ํƒˆํ‡ดํ•˜๊ธฐ',style: textStyle.bk14normal,), + ), + SvgPicture.asset( + 'assets/images/memorial/blue_arrow.svg', + //fit: BoxFit.cover, + ), + ], + ) + ), + ), + + ], + ), + ), + ) + + ); + + } +} diff --git a/client/lib/mypage/announcement_detail.dart b/client/lib/mypage/announcement_detail.dart new file mode 100644 index 0000000..52ba324 --- /dev/null +++ b/client/lib/mypage/announcement_detail.dart @@ -0,0 +1,205 @@ +import 'dart:async'; +import 'dart:io'; +import 'package:flutter/material.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter_svg/svg.dart'; +import 'package:get/get.dart'; +//import 'package:get/get.dart'; +import 'package:image_picker/image_picker.dart'; +import 'package:client/sign/password_reset.dart'; +import 'package:client/style.dart'; +import 'package:intl/intl.dart'; +import 'dart:convert'; +import 'package:flutter/services.dart'; +import 'package:exif/exif.dart'; +import 'package:http/http.dart' as http; +import 'package:http_parser/http_parser.dart'; +import 'package:dio/dio.dart'; +import 'package:http_parser/http_parser.dart'; +import 'package:client/sign/sign_in.dart' as sign_in; +import 'announcement_main.dart' as anmain; + +/// ๊ณต์ง€์‚ฌํ•ญ ๊ธ€ +class AnnouncementDetailPage extends StatefulWidget { + static Future navigatorPush(BuildContext context) async { + return Navigator.push( + context, + MaterialPageRoute( + builder: (_) => AnnouncementDetailPage(), + ), + ); + } + + @override + _AnnouncementDetailPageState createState() => _AnnouncementDetailPageState(); +} + +class _AnnouncementDetailPageState extends State { + + late Map parsedResponseUser; // ์‚ฌ์šฉ์ž ์ •๋ณด + bool takeUser = false; + + late Map parsedResponseCM; // ๊ธ€ ์„ธ๋ถ€ ๋‚ด์šฉ + bool addComment = false; // ๋ฐ”๋กœ ์ฝ”๋ฉ˜ํŠธ ๋ถ™์˜€์„ ๋•Œ + bool isComment = false; + + String title = ""; + String content = ""; + + int comments = 0; + + // ์„ธ๋ถ€๊ธ€ ๊ฐ€์ ธ์˜ค๊ธฐ + void fetchDataAD() async { + // API ์—”๋“œํฌ์ธํŠธ URL + String apiUrl = 'http://3.38.1.125:8080/mypage/announcement?aid=${anmain.contentId}'; + + // HTTP GET ์š”์ฒญ ๋ณด๋‚ด๊ธฐ + var response = await http.get(Uri.parse(apiUrl)); + + ///var jsonResponse = utf8.decode(response.bodyBytes); + // HTTP ์‘๋‹ต ์ƒํƒœ ํ™•์ธ + if (response.statusCode == 200) { + // ์‘๋‹ต ๋ฐ์ดํ„ฐ๋ฅผ JSON ํ˜•์‹์œผ๋กœ ๋””์ฝ”๋”ฉ + var data = json.decode(response.body); + var jsonResponse = utf8.decode(response.bodyBytes); + + parsedResponseCM = json.decode(jsonResponse); + + title = parsedResponseCM['title']; + content = parsedResponseCM['content']; + + // ๋ฐ์ดํ„ฐ ์ฒ˜๋ฆฌ + print('์„œ๋ฒ„๋กœ๋ถ€ํ„ฐ ๋ฐ›์€ ๋ฐ์ดํ„ฐ: $jsonResponse'); + + takeUser = true; + isComment = true; + comments = parsedResponseCM.length; + setState(() { + }); + + } else { + // ์š”์ฒญ์ด ์‹คํŒจํ•œ ๊ฒฝ์šฐ ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌ + print('HTTP ์š”์ฒญ ์‹คํŒจ: ${response.statusCode}'); + } + } + + + @override + void initState() { + super.initState(); + fetchDataAD(); // ์‚ฌ์šฉ์ž ์ •๋ณด ๊ฐ€์ ธ์˜ค๊ธฐ + } + + @override + void dispose() async { + super.dispose(); + } + + @override + Widget build(BuildContext context) { + MediaQueryData deviceData = MediaQuery.of(context); + Size screenSize = deviceData.size; + return + Scaffold( + backgroundColor: Color(0xffF2F4F6), + appBar: PreferredSize( + preferredSize: Size.fromHeight(72), + child: AppBar( + title: + Container( + height: 50, + width: screenSize.width, + child: Column( + children: [ + SizedBox(height: 24,), + Center( + child: Padding( + padding: EdgeInsets.only(right: 60), + child: Text( + '๊ณต์ง€์‚ฌํ•ญ', + style: textStyle.bk20normal, + ), + )), + ],) + ), + backgroundColor: Colors.transparent, + elevation: 0.0, + iconTheme: IconThemeData(color: Colors.black), + centerTitle: true, + leading: Padding( + padding: EdgeInsets.only(top: 20), + child: IconButton( + icon: Icon(Icons.arrow_back_ios_rounded, color: Colors.black), + onPressed: () => Navigator.of(context).pop(), + ), + ), + ), + ),extendBodyBehindAppBar: false, + body: Container( + width: screenSize.width, + height: screenSize.height, + child: SingleChildScrollView( + padding: EdgeInsets.fromLTRB(16, 0, 16, 16), + scrollDirection: Axis.vertical, + child: + Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + if(takeUser)...[ + SizedBox(height: 0,), + Container( + width: Get.width, + child: + ClipRRect( + borderRadius: BorderRadius.only(topLeft: Radius.circular(16.0), topRight: Radius.circular(16.0)), + child: + Container( + color: Colors.white, + padding: const EdgeInsets.all(15), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox(height: 8,), + Text('์ œ๋ชฉ', style: textStyle.bk14midium,), + SizedBox(height: 8,), + Text('${title}', style: textStyle.bk16normalCon,), + SizedBox(height: 8,), + ], + ), + ) + ), + //Image.network(parsedResponseCM[index]['image'], fit: BoxFit.cover,), + ), + SizedBox(height: 8,), + + Container( + width: Get.width, + child: ClipRRect( + borderRadius: BorderRadius.only(bottomLeft: Radius.circular(16.0), bottomRight: Radius.circular(16.0)), + child: + Container( + color: Colors.white, + padding: const EdgeInsets.only(top: 16, left: 16, right: 16,bottom: 16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text('๋‚ด์šฉ', style: textStyle.bk14midium,), + SizedBox(height: 8,), + Text('${content}', style: textStyle.bk16normalCon,) + ], + ), + ) + ), + ), + + ], + + ], + ), + ), + ) + + ); + + } +} diff --git a/client/lib/mypage/announcement_main.dart b/client/lib/mypage/announcement_main.dart new file mode 100644 index 0000000..62ee6b2 --- /dev/null +++ b/client/lib/mypage/announcement_main.dart @@ -0,0 +1,211 @@ +import 'dart:async'; +import 'dart:io'; +import 'package:flutter/material.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:get/get.dart'; +import 'package:flutter_svg/svg.dart'; +//import 'package:get/get.dart'; +import 'package:image_picker/image_picker.dart'; +import 'package:client/mypage/announcement_detail.dart'; +import 'package:client/sign/password_reset.dart'; +import 'package:client/style.dart'; +import 'package:intl/intl.dart'; +import 'dart:convert'; +import 'package:flutter/services.dart'; +import 'package:exif/exif.dart'; +import 'package:http/http.dart' as http; +import 'package:http_parser/http_parser.dart'; +import 'package:dio/dio.dart'; +import 'package:http_parser/http_parser.dart'; +import 'package:client/sign/sign_in.dart' as sign_in; + +int contentId = 0; + +/// ๊ณต์ง€์‚ฌํ•ญ +class AnnouncementMainPage extends StatefulWidget { + static Future navigatorPush(BuildContext context) async { + return Navigator.push( + context, + MaterialPageRoute( + builder: (_) => AnnouncementMainPage(), + ), + ); + } + + @override + _AnnouncementMainPageState createState() => _AnnouncementMainPageState(); +} + +class _AnnouncementMainPageState extends State { + + late Map parsedResponseUser; // ์‚ฌ์šฉ์ž ์ •๋ณด + bool takeUser = false; + + late List parsedResponseCM; // ๊ธ€ + bool addComment = false; + bool isComment = false; + + int comments = 0; + // ๊ธ€ ๊ฐ€์ ธ์˜ค๊ธฐ + void fetchDataA() async { + // API ์—”๋“œํฌ์ธํŠธ URL + String apiUrl = 'http://3.38.1.125:8080/mypage/announcement/all'; + + // HTTP GET ์š”์ฒญ ๋ณด๋‚ด๊ธฐ + var response = await http.get(Uri.parse(apiUrl)); + + ///var jsonResponse = utf8.decode(response.bodyBytes); + // HTTP ์‘๋‹ต ์ƒํƒœ ํ™•์ธ + if (response.statusCode == 200) { + // ์‘๋‹ต ๋ฐ์ดํ„ฐ๋ฅผ JSON ํ˜•์‹์œผ๋กœ ๋””์ฝ”๋”ฉ + var data = json.decode(response.body); + var jsonResponse = utf8.decode(response.bodyBytes); + + parsedResponseCM = json.decode(jsonResponse); + + // ๋ฐ์ดํ„ฐ ์ฒ˜๋ฆฌ + print('์„œ๋ฒ„๋กœ๋ถ€ํ„ฐ ๋ฐ›์€ ๋ฐ์ดํ„ฐ: $jsonResponse'); + + takeUser = true; + isComment = true; + comments = parsedResponseCM.length; + setState(() { + }); + + } else { + // ์š”์ฒญ์ด ์‹คํŒจํ•œ ๊ฒฝ์šฐ ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌ + print('HTTP ์š”์ฒญ ์‹คํŒจ: ${response.statusCode}'); + } + } + + + @override + void initState() { + super.initState(); + fetchDataA(); // ์‚ฌ์šฉ์ž ์ •๋ณด ๊ฐ€์ ธ์˜ค๊ธฐ + } + + @override + void dispose() async { + super.dispose(); + } + + // ๋ฆฌ์ŠคํŠธ ์œ„์ ฏ + Widget listview_builder(){ + return ListView.builder( + shrinkWrap: true, + scrollDirection: Axis.vertical, + padding: EdgeInsets.all(0), + physics: NeverScrollableScrollPhysics(), + itemCount: parsedResponseCM.length, + itemBuilder: (BuildContext context, int index){ + return Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Container( + padding: EdgeInsets.all(16), + height: 95, + width: Get.width, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(16), + ), + child: InkWell( + onTap: (){ + contentId = parsedResponseCM[index]['id']; + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => AnnouncementDetailPage())); + // ํ•ด๋‹น ๊ธ€์œผ๋กœ ์ด๋™ + }, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row(children: [ + Container( + width: 262, + child:Text('ํ•จ๊ป˜ํ• ๊ฐœ ์ด์šฉ ๊ทœ์น™ ์•ˆ๋‚ด',style: textStyle.bk14midium,), + ), + Text('2023-11-19',style: textStyle.bg10normal,), + ],), + SizedBox(height: 8,), + Container( + width: 308, + height: 32, + child:Text('${parsedResponseCM[index]['metaContent']}',style: textStyle.bk14normal,), + ), + + ], + ) + ), + ), + SizedBox(height: 16,), + + ], + ); + + } + ); + } + + + @override + Widget build(BuildContext context) { + MediaQueryData deviceData = MediaQuery.of(context); + Size screenSize = deviceData.size; + return + Scaffold( + backgroundColor: Color(0xffF2F4F6), + appBar: PreferredSize( + preferredSize: Size.fromHeight(72), + child: AppBar( + title: + Container( + height: 50, + width: screenSize.width, + child: Column( + children: [ + SizedBox(height: 24,), + Center( + child: Padding( + padding: EdgeInsets.only(right: 60), + child: Text( + '๊ณต์ง€์‚ฌํ•ญ', + style: textStyle.bk20normal, + ), + )), + ],) + ), + backgroundColor: Colors.transparent, + elevation: 0.0, + iconTheme: IconThemeData(color: Colors.black), + centerTitle: true, + leading: Padding( + padding: EdgeInsets.only(top: 20), + child: IconButton( + icon: Icon(Icons.arrow_back_ios_rounded, color: Colors.black), + onPressed: () => Navigator.of(context).pop(), + ), + ), + ), + ),extendBodyBehindAppBar: false, + body: Container( + width: screenSize.width, + height: screenSize.height, + child: SingleChildScrollView( + padding: EdgeInsets.fromLTRB(16, 0, 16, 16), + scrollDirection: Axis.vertical, + child: + Column( + children: [ + listview_builder() + ], + ) + ), + ) + + ); + + } +} diff --git a/client/lib/mypage/delete_account.dart b/client/lib/mypage/delete_account.dart new file mode 100644 index 0000000..bfd3aef --- /dev/null +++ b/client/lib/mypage/delete_account.dart @@ -0,0 +1,330 @@ +import 'dart:async'; +import 'dart:convert'; +import 'dart:io'; +import 'package:flutter/material.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter_svg/svg.dart'; +import 'package:client/style.dart'; +import 'package:flutter/services.dart'; +import 'package:http/http.dart' as http; +import 'package:firebase_auth/firebase_auth.dart'; +import 'package:client/sign/sign_in.dart' as sign_in; +// import 'sign_in.dart'; + +/// ํšŒ์› ํƒˆํ‡ด ํŽ˜์ด์ง€ +class DeleteAccountPage extends StatefulWidget { + static Future navigatorPush(BuildContext context) async { + return Navigator.push( + context, + MaterialPageRoute( + builder: (_) => DeleteAccountPage(), + ), + ); + } + + @override + _DeleteAccountPageState createState() => _DeleteAccountPageState(); +} + +class _DeleteAccountPageState extends State { + + late Map parsedResponseUser; // ์‚ฌ์šฉ์ž ์ •๋ณด + bool takeUser = false; + + // ์‚ฌ์šฉ์ž ์ •๋ณด ์กฐํšŒ + void fetchUserInfo(String aToken) async { + // API ์—”๋“œํฌ์ธํŠธ URL + print("๋ฐ›ํ† :" + aToken); + String apiUrl = 'http://3.38.1.125:8080/user/info'; // ์‹ค์ œ API ์—”๋“œํฌ์ธํŠธ๋กœ ๋ณ€๊ฒฝํ•˜์„ธ์š” + + // ํ—ค๋” ์ •๋ณด ์„ค์ • + Map headers = { + 'Authorization': 'Bearer $aToken', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• + 'Content-Type': 'application/json', // ์˜ˆ: JSON ์š”์ฒญ์ธ ๊ฒฝ์šฐ ํ—ค๋” ์„ค์ • + }; + + // HTTP GET ์š”์ฒญ ๋ณด๋‚ด๊ธฐ + var response = await http.get( + Uri.parse(apiUrl), + headers: headers, // ํ—ค๋” ์ถ”๊ฐ€ + ); + + // HTTP ์‘๋‹ต ์ƒํƒœ ํ™•์ธ + if (response.statusCode == 200) { + // ์‘๋‹ต ๋ฐ์ดํ„ฐ ์ฒ˜๋ฆฌ + print('์„œ๋ฒ„๋กœ๋ถ€ํ„ฐ ๋ฐ›์€ ๋‚ด์šฉ ๋ฐ์ดํ„ฐ(์‚ฌ์šฉ์ž ์ •๋ณด): ${response.body}'); + var jsonResponse = utf8.decode(response.bodyBytes); + + parsedResponseUser = json.decode(jsonResponse); + takeUser = true; + + setState(() { + + }); + + } else { + // ์š”์ฒญ์ด ์‹คํŒจํ•œ ๊ฒฝ์šฐ ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌ + print('HTTP ์š”์ฒญ ์‹คํŒจ: ${response.statusCode}'); + } + } + + final FirebaseAuth _auth = FirebaseAuth.instance; + + Future _deleteAccount() async { + try { + User? user = _auth.currentUser; + if (user != null) { + await user.delete(); + print("๊ณ„์ • ์‚ญ์ œ ์„ฑ๊ณต"); + } else { + print("์‚ฌ์šฉ์ž ๋กœ๊ทธ์ธ ์ƒํƒœ ์•„๋‹˜"); + } + } catch (e) { + print("๊ณ„์ • ์‚ญ์ œ ์‹คํŒจ: $e"); + } + } + + // ๊ณ„์ • ์‚ญ์ œ - DB ์‚ญ์ œ + void deleteAccount(String aToken) async { + // API ์—”๋“œํฌ์ธํŠธ URL + String apiUrl = 'http://3.38.1.125:8080/user/account'; + + // ํ—ค๋” ์ •๋ณด ์„ค์ • + Map headers = { + 'Authorization': 'Bearer $aToken', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• + 'Content-Type': 'application/json', // ์˜ˆ: JSON ์š”์ฒญ์ธ ๊ฒฝ์šฐ ํ—ค๋” ์„ค์ • + }; + + // HTTP GET ์š”์ฒญ ๋ณด๋‚ด๊ธฐ + var response = await http.delete( + Uri.parse(apiUrl), + headers: headers, // ํ—ค๋” ์ถ”๊ฐ€ + ); + + ///var jsonResponse = utf8.decode(response.bodyBytes); + // HTTP ์‘๋‹ต ์ƒํƒœ ํ™•์ธ + if (response.statusCode == 200) { + // ์‘๋‹ต ๋ฐ์ดํ„ฐ๋ฅผ JSON ํ˜•์‹์œผ๋กœ ๋””์ฝ”๋”ฉ + print("์‚ญ์ œ์„ฑ๊ณต"); + setState(() { + }); + + } else { + // ์š”์ฒญ์ด ์‹คํŒจํ•œ ๊ฒฝ์šฐ ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌ + print('HTTP ์š”์ฒญ ์‹คํŒจ: ${response.statusCode}'); + } + } + + // ํšŒ์›ํƒˆํ‡ด ๋‹ค์ด์–ผ๋กœ๊ทธ + void deleteDialog() { + showDialog( + context: context, + builder: (_) => new AlertDialog( + shape: RoundedRectangleBorder( + borderRadius: + BorderRadius.all( + Radius.circular(30.0))), + content: Builder( + builder: (context) { + + return Container( + height: 296, + width: 292, + child: + Padding(padding: EdgeInsets.all(0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SizedBox(height: 20,), + Container( + width: 125, + height: 117, + child: SvgPicture.asset( + 'assets/images/no_result.svg', + width: 132, + height: 123, + fit: BoxFit.contain, + ), + ), + SizedBox(height: 32,), + Text("์ •๋ง ํƒˆํ‡ดํ•˜์‹œ๊ฒ ์–ด์š”?",style: textStyle.bk16bold,), + SizedBox(height: 16,), + Text("ํƒˆํ‡ด ํ›„์—๋Š” ๋ฐ์ดํ„ฐ๋ฅผ ๋ณต๊ตฌํ•  ์ˆ˜ ์—†์–ด์š”.",style: textStyle.bk14normal,), + SizedBox(height: 16,), + Row( + children: [ + Container(width: 120, + child: ElevatedButton( + child: new Text("์ทจ์†Œ", style: textStyle.purple16midium), + style: buttonChart().purplebtn3, + onPressed: () { + Navigator.pop(context); + }, + ), + ), + SizedBox(width: 10,), + Container(width: 124, + child: ElevatedButton( + child: new Text("ํƒˆํ‡ดํ•˜๊ธฐ", style: textStyle.white16semibold), + style: buttonChart().purplebtn, + onPressed: () { + //signOut(); + _deleteAccount(); + deleteAccount(sign_in.userAccessToken); + Navigator.popUntil(context, ModalRoute.withName("/")); + //Navigator.popUntil(context, ModalRoute.withName(Navigator.defaultRouteName)); + }, + ), + ), + ], + ) + ], + ),) + ); + }, + ), + ) + ); + } + + // ํ…์ŠคํŠธ์—๋””ํŒ…์ปจํŠธ๋กค๋Ÿฌ๋ฅผ ์ƒ์„ฑํ•˜์—ฌ ํ•„๋“œ์— ํ• ๋‹น + final pwController = TextEditingController(); + + // ๋‹จ๊ณ„๋ฅผ ์œ„ํ•œ bool + bool setPassword = false; + + @override + void initState() { + super.initState(); + + } + + @override + void dispose() async { + super.dispose(); + } + + + + @override + Widget build(BuildContext context) { + MediaQueryData deviceData = MediaQuery.of(context); + Size screenSize = deviceData.size; + return + Scaffold( + backgroundColor: Color(0xffF2F4F6), + appBar: AppBar( + title: Text("ํƒˆํ‡ดํ•˜๊ธฐ", style: textStyle.bk20normal), + backgroundColor: Colors.transparent, + elevation: 0.0, + iconTheme: IconThemeData(color: Colors.black), + centerTitle: true, + leading: IconButton( + icon: Icon(Icons.arrow_back_ios_rounded, color: Colors.black), + onPressed: () => Navigator.of(context).pop(), + ), + ),extendBodyBehindAppBar: true, + body: Container( + padding: const EdgeInsets.all(16.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SizedBox(height: 86,), + Row( + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text('๋น„๋ฐ€๋ฒˆํ˜ธ๋ฅผ ์ž…๋ ฅํ•ด์ฃผ์„ธ์š”.',style: textStyle.bk20semibold), + SizedBox(height: 16,), + Text('๊ณ„์ • ๋น„๋ฐ€๋ฒˆํ˜ธ๋ฅผ ์ž…๋ ฅํ•˜์„ธ์š”.',style: textStyle.bk13light), + ], + ), + ], + ), + SizedBox(height: 16,), + + Container( + width: screenSize.width, + height: 44, + child: TextFormField( + obscureText: true, + style: TextStyle(decorationThickness: 0, fontFamily: 'Pretendard', + fontSize: 16, fontWeight: FontWeight.w400, color: Color(colorChart.black)), + controller: pwController, + onChanged: (text){ + setPassword = true; + setState(() { + }); + }, + decoration: InputDecoration( + contentPadding: EdgeInsets.only(top:3, left: 5), + hintStyle: textStyle.grey16normal, + border: InputBorder.none, + filled: true, + fillColor: Color(0xffF9F9F9), + hintText: '๋น„๋ฐ€๋ฒˆํ˜ธ', + enabledBorder: OutlineInputBorder( + borderSide: BorderSide(width: 1, color: Colors.white), //<-- SEE HERE + borderRadius: BorderRadius.circular(12.0), + ), + ), + onSaved: (value) { + print('Name field onSaved:$value'); + }, + validator: (value) { + if(value!.length < 8){ + return '8์ž ์ด์ƒ์˜ ์˜๋ฌธ, ์ˆซ์ž, ํŠน์ˆ˜๋ฌธ์ž๋ฅผ ์กฐํ•ฉํ•˜์—ฌ ์„ค์ •ํ•ด์ฃผ์„ธ์š”.'; + } + // if(!RegExp(r'^[a-zA-Z0-9 ]+$').hasMatch(value!)){ + // return '8์ž ์ด์ƒ์˜ ์˜๋ฌธ, ์ˆซ์ž, ํŠน์ˆ˜๋ฌธ์ž๋ฅผ ์กฐํ•ฉํ•˜์—ฌ ์„ค์ •ํ•ด์ฃผ์„ธ์š”.'; + // } else if(!RegExp(r'[a-zA-Z]').hasMatch(value!)){ + // return '8์ž ์ด์ƒ์˜ ์˜๋ฌธ, ์ˆซ์ž, ํŠน์ˆ˜๋ฌธ์ž๋ฅผ ์กฐํ•ฉํ•˜์—ฌ ์„ค์ •ํ•ด์ฃผ์„ธ์š”.'; + // }else if(value!.length < 8){ + // return '8์ž ์ด์ƒ์˜ ์˜๋ฌธ, ์ˆซ์ž, ํŠน์ˆ˜๋ฌธ์ž๋ฅผ ์กฐํ•ฉํ•˜์—ฌ ์„ค์ •ํ•ด์ฃผ์„ธ์š”.'; + // } + }, + onFieldSubmitted: (value) { + print('submitted:$value'); + }, + ), + ), + SizedBox( height: 16,), + if(setPassword)...[ + Container( + height: 44, + width: screenSize.width, + child: ElevatedButton(onPressed: (){ + + deleteDialog(); + // if (_formKey.currentState!.validate()) { + // setState(() { + // _formKey.currentState!.save(); + // pwCheck = true; + // userPassword = pwController.text; + // }); + // } + }, + style: buttonChart().signInbtn, + child: Text("๋‹ค์Œ", style: textStyle.white16semibold,) + ), + ), + ]else...[ + Container( + height: 44, + width: screenSize.width, + child: ElevatedButton(onPressed: (){ + // ์•„๋ฌด ๋ฐ˜์‘ ์—†๋Š” ๊ฒƒ์ด ๋งž์Œ + }, + style: buttonChart().purplebtn3, + child: Text("๋‹ค์Œ", style: textStyle.white16semibold,) + ), + ), + ] + ], + ), + ) + + ); + } +} diff --git a/client/lib/mypage/mycoments.dart b/client/lib/mypage/mycoments.dart new file mode 100644 index 0000000..2789bf8 --- /dev/null +++ b/client/lib/mypage/mycoments.dart @@ -0,0 +1,254 @@ +import 'dart:async'; +import 'dart:io'; +import 'package:flutter/material.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter_svg/svg.dart'; +import 'package:get/get.dart'; +import 'package:image_picker/image_picker.dart'; +import 'package:client/sign/password_reset.dart'; +import 'package:client/style.dart'; +import 'package:intl/intl.dart'; +import 'dart:convert'; +import 'package:flutter/services.dart'; +import 'package:exif/exif.dart'; +import 'package:http/http.dart' as http; +import 'package:http_parser/http_parser.dart'; +import 'package:dio/dio.dart'; +import 'package:http_parser/http_parser.dart'; +import 'package:client/sign/sign_in.dart' as sign_in; +import 'package:client/home.dart' as home; + +/// ๋‚ด๊ฐ€ ์“ด ๋Œ“๊ธ€๋“ค +class MyCommentsPage extends StatefulWidget { + static Future navigatorPush(BuildContext context) async { + return Navigator.push( + context, + MaterialPageRoute( + builder: (_) => MyCommentsPage(), + ), + ); + } + + @override + _MyCommentsPageState createState() => _MyCommentsPageState(); +} + +class _MyCommentsPageState extends State { + + late Map parsedResponseUser; // ์‚ฌ์šฉ์ž ์ •๋ณด + bool takeUser = false; + + // ์‚ฌ์šฉ์ž ์ •๋ณด ์กฐํšŒ + void fetchUserInfo(String aToken) async { + // API ์—”๋“œํฌ์ธํŠธ URL + print("๋ฐ›ํ† :" + aToken); + String apiUrl = 'http://3.38.1.125:8080/user/info'; // ์‹ค์ œ API ์—”๋“œํฌ์ธํŠธ๋กœ ๋ณ€๊ฒฝํ•˜์„ธ์š” + + // ํ—ค๋” ์ •๋ณด ์„ค์ • + Map headers = { + 'Authorization': 'Bearer $aToken', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• + 'Content-Type': 'application/json', // ์˜ˆ: JSON ์š”์ฒญ์ธ ๊ฒฝ์šฐ ํ—ค๋” ์„ค์ • + }; + + // HTTP GET ์š”์ฒญ ๋ณด๋‚ด๊ธฐ + var response = await http.get( + Uri.parse(apiUrl), + headers: headers, // ํ—ค๋” ์ถ”๊ฐ€ + ); + + // HTTP ์‘๋‹ต ์ƒํƒœ ํ™•์ธ + if (response.statusCode == 200) { + // ์‘๋‹ต ๋ฐ์ดํ„ฐ ์ฒ˜๋ฆฌ + print('์„œ๋ฒ„๋กœ๋ถ€ํ„ฐ ๋ฐ›์€ ๋‚ด์šฉ ๋ฐ์ดํ„ฐ(์‚ฌ์šฉ์ž ์ •๋ณด): ${response.body}'); + var jsonResponse = utf8.decode(response.bodyBytes); + + parsedResponseUser = json.decode(jsonResponse); + takeUser = true; + + setState(() { + + }); + + } else { + // ์š”์ฒญ์ด ์‹คํŒจํ•œ ๊ฒฝ์šฐ ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌ + print('HTTP ์š”์ฒญ ์‹คํŒจ: ${response.statusCode}'); + } + } + + late List parsedResponseCM; // ๋Œ“๊ธ€ + bool isComment = false; + // ์ฝ”๋ฉ˜ํŠธ ์ˆ˜ + int comments = 0; + + // ๋Œ“๊ธ€ ๊ฐ€์ ธ์˜ค๊ธฐ + void fetchDataComment(String aToken) async { + // API ์—”๋“œํฌ์ธํŠธ URL + String apiUrl = 'http://3.38.1.125:8080/mypage/comment/all'; + + // ํ—ค๋” ์ •๋ณด ์„ค์ • + Map headers = { + 'Authorization': 'Bearer $aToken', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• + 'Content-Type': 'application/json', // ์˜ˆ: JSON ์š”์ฒญ์ธ ๊ฒฝ์šฐ ํ—ค๋” ์„ค์ • + }; + + // HTTP GET ์š”์ฒญ ๋ณด๋‚ด๊ธฐ + var response = await http.get( + Uri.parse(apiUrl), + headers: headers, // ํ—ค๋” ์ถ”๊ฐ€ + ); + + // HTTP ์‘๋‹ต ์ƒํƒœ ํ™•์ธ + if (response.statusCode == 200) { + // ์‘๋‹ต ๋ฐ์ดํ„ฐ๋ฅผ JSON ํ˜•์‹์œผ๋กœ ๋””์ฝ”๋”ฉ + var data = json.decode(response.body); + var jsonResponse = utf8.decode(response.bodyBytes); + + parsedResponseCM = json.decode(jsonResponse); + + // ๋ฐ์ดํ„ฐ ์ฒ˜๋ฆฌ + print('์„œ๋ฒ„๋กœ๋ถ€ํ„ฐ ๋ฐ›์€ ๋ฐ์ดํ„ฐ(๋Œ“๊ธ€): $jsonResponse'); + + isComment = true; + comments = parsedResponseCM.length; + setState(() { + }); + + } else { + // ์š”์ฒญ์ด ์‹คํŒจํ•œ ๊ฒฝ์šฐ ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌ + print('HTTP ์š”์ฒญ ์‹คํŒจ: ${response.statusCode}'); + } + } + + @override + void initState() { + super.initState(); + fetchUserInfo(sign_in.userAccessToken); // ์‚ฌ์šฉ์ž ์ •๋ณด ๊ฐ€์ ธ์˜ค๊ธฐ + fetchDataComment(sign_in.userAccessToken); + } + + @override + void dispose() async { + super.dispose(); + } + + // ๋ฆฌ์ŠคํŠธ ์œ„์ ฏ + Widget listview_builder(){ + return ListView.builder( + shrinkWrap: true, + scrollDirection: Axis.vertical, + padding: EdgeInsets.all(0), + physics: NeverScrollableScrollPhysics(), + itemCount: parsedResponseCM.length, + itemBuilder: (BuildContext context, int index){ + return Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + if(takeUser)...[ + Container( + padding: EdgeInsets.all(16), + height: 95, + width: Get.width, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(16), + ), + child: InkWell( + onTap: (){ + // ํ•ด๋‹น ๊ธ€์œผ๋กœ ์ด๋™ + }, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row(children: [ + if(home.user == parsedResponseCM[index]['postOpName'])...[ + Text('๋‚ด๊ฐ€ ์“ด ๊ธ€์— ๋Œ“๊ธ€์„ ๋‹ฌ์•˜์Šต๋‹ˆ๋‹ค.',style: textStyle.bk6614normal,), + ]else...[ + Text('${parsedResponseCM[index]['postOpName']}',style: textStyle.bk6614midium,), + Text('๋‹˜์˜ ๊ธ€์— ๋Œ“๊ธ€์„ ๋‹ฌ์•˜์Šต๋‹ˆ๋‹ค.',style: textStyle.bk6614normal,), + ] + + ],), + SizedBox(height: 8,), + Text('${parsedResponseCM[index]['content']}',style: textStyle.bk14midium,), + SizedBox(height: 8,), + Text(DateFormat('MM/dd HH:mm').format(DateTime.parse(parsedResponseCM[index]['createdAt'])).toString(),style: textStyle.bg10normal,), + ], + ) + ), + ), + SizedBox(height: 16,), + + ], + + ], + ), + + ], + ); + + } + ); + } + + @override + Widget build(BuildContext context) { + MediaQueryData deviceData = MediaQuery.of(context); + Size screenSize = deviceData.size; + return + Scaffold( + backgroundColor: Color(0xffF2F4F6), + appBar: PreferredSize( + preferredSize: Size.fromHeight(72), + child: AppBar( + title: + Container( + height: 50, + width: screenSize.width, + child: Column( + children: [ + SizedBox(height: 24,), + Center( + child: Padding( + padding: EdgeInsets.only(right: 60), + child: Text( + '๋‚ด๊ฐ€ ์“ด ๋Œ“๊ธ€', + style: textStyle.bk20normal, + ), + )), + ],) + ), + backgroundColor: Colors.transparent, + elevation: 0.0, + iconTheme: IconThemeData(color: Colors.black), + centerTitle: true, + leading: Padding( + padding: EdgeInsets.only(top: 20), + child: IconButton( + icon: Icon(Icons.arrow_back_ios_rounded, color: Colors.black), + onPressed: () => Navigator.of(context).pop(), + ), + ), + ), + ),extendBodyBehindAppBar: false, + body: Container( + width: screenSize.width, + height: screenSize.height, + child: SingleChildScrollView( + padding: EdgeInsets.fromLTRB(16, 0, 16, 16), + scrollDirection: Axis.vertical, + child: + Column( + children: [ + listview_builder() + ], + ) + ), + ) + + ); + + } +} diff --git a/client/lib/mypage/myhelp_con.dart b/client/lib/mypage/myhelp_con.dart new file mode 100644 index 0000000..a7d8a06 --- /dev/null +++ b/client/lib/mypage/myhelp_con.dart @@ -0,0 +1,220 @@ +import 'dart:async'; +import 'dart:convert'; +import 'package:flutter/material.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter_svg/svg.dart'; +import 'package:fluttertoast/fluttertoast.dart'; +import 'package:http/http.dart' as http; +import 'package:client/conversation/early_period/memory2.dart'; +import 'package:client/conversation/end_period/end2.dart'; +import 'package:client/progressbar/animation_progressbar.dart'; +import 'package:client/style.dart'; +import 'package:just_audio/just_audio.dart'; +import 'package:client/conversation/intro/intro2.dart' as intro2; +import 'package:flutter_gif/flutter_gif.dart'; + +/// ๋„์›€_์ฝ”์น˜๋งˆํฌ +class MyHelpHelpPage extends StatefulWidget { + + static Future navigatorPush(BuildContext context) async { + return Navigator.push( + context, + MaterialPageRoute( + builder: (_) => MyHelpHelpPage(), + ), + ); + } + + @override + _MyHelpHelpPageState createState() => _MyHelpHelpPageState(); +} + +class _MyHelpHelpPageState extends State { + + FocusNode _focusNode = FocusNode(); + + @override + void initState() { + super.initState(); + _focusNode.addListener(_onFocusChange); + } + + void _onFocusChange() { + if (_focusNode.hasFocus) { + // ํ‚ค๋ณด๋“œ ์˜ฌ๋ฆฌ๊ธฐ + FocusScope.of(context).requestFocus(_focusNode); + } + } + + @override + void dispose() async { + super.dispose(); + } + + int nextPage = 0; + + List questions0 =[ + "๋„์›€ ๋‚ด์—ญ ์ฝ”์น˜ ๋งˆํฌ1:\n\n๋‹ค๋ฅธ ๋ฐ˜๋ ค์ธ๋“ค์ด ๋‚˜์—๊ฒŒ ์š”์ฒญํ•œ\n๋„์›€์„ ํ™•์ธํ•ด๋ณด์„ธ์š”.", + "๋„์›€ ๋‚ด์—ญ ์ฝ”์น˜ ๋งˆํฌ2:\n\n์„œ๋กœ๋ฅผ ์ง€์ง€ํ•˜๋Š” ๋งˆ์Œ์œผ๋กœ\n๋„์›€์„ ๋ณด๋‚ผ์ˆ˜ ์žˆ์–ด์š”.", + ]; + + int nextQuestion = 0; + + + @override + Widget build(BuildContext context) { + MediaQueryData deviceData = MediaQuery.of(context); + Size screenSize = deviceData.size; + return + Container( + decoration: BoxDecoration( + gradient: LinearGradient( + begin: Alignment.topRight, + end: Alignment.bottomLeft, + colors: [ + Color(0xffE4ECFF), + Color(0xffA2BEFF), + ], + ) + ), + child: GestureDetector( + onTap: (){ + print(nextQuestion); + if(nextPage == 1){ + // Navigator.pop(context); // early2๋กœ ๊ฐ€๊ธฐ + // intro2.player2.setAsset(intro2.voice[2]); + // intro2.player2.play(); + } else if(nextPage < 1){ + nextPage++; + } + + setState(() { + }); + }, + child: Scaffold( + backgroundColor: Colors.transparent, + appBar: AppBar( + //title: Text("๊ธฐ์–ตํ• ๊ฐœ", style: TextStyle(fontSize:16, color: Colors.white ),), + //centerTitle: true, + backgroundColor: Colors.transparent, + elevation: 0.0, + automaticallyImplyLeading: false, + ),extendBodyBehindAppBar: true, + body: + Container( + child: Column( + children: [ + Stack( + children: [ + Padding(padding: EdgeInsets.only(left: 52, top: 138), + child: Container( + width: 275, + height: 605, + //color: Colors.white, + child: ClipRRect( + borderRadius: BorderRadius.circular(24.0), + child: Container( + decoration: BoxDecoration( + boxShadow: [ + BoxShadow( + color: Colors.black.withOpacity(0.8), + blurRadius: 5.0, + spreadRadius: 0.0, + offset: const Offset(0,7), + ) + ], + color: Colors.white, + borderRadius: BorderRadius.circular(16), + ), + width: 275, + height: 595, + //color: Colors.white, + ), + + ), + ), + ), + + if(nextPage == 0)...[ + Padding(padding: EdgeInsets.only(left: 60, top: 145), + child: Container( + width: 260, + height: 575, + child: ClipRRect( + borderRadius: BorderRadius.circular(24.0), + child: Image.asset('assets/images/conversation/end/sc1.png', + fit: BoxFit.fill,) + ), + ), + ), + ] else if(nextPage == 1)...[ + Padding(padding: EdgeInsets.only(left: 60, top: 145), + child: Container( + width: 260, + height: 575, + child: ClipRRect( + borderRadius: BorderRadius.circular(24.0), + child: Image.asset('assets/images/conversation/end/sc2.png', + fit: BoxFit.fill,) + ), + ), + ), + ], + Padding(padding: EdgeInsets.only(left: 170, top: 706), + child: Container( + width: 40, + height: 2, + child: Container( + width: 40, height: 2, + color: Colors.white, + ) + ), + ), + ], + ) + ], + ), + ), + + bottomSheet: Padding( + padding: EdgeInsets.only( + bottom: MediaQuery.of(context).viewInsets.bottom * 0.001), + child: Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + if(nextPage == 1)...[ + Container( + color: Color(0xffFFFFFF).withOpacity(0), + child: Padding( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 24), + child: Container( + + width: screenSize.width, + height: 40, + child: ElevatedButton( + style: buttonChart().bluebtn3, + onPressed: () { + // ์ดˆ๊ธฐ2๋กœ ์ด๋™ + Navigator.pop(context); + }, + child: Text("์™„๋ฃŒ", style: TextStyle( + fontFamily: 'Pretendard', + fontSize: 16, fontWeight: FontWeight.w500, color: Color(0xffFFFFFF))), + ), + ),), + ), + ] + ], + ), + ), + + ), + ) + + ); + + } +} diff --git a/client/lib/mypage/myhelp_main.dart b/client/lib/mypage/myhelp_main.dart new file mode 100644 index 0000000..4eb6788 --- /dev/null +++ b/client/lib/mypage/myhelp_main.dart @@ -0,0 +1,196 @@ +import 'dart:async'; +import 'dart:io'; +import 'package:flutter/material.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter_svg/svg.dart'; +//import 'package:get/get.dart'; +import 'package:image_picker/image_picker.dart'; +import 'package:client/mypage/myhelp_memorial.dart'; +import 'package:client/mypage/myhelp_watch_others.dart'; +import 'package:client/sign/password_reset.dart'; +import 'package:client/style.dart'; +import 'package:intl/intl.dart'; +import 'dart:convert'; +import 'package:flutter/services.dart'; +import 'package:exif/exif.dart'; +import 'package:http/http.dart' as http; +import 'package:http_parser/http_parser.dart'; +import 'package:dio/dio.dart'; +import 'package:http_parser/http_parser.dart'; +import 'package:client/sign/sign_in.dart' as sign_in; + +import 'myhelp_con.dart'; + +/// ๋„์›€๋ง +class MyHelpMainPage extends StatefulWidget { + static Future navigatorPush(BuildContext context) async { + return Navigator.push( + context, + MaterialPageRoute( + builder: (_) => MyHelpMainPage(), + ), + ); + } + + @override + _MyHelpMainPageState createState() => _MyHelpMainPageState(); +} + +class _MyHelpMainPageState extends State { + + @override + void initState() { + super.initState(); + } + + @override + void dispose() async { + super.dispose(); + } + + @override + Widget build(BuildContext context) { + MediaQueryData deviceData = MediaQuery.of(context); + Size screenSize = deviceData.size; + return + Scaffold( + backgroundColor: Color(0xffF2F4F6), + appBar: PreferredSize( + preferredSize: Size.fromHeight(72), + child: AppBar( + title: + Container( + height: 50, + width: screenSize.width, + child: Column( + children: [ + SizedBox(height: 24,), + Center( + child: Padding( + padding: EdgeInsets.only(right: 60), + child: Text( + '๋„์›€๋ง', + style: textStyle.bk20normal, + ), + )), + ],) + ), + backgroundColor: Colors.transparent, + elevation: 0.0, + iconTheme: IconThemeData(color: Colors.black), + centerTitle: true, + leading: Padding( + padding: EdgeInsets.only(top: 20), + child: IconButton( + icon: Icon(Icons.arrow_back_ios_rounded, color: Colors.black), + onPressed: () => Navigator.of(context).pop(), + ), + ), + ), + ),extendBodyBehindAppBar: false, + body: Container( + width: screenSize.width, + height: screenSize.height, + child: SingleChildScrollView( + padding: EdgeInsets.fromLTRB(16, 0, 16, 16), + scrollDirection: Axis.vertical, + child: + Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Container( + padding: EdgeInsets.all(16), + height: 49, + width: screenSize.width, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(16), + ), + child: InkWell( + onTap: (){ + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => MyHelpHelpPage())); + }, + child: Row( + children: [ + Container(width: 310, + child: Text('๋„์›€๋ณด๋‚ด๊ธฐ ๋„์›€๋ง',style: textStyle.bk14normal,), + ), + SvgPicture.asset( + 'assets/images/memorial/blue_arrow.svg', + //fit: BoxFit.cover, + ), + ], + ) + ), + ), + SizedBox(height: 16,), + Container( + padding: EdgeInsets.all(16), + height: 49, + width: screenSize.width, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(16), + ), + child: InkWell( + onTap: (){ + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => MyHelpMemorialPage())); + }, + child: Row( + children: [ + Container(width: 310, + child: Text('๊ธฐ์–ตํ• ๊ฐœ ๋„์›€๋ง',style: textStyle.bk14normal,), + ), + SvgPicture.asset( + 'assets/images/memorial/blue_arrow.svg', + //fit: BoxFit.cover, + ), + ], + ) + ), + ), + SizedBox(height: 16,), + Container( + padding: EdgeInsets.all(16), + height: 49, + width: screenSize.width, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(16), + ), + child: InkWell( + onTap: (){ + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => MyHelpWatchOthersPage())); + }, + child: Row( + children: [ + Container(width: 310, + child: Text('ํ•จ๊ป˜ํ• ๊ฐœ ๋„์›€๋ง',style: textStyle.bk14normal,), + ), + SvgPicture.asset( + 'assets/images/memorial/blue_arrow.svg', + //fit: BoxFit.cover, + ), + ], + ) + ), + ), + + ], + ), + ), + ) + + ); + + } +} diff --git a/client/lib/mypage/myhelp_memorial.dart b/client/lib/mypage/myhelp_memorial.dart new file mode 100644 index 0000000..04c349a --- /dev/null +++ b/client/lib/mypage/myhelp_memorial.dart @@ -0,0 +1,239 @@ +import 'dart:async'; +import 'dart:convert'; +import 'package:flutter/material.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter_svg/svg.dart'; +import 'package:fluttertoast/fluttertoast.dart'; +import 'package:http/http.dart' as http; +import 'package:client/progressbar/animation_progressbar.dart'; +import 'package:client/style.dart'; +import 'package:just_audio/just_audio.dart'; +import 'package:client/conversation/intro/intro2.dart' as intro2; +import 'package:flutter_gif/flutter_gif.dart'; + +/// ๊ธฐ์–ตํ• ๊ฐœ_์ฝ”์น˜๋งˆํฌ +class MyHelpMemorialPage extends StatefulWidget { + + static Future navigatorPush(BuildContext context) async { + return Navigator.push( + context, + MaterialPageRoute( + builder: (_) => MyHelpMemorialPage(), + ), + ); + } + + @override + _MyHelpMemorialPageState createState() => _MyHelpMemorialPageState(); +} + +class _MyHelpMemorialPageState extends State { + + FocusNode _focusNode = FocusNode(); + + @override + void initState() { + super.initState(); + _focusNode.addListener(_onFocusChange); + } + + void _onFocusChange() { + if (_focusNode.hasFocus) { + // ํ‚ค๋ณด๋“œ ์˜ฌ๋ฆฌ๊ธฐ + FocusScope.of(context).requestFocus(_focusNode); + } + } + + @override + void dispose() async { + super.dispose(); + } + + int nextPage = 0; + + List introText =[]; + + int nextQuestion = 0; + + @override + Widget build(BuildContext context) { + MediaQueryData deviceData = MediaQuery.of(context); + Size screenSize = deviceData.size; + return + Container( + decoration: BoxDecoration( + gradient: LinearGradient( + begin: Alignment.topRight, + end: Alignment.bottomLeft, + colors: [ + Color(0xffE4ECFF), + Color(0xffA2BEFF), + ], + ) + ), + child: GestureDetector( + onTap: (){ + print(nextQuestion); + if(nextPage == 3){ + + } else if(nextPage < 3){ + nextPage++; + } + + setState(() { + }); + }, + child: Scaffold( + backgroundColor: Colors.transparent, + appBar: AppBar( + //title: Text("๊ธฐ์–ตํ• ๊ฐœ", style: TextStyle(fontSize:16, color: Colors.white ),), + //centerTitle: true, + backgroundColor: Colors.transparent, + elevation: 0.0, + automaticallyImplyLeading: false, + ),extendBodyBehindAppBar: true, + body: + Container( + width: screenSize.width, + child: Column( + children: [ + + Stack( + children: [ + Padding(padding: EdgeInsets.only(left: 0, top: 138), + child: Container( + width: 275, + height: 605, + //color: Colors.white, + child: ClipRRect( + borderRadius: BorderRadius.circular(24.0), + child: Container( + decoration: BoxDecoration( + boxShadow: [ + BoxShadow( + color: Colors.black.withOpacity(0.8), + blurRadius: 5.0, + spreadRadius: 0.0, + offset: const Offset(0,7), + ) + ], + color: Colors.white, + borderRadius: BorderRadius.circular(16), + ), + width: 275, + height: 595, + //color: Colors.white, + ), + + ), + ), + ), + + if(nextPage == 0)...[ + Padding(padding: EdgeInsets.only(left: 8, top: 145), + child: Container( + width: 260, + height: 575, + child: ClipRRect( + borderRadius: BorderRadius.circular(24.0), + child: Image.asset('assets/images/conversation/intro/iscreen1.png', + fit: BoxFit.fill,) + ), + ), + ), + ] else if(nextPage == 1)...[ + Padding(padding: EdgeInsets.only(left: 8, top: 145), + child: Container( + width: 260, + height: 575, + child: ClipRRect( + borderRadius: BorderRadius.circular(24.0), + child: Image.asset('assets/images/conversation/intro/iscreen2.png', + fit: BoxFit.fill,) + ), + ), + ), + ] else if(nextPage == 2)...[ + Padding(padding: EdgeInsets.only(left: 8, top: 145), + child: Container( + width: 260, + height: 575, + child: ClipRRect( + borderRadius: BorderRadius.circular(24.0), + child: Image.asset('assets/images/conversation/intro/iscreen3.png', + fit: BoxFit.fill,) + ), + ), + ), + ] else if(nextPage == 3)...[ + Padding(padding: EdgeInsets.only(left: 8, top: 145), + child: Container( + width: 260, + height: 575, + child: ClipRRect( + borderRadius: BorderRadius.circular(24.0), + child: Image.asset('assets/images/conversation/intro/iscreen4.png', + fit: BoxFit.fill,) + ), + ), + ), + ], + + Padding(padding: EdgeInsets.only(left: 120, top: 706), + child: Container( + width: 40, + height: 2, + child: Container( + width: 40, height: 2, + color: Colors.white, + ) + ), + ), + ], + ) + ], + ), + ), + bottomSheet: Padding( + padding: EdgeInsets.only( + bottom: MediaQuery.of(context).viewInsets.bottom * 0.001), + child: Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + if(nextPage == 3)...[ + Container( + color: Color(0xffFFFFFF).withOpacity(0.0), + child: Padding( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 24), + child: Container( + width: screenSize.width, + height: 40, + child: ElevatedButton( + style: buttonChart().bluebtn3, + onPressed: () { + Navigator.pop(context); // intro2๋กœ ๋Œ์•„๊ฐ€๊ธฐ + setState(() { + + }); + }, + child: Text("ํ™•์ธ", style: TextStyle( + fontFamily: 'Pretendard', + fontSize: 16, fontWeight: FontWeight.w500, color: Color(0xffFFFFFF))), + ), + ),), + ), + ] + ], + ), + ) + + ), + ) + + ); + + } +} diff --git a/client/lib/mypage/myhelp_watch_others.dart b/client/lib/mypage/myhelp_watch_others.dart new file mode 100644 index 0000000..10fba67 --- /dev/null +++ b/client/lib/mypage/myhelp_watch_others.dart @@ -0,0 +1,242 @@ +import 'dart:async'; +import 'dart:convert'; +import 'package:flutter/material.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter_svg/svg.dart'; +import 'package:fluttertoast/fluttertoast.dart'; +import 'package:http/http.dart' as http; +import 'package:client/conversation/early_period/memory2.dart'; +import 'package:client/progressbar/animation_progressbar.dart'; +import 'package:client/style.dart'; +import 'package:just_audio/just_audio.dart'; +import 'package:client/conversation/intro/intro2.dart' as intro2; +import 'package:flutter_gif/flutter_gif.dart'; + +/// ํ•จ๊ป˜ํ• ๊ฐœ_์ฝ”์น˜๋งˆํฌ +class MyHelpWatchOthersPage extends StatefulWidget { + + static Future navigatorPush(BuildContext context) async { + return Navigator.push( + context, + MaterialPageRoute( + builder: (_) => MyHelpWatchOthersPage(), + ), + ); + } + + @override + _MyHelpWatchOthersPageState createState() => _MyHelpWatchOthersPageState(); +} + +class _MyHelpWatchOthersPageState extends State { + + FocusNode _focusNode = FocusNode(); + + @override + void initState() { + super.initState(); + _focusNode.addListener(_onFocusChange); + } + + void _onFocusChange() { + if (_focusNode.hasFocus) { + // ํ‚ค๋ณด๋“œ ์˜ฌ๋ฆฌ๊ธฐ + FocusScope.of(context).requestFocus(_focusNode); + } + } + + @override + void dispose() async { + super.dispose(); + } + + int nextPage = 0; + + int nextQuestion = 0; + + @override + Widget build(BuildContext context) { + MediaQueryData deviceData = MediaQuery.of(context); + Size screenSize = deviceData.size; + return + Container( + decoration: BoxDecoration( + gradient: LinearGradient( + begin: Alignment.topRight, + end: Alignment.bottomLeft, + colors: [ + Color(0xffE4ECFF), + Color(0xffA2BEFF), + ], + ) + ), + child: GestureDetector( + onTap: (){ + print(nextQuestion); + if(nextPage == 3){ + // Navigator.pop(context); // early2๋กœ ๊ฐ€๊ธฐ + // intro2.player2.setAsset(intro2.voice[2]); + // intro2.player2.play(); + } else if(nextPage < 3){ + nextPage++; + } + + setState(() { + }); + }, + child: Scaffold( + backgroundColor: Colors.transparent, + appBar: AppBar( + //title: Text("๊ธฐ์–ตํ• ๊ฐœ", style: TextStyle(fontSize:16, color: Colors.white ),), + //centerTitle: true, + backgroundColor: Colors.transparent, + elevation: 0.0, + automaticallyImplyLeading: false, + ),extendBodyBehindAppBar: true, + + body: + Container( + width: screenSize.width, + child: Column( + children: [ + Stack( + children: [ + Padding(padding: EdgeInsets.only(left: 0, top: 138), + child: Container( + width: 275, + height: 605, + //color: Colors.white, + child: ClipRRect( + borderRadius: BorderRadius.circular(24.0), + child: Container( + decoration: BoxDecoration( + boxShadow: [ + BoxShadow( + color: Colors.black.withOpacity(0.8), + blurRadius: 5.0, + spreadRadius: 0.0, + offset: const Offset(0,7), + ) + ], + color: Colors.white, + borderRadius: BorderRadius.circular(16), + ), + width: 275, + height: 595, + //color: Colors.white, + ), + + ), + ), + ), + + if(nextPage == 0)...[ + Padding(padding: EdgeInsets.only(left: 6, top: 145), + child: Container( + width: 260, + height: 575, + child: ClipRRect( + borderRadius: BorderRadius.circular(24.0), + child: Image.asset('assets/images/conversation/early/screen01.png', + fit: BoxFit.fill,) + ), + ), + ), + ] else if(nextPage == 1)...[ + Padding(padding: EdgeInsets.only(left: 6, top: 145), + child: Container( + width: 260, + height: 575, + child: ClipRRect( + borderRadius: BorderRadius.circular(24.0), + child: Image.asset('assets/images/conversation/early/screen02.png', + fit: BoxFit.fill,) + ), + ), + ), + ] else if(nextPage == 2)...[ + Padding(padding: EdgeInsets.only(left:6, top: 145), + child: Container( + width: 260, + height: 575, + child: ClipRRect( + borderRadius: BorderRadius.circular(24.0), + child: Image.asset('assets/images/conversation/early/screen03.png', + fit: BoxFit.fill,) + ), + ), + ), + ] else if(nextPage == 3)...[ + Padding(padding: EdgeInsets.only(left: 6, top: 145), + child: Container( + width: 260, + height: 575, + child: ClipRRect( + borderRadius: BorderRadius.circular(24.0), + child: Image.asset('assets/images/conversation/early/screen04.png', + fit: BoxFit.fill,) + ), + ), + ), + ], + + Padding(padding: EdgeInsets.only(left: 120, top: 706), + child: Container( + width: 40, + height: 2, + child: Container( + width: 40, height: 2, + color: Colors.white, + ) + ), + ), + ], + ) + ], + ), + ), + + bottomSheet: Padding( + padding: EdgeInsets.only( + bottom: MediaQuery.of(context).viewInsets.bottom * 0.001), + child: Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + if(nextPage == 3)...[ + Container( + color: Color(0xffFFFFFF).withOpacity(0), + child: Padding( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 24), + child: Container( + + width: screenSize.width, + height: 40, + child: ElevatedButton( + style: buttonChart().bluebtn3, + onPressed: () { + Navigator.pop(context); // intro2๋กœ ๋Œ์•„๊ฐ€๊ธฐ + setState(() { + + }); + }, + child: Text("ํ™•์ธ", style: TextStyle( + fontFamily: 'Pretendard', + fontSize: 16, fontWeight: FontWeight.w500, color: Color(0xffFFFFFF))), + ), + ),), + ), + ] + ], + ), + ), + + ), + ) + + ); + + } +} diff --git a/client/lib/mypage/mypage_main.dart b/client/lib/mypage/mypage_main.dart new file mode 100644 index 0000000..b831708 --- /dev/null +++ b/client/lib/mypage/mypage_main.dart @@ -0,0 +1,319 @@ +import 'dart:async'; +import 'dart:io'; +import 'package:flutter/material.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:get/get.dart'; +import 'package:flutter/cupertino.dart'; +import 'dart:convert'; +import 'package:http/http.dart' as http; +import 'package:client/mypage/account_manage_main.dart'; +import 'package:client/mypage/announcement_main.dart'; +import 'package:client/mypage/mycoments.dart'; +import 'package:client/mypage/myhelp_main.dart'; +import 'package:client/style.dart'; +import 'package:client/sign/sign_in.dart' as sign_in; +import 'package:dio/dio.dart'; + + +class MypagePage extends StatefulWidget { + static Future navigatorPush(BuildContext context) async { + return Navigator.push( + context, + MaterialPageRoute( + builder: (_) => MypagePage(), + ), + ); + } + + @override + _MypagePageState createState() => _MypagePageState(); +} + +class _MypagePageState extends State { + + late Map parsedResponseUser; // ์‚ฌ์šฉ์ž ์ •๋ณด + + bool checkUser = false; + + // ์‚ฌ์šฉ์ž ์ •๋ณด ์กฐํšŒ : ๋Œ€ํ™”ํ•˜๊ธฐ๊ฐ€ 1์ด๋ฉด ์ธํŠธ๋กœ ์•„๋‹ˆ๋ฉด ๊ทธ๋ƒฅ ํ™ˆ์œผ๋กœ ์ด๋™ + void fetchUserInfo(String aToken) async { + // API ์—”๋“œํฌ์ธํŠธ URL + print("๋ฐ›ํ† :" + aToken); + String apiUrl = 'http://3.38.1.125:8080/user/info'; // ์‹ค์ œ API ์—”๋“œํฌ์ธํŠธ๋กœ ๋ณ€๊ฒฝํ•˜์„ธ์š” + + // ํ—ค๋” ์ •๋ณด ์„ค์ • + Map headers = { + 'Authorization': 'Bearer $aToken', // ์˜ˆ: ์ธ์ฆ ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ• + 'Content-Type': 'application/json', // ์˜ˆ: JSON ์š”์ฒญ์ธ ๊ฒฝ์šฐ ํ—ค๋” ์„ค์ • + }; + + // HTTP GET ์š”์ฒญ ๋ณด๋‚ด๊ธฐ + var response = await http.get( + Uri.parse(apiUrl), + headers: headers, // ํ—ค๋” ์ถ”๊ฐ€ + ); + + // HTTP ์‘๋‹ต ์ƒํƒœ ํ™•์ธ + if (response.statusCode == 200) { + // ์‘๋‹ต ๋ฐ์ดํ„ฐ ์ฒ˜๋ฆฌ + print('์„œ๋ฒ„๋กœ๋ถ€ํ„ฐ ๋ฐ›์€ ๋‚ด์šฉ ๋ฐ์ดํ„ฐ(์‚ฌ์šฉ์ž ์ •๋ณด): ${response.body}'); + var jsonResponse = utf8.decode(response.bodyBytes); + + checkUser = true; + parsedResponseUser = json.decode(jsonResponse); + setState(() { + + }); + + } else { + // ์š”์ฒญ์ด ์‹คํŒจํ•œ ๊ฒฝ์šฐ ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌ + print('HTTP ์š”์ฒญ ์‹คํŒจ: ${response.statusCode}'); + } + } + + + @override + void initState() { + super.initState(); + SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: [SystemUiOverlay.top]); + fetchUserInfo(sign_in.userAccessToken); + } + + @override + void dispose() async { + super.dispose(); + } + + bool time = false; + + @override + Widget build(BuildContext context) { + MediaQueryData deviceData = MediaQuery.of(context); + Size screenSize = deviceData.size; + return + Container( + color: Color(0xffDDE7FD), + child: Scaffold( + backgroundColor: Colors.transparent, + appBar: AppBar( + title: Container( + width: screenSize.width, + height: 46, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox(height: 18,), + SvgPicture.asset( + 'assets/images/logo/pup_logo.svg', + height: 25.41, + width: 110.19, + fit: BoxFit.cover, + ), + ], + ), + ), + backgroundColor: Colors.transparent, + elevation: 0.0, + automaticallyImplyLeading: false, + ), + body: Container( + child: SingleChildScrollView( + padding: EdgeInsets.fromLTRB(0, 16, 0, 16), + child: + Column( + children: [ + if(checkUser)...[ + Row(children: [ + SizedBox(width: 16,), + Text('${parsedResponseUser['nickname']}',style: textStyle.bk20semibold,), + Text('๋‹˜',style: textStyle.bk16normal,), + ],), + SizedBox(height: 8,), + Row(children: [ + SizedBox(width: 16,), + Text('${parsedResponseUser['puppyName']}',style: textStyle.bk16semibold,), + Text('(${parsedResponseUser['puppyType']}, ${parsedResponseUser['puppyAge']}์‚ด)์˜ ๋ฐ˜๋ ค์ธ',style: textStyle.bk12normal,), + ],), + ], + SizedBox(height: 32,), + Row(children: [ + SizedBox(width: 16,), + Container( + //padding: EdgeInsets.fromLTRB(14, 13, 0, 15), + width: 168, + height: 108, + decoration: BoxDecoration( + color: Color(0xffF2F4F6), + borderRadius: BorderRadius.circular(16), + ), + child: InkWell( + onTap: (){ + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => AccountManageMainPage())); + }, + child: Container( + //padding: EdgeInsets.fromLTRB(14, 13, 0, 15), + decoration: BoxDecoration( + color: Color(0xffF2F4F6), + borderRadius: BorderRadius.circular(16), + ), + child:Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SizedBox(height: 32,), + Image.asset( + 'assets/images/mypage/setting.png', + width: 28, + height: 28, + ), + SizedBox(height: 16,), + Text('๊ณ„์ • ๊ด€๋ฆฌ',style: textStyle.bk12midium,), + ],) + + ), + ), + ), + SizedBox(width: 16,), + Container( + //padding: EdgeInsets.fromLTRB(14, 13, 0, 15), + width: 168, + height: 108, + decoration: BoxDecoration( + color: Color(0xffF2F4F6), + borderRadius: BorderRadius.circular(16), + ), + child: InkWell( + onTap: (){ + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => MyCommentsPage())); + }, + child: Container( + //padding: EdgeInsets.fromLTRB(14, 13, 0, 15), + decoration: BoxDecoration( + color: Color(0xffF2F4F6), + borderRadius: BorderRadius.circular(16), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SizedBox(height: 28,), + SvgPicture.asset( + 'assets/images/mypage/comment.svg', + ), + SizedBox(height: 8,), + Text('๋‚ด๊ฐ€ ์“ด ๋Œ“๊ธ€',style: textStyle.bk12midium,), + ],) + ), + ), + ), + ],), + SizedBox(height: 16,), + Row( + children: [ + SizedBox(width: 16,), + Container( + //padding: EdgeInsets.fromLTRB(14, 13, 0, 15), + width: 168, + height: 108, + decoration: BoxDecoration( + color: Color(0xffF2F4F6), + borderRadius: BorderRadius.circular(16), + ), + child: InkWell( + onTap: (){ + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => MyHelpMainPage())); + }, + child: Container( + //padding: EdgeInsets.fromLTRB(14, 13, 0, 15), + decoration: BoxDecoration( + color: Color(0xffF2F4F6), + borderRadius: BorderRadius.circular(16), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SizedBox(height: 32,), + SvgPicture.asset( + 'assets/images/mypage/help.svg', + ), + SizedBox(height: 8,), + Text('๋„์›€๋ง',style: textStyle.bk12midium,), + ],) + ), + ), + ), + SizedBox(width: 16,), + Container( + //padding: EdgeInsets.fromLTRB(14, 13, 0, 15), + width: 168, + height: 108, + decoration: BoxDecoration( + color: Color(0xffF2F4F6), + borderRadius: BorderRadius.circular(16), + ), + child: InkWell( + onTap: (){ + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => AnnouncementMainPage())); + }, + child: Container( + //padding: EdgeInsets.fromLTRB(14, 13, 0, 15), + decoration: BoxDecoration( + color: Color(0xffF2F4F6), + borderRadius: BorderRadius.circular(16), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SizedBox(height: 24,), + SvgPicture.asset( + 'assets/images/mypage/announce.svg', + ), + SizedBox(height: 8,), + Text('๊ณต์ง€์‚ฌํ•ญ',style: textStyle.bk12midium,), + ],) + ), + ), + ), + ], + ), + SizedBox(height: 117,), + Stack( + children: [ + Container( + padding: EdgeInsets.only(top: 28), + width: screenSize.width, + child: Image.asset( + 'assets/images/mypage/cloud.png', + fit: BoxFit.fill, + ), + ), + Padding( + padding: EdgeInsets.only(left:88,), + child: SvgPicture.asset( + 'assets/images/mypage/smart.svg', + ),), + ], + ) + ], + ), + ), + ), + ) + ); + + } +} + + diff --git a/client/lib/progressbar/animation_progressbar.dart b/client/lib/progressbar/animation_progressbar.dart new file mode 100644 index 0000000..824db44 --- /dev/null +++ b/client/lib/progressbar/animation_progressbar.dart @@ -0,0 +1,201 @@ +import 'package:flutter/animation.dart'; +import 'package:flutter/widgets.dart'; + +String _defaultFormatValue(double value, int? fixed) { + if (fixed != null) { + return value.toStringAsFixed(fixed); + } else { + return value.toStringAsFixed(value.truncateToDouble() == value ? 0 : 2); + } +} + +class FAProgressBar extends StatefulWidget { + FAProgressBar({ + Key? key, + this.currentValue = 0, + this.maxValue = 100, + this.size = 10, + this.animatedDuration = const Duration(milliseconds: 300), + this.direction = Axis.horizontal, + this.verticalDirection = VerticalDirection.down, + BorderRadiusGeometry? borderRadius, + this.border, + this.backgroundColor = const Color(0x00FFFFFF), + this.progressColor = const Color(0xFF83A8FF), + this.changeColorValue, + this.changeProgressColor = const Color(0xFF5F4B8B), + this.formatValue = _defaultFormatValue, + this.formatValueFixed, + this.displayText, + this.displayTextStyle = + const TextStyle(color: const Color(0xFFFFFFFF), fontSize: 12), + this.progressGradient + }) : _borderRadius = borderRadius ?? BorderRadius.circular(8), + super(key: key); + final double currentValue; + final double maxValue; + final double size; + final Duration animatedDuration; + final Axis direction; + final VerticalDirection verticalDirection; + final BorderRadiusGeometry _borderRadius; + final BoxBorder? border; + final Color backgroundColor; + final Color progressColor; + final int? changeColorValue; + final Color changeProgressColor; + final String Function(double value, int? fixed) formatValue; + final int? formatValueFixed; + final String? displayText; + final TextStyle displayTextStyle; + final Gradient? progressGradient; + + @override + _FAProgressBarState createState() => _FAProgressBarState(); +} + +class _FAProgressBarState extends State + with SingleTickerProviderStateMixin { + late Animation _animation; + late AnimationController _controller; + double _currentBegin = 0; + double _currentEnd = 0; + + @override + void initState() { + _controller = + AnimationController(duration: widget.animatedDuration, vsync: this); + _animation = Tween(begin: _currentBegin, end: _currentEnd) + .animate(_controller); + triggerAnimation(); + super.initState(); + } + + @override + void didUpdateWidget(FAProgressBar old) { + triggerAnimation(); + super.didUpdateWidget(old); + } + + void triggerAnimation() { + setState(() { + _currentBegin = _animation.value; + + if (widget.currentValue == 0 || widget.maxValue == 0) { + _currentEnd = 0; + } else { + _currentEnd = widget.currentValue / widget.maxValue; + } + + _animation = Tween(begin: _currentBegin, end: _currentEnd) + .animate(_controller); + }); + _controller.reset(); + _controller.duration = widget.animatedDuration; + _controller.forward(); + } + + @override + Widget build(BuildContext context) => AnimatedProgressBar( + animation: _animation, + widget: widget, + ); + + @override + void dispose() { + _controller.dispose(); + super.dispose(); + } +} + +class AnimatedProgressBar extends AnimatedWidget { + AnimatedProgressBar({ + Key? key, + required Animation animation, + required this.widget, + }) : super(key: key, listenable: animation); + + final FAProgressBar widget; + + double transformValue(x, begin, end, before) { + double y = (end * x - (begin - before)) * (1 / before); + return y < 0 ? 0 : ((y > 1) ? 1 : y); + } + + Widget build(BuildContext context) { + final animation = listenable as Animation; + Color progressColor = widget.progressColor; + + if (widget.changeColorValue != null) { + final _colorTween = ColorTween( + begin: widget.progressColor, + end: widget.changeProgressColor, + ); + + progressColor = _colorTween.transform(transformValue( + animation.value, + widget.changeColorValue, + widget.maxValue, + 5, + ))!; + } + + List progressWidgets = []; + Widget progressWidget = Container( + decoration: BoxDecoration( + color: widget.progressGradient != null ? null : progressColor, + gradient: widget.progressGradient, + borderRadius: widget._borderRadius, + border: widget.border, + ), + ); + progressWidgets.add(progressWidget); + + if (widget.displayText != null) { + Widget textProgress = Container( + alignment: widget.direction == Axis.horizontal + ? FractionalOffset(0.95, 0.5) + : (widget.verticalDirection == VerticalDirection.up + ? FractionalOffset(0.5, 0.05) + : FractionalOffset(0.5, 0.95)), + child: Text( + widget.formatValue.call( + animation.value * widget.maxValue, widget.formatValueFixed) + + widget.displayText!, + softWrap: false, + style: widget.displayTextStyle, + ), + ); + progressWidgets.add(textProgress); + } + + return Directionality( + textDirection: TextDirection.ltr, + child: Container( + width: widget.direction == Axis.vertical ? widget.size : null, + height: widget.direction == Axis.horizontal ? widget.size : null, + decoration: BoxDecoration( + color: widget.backgroundColor, + borderRadius: widget._borderRadius, + border: widget.border, + ), + child: Flex( + direction: widget.direction, + verticalDirection: widget.verticalDirection, + children: [ + Expanded( + flex: (animation.value * 100).toInt(), + child: Stack( + children: progressWidgets, + ), + ), + Expanded( + flex: 100 - (animation.value * 100).toInt(), + child: Container(), + ) + ], + ), + ), + ); + } +} diff --git a/client/lib/screen.dart b/client/lib/screen.dart new file mode 100644 index 0000000..34f10ea --- /dev/null +++ b/client/lib/screen.dart @@ -0,0 +1,95 @@ +/// ์˜ฎ๊ธฐ๊ธฐ ๊ฐ€๋Šฅ +import 'package:flutter/material.dart'; +import 'dart:async'; +import 'package:flutter/cupertino.dart'; +//import 'package:client/memorial/watch_others.dart'; +import 'home.dart'; +import 'memorial/memorial_main.dart'; +import 'memorial/watch_others.dart'; +import 'mypage/mypage_main.dart'; +import 'main.dart' as main; +//import 'memorial/memorial_main0919.dart'; + + +class MyScreenPage extends StatefulWidget { + const MyScreenPage({super.key, required this.title}); + + final String title; + + @override + State createState() => _MyScreenPageState(); +} + +class _MyScreenPageState extends State { + + int _selectedIndex = 0; + + final List _widgetOptions = [ + HomePage(), + MemorialMainPage(), + WatchOthersPage(), + MypagePage(), + ]; + + void _onItemTapped(int index) { + setState(() { + _selectedIndex = index; + }); + } + + // ๋ฉ”์ธ ์œ„์ ฏ + @override + Widget build(BuildContext context) { + MediaQueryData deviceData = MediaQuery.of(context); + Size screenSize = deviceData.size; + + return Scaffold( + body: Container( + width: screenSize.width, + child: _widgetOptions.elementAt(_selectedIndex), + ), + bottomNavigationBar: + Container( + height: 72, + width: screenSize.width, + child: BottomNavigationBar( + type: BottomNavigationBarType.fixed, + showSelectedLabels: false, + showUnselectedLabels: false, + // backgroundColor: Colors.black, + items: const [ + BottomNavigationBarItem( + icon: ImageIcon(AssetImage('assets/images/bottom_navigation/home.png')), + label: '', + ), + BottomNavigationBarItem( + icon: ImageIcon(AssetImage('assets/images/bottom_navigation/gallery.png')), + label: '', + ), + BottomNavigationBarItem( + icon: ImageIcon(AssetImage('assets/images/bottom_navigation/feed.png')), + label: '', + ), + BottomNavigationBarItem( + icon: ImageIcon(AssetImage('assets/images/bottom_navigation/my_page.png')), + label: '', + ), + ], + currentIndex: _selectedIndex, + // unselectedIconTheme: IconThemeData( + // color: Color(0xffD6CEFF), + // opacity: 0.5), + unselectedItemColor: Color(0xffC0D2FC), + selectedItemColor: Color(0xff83A8FF), + unselectedIconTheme: IconThemeData( + shadows: [Shadow(blurRadius: 10, color: Colors.black, offset: Offset.zero)], + opacity: 1.0), + selectedIconTheme: IconThemeData( + shadows: [Shadow(blurRadius: 3, color: Colors.black, offset: Offset.zero)], + opacity: 100), + onTap: _onItemTapped, + ), + ) + ); + } +} \ No newline at end of file diff --git a/client/lib/sign/login_screen.dart b/client/lib/sign/login_screen.dart new file mode 100644 index 0000000..91ed381 --- /dev/null +++ b/client/lib/sign/login_screen.dart @@ -0,0 +1,492 @@ +// import 'package:flutter/material.dart'; +// import 'package:firebase_auth/firebase_auth.dart'; +// +// class LoginSignupScreen extends StatefulWidget { +// const LoginSignupScreen({Key? key}) : super(key: key); +// +// @override +// _LoginSignupScreenState createState() => _LoginSignupScreenState(); +// } +// +// class _LoginSignupScreenState extends State { +// final _authentication = FirebaseAuth.instance; +// +// bool isSignupScreen = true; +// final _formKey = GlobalKey(); +// String userName = ''; +// String userEmail = ''; +// String userPassword = ''; +// +// void _tryValidation() { +// final isValid = _formKey.currentState!.validate(); +// if (isValid) { +// _formKey.currentState!.save(); +// } +// } +// +// @override +// Widget build(BuildContext context) { +// return Scaffold( +// body: GestureDetector( +// onTap: () { +// FocusScope.of(context).unfocus(); +// }, +// child: Stack( +// children: [ +// Positioned( +// top: 0, +// right: 0, +// left: 0, +// child: Container( +// height: 300, +// decoration: BoxDecoration( +// image: DecorationImage( +// image: AssetImage('image/red.jpg'), fit: BoxFit.fill), +// ), +// child: Container( +// padding: EdgeInsets.only(top: 90, left: 20), +// child: Column( +// crossAxisAlignment: CrossAxisAlignment.start, +// children: [ +// RichText( +// text: TextSpan( +// text: 'Welcome', +// style: TextStyle( +// letterSpacing: 1.0, +// fontSize: 25, +// color: Colors.white), +// children: [ +// TextSpan( +// text: +// isSignupScreen ? ' to Yummy chat!' : ' back', +// style: TextStyle( +// letterSpacing: 1.0, +// fontSize: 25, +// color: Colors.white, +// fontWeight: FontWeight.bold, +// ), +// ), +// ], +// ), +// ), +// SizedBox( +// height: 5.0, +// ), +// Text( +// isSignupScreen +// ? 'Signup to continue' +// : 'Signin to continue', +// style: TextStyle( +// letterSpacing: 1.0, +// color: Colors.white, +// ), +// ), +// ], +// ), +// ), +// ), +// ), +// //๋ฐฐ๊ฒฝ +// AnimatedPositioned( +// duration: Duration(milliseconds: 500), +// curve: Curves.easeIn, +// top: 180, +// child: AnimatedContainer( +// duration: Duration(milliseconds: 500), +// curve: Curves.easeIn, +// padding: EdgeInsets.all(20.0), +// height: isSignupScreen ? 280.0 : 250.0, +// width: MediaQuery.of(context).size.width - 40, +// margin: EdgeInsets.symmetric(horizontal: 20.0), +// decoration: BoxDecoration( +// color: Colors.white, +// borderRadius: BorderRadius.circular(15.0), +// boxShadow: [ +// BoxShadow( +// color: Colors.black.withOpacity(0.3), +// blurRadius: 15, +// spreadRadius: 5), +// ], +// ), +// child: SingleChildScrollView( +// padding: EdgeInsets.only(bottom: 20), +// child: Column( +// children: [ +// Row( +// mainAxisAlignment: MainAxisAlignment.spaceAround, +// children: [ +// GestureDetector( +// onTap: () { +// setState(() { +// isSignupScreen = false; +// }); +// }, +// child: Column( +// children: [ +// Text( +// 'LOGIN', +// ), +// if (!isSignupScreen) +// Container( +// margin: EdgeInsets.only(top: 3), +// height: 2, +// width: 55, +// color: Colors.orange, +// ) +// ], +// ), +// ), +// GestureDetector( +// onTap: () { +// setState(() { +// isSignupScreen = true; +// }); +// }, +// child: Column( +// children: [ +// Text( +// 'SIGNUP', +// ), +// if (isSignupScreen) +// Container( +// margin: EdgeInsets.only(top: 3), +// height: 2, +// width: 55, +// color: Colors.orange, +// ) +// ], +// ), +// ) +// ], +// ), +// if (isSignupScreen) +// Container( +// margin: EdgeInsets.only(top: 20), +// child: Form( +// key: _formKey, +// child: Column( +// children: [ +// TextFormField( +// key: ValueKey(1), +// validator: (value) { +// if (value!.isEmpty || value.length < 4) { +// return 'Please enter at least 4 characters'; +// } +// return null; +// }, +// onSaved: (value) { +// userName = value!; +// }, +// onChanged: (value) { +// userName = value; +// }, +// decoration: InputDecoration( +// prefixIcon: Icon( +// Icons.account_circle, +// ), +// enabledBorder: OutlineInputBorder( +// borderRadius: BorderRadius.all( +// Radius.circular(35.0), +// ), +// ), +// focusedBorder: OutlineInputBorder( +// borderRadius: BorderRadius.all( +// Radius.circular(35.0), +// ), +// ), +// hintText: 'User name', +// contentPadding: EdgeInsets.all(10)), +// ), +// SizedBox( +// height: 8, +// ), +// TextFormField( +// keyboardType: TextInputType.emailAddress, +// key: ValueKey(2), +// validator: (value) { +// if (value!.isEmpty || +// !value.contains('@')) { +// return 'Please enter a valid email address.'; +// } +// return null; +// }, +// onSaved: (value) { +// userEmail = value!; +// }, +// onChanged: (value) { +// userEmail = value; +// }, +// decoration: InputDecoration( +// prefixIcon: Icon( +// Icons.email, +// ), +// enabledBorder: OutlineInputBorder( +// borderRadius: BorderRadius.all( +// Radius.circular(35.0), +// ), +// ), +// focusedBorder: OutlineInputBorder( +// borderRadius: BorderRadius.all( +// Radius.circular(35.0), +// ), +// ), +// hintText: 'email', +// contentPadding: EdgeInsets.all(10)), +// ), +// SizedBox( +// height: 8, +// ), +// TextFormField( +// obscureText: true, +// key: ValueKey(3), +// validator: (value) { +// if (value!.isEmpty || value.length < 6) { +// return 'Password must be at least 7 characters long.'; +// } +// return null; +// }, +// onSaved: (value) { +// userPassword = value!; +// }, +// onChanged: (value) { +// userPassword = value; +// }, +// decoration: InputDecoration( +// prefixIcon: Icon( +// Icons.lock, +// ), +// enabledBorder: OutlineInputBorder( +// borderRadius: BorderRadius.all( +// Radius.circular(35.0), +// ), +// ), +// focusedBorder: OutlineInputBorder( +// borderRadius: BorderRadius.all( +// Radius.circular(35.0), +// ), +// ), +// hintText: 'password', +// hintStyle: TextStyle( +// fontSize: 14,), +// contentPadding: EdgeInsets.all(10)), +// ) +// ], +// ), +// ), +// ), +// if (!isSignupScreen) +// Container( +// margin: EdgeInsets.only(top: 20), +// child: Form( +// key: _formKey, +// child: Column( +// children: [ +// TextFormField( +// key: ValueKey(4), +// validator: (value) { +// if (value!.isEmpty || +// !value.contains('@')) { +// return 'Please enter a valid email address.'; +// } +// return null; +// }, +// onSaved: (value) { +// userEmail = value!; +// }, +// onChanged: (value) { +// userEmail = value; +// }, +// decoration: InputDecoration( +// prefixIcon: Icon( +// Icons.email, +// ), +// enabledBorder: OutlineInputBorder( +// borderRadius: BorderRadius.all( +// Radius.circular(35.0), +// ), +// ), +// focusedBorder: OutlineInputBorder( +// borderRadius: BorderRadius.all( +// Radius.circular(35.0), +// ), +// ), +// hintText: 'email', +// hintStyle: TextStyle( +// fontSize: 14,), +// contentPadding: EdgeInsets.all(10)), +// ), +// SizedBox( +// height: 8.0, +// ), +// TextFormField( +// key: ValueKey(5), +// validator: (value) { +// if (value!.isEmpty || value.length < 6) { +// return 'Password must be at least 7 characters long.'; +// } +// return null; +// }, +// onSaved: (value) { +// userPassword = value!; +// }, +// onChanged: (value) { +// userPassword = value; +// }, +// decoration: InputDecoration( +// prefixIcon: Icon( +// Icons.lock, +// ), +// enabledBorder: OutlineInputBorder( +// borderRadius: BorderRadius.all( +// Radius.circular(35.0), +// ), +// ), +// focusedBorder: OutlineInputBorder( +// borderRadius: BorderRadius.all( +// Radius.circular(35.0), +// ), +// ), +// hintText: 'password', +// hintStyle: TextStyle( +// fontSize: 14,), +// contentPadding: EdgeInsets.all(10)), +// ) +// ], +// ), +// ), +// ) +// ], +// ), +// ), +// ), +// ), +// //ํ…์ŠคํŠธ ํผ ํ•„๋“œ +// AnimatedPositioned( +// duration: Duration(milliseconds: 500), +// curve: Curves.easeIn, +// top: isSignupScreen ? 430 : 390, +// right: 0, +// left: 0, +// child: Center( +// child: Container( +// padding: EdgeInsets.all(15), +// height: 90, +// width: 90, +// decoration: BoxDecoration( +// color: Colors.white, +// borderRadius: BorderRadius.circular(50)), +// child: GestureDetector( +// onTap: () async { +// if (isSignupScreen) { +// _tryValidation(); +// +// try { +// final newUser = await _authentication +// .createUserWithEmailAndPassword( +// email: userEmail, +// password: userPassword, +// ); +// +// if (newUser.user != null) { +// Navigator.push( +// context, +// MaterialPageRoute( +// builder: (context) { +// }, +// ), +// ); +// } +// } catch (e) { +// print(e); +// ScaffoldMessenger.of(context).showSnackBar( +// SnackBar( +// content: +// Text('Please check your email and password'), +// backgroundColor: Colors.blue, +// ), +// ); +// } +// } +// if (!isSignupScreen) { +// _tryValidation(); +// +// try { +// final newUser = +// await _authentication.signInWithEmailAndPassword( +// email: userEmail, +// password: userPassword, +// ); +// if (newUser.user != null) { +// Navigator.push( +// context, +// MaterialPageRoute( +// builder: (context) { +// }, +// ), +// ); +// } +// }catch(e){ +// print(e); +// } +// } +// }, +// child: Container( +// decoration: BoxDecoration( +// gradient: LinearGradient( +// colors: [Colors.orange, Colors.red], +// begin: Alignment.topLeft, +// end: Alignment.bottomRight), +// borderRadius: BorderRadius.circular(30), +// boxShadow: [ +// BoxShadow( +// color: Colors.black.withOpacity(0.3), +// spreadRadius: 1, +// blurRadius: 1, +// offset: Offset(0, 1), +// ), +// ], +// ), +// child: Icon( +// Icons.arrow_forward, +// color: Colors.white, +// ), +// ), +// ), +// ), +// ), +// ), +// //์ „์†ก๋ฒ„ํŠผ +// AnimatedPositioned( +// duration: Duration(milliseconds: 500), +// curve: Curves.easeIn, +// top: isSignupScreen +// ? MediaQuery.of(context).size.height - 125 +// : MediaQuery.of(context).size.height - 165, +// right: 0, +// left: 0, +// child: Column( +// children: [ +// Text(isSignupScreen ? 'or Signup with' : 'or Signin with'), +// SizedBox( +// height: 10, +// ), +// TextButton.icon( +// onPressed: () {}, +// style: TextButton.styleFrom( +// primary: Colors.white, +// minimumSize: Size(155, 40), +// shape: RoundedRectangleBorder( +// borderRadius: BorderRadius.circular(20)),), +// icon: Icon(Icons.add), +// label: Text('Google'), +// ), +// ], +// ), +// ), +// //๊ตฌ๊ธ€ ๋กœ๊ทธ์ธ ๋ฒ„ํŠผ +// ], +// ), +// ), +// ); +// } +// } \ No newline at end of file diff --git a/client/lib/sign/logintest.dart b/client/lib/sign/logintest.dart new file mode 100644 index 0000000..01fa496 --- /dev/null +++ b/client/lib/sign/logintest.dart @@ -0,0 +1,116 @@ +import 'package:firebase_auth/firebase_auth.dart'; +//import 'package:lottery_bang/main.dart'; + +class AuthManage{ + /// ํšŒ์›๊ฐ€์ž… + Future createUser(String email, String pw) async{ + try { + final credential = await FirebaseAuth.instance.createUserWithEmailAndPassword( + email: email, + password: pw, + ); + } on FirebaseAuthException catch (e) { + if (e.code == 'weak-password') { + print('The password provided is too weak.'); + } else if (e.code == 'email-already-in-use') { + print('The account already exists for that email.'); + } + } catch (e) { + print(e); + return false; + } + // authPersistence(); // ์ธ์ฆ ์˜์† + return true; + } + + /// ๋กœ๊ทธ์ธ + Future signIn(String email, String pw) async{ + try { + final credential = await FirebaseAuth.instance.signInWithEmailAndPassword( + email: email, + password: pw + ); + } on FirebaseAuthException catch (e) { + if (e.code == 'user-not-found') { + print('No user found for that email.'); + } else if (e.code == 'wrong-password') { + print('Wrong password provided for that user.'); + } + } catch (e) { + print(e); + return false; + } + // authPersistence(); // ์ธ์ฆ ์˜์† + return true; + } + /// ๋กœ๊ทธ์•„์›ƒ + void signOut() async{ + await FirebaseAuth.instance.signOut(); + } + + /// ํšŒ์›๊ฐ€์ž…, ๋กœ๊ทธ์ธ์‹œ ์‚ฌ์šฉ์ž ์˜์† + void authPersistence() async{ + await FirebaseAuth.instance.setPersistence(Persistence.NONE); + } + /// ์œ ์ € ์‚ญ์ œ + Future deleteUser(String email) async{ + final user = FirebaseAuth.instance.currentUser; + await user?.delete(); + } + + /// ํ˜„์žฌ ์œ ์ € ์ •๋ณด ์กฐํšŒ + User? getUser(){ + final user = FirebaseAuth.instance.currentUser; + if (user != null) { + // Name, email address, and profile photo URL + final name = user.displayName; + final email = user.email; + final photoUrl = user.photoURL; + + // Check if user's email is verified + final emailVerified = user.emailVerified; + + // The user's ID, unique to the Firebase project. Do NOT use this value to + // authenticate with your backend server, if you have one. Use + // User.getIdToken() instead. + final uid = user.uid; + } + return user; + } + /// ๊ณต๊ธ‰์ž๋กœ๋ถ€ํ„ฐ ์œ ์ € ์ •๋ณด ์กฐํšŒ + User? getUserFromSocial(){ + final user = FirebaseAuth.instance.currentUser; + if (user != null) { + for (final providerProfile in user.providerData) { + // ID of the provider (google.com, apple.cpm, etc.) + final provider = providerProfile.providerId; + + // UID specific to the provider + final uid = providerProfile.uid; + + // Name, email address, and profile photo URL + final name = providerProfile.displayName; + final emailAddress = providerProfile.email; + final profilePhoto = providerProfile.photoURL; + } + } + return user; + } + /// ์œ ์ € ์ด๋ฆ„ ์—…๋ฐ์ดํŠธ + Future updateProfileName(String name) async{ + final user = FirebaseAuth.instance.currentUser; + await user?.updateDisplayName(name); + } + /// ์œ ์ € url ์—…๋ฐ์ดํŠธ + Future updateProfileUrl(String url) async{ + final user = FirebaseAuth.instance.currentUser; + await user?.updatePhotoURL(url); + } + /// ๋น„๋ฐ€๋ฒˆํ˜ธ ์ดˆ๊ธฐํ™” ๋ฉ”์ผ๋ณด๋‚ด๊ธฐ + Future sendPasswordResetEmail(String email) async{ + await FirebaseAuth.instance.setLanguageCode("kr"); + await FirebaseAuth.instance.sendPasswordResetEmail(email:email); + } + + +} \ No newline at end of file diff --git a/client/lib/sign/logintest2.dart b/client/lib/sign/logintest2.dart new file mode 100644 index 0000000..9f5e38b --- /dev/null +++ b/client/lib/sign/logintest2.dart @@ -0,0 +1,138 @@ +import 'package:flutter/material.dart'; +import 'package:firebase_auth/firebase_auth.dart'; + +import '../main.dart'; + + +class MyApp extends StatelessWidget { + const MyApp({Key? key}) : super(key: key); + + // This widget is the root of your application. + @override + Widget build(BuildContext context) { + return MaterialApp( + title: 'Flutter Demo', + theme: ThemeData( + // This is the theme of your application. + // + // Try running your application with "flutter run". You'll see the + // application has a blue toolbar. Then, without quitting the app, try + // changing the primarySwatch below to Colors.green and then invoke + // "hot reload" (press "r" in the console where you ran "flutter run", + // or simply save your changes to "hot reload" in a Flutter IDE). + // Notice that the counter didn't reset back to zero; the application + // is not restarted. + primarySwatch: Colors.blue, + ), + home: const logintest2Page(title: 'Flutter Demo Home Page'), + ); + } +} + +class logintest2Page extends StatefulWidget { + const logintest2Page({Key? key, required this.title}) : super(key: key); + + // This widget is the home page of your application. It is stateful, meaning + // that it has a State object (defined below) that contains fields that affect + // how it looks. + + // This class is the configuration for the state. It holds the values (in this + // case the title) provided by the parent (in this case the App widget) and + // used by the build method of the State. Fields in a Widget subclass are + // always marked "final". + + final String title; + + @override + State createState() => _logintest2PageState(); +} + +class _logintest2PageState extends State { + + TextEditingController idController = TextEditingController(); + TextEditingController passwordController = TextEditingController(); + + int _counter = 0; + + void _incrementCounter() { + setState(() { + // This call to setState tells the Flutter framework that something has + // changed in this State, which causes it to rerun the build method below + // so that the display can reflect the updated values. If we changed + // _counter without calling setState(), then the build method would not be + // called again, and so nothing would appear to happen. + _counter++; + }); + } + + /// ํšŒ์›๊ฐ€์ž… + Future createUser(String email, String pw) async{ + + try { + UserCredential credential = await FirebaseAuth.instance.createUserWithEmailAndPassword( + email: email, + password: pw, + ); + if (credential.user != null) { + print("๋” ํ…Œ์ŠคํŠธ ํ•œ๋ฒˆ๋งŒ.."); + print(credential.user!.uid); + print(credential); + } + } on FirebaseAuthException catch (e) { + if (e.code == 'weak-password') { + print('The password provided is too weak.'); + } else if (e.code == 'email-already-in-use') { + print('The account already exists for that email.'); + } + } catch (e) { + print(e); + } + authPersistence(); // ์ธ์ฆ ์˜์† + } + + /// ํšŒ์›๊ฐ€์ž…, ๋กœ๊ทธ์ธ์‹œ ์‚ฌ์šฉ์ž ์˜์† + void authPersistence() async{ + await FirebaseAuth.instance.setPersistence(Persistence.NONE); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('Sign-Up Test Page'), + ), + body: SingleChildScrollView( + child: Column( + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: TextField( + controller: idController, + decoration: InputDecoration(labelText: 'E-mail ID'), + ), + ), + SizedBox( + height: 10, + ), + Padding( + padding: const EdgeInsets.all(8.0), + child: TextField( + controller: passwordController, + decoration: InputDecoration(labelText: 'Password'), + ), + ), + ElevatedButton(onPressed: ()async => createUser(idController.text,passwordController.text), + child: Text("ํšŒ์›๊ฐ€์ž…")), + TextButton(onPressed: (){ + Navigator.push(context, + MaterialPageRoute(builder: (_) => MyApp())); + }, child: Text("ํšŒ์›๊ฐ€์ž… ์™„๋ฃŒ")) + // ElevatedButton(onPressed: ()async => Navigator.push(context, + // MaterialPageRoute(builder: (_) => logintest2Page(title: 'test',))) : print('์ด๋ฉ”์ผ ํ™•์ธ ์•ˆ๋Œ'), + // child: Text("ํšŒ์›๊ฐ€์ž…")) + ], + ), + ), + ); + } +} diff --git a/client/lib/sign/password_reset.dart b/client/lib/sign/password_reset.dart index 04fd0c5..0f169b6 100644 --- a/client/lib/sign/password_reset.dart +++ b/client/lib/sign/password_reset.dart @@ -61,139 +61,142 @@ class _PasswordResetPageState extends State { Size screenSize = deviceData.size; return Scaffold( - backgroundColor: Color(0xffF2F4F6), - appBar: AppBar( - title: Text("๋น„๋ฐ€๋ฒˆํ˜ธ ์žฌ์„ค์ •", style: textStyle.bk20normal), - backgroundColor: Colors.transparent, - elevation: 0.0, - iconTheme: IconThemeData(color: Colors.black), - centerTitle: true, - leading: IconButton( - icon: Icon(Icons.arrow_back_ios_rounded, color: Colors.black), - onPressed: () => Navigator.of(context).pop(), - ), - ),extendBodyBehindAppBar: true, - body: Container( - padding: const EdgeInsets.all(16.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - SizedBox(height: 86,), - Row( - children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text(sent ? '์ด๋ฉ”์ผ์„ ์ „์†กํ–ˆ์–ด์š”.':'๊ฐ€์ž…ํ•œ ์ด๋ฉ”์ผ ์ฃผ์†Œ๋ฅผ ์ž…๋ ฅํ•˜์„ธ์š”.',style: textStyle.bk20semibold), - SizedBox(height: 16,), - Text(sent ?'๋น„๋ฐ€๋ฒˆํ˜ธ ์žฌ์„ค์ •์„ ์œ„ํ•œ ์ด๋ฉ”์ผ์„ ์ „์†กํ–ˆ์–ด์š”.\n์ด๋ฉ”์ผ์ด ์˜ค์ง€ ์•Š์•˜๋‹ค๋ฉด, ์ŠคํŒธ๋ฉ”์ผํ•จ์„ ํ™•์ธํ•ด๋ณด์„ธ์š”.' : '์ด๋ฉ”์ผ ์ฃผ์†Œ๋กœ ๋น„๋ฐ€๋ฒˆํ˜ธ ์žฌ์„ค์ • ๋งํฌ๋ฅผ ์ „์†กํ•ฉ๋‹ˆ๋‹ค.',style: textStyle.bk13light), - ], - ), - ], - ), - SizedBox(height: 16,), - - if(sent == false)...[ - Container( - width: screenSize.width, - height: 44, - child: TextField( - controller: emailController, - style: TextStyle(decorationThickness: 0, fontFamily: 'Pretendard', - fontSize: 16, fontWeight: FontWeight.w400, color: Color(colorChart.black)), - onChanged: (text){ - setEmail = true; - setState(() { - }); - }, - decoration: InputDecoration( - filled: true, - border: InputBorder.none, - fillColor: Color(0xffF9F9F9), - hintText: '์ด๋ฉ”์ผ ์ฃผ์†Œ', - hintStyle: textStyle.grey16normal, - enabledBorder: OutlineInputBorder( - borderSide: BorderSide(width: 1, color: Colors.white), //<-- SEE HERE - borderRadius: BorderRadius.circular(12.0), - ), + backgroundColor: Color(0xffF2F4F6), + appBar: AppBar( + title: Text("๋น„๋ฐ€๋ฒˆํ˜ธ ์žฌ์„ค์ •", style: textStyle.bk20normal), + backgroundColor: Colors.transparent, + elevation: 0.0, + iconTheme: IconThemeData(color: Colors.black), + centerTitle: true, + leading: IconButton( + icon: Icon(Icons.arrow_back_ios_rounded, color: Colors.black), + onPressed: () => Navigator.of(context).pop(), + ), + ),extendBodyBehindAppBar: true, + body: Container( + padding: const EdgeInsets.all(16.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SizedBox(height: 86,), + Row( + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text(sent ? '์ด๋ฉ”์ผ์„ ์ „์†กํ–ˆ์–ด์š”.':'๊ฐ€์ž…ํ•œ ์ด๋ฉ”์ผ ์ฃผ์†Œ๋ฅผ ์ž…๋ ฅํ•˜์„ธ์š”.',style: textStyle.bk20semibold), + SizedBox(height: 16,), + Text(sent ?'๋น„๋ฐ€๋ฒˆํ˜ธ ์žฌ์„ค์ •์„ ์œ„ํ•œ ์ด๋ฉ”์ผ์„ ์ „์†กํ–ˆ์–ด์š”.\n์ด๋ฉ”์ผ์ด ์˜ค์ง€ ์•Š์•˜๋‹ค๋ฉด, ์ŠคํŒธ๋ฉ”์ผํ•จ์„ ํ™•์ธํ•ด๋ณด์„ธ์š”.' : '์ด๋ฉ”์ผ ์ฃผ์†Œ๋กœ ๋น„๋ฐ€๋ฒˆํ˜ธ ์žฌ์„ค์ • ๋งํฌ๋ฅผ ์ „์†กํ•ฉ๋‹ˆ๋‹ค.',style: textStyle.bk13light), + ], + ), + ], + ), + SizedBox(height: 16,), + + if(sent == false)...[ + Container( + width: screenSize.width, + height: 44, + child: TextField( + controller: emailController, + style: TextStyle(decorationThickness: 0, fontFamily: 'Pretendard', + fontSize: 16, fontWeight: FontWeight.w400, color: Color(colorChart.black)), + onChanged: (text){ + setEmail = true; + setState(() { + }); + }, + decoration: InputDecoration( + contentPadding: EdgeInsets.only(top:3, left: 5), + hintStyle: textStyle.grey16normal, + filled: true, + border: InputBorder.none, + fillColor: Color(0xffF9F9F9), + hintText: '์ด๋ฉ”์ผ ์ฃผ์†Œ', + enabledBorder: OutlineInputBorder( + borderSide: BorderSide(width: 1, color: Colors.white), //<-- SEE HERE + borderRadius: BorderRadius.circular(12.0), ), ), ), - ]else...[ - Container( - width: screenSize.width, - height: 44, - child: TextField( - style: TextStyle(decorationThickness: 0, fontFamily: 'Pretendard', - fontSize: 16, fontWeight: FontWeight.w400, color: Color(colorChart.grey)), - readOnly: true, // ์ฝ๊ธฐ ์ „์šฉ - decoration: InputDecoration( - border: InputBorder.none, - filled: true, - fillColor: Color(0xffEAEAEA), - enabledBorder: OutlineInputBorder( - borderSide: BorderSide(width: 1, color: Colors.white), //<-- SEE HERE - borderRadius: BorderRadius.circular(12.0), - ), + ), + ]else...[ + Container( + width: screenSize.width, + height: 44, + child: TextField( + style: TextStyle(decorationThickness: 0, fontFamily: 'Pretendard', + fontSize: 16, fontWeight: FontWeight.w400, color: Color(colorChart.grey)), + readOnly: true, // ์ฝ๊ธฐ ์ „์šฉ + decoration: InputDecoration( + contentPadding: EdgeInsets.only(top:3, left: 5), + hintStyle: textStyle.grey16normal, + border: InputBorder.none, + filled: true, + fillColor: Color(0xffEAEAEA), + enabledBorder: OutlineInputBorder( + borderSide: BorderSide(width: 1, color: Colors.white), //<-- SEE HERE + borderRadius: BorderRadius.circular(12.0), ), ), ), - ], + ), + ], - SizedBox(height: 16,), - - Column( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - if(sent==false)...[ - if(setEmail)...[ - Container( - height: 44, - width: screenSize.width, - child: ElevatedButton(onPressed: (){ - // ์ด๋ฉ”์ผ๋กœ ๋น„๋ฐ€๋ฒˆํ˜ธ ์žฌ์„ค์ • ๋งํฌ ์ „๋‹ฌ - sent = true; - setedEmail = emailController.text; - resetPassword(setedEmail); - setState(() {}); - }, - style: buttonChart().signInbtn, - child: Text("์ด๋ฉ”์ผ ์ „์†ก", style: textStyle.white16semibold,) - ), - ), - ]else...[ - Container( - height: 44, - width: screenSize.width, - child: ElevatedButton(onPressed: (){ - // ์•„๋ฌด ๋ฐ˜์‘ ์—†๋Š” ๊ฒƒ์ด ๋งž์Œ - }, - style: buttonChart().purplebtn3, - child: Text("์ด๋ฉ”์ผ ์ „์†ก", style: textStyle.white16semibold,) - ), + SizedBox(height: 16,), + + Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + if(sent==false)...[ + if(setEmail)...[ + Container( + height: 44, + width: screenSize.width, + child: ElevatedButton(onPressed: (){ + // ์ด๋ฉ”์ผ๋กœ ๋น„๋ฐ€๋ฒˆํ˜ธ ์žฌ์„ค์ • ๋งํฌ ์ „๋‹ฌ + sent = true; + setedEmail = emailController.text; + resetPassword(setedEmail); + setState(() {}); + }, + style: buttonChart().signInbtn, + child: Text("์ด๋ฉ”์ผ ์ „์†ก", style: textStyle.white16semibold,) ), - ] + ), ]else...[ Container( height: 44, width: screenSize.width, child: ElevatedButton(onPressed: (){ - // ์ฒ˜์Œ ๋กœ๊ทธ์ธ ํ™”๋ฉด์œผ๋กœ ์ด๋™ํ•˜๊ธฐ - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => SignInPage())); + // ์•„๋ฌด ๋ฐ˜์‘ ์—†๋Š” ๊ฒƒ์ด ๋งž์Œ }, - style: buttonChart().signInbtn, - child: Text("ํ™•์ธ", style: textStyle.white16semibold,) + style: buttonChart().purplebtn3, + child: Text("์ด๋ฉ”์ผ ์ „์†ก", style: textStyle.white16semibold,) ), ), - ], + ] + ]else...[ + Container( + height: 44, + width: screenSize.width, + child: ElevatedButton(onPressed: (){ + // ์ฒ˜์Œ ๋กœ๊ทธ์ธ ํ™”๋ฉด์œผ๋กœ ์ด๋™ํ•˜๊ธฐ + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => SignInPage())); + }, + style: buttonChart().signInbtn, + child: Text("ํ™•์ธ", style: textStyle.white16semibold,) + ), + ), ], - ), - ], - ), - ) + ], + ), + ], + ), + ) ); } diff --git a/client/lib/sign/sign_in.dart b/client/lib/sign/sign_in.dart index aec4c1e..0d1db48 100644 --- a/client/lib/sign/sign_in.dart +++ b/client/lib/sign/sign_in.dart @@ -1,19 +1,17 @@ -/// ์˜ฎ๊ธฐ๊ธฐ ๊ฐ€๋Šฅ import 'package:flutter_svg/svg.dart'; import 'package:client/conversation/intro/intro.dart'; import 'package:client/style.dart'; import 'package:flutter/material.dart'; import 'package:firebase_auth/firebase_auth.dart'; import 'dart:convert'; -import 'package:flutter_secure_storage/flutter_secure_storage.dart'; import 'package:http/http.dart' as http; import 'package:google_sign_in/google_sign_in.dart'; import '../screen.dart'; import 'password_reset.dart'; -import 'sign_up2.dart'; +import 'sign_up.dart'; String userAccessToken = ""; -bool checkSignIn = false; +bool checkSignUp = false; class SignInPage extends StatefulWidget { @override @@ -25,30 +23,29 @@ class _SignInPageState extends State { TextEditingController passwordController = TextEditingController(); String errorString = ''; //login error ๋ณด๋ ค๊ณ  ๋งŒ๋“  String state - static final storage = FlutterSecureStorage(); // FlutterSecureStorage๋ฅผ storage๋กœ ์ €์žฅ dynamic userInfo = ''; // storage์— ์žˆ๋Š” ์œ ์ € ์ •๋ณด๋ฅผ ์ €์žฅ - _asyncMethod() async { - // read ํ•จ์ˆ˜๋กœ key๊ฐ’์— ๋งž๋Š” ์ •๋ณด๋ฅผ ๋ถˆ๋Ÿฌ์˜ค๊ณ  ๋ฐ์ดํ„ฐํƒ€์ž…์€ String ํƒ€์ž… - // ๋ฐ์ดํ„ฐ๊ฐ€ ์—†์„๋•Œ๋Š” null์„ ๋ฐ˜ํ™˜ - userInfo = await storage.read(key:'login'); - - // user์˜ ์ •๋ณด๊ฐ€ ์žˆ๋‹ค๋ฉด ๋กœ๊ทธ์ธ ํ›„ ๋“ค์–ด๊ฐ€๋Š” ์ฒซ ํŽ˜์ด์ง€๋กœ ๋„˜์–ด๊ฐ€๊ฒŒ ํ•ฉ๋‹ˆ๋‹ค. - if (userInfo != null) { - Navigator.pushNamed(context, '/main'); - } else { - print('๋กœ๊ทธ์ธ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค'); - } - } + // _asyncMethod() async { + // // read ํ•จ์ˆ˜๋กœ key๊ฐ’์— ๋งž๋Š” ์ •๋ณด๋ฅผ ๋ถˆ๋Ÿฌ์˜ค๊ณ  ๋ฐ์ดํ„ฐํƒ€์ž…์€ String ํƒ€์ž… + // // ๋ฐ์ดํ„ฐ๊ฐ€ ์—†์„๋•Œ๋Š” null์„ ๋ฐ˜ํ™˜ + // userInfo = await storage.read(key:'login'); + // + // // user์˜ ์ •๋ณด๊ฐ€ ์žˆ๋‹ค๋ฉด ๋กœ๊ทธ์ธ ํ›„ ๋“ค์–ด๊ฐ€๋Š” ์ฒซ ํŽ˜์ด์ง€๋กœ ๋„˜์–ด๊ฐ€๊ฒŒ ํ•ฉ๋‹ˆ๋‹ค. + // if (userInfo != null) { + // Navigator.pushNamed(context, '/main'); + // } else { + // print('๋กœ๊ทธ์ธ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค'); + // } + // } @override void initState() { super.initState(); // ๋น„๋™๊ธฐ๋กœ flutter secure storage ์ •๋ณด๋ฅผ ๋ถˆ๋Ÿฌ์˜ค๋Š” ์ž‘์—… - WidgetsBinding.instance.addPostFrameCallback((_) { - _asyncMethod(); - }); + // WidgetsBinding.instance.addPostFrameCallback((_) { + // _asyncMethod(); + // }); } @@ -98,7 +95,7 @@ class _SignInPageState extends State { // ์‚ฌ์šฉ์ž ์ •๋ณด ์กฐํšŒ : ๋Œ€ํ™”ํ•˜๊ธฐ๊ฐ€ 1์ด๋ฉด ์ธํŠธ๋กœ ์•„๋‹ˆ๋ฉด ๊ทธ๋ƒฅ ํ™ˆ์œผ๋กœ ์ด๋™ void fetchUserInfo(String aToken) async { // API ์—”๋“œํฌ์ธํŠธ URL - print("๋ฐ›ํ† ~~~:" + aToken); + print("๋ฐ›ํ† :" + aToken); String apiUrl = 'http://3.38.1.125:8080/user/info'; // ์‹ค์ œ API ์—”๋“œํฌ์ธํŠธ๋กœ ๋ณ€๊ฒฝํ•˜์„ธ์š” // ํ—ค๋” ์ •๋ณด ์„ค์ • @@ -220,6 +217,8 @@ class _SignInPageState extends State { // ์‚ฌ์šฉ์ž๊ฐ€ ์ฒ˜์Œ ๋กœ๊ทธ์ธํ•œ ๊ฒฝ์šฐ print("check uid(์ฒ˜์Œ ๋กœ๊ทธ์ธ):"+ user.uid); fetchSignUpToken(user.uid, googleUser!.email); + checkSignUp = true; + } else{ print("check uid(์›๋ž˜ ์žˆ๋˜ ๋กœ๊ทธ์ธ):"+ user!.uid); fetchSignInToken(user!.uid); @@ -256,17 +255,45 @@ class _SignInPageState extends State { ), SizedBox(height: 32,), + // Container( + // width: screenSize.width, + // height: 44, + // child: + // TextFormField( + // controller: idController, + // style: textStyle.bk16normal, + // decoration: InputDecoration( + // contentPadding: EdgeInsets.only(top:3, left: 5), + // hintStyle: textStyle.grey16normal, + // border: InputBorder.none, + // focusedBorder: OutlineInputBorder( + // borderRadius: BorderRadius.circular(12.0), + // borderSide: BorderSide(width: 1, color: Colors.white), + // ), + // filled: true, + // fillColor: Color(0xffEEF3FE), + // hintText: '์ด๋ฉ”์ผ', + // enabledBorder: OutlineInputBorder( + // borderSide: BorderSide(width: 1, color: Colors.white), //<-- SEE HERE + // borderRadius: BorderRadius.circular(12.0), + // ), + // ), + // ), + // ), Container( width: screenSize.width, height: 44, - child: - TextFormField( + child: TextFormField( controller: idController, style: textStyle.bk16normal, decoration: InputDecoration( contentPadding: EdgeInsets.only(top:3, left: 5), hintStyle: textStyle.grey16normal, border: InputBorder.none, + focusedBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(12.0), + borderSide: BorderSide(color: Colors.white), + ), filled: true, fillColor: Color(0xffEEF3FE), hintText: '์ด๋ฉ”์ผ', @@ -290,6 +317,10 @@ class _SignInPageState extends State { contentPadding: EdgeInsets.only(top:3, left: 5), hintStyle: textStyle.grey16normal, border: InputBorder.none, + focusedBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(12.0), + borderSide: BorderSide(color: Colors.white), + ), filled: true, fillColor: Color(0xffEEF3FE), hintText: '๋น„๋ฐ€๋ฒˆํ˜ธ', @@ -317,7 +348,7 @@ class _SignInPageState extends State { ); if (credential.user != null) { - checkSignIn = true; + // checkSignIn = true; print("ํ…Œ์ŠคํŠธ"); print(credential); print(credential.user!.uid); @@ -387,6 +418,7 @@ class _SignInPageState extends State { height: 44, width: screenSize.width, child: ElevatedButton(onPressed: (){ + // checkSignUp = true; // ์œ„์น˜ ๋ณ€๊ฒฝ ํ•„์š” Navigator.push( context, MaterialPageRoute( diff --git a/client/lib/sign/sign_up2.dart b/client/lib/sign/sign_up.dart similarity index 96% rename from client/lib/sign/sign_up2.dart rename to client/lib/sign/sign_up.dart index 4872876..49bbd72 100644 --- a/client/lib/sign/sign_up2.dart +++ b/client/lib/sign/sign_up.dart @@ -1,9 +1,9 @@ -/// ์˜ฎ๊ธฐ๊ธฐ ๊ฐ€๋Šฅ import 'dart:async'; import 'dart:convert'; import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; import 'package:client/conversation/intro/intro.dart'; +import 'package:client/conversation/intro/intro_story.dart'; import 'package:client/screen.dart'; import 'package:client/sign/sign_in.dart'; import 'package:client/style.dart'; @@ -12,7 +12,7 @@ import 'package:http/http.dart' as http; import 'package:firebase_auth/firebase_auth.dart'; import 'package:client/sign/sign_in.dart' as sign_in; -bool checkSignUp = false; +// bool checkSignUp = false; /// ํšŒ์›๊ฐ€์ž… ํŽ˜์ด์ง€(์ด๋ฉ”์ผ ํšŒ์›๊ฐ€์ž…) class SignUpPage extends StatefulWidget { @@ -121,6 +121,7 @@ class _SignUpPageState extends State { } late Map parsedResponseUser; // ์‚ฌ์šฉ์ž ์ •๋ณด + // ์‚ฌ์šฉ์ž ์ •๋ณด ์กฐํšŒ : ๋Œ€ํ™”ํ•˜๊ธฐ๊ฐ€ 1์ด๋ฉด ์ธํŠธ๋กœ ์•„๋‹ˆ๋ฉด ๊ทธ๋ƒฅ ํ™ˆ์œผ๋กœ ์ด๋™ void fetchUserInfo(String aToken) async { // API ์—”๋“œํฌ์ธํŠธ URL @@ -151,7 +152,7 @@ class _SignUpPageState extends State { Navigator.push( context, MaterialPageRoute( - builder: (context) => IntroPage())); + builder: (context) => IntroStoryPage())); } else { // ์š”์ฒญ์ด ์‹คํŒจํ•œ ๊ฒฝ์šฐ ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌ @@ -160,6 +161,7 @@ class _SignUpPageState extends State { } late Map parsedResponseAT; // ์•ก์„ธ์Šค ํ† ํฐ + // ํšŒ์›๊ฐ€์ž… = ํšŒ์›์ƒ์„ฑ ๋ฐ ํšŒ์› ์ฒ˜์Œ ์ •๋ณด db ์ƒ์„ฑ์„ ์œ„ํ•ด์„œ ์กด์žฌ void fetchSignUpToken(String userUid, String email) async { @@ -195,10 +197,11 @@ class _SignUpPageState extends State { userAccessToken = parsedResponseAT['accessToken']; // ์•ก์„ธ์Šค ํ† ํฐ์„ ์ „์—ญ๋ณ€์ˆ˜์— ์ €์žฅ -> ๋‹ค๋ฅธ ํŒŒ์ผ์—์„œ๋„ ์‚ฌ์šฉ print("accessToken:" + userAccessToken); - + sign_in.checkSignUp = true; sign_in.userAccessToken = userAccessToken; fetchUserInfo(userAccessToken); + } else { // ์š”์ฒญ์ด ์‹คํŒจํ•œ ๊ฒฝ์šฐ ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌ print('HTTP ์š”์ฒญ ์‹คํŒจ: ${response.statusCode}'); @@ -325,6 +328,10 @@ class _SignUpPageState extends State { contentPadding: EdgeInsets.only(top:3, left: 5), hintStyle: textStyle.grey16normal, border: InputBorder.none, + focusedBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(12.0), + borderSide: BorderSide(width: 1, color: Colors.white), + ), filled: true, fillColor: Color(0xffF9F9F9), hintText: '์ด๋ฉ”์ผ ์ฃผ์†Œ', @@ -374,6 +381,10 @@ class _SignUpPageState extends State { contentPadding: EdgeInsets.only(top:3, left: 5), hintStyle: textStyle.grey16normal, border: InputBorder.none, + focusedBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(12.0), + borderSide: BorderSide(width: 1, color: Colors.white), + ), filled: true, fillColor: Color(0xffF9F9F9), hintText: '๋น„๋ฐ€๋ฒˆํ˜ธ', @@ -427,6 +438,10 @@ class _SignUpPageState extends State { contentPadding: EdgeInsets.only(top:3, left: 5), hintStyle: textStyle.grey16normal, border: InputBorder.none, + focusedBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(12.0), + borderSide: BorderSide(width: 1, color: Colors.white), + ), filled: true, fillColor: Color(0xffF9F9F9), hintText: '๋น„๋ฐ€๋ฒˆํ˜ธ ํ™•์ธ', @@ -535,6 +550,10 @@ class _SignUpPageState extends State { contentPadding: EdgeInsets.only(top:3, left: 5), hintStyle: textStyle.grey16normal, border: InputBorder.none, + focusedBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(12.0), + borderSide: BorderSide(width: 1, color: Colors.white), + ), filled: true, fillColor: Color(0xffF9F9F9), hintText: '์ธ์ฆ ๋ฒˆํ˜ธ', diff --git a/client/lib/start/start1.dart b/client/lib/start/start1.dart new file mode 100644 index 0000000..d9f2558 --- /dev/null +++ b/client/lib/start/start1.dart @@ -0,0 +1,97 @@ +import 'package:flutter/material.dart'; + + +class Start1 extends StatelessWidget { + const Start1({super.key}); + + // This widget is the root of your application. + @override + Widget build(BuildContext context) { + return MaterialApp( + title: 'Flutter Demo', + theme: ThemeData( + // This is the theme of your application. + // + // Try running your application with "flutter run". You'll see the + // application has a blue toolbar. Then, without quitting the app, try + // changing the primarySwatch below to Colors.green and then invoke + // "hot reload" (press "r" in the console where you ran "flutter run", + // or simply save your changes to "hot reload" in a Flutter IDE). + // Notice that the counter didn't reset back to zero; the application + // is not restarted. + primarySwatch: Colors.blue, + ), + home: const Start1Page(title: 'Flutter Demo Home Page'), + ); + } +} + +class Start1Page extends StatefulWidget { + const Start1Page({super.key, required this.title}); + + final String title; + + @override + State createState() => _Start1PageState(); +} + +class _Start1PageState extends State { + int _counter = 0; + + void _incrementCounter() { + setState(() { + _counter++; + }); + } + + @override + void initState() { + super.initState(); + initialization(); + } + + void initialization() async { + print('ready in 3...'); + await Future.delayed(const Duration(seconds: 1)); + print('ready in 2...'); + await Future.delayed(const Duration(seconds: 1)); + print('ready in 1...'); + await Future.delayed(const Duration(seconds: 1)); + print('go!'); + //FlutterNativeSplash.remove(); + } + + @override + Widget build(BuildContext context) { + + return Scaffold( + body: Center( + // Center is a layout widget. It takes a single child and positions it + // in the middle of the parent. + child: Column( + // Column is also a layout widget. It takes a list of children and + // arranges them vertically. By default, it sizes itself to fit its + // children horizontally, and tries to be as tall as its parent. + // + // Invoke "debug painting" (press "p" in the console, choose the + // "Toggle Debug Paint" action from the Flutter Inspector in Android + // Studio, or the "Toggle Debug Paint" command in Visual Studio Code) + // to see the wireframe for each widget. + // + // Column has various properties to control how it sizes itself and + // how it positions its children. Here we use mainAxisAlignment to + // center the children vertically; the main axis here is the vertical + // axis because Columns are vertical (the cross axis would be + // horizontal). + mainAxisAlignment: MainAxisAlignment.center, + children: [ + const Text( + '์•ˆ๋…•ํ•˜์„ธ์š”,\n์ €๋Š” ๋‹น์‹ ์˜ ๋งˆ์Œ์„ ์ง€ํ‚ค๋Š”\nํ•„์ด์—์š”.', + ), + + ], + ), + ), // This trailing comma makes auto-formatting nicer for build methods. + ); + } +} \ No newline at end of file diff --git a/client/lib/start/start2.dart b/client/lib/start/start2.dart new file mode 100644 index 0000000..e69de29 diff --git a/client/lib/start/start3.dart b/client/lib/start/start3.dart new file mode 100644 index 0000000..e69de29 diff --git a/client/lib/style.dart b/client/lib/style.dart new file mode 100644 index 0000000..b1d719c --- /dev/null +++ b/client/lib/style.dart @@ -0,0 +1,520 @@ +import 'dart:ui'; +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; + +class colorChart{ + static int black = 0xff000000; + static int white = 0xffFFFFFF; + static int grey = 0xffAAAAAA; + static int lightgrey = 0xffD9D9D9; + static int green = 0xff8CC63F; + + static int blue = 0xff83A8FF; + static int lightblue = 0xffC0D2FC; + static int lightblue2 = 0xffDDE7FD; + + static int pink = 0xffEFB3B5; + static int lightpink = 0xffFCCBCD; + + // F2F6FF DDE7FD + static int purple = 0xff4B5396; + static int lightpurple = 0xffF2F6FF; + static int lightpurple2 = 0xffDDE7FD; + + static int yellow = 0xffFEFBAC; + + //99A8CB + static int bluegrey = 0xff99A8CB; + +//4B5396 + + +} + +class buttonChart{ + static double btnheight = 40; + + // 83A8FF + var blackbtn = ElevatedButton.styleFrom( + minimumSize: Size(Get.width, btnheight), + maximumSize: Size(Get.width, btnheight), + elevation: 0, + primary: Color(colorChart.black), + onPrimary: Color(colorChart.grey), + // shape: const StadiumBorder(), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(30.0), + ), + ); + + var whitebtn = ElevatedButton.styleFrom( + minimumSize: Size(Get.width, btnheight), + maximumSize: Size(Get.width, btnheight), + elevation: 0, + primary: Color(colorChart.white), + onPrimary: Color(colorChart.black), + // shape: const StadiumBorder(), + shape: RoundedRectangleBorder( + side: BorderSide(color: Color(colorChart.blue), width: 1.0, style: BorderStyle.solid), + borderRadius: BorderRadius.circular(30.0), + ), + ); + + var whitebtn_1 = ElevatedButton.styleFrom( + minimumSize: Size(Get.width, btnheight), + maximumSize: Size(Get.width, btnheight), + elevation: 0, + primary: Color(colorChart.white), + onPrimary: Color(colorChart.black), + // shape: const StadiumBorder(), + shape: RoundedRectangleBorder( + side: BorderSide(color: Color(colorChart.blue), width: 1.0, style: BorderStyle.solid), + borderRadius: BorderRadius.circular(16.0), + ), + ); + + var greybtn_1 = ElevatedButton.styleFrom( + minimumSize: Size(Get.width, btnheight), + maximumSize: Size(Get.width, btnheight), + elevation: 0, + primary: Color(0xffEFEFEF), + onPrimary: Color(0xffAEAEAE), + // shape: const StadiumBorder(), + shape: RoundedRectangleBorder( + side: BorderSide(color: Color(0xffAAAAAA), width: 1.0, style: BorderStyle.solid), + borderRadius: BorderRadius.circular(16.0), + ), + ); + + var whitebtn2 = ElevatedButton.styleFrom( + minimumSize: Size(Get.width, btnheight), + maximumSize: Size(Get.width, btnheight), + elevation: 0, + primary: Colors.white, + onPrimary: Color(0xff4B5396), + // shape: const StadiumBorder(), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(30.0), + ), + ); + + var whitebtn3 = ElevatedButton.styleFrom( + shadowColor: Colors.black.withOpacity(0.08), + minimumSize: Size(Get.width, btnheight), + maximumSize: Size(Get.width, btnheight), + elevation: 5, + primary: Colors.white, + onPrimary: Color(0xff4B5396), + // shape: const StadiumBorder(), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(30.0), + ), + ); + + var whitebtn4 = ElevatedButton.styleFrom( + shadowColor: Colors.black.withOpacity(0.08), + minimumSize: Size(Get.width, btnheight), + maximumSize: Size(Get.width, btnheight), + elevation: 5, + primary: Colors.white, + onPrimary: Color(0xff4B5396), + // shape: const StadiumBorder(), + shape: RoundedRectangleBorder( + side: BorderSide(color: Color(0xff4F6AC9), width: 1.0, style: BorderStyle.solid), + borderRadius: BorderRadius.circular(30.0), + ), + ); + + var signInbtn = ElevatedButton.styleFrom( + minimumSize: Size(Get.width, btnheight), + maximumSize: Size(Get.width, btnheight), + elevation: 0, + primary: Color(0xff83A8FF), + onPrimary: Color(colorChart.grey), + // shape: const StadiumBorder(), + shape: RoundedRectangleBorder( + side: BorderSide(color: Color(colorChart.blue), width: 1.0, style: BorderStyle.solid), + borderRadius: BorderRadius.circular(30.0), + ), + ); + + var greybtn = ElevatedButton.styleFrom( + minimumSize: Size(Get.width, btnheight), + maximumSize: Size(Get.width, btnheight), + elevation: 0, + primary: Color(colorChart.grey), + onPrimary: Colors.white, + // shape: const StadiumBorder(), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(30.0), + ), + ); + + var bluebtn = ElevatedButton.styleFrom( + minimumSize: Size(Get.width, btnheight), + maximumSize: Size(Get.width, btnheight), + elevation: 0, + primary: Color(colorChart.lightblue), + onPrimary: Color(colorChart.black), + // shape: const StadiumBorder(), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(30.0), + ), + ); + + var bluebtn2 = ElevatedButton.styleFrom( + minimumSize: Size(Get.width, btnheight), + maximumSize: Size(Get.width, btnheight), + elevation: 0, + primary: Color(colorChart.lightblue), + onPrimary: Color(colorChart.black), + // shape: const StadiumBorder(), + shape: RoundedRectangleBorder( + side: BorderSide(color: Color(colorChart.blue), width: 1.0, style: BorderStyle.solid), + borderRadius: BorderRadius.circular(30.0), + ), + ); + + var bluebtn2_1 = ElevatedButton.styleFrom( + minimumSize: Size(Get.width, btnheight), + maximumSize: Size(Get.width, btnheight), + elevation: 0, + primary: Color(colorChart.lightblue), + onPrimary: Color(colorChart.black), + // shape: const StadiumBorder(), + shape: RoundedRectangleBorder( + side: BorderSide(color: Color(colorChart.blue), width: 1.0, style: BorderStyle.solid), + borderRadius: BorderRadius.circular(16.0), + ), + ); + + var bluebtn3 = ElevatedButton.styleFrom( + minimumSize: Size(Get.width, btnheight), + maximumSize: Size(Get.width, btnheight), + elevation: 0, + primary: Color(colorChart.blue), + onPrimary: Color(colorChart.white), + // shape: const StadiumBorder(), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(30.0), + ), + ); + + var bluebtn4 = ElevatedButton.styleFrom( + minimumSize: Size(Get.width, btnheight), + maximumSize: Size(Get.width, btnheight), + elevation: 0, + primary: Color(colorChart.white), + onPrimary: Color(colorChart.black), + // shape: const StadiumBorder(), + shape: RoundedRectangleBorder( + side: BorderSide(color: Color(colorChart.lightblue2), width: 1.0, style: BorderStyle.solid), + borderRadius: BorderRadius.circular(30.0), + ), + ); + + var pinkbtn = ElevatedButton.styleFrom( + minimumSize: Size(Get.width, btnheight), + maximumSize: Size(Get.width, btnheight), + elevation: 0, + primary: Color(colorChart.lightpink), + onPrimary: Color(colorChart.pink), + // shape: const StadiumBorder(), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(30.0), + ), + ); + + var pinkbtn2 = ElevatedButton.styleFrom( + minimumSize: Size(Get.width, btnheight), + maximumSize: Size(Get.width, btnheight), + elevation: 0, + primary: Color(colorChart.lightpink), + onPrimary: Color(colorChart.lightpink), + // shape: const StadiumBorder(), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(30.0), + ), + ); + + var purplebtn = ElevatedButton.styleFrom( + minimumSize: Size(Get.width, btnheight), + maximumSize: Size(Get.width, btnheight), + elevation: 0, + primary: Color(colorChart.purple), + onPrimary: Color(colorChart.purple), + // shape: const StadiumBorder(), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(30.0), + ), + ); + + var purplebtn2 = ElevatedButton.styleFrom( + minimumSize: Size(Get.width, btnheight), + maximumSize: Size(Get.width, btnheight), + elevation: 0, + primary: Color(colorChart.purple), + onPrimary: Color(colorChart.lightpurple), + // shape: const StadiumBorder(), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(30.0), + ), + ); + + var purplebtn3 = ElevatedButton.styleFrom( + minimumSize: Size(Get.width, btnheight), + maximumSize: Size(Get.width, btnheight), + elevation: 0, + primary: Color(colorChart.lightpurple2), + //onPrimary: Color(colorChart.white), + // shape: const StadiumBorder(), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(30.0), + ), + ); + + + var yellowbtn = ElevatedButton.styleFrom( + minimumSize: Size(Get.width, btnheight), + maximumSize: Size(Get.width, btnheight), + elevation: 0, + primary: Color(colorChart.yellow).withOpacity(0.8), + onPrimary: Color(colorChart.purple), + // shape: const StadiumBorder(), + shape: RoundedRectangleBorder( + side: BorderSide(color: Color(colorChart.purple), width: 1.0, style: BorderStyle.solid), + borderRadius: BorderRadius.circular(30.0), + ), + ); + + var yellowbtn2 = ElevatedButton.styleFrom( + minimumSize: Size(Get.width, btnheight), + maximumSize: Size(Get.width, btnheight), + elevation: 0, + primary: Color(colorChart.yellow).withOpacity(0.8), + onPrimary: Color(colorChart.purple), + // shape: const StadiumBorder(), + shape: RoundedRectangleBorder( + //side: BorderSide(color: Color(colorChart.purple), width: 1.0, style: BorderStyle.solid), + borderRadius: BorderRadius.circular(30.0), + ), + ); + +} + +// style: TextStyle(color: Color(0xff4B5396),fontSize: 16, fontFamily: 'Pretendard', +// fontWeight: FontWeight.w600,), + +class textStyle { + static TextStyle bk40bold = TextStyle( + fontFamily: 'Pretendard', + fontSize: 40, + fontWeight: FontWeight.w700, + color: Colors.black, + ); + static TextStyle bk40normal = TextStyle( + fontFamily: 'Pretendard', + fontSize: 40, + fontWeight: FontWeight.w400, + color: Colors.black, + ); + + static TextStyle bk20semibold = + TextStyle( + fontFamily: 'Pretendard', + fontSize: 20, fontWeight: FontWeight.w600, color: Colors.black); + + static TextStyle bk20bold = + TextStyle( + fontFamily: 'Pretendard', + fontSize: 20, fontWeight: FontWeight.w700, color: Colors.black); + + static TextStyle bk20normal = TextStyle( + fontFamily: 'Pretendard', + fontSize: 20, fontWeight: FontWeight.w400, color: Colors.black); + + static TextStyle bk16light = TextStyle( + fontFamily: 'Pretendard', + fontSize: 16, fontWeight: FontWeight.w300, color: Colors.black); + + static TextStyle bk16normal = TextStyle( + fontFamily: 'Pretendard', + fontSize: 16, fontWeight: FontWeight.w400, color: Colors.black); + + static TextStyle bk16normalCon = TextStyle( + fontFamily: 'Pretendard', height: 1.5, + fontSize: 16, fontWeight: FontWeight.w400, color: Color(0xff333333)); + + static TextStyle bk16midium = TextStyle( + fontFamily: 'Pretendard', + fontSize: 16, fontWeight: FontWeight.w500, color: Colors.black); + + static TextStyle bk16semibold = + TextStyle(fontFamily: 'Pretendard', fontSize: 16, fontWeight: FontWeight.w600, color: Colors.black); + + static TextStyle wo16semibold = + TextStyle(fontFamily: 'Pretendard', fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff4F6AC9)); + + + static TextStyle bk16bold = + TextStyle(fontFamily: 'Pretendard', fontSize: 16, fontWeight: FontWeight.w700, color: Colors.black); + + static TextStyle bk14light = TextStyle( + fontFamily: 'Pretendard', + fontSize: 14, fontWeight: FontWeight.w300, color: Colors.black); + + static TextStyle bk14normal = TextStyle( + fontFamily: 'Pretendard', + fontSize: 14, fontWeight: FontWeight.w400, color: Colors.black); + + static TextStyle bk6614normal = TextStyle( + fontFamily: 'Pretendard', + fontSize: 14, fontWeight: FontWeight.w400, color: Color(0xff666666)); + + static TextStyle bk14midium = TextStyle( + fontFamily: 'Pretendard', + fontSize: 14, fontWeight: FontWeight.w500, color: Colors.black); + + static TextStyle bk6614midium = TextStyle( + fontFamily: 'Pretendard', + fontSize: 14, fontWeight: FontWeight.w500, color: Color(0xff666666)); + + static TextStyle bk14semibold = TextStyle( + fontFamily: 'Pretendard', + fontSize: 14, fontWeight: FontWeight.w600, color: Colors.black); + + static TextStyle pp1 = TextStyle( + fontFamily: 'Pretendard', + fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff83A8FF)); + + static TextStyle pp2 = TextStyle( + fontFamily: 'Pretendard', + fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff4B5396)); + + static TextStyle bk13light = TextStyle( + fontFamily: 'Pretendard', + fontSize: 13, fontWeight: FontWeight.w300, color: Colors.black); + + static TextStyle bk12normal = TextStyle( + fontFamily: 'Pretendard', + fontSize: 12, fontWeight: FontWeight.w400, color: Colors.black); + + static TextStyle bk12midium = TextStyle( + fontFamily: 'Pretendard', + fontSize: 12, fontWeight: FontWeight.w500, color: Colors.black); + + static TextStyle bk12light = TextStyle( + fontFamily: 'Pretendard', height: 1.4, + fontSize: 12, fontWeight: FontWeight.w300, color: Colors.black); + + static TextStyle grey16bold = TextStyle( + fontFamily: 'Pretendard', + fontSize: 18, fontWeight: FontWeight.w700, color: Color(colorChart.grey)); + + static TextStyle grey16semibold = TextStyle( + fontFamily: 'Pretendard', + fontSize: 18, fontWeight: FontWeight.w600, color: Color(colorChart.grey)); + + static TextStyle grey14regular = TextStyle( + fontFamily: 'Pretendard', + fontSize: 14, fontWeight: FontWeight.w600, color: Color(colorChart.grey)); + + static TextStyle grey14midium = TextStyle( + fontFamily: 'Pretendard', + fontSize: 14, fontWeight: FontWeight.w500, color: Color(colorChart.grey)); + + static TextStyle grey12normal = TextStyle( + fontFamily: 'Pretendard', + fontSize: 12, fontWeight: FontWeight.w400, color: Color(colorChart.grey)); + + static TextStyle grey16normal = TextStyle( + fontFamily: 'Pretendard', + fontSize: 16, fontWeight: FontWeight.w400, color: Color(colorChart.grey)); + + static TextStyle grey14normal = TextStyle( + fontFamily: 'Pretendard', + fontSize: 14, fontWeight: FontWeight.w400, color: Color(0xff99A8CB)); + + static TextStyle grey16normal2 = TextStyle( + fontFamily: 'Pretendard', height: 1.5, + fontSize: 16, fontWeight: FontWeight.w400, color: Color(colorChart.grey)); + + static TextStyle grey16normalCon = TextStyle( + fontFamily: 'Pretendard', height: 1.4, + fontSize: 16, fontWeight: FontWeight.w400, color: Color(colorChart.grey)); + + static TextStyle white20bold = TextStyle( + fontFamily: 'Pretendard', + fontSize: 20, fontWeight: FontWeight.w700, color: Colors.white); + + static TextStyle white16normal = TextStyle( + fontFamily: 'Pretendard', + fontSize: 16, fontWeight: FontWeight.w400, color: Colors.white); + + static TextStyle white16midium = TextStyle( + fontFamily: 'Pretendard', + fontSize: 16, fontWeight: FontWeight.w500, color: Colors.white); + + static TextStyle white16semibold = TextStyle( + fontFamily: 'Pretendard', + fontSize: 16, fontWeight: FontWeight.w600, color: Colors.white); + + static TextStyle white16bold = TextStyle( + fontFamily: 'Pretendard', + fontSize: 16, fontWeight: FontWeight.w700, color: Colors.white); + + static TextStyle white14light = TextStyle( + fontFamily: 'Pretendard', + fontSize: 14, fontWeight: FontWeight.w300, color: Colors.white); + + static TextStyle white14normal = TextStyle( + fontFamily: 'Pretendard', + fontSize: 14, fontWeight: FontWeight.w400, color: Colors.white); + + static TextStyle white12normal = TextStyle( + fontFamily: 'Pretendard', + fontSize: 12, fontWeight: FontWeight.w400, color: Colors.white); + + static TextStyle bg10normal = TextStyle( + fontFamily: 'Pretendard', + fontSize: 10, fontWeight: FontWeight.w400, color: Color(colorChart.bluegrey)); + + static TextStyle purple12normal = TextStyle( + fontFamily: 'Pretendard', + fontSize: 12, fontWeight: FontWeight.w400, color: Color(colorChart.purple)); + + static TextStyle purple12light = TextStyle( + fontFamily: 'Pretendard', letterSpacing: 0.6, + fontSize: 12, fontWeight: FontWeight.w300, color: Color(colorChart.purple)); + + static TextStyle purple16midium = TextStyle( + fontFamily: 'Pretendard', + fontSize: 16, fontWeight: FontWeight.w500, color: Color(colorChart.purple)); + + static TextStyle green16bold = TextStyle( + fontFamily: 'Pretendard', + fontSize: 16, + fontWeight: FontWeight.w700, + color: Color(colorChart.green)); + + static TextStyle bubbletext = TextStyle( + fontFamily: 'Nanum-BaReunHiPi', height: 1.4, + fontSize: 20, fontWeight: FontWeight.w500, color: Color(0xff222222)); + + static TextStyle bubbletext2 = TextStyle( + fontFamily: 'Nanum-BaReunHiPi', height: 1.4, + fontSize: 16, fontWeight: FontWeight.w500, color: Color(0xff222222)); + + static TextStyle introbubbletext = TextStyle( + fontFamily: 'Nanum-BaReunHiPi', height: 1.4, + fontSize: 19, fontWeight: FontWeight.w500, color: Color(0xff4B5396)); + + + static TextStyle field = TextStyle( + fontFamily: 'Pretendard', + fontSize: 20, fontWeight: FontWeight.w600, color: Color(0xff83A8FF)); + + static TextStyle inputfield = TextStyle( + fontFamily: 'Pretendard', + fontSize: 20, fontWeight: FontWeight.w500, color: Color(colorChart.purple)); +} \ No newline at end of file diff --git a/client/pubspec.lock b/client/pubspec.lock index cbbea7d..4b1ad80 100644 --- a/client/pubspec.lock +++ b/client/pubspec.lock @@ -5,10 +5,18 @@ packages: dependency: transitive description: name: _flutterfire_internals - sha256: d687576bb973e8d2539d0b4615d985336269a0dbe1b3984e937fd22d31406fb8 + sha256: f5628cd9c92ed11083f425fd1f8f1bc60ecdda458c81d73b143aeda036c35fe7 url: "https://pub.dev" source: hosted - version: "1.3.0" + version: "1.3.16" + animated_text_kit: + dependency: "direct main" + description: + name: animated_text_kit + sha256: "37392a5376c9a1a503b02463c38bc0342ef814ddbb8f9977bc90f2a84b22fa92" + url: "https://pub.dev" + source: hosted + version: "4.2.2" archive: dependency: transitive description: @@ -33,6 +41,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.10.0" + audio_session: + dependency: transitive + description: + name: audio_session + sha256: "6fdf255ed3af86535c96452c33ecff1245990bb25a605bfb1958661ccc3d467f" + url: "https://pub.dev" + source: hosted + version: "0.1.18" boolean_selector: dependency: transitive description: @@ -41,14 +57,6 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.1" - change_app_package_name: - dependency: "direct main" - description: - name: change_app_package_name - sha256: f9ebaf68a4b5a68c581492579bb68273c523ef325fbf9ce2f1b57fb136ad023b - url: "https://pub.dev" - source: hosted - version: "1.1.0" characters: dependency: transitive description: @@ -57,38 +65,30 @@ packages: url: "https://pub.dev" source: hosted version: "1.2.1" - clock: + checked_yaml: dependency: transitive description: - name: clock - sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf - url: "https://pub.dev" - source: hosted - version: "1.1.1" - cloud_firestore: - dependency: "direct main" - description: - name: cloud_firestore - sha256: "89d0786dd45eb4a058fe34de621ba2404a32f782b1d4055dbaedfb40f2fda74a" + name: checked_yaml + sha256: feb6bed21949061731a7a75fc5d2aa727cf160b91af9a3e464c5e3a32e28b5ff url: "https://pub.dev" source: hosted - version: "4.7.0" - cloud_firestore_platform_interface: + version: "2.0.3" + cli_util: dependency: transitive description: - name: cloud_firestore_platform_interface - sha256: be88dc57bbe36a8dc672d96651e8e946e7c480bdbdc5ca254cb87e22b337dea4 + name: cli_util + sha256: b8db3080e59b2503ca9e7922c3df2072cf13992354d5e944074ffa836fba43b7 url: "https://pub.dev" source: hosted - version: "5.14.0" - cloud_firestore_web: + version: "0.4.0" + clock: dependency: transitive description: - name: cloud_firestore_web - sha256: f43b2fba735086e6746177edcb326a9991e9334b2ec0a121514c5f13b5cacf43 + name: clock + sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf url: "https://pub.dev" source: hosted - version: "3.5.0" + version: "1.1.1" collection: dependency: transitive description: @@ -105,22 +105,22 @@ packages: url: "https://pub.dev" source: hosted version: "3.1.1" - crypto: + cross_file: dependency: transitive description: - name: crypto - sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab + name: cross_file + sha256: "445db18de832dba8d851e287aff8ccf169bed30d2e94243cb54c7d2f1ed2142c" url: "https://pub.dev" source: hosted - version: "3.0.3" - csslib: + version: "0.3.3+6" + crypto: dependency: transitive description: - name: csslib - sha256: "831883fb353c8bdc1d71979e5b342c7d88acfbc643113c14ae51e2442ea0f20f" + name: crypto + sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab url: "https://pub.dev" source: hosted - version: "0.17.3" + version: "3.0.3" cupertino_icons: dependency: "direct main" description: @@ -129,14 +129,38 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.5" - custom_navigation_bar: + dbus: + dependency: transitive + description: + name: dbus + sha256: "365c771ac3b0e58845f39ec6deebc76e3276aa9922b0cc60840712094d9047ac" + url: "https://pub.dev" + source: hosted + version: "0.7.10" + delayed_display: + dependency: "direct main" + description: + name: delayed_display + sha256: "8d722bb730071b872cef2bc0b07ef20549ebd269087a16ed1c5696896246c296" + url: "https://pub.dev" + source: hosted + version: "2.0.0" + dio: dependency: "direct main" description: - name: custom_navigation_bar - sha256: "2e00e138a1eba71c288aadbcd728f1f8caebf659b95b793aae08a9c0d70ca941" + name: dio + sha256: "7d328c4d898a61efc3cd93655a0955858e29a0aa647f0f9e02d59b3bb275e2e8" url: "https://pub.dev" source: hosted - version: "0.8.2" + version: "4.0.6" + exif: + dependency: "direct main" + description: + name: exif + sha256: a7980fdb3b7ffcd0b035e5b8a5e1eef7cadfe90ea6a4e85ebb62f87b96c7a172 + url: "https://pub.dev" + source: hosted + version: "3.3.0" fake_async: dependency: transitive description: @@ -145,59 +169,139 @@ packages: url: "https://pub.dev" source: hosted version: "1.3.1" + ffi: + dependency: transitive + description: + name: ffi + sha256: ed5337a5660c506388a9f012be0288fb38b49020ce2b45fe1f8b8323fe429f99 + url: "https://pub.dev" + source: hosted + version: "2.0.2" + file_selector_linux: + dependency: transitive + description: + name: file_selector_linux + sha256: "045d372bf19b02aeb69cacf8b4009555fb5f6f0b7ad8016e5f46dd1387ddd492" + url: "https://pub.dev" + source: hosted + version: "0.9.2+1" + file_selector_macos: + dependency: transitive + description: + name: file_selector_macos + sha256: b15c3da8bd4908b9918111fa486903f5808e388b8d1c559949f584725a6594d6 + url: "https://pub.dev" + source: hosted + version: "0.9.3+3" + file_selector_platform_interface: + dependency: transitive + description: + name: file_selector_platform_interface + sha256: "0aa47a725c346825a2bd396343ce63ac00bda6eff2fbc43eabe99737dede8262" + url: "https://pub.dev" + source: hosted + version: "2.6.1" + file_selector_windows: + dependency: transitive + description: + name: file_selector_windows + sha256: d3547240c20cabf205c7c7f01a50ecdbc413755814d6677f3cb366f04abcead0 + url: "https://pub.dev" + source: hosted + version: "0.9.3+1" firebase_auth: dependency: "direct main" description: name: firebase_auth - sha256: bb7064bc837965445893b2388da27142d1cd8198e4be9a3855703d2bfc6ffbaf + sha256: "279b2773ff61afd9763202cb5582e2b995ee57419d826b9af6517302a59b672f" url: "https://pub.dev" source: hosted - version: "4.6.0" + version: "4.16.0" firebase_auth_platform_interface: dependency: transitive description: name: firebase_auth_platform_interface - sha256: "00247ae9b9deb1d1ef3ff1b0c7a1103b51caf973b8a43f326595e414380fd5e2" + sha256: "3c9cfaccb7549492edf5b0c67c6dd1c6727c7830891aa6727f2fb225f0226626" url: "https://pub.dev" source: hosted - version: "6.15.0" + version: "7.0.9" firebase_auth_web: dependency: transitive description: name: firebase_auth_web - sha256: "2c273f8bd78ba5fcd955b85ac0cbba1e7568fee02f14ef9416befcb899a2aa9e" + sha256: c7b1379ccef7abf4b6816eede67a868c44142198e42350f51c01d8fc03f95a7d url: "https://pub.dev" source: hosted - version: "5.5.0" + version: "5.8.13" firebase_core: dependency: "direct main" description: name: firebase_core - sha256: "4491238f4fddc885bc994e304a035eb8aba2c935816b2c0b31d87f3ec6e96682" + sha256: "96607c0e829a581c2a483c658f04e8b159964c3bae2730f73297070bc85d40bb" url: "https://pub.dev" source: hosted - version: "2.12.0" + version: "2.24.2" firebase_core_platform_interface: dependency: transitive description: name: firebase_core_platform_interface - sha256: b63e3be6c96ef5c33bdec1aab23c91eb00696f6452f0519401d640938c94cba2 + sha256: c437ae5d17e6b5cc7981cf6fd458a5db4d12979905f9aafd1fea930428a9fe63 url: "https://pub.dev" source: hosted - version: "4.8.0" + version: "5.0.0" firebase_core_web: dependency: transitive description: name: firebase_core_web - sha256: "8c0f4c87d20e2d001a5915df238c1f9c88704231f591324205f5a5d2a7740a45" + sha256: d585bdf3c656c3f7821ba1bd44da5f13365d22fcecaf5eb75c4295246aaa83c0 url: "https://pub.dev" source: hosted - version: "2.5.0" + version: "2.10.0" flutter: dependency: "direct main" description: flutter source: sdk version: "0.0.0" + flutter_animation_progress_bar: + dependency: "direct main" + description: + name: flutter_animation_progress_bar + sha256: "85f05404faeef7141b1c5b53571293fc19359c120c4aea4430b2b7d808461d09" + url: "https://pub.dev" + source: hosted + version: "2.3.1" + flutter_exif_rotation: + dependency: "direct main" + description: + name: flutter_exif_rotation + sha256: "805143b89fe34ce5b32a7332bd6193d67b23ad054f2df03c4de4dee900d748e9" + url: "https://pub.dev" + source: hosted + version: "0.4.3" + flutter_gif: + dependency: "direct main" + description: + name: flutter_gif + sha256: b13d7e484e40685e9236ffbaddf012c2448a2e2c1ac48bed345184dd7bc87f88 + url: "https://pub.dev" + source: hosted + version: "0.0.4" + flutter_image_slideshow: + dependency: "direct main" + description: + name: flutter_image_slideshow + sha256: ed259d96aea889b6ddc2b641891c3b721ec8ed33e160f08f2ef11acf0438984f + url: "https://pub.dev" + source: hosted + version: "0.1.6" + flutter_launcher_icons: + dependency: "direct main" + description: + name: flutter_launcher_icons + sha256: "526faf84284b86a4cb36d20a5e45147747b7563d921373d4ee0559c54fcdbcea" + url: "https://pub.dev" + source: hosted + version: "0.13.1" flutter_lints: dependency: "direct dev" description: @@ -206,14 +310,62 @@ packages: url: "https://pub.dev" source: hosted version: "2.0.1" - flutter_native_splash: + flutter_local_notifications: dependency: "direct main" description: - name: flutter_native_splash - sha256: af665ef80a213a9ed502845a3d7a61b9acca4100ee7e9f067a7440bc3acd6730 + name: flutter_local_notifications + sha256: "55b9b229307a10974b26296ff29f2e132256ba4bd74266939118eaefa941cb00" + url: "https://pub.dev" + source: hosted + version: "16.3.3" + flutter_local_notifications_linux: + dependency: transitive + description: + name: flutter_local_notifications_linux + sha256: "33f741ef47b5f63cc7f78fe75eeeac7e19f171ff3c3df054d84c1e38bedb6a03" + url: "https://pub.dev" + source: hosted + version: "4.0.0+1" + flutter_local_notifications_platform_interface: + dependency: transitive + description: + name: flutter_local_notifications_platform_interface + sha256: "7cf643d6d5022f3baed0be777b0662cce5919c0a7b86e700299f22dc4ae660ef" url: "https://pub.dev" source: hosted - version: "2.2.19" + version: "7.0.0+1" + flutter_plugin_android_lifecycle: + dependency: transitive + description: + name: flutter_plugin_android_lifecycle + sha256: b068ffc46f82a55844acfa4fdbb61fad72fa2aef0905548419d97f0f95c456da + url: "https://pub.dev" + source: hosted + version: "2.0.17" + flutter_scatter: + dependency: "direct main" + description: + name: flutter_scatter + sha256: "9c0b72595e9c3c94607e29d845b4d32e12adbb02492bac7da1cd765856bf4ac1" + url: "https://pub.dev" + source: hosted + version: "0.2.0" + flutter_spinkit: + dependency: "direct main" + description: + name: flutter_spinkit + sha256: b39c753e909d4796906c5696a14daf33639a76e017136c8d82bf3e620ce5bb8e + url: "https://pub.dev" + source: hosted + version: "5.2.0" + flutter_svg: + dependency: "direct main" + description: + name: flutter_svg + sha256: "6ff9fa12892ae074092de2fa6a9938fb21dbabfdaa2ff57dc697ff912fc8d4b2" + url: "https://pub.dev" + source: hosted + version: "1.1.6" flutter_test: dependency: "direct dev" description: flutter @@ -224,6 +376,22 @@ packages: description: flutter source: sdk version: "0.0.0" + fluttertoast: + dependency: "direct main" + description: + name: fluttertoast + sha256: dfdde255317af381bfc1c486ed968d5a43a2ded9c931e87cbecd88767d6a71c1 + url: "https://pub.dev" + source: hosted + version: "8.2.4" + get: + dependency: "direct main" + description: + name: get + sha256: "2ba20a47c8f1f233bed775ba2dd0d3ac97b4cf32fc17731b3dfc672b06b0e92a" + url: "https://pub.dev" + source: hosted + version: "4.6.5" google_identity_services_web: dependency: transitive description: @@ -272,14 +440,6 @@ packages: url: "https://pub.dev" source: hosted version: "0.12.0" - html: - dependency: transitive - description: - name: html - sha256: "58e3491f7bf0b6a4ea5110c0c688877460d1a6366731155c4a4580e7ded773e8" - url: "https://pub.dev" - source: hosted - version: "0.15.3" http: dependency: "direct main" description: @@ -304,6 +464,86 @@ packages: url: "https://pub.dev" source: hosted version: "4.0.17" + image_picker: + dependency: "direct main" + description: + name: image_picker + sha256: b6951e25b795d053a6ba03af5f710069c99349de9341af95155d52665cb4607c + url: "https://pub.dev" + source: hosted + version: "0.8.9" + image_picker_android: + dependency: transitive + description: + name: image_picker_android + sha256: d6a6e78821086b0b737009b09363018309bbc6de3fd88cc5c26bc2bb44a4957f + url: "https://pub.dev" + source: hosted + version: "0.8.8+2" + image_picker_for_web: + dependency: transitive + description: + name: image_picker_for_web + sha256: "869fe8a64771b7afbc99fc433a5f7be2fea4d1cb3d7c11a48b6b579eb9c797f0" + url: "https://pub.dev" + source: hosted + version: "2.2.0" + image_picker_ios: + dependency: transitive + description: + name: image_picker_ios + sha256: "76ec722aeea419d03aa915c2c96bf5b47214b053899088c9abb4086ceecf97a7" + url: "https://pub.dev" + source: hosted + version: "0.8.8+4" + image_picker_linux: + dependency: transitive + description: + name: image_picker_linux + sha256: "4ed1d9bb36f7cd60aa6e6cd479779cc56a4cb4e4de8f49d487b1aaad831300fa" + url: "https://pub.dev" + source: hosted + version: "0.2.1+1" + image_picker_macos: + dependency: transitive + description: + name: image_picker_macos + sha256: "3f5ad1e8112a9a6111c46d0b57a7be2286a9a07fc6e1976fdf5be2bd31d4ff62" + url: "https://pub.dev" + source: hosted + version: "0.2.1+1" + image_picker_platform_interface: + dependency: transitive + description: + name: image_picker_platform_interface + sha256: ed9b00e63977c93b0d2d2b343685bed9c324534ba5abafbb3dfbd6a780b1b514 + url: "https://pub.dev" + source: hosted + version: "2.9.1" + image_picker_windows: + dependency: transitive + description: + name: image_picker_windows + sha256: "6ad07afc4eb1bc25f3a01084d28520496c4a3bb0cb13685435838167c9dcedeb" + url: "https://pub.dev" + source: hosted + version: "0.2.1+1" + input_slider: + dependency: "direct main" + description: + name: input_slider + sha256: d88e70774950db0499280d9e26b084db494d644cd27adc5e796026d84bce09de + url: "https://pub.dev" + source: hosted + version: "0.3.1" + intl: + dependency: "direct main" + description: + name: intl + sha256: "910f85bce16fb5c6f614e117efa303e85a1731bb0081edf3604a2ae6e9a3cc91" + url: "https://pub.dev" + source: hosted + version: "0.17.0" js: dependency: transitive description: @@ -312,6 +552,38 @@ packages: url: "https://pub.dev" source: hosted version: "0.6.5" + json_annotation: + dependency: transitive + description: + name: json_annotation + sha256: b10a7b2ff83d83c777edba3c6a0f97045ddadd56c944e1a23a3fdf43a1bf4467 + url: "https://pub.dev" + source: hosted + version: "4.8.1" + just_audio: + dependency: "direct main" + description: + name: just_audio + sha256: b607cd1a43bac03d85c3aaee00448ff4a589ef2a77104e3d409889ff079bf823 + url: "https://pub.dev" + source: hosted + version: "0.9.36" + just_audio_platform_interface: + dependency: transitive + description: + name: just_audio_platform_interface + sha256: c3dee0014248c97c91fe6299edb73dc4d6c6930a2f4f713579cd692d9e47f4a1 + url: "https://pub.dev" + source: hosted + version: "4.2.2" + just_audio_web: + dependency: transitive + description: + name: just_audio_web + sha256: "134356b0fe3d898293102b33b5fd618831ffdc72bb7a1b726140abdf22772b70" + url: "https://pub.dev" + source: hosted + version: "0.4.9" lints: dependency: transitive description: @@ -344,6 +616,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.8.0" + mime: + dependency: transitive + description: + name: mime + sha256: e4ff8e8564c03f255408decd16e7899da1733852a9110a58fe6d1b817684a63e + url: "https://pub.dev" + source: hosted + version: "1.0.4" path: dependency: transitive description: @@ -352,6 +632,86 @@ packages: url: "https://pub.dev" source: hosted version: "1.8.2" + path_drawing: + dependency: transitive + description: + name: path_drawing + sha256: bbb1934c0cbb03091af082a6389ca2080345291ef07a5fa6d6e078ba8682f977 + url: "https://pub.dev" + source: hosted + version: "1.0.1" + path_parsing: + dependency: transitive + description: + name: path_parsing + sha256: e3e67b1629e6f7e8100b367d3db6ba6af4b1f0bb80f64db18ef1fbabd2fa9ccf + url: "https://pub.dev" + source: hosted + version: "1.0.1" + path_provider: + dependency: "direct main" + description: + name: path_provider + sha256: a1aa8aaa2542a6bc57e381f132af822420216c80d4781f7aa085ca3229208aaa + url: "https://pub.dev" + source: hosted + version: "2.1.1" + path_provider_android: + dependency: transitive + description: + name: path_provider_android + sha256: e595b98692943b4881b219f0a9e3945118d3c16bd7e2813f98ec6e532d905f72 + url: "https://pub.dev" + source: hosted + version: "2.2.1" + path_provider_foundation: + dependency: transitive + description: + name: path_provider_foundation + sha256: "19314d595120f82aca0ba62787d58dde2cc6b5df7d2f0daf72489e38d1b57f2d" + url: "https://pub.dev" + source: hosted + version: "2.3.1" + path_provider_linux: + dependency: transitive + description: + name: path_provider_linux + sha256: f7a1fe3a634fe7734c8d3f2766ad746ae2a2884abe22e241a8b301bf5cac3279 + url: "https://pub.dev" + source: hosted + version: "2.2.1" + path_provider_platform_interface: + dependency: transitive + description: + name: path_provider_platform_interface + sha256: "94b1e0dd80970c1ce43d5d4e050a9918fce4f4a775e6142424c30a29a363265c" + url: "https://pub.dev" + source: hosted + version: "2.1.1" + path_provider_windows: + dependency: transitive + description: + name: path_provider_windows + sha256: "8bc9f22eee8690981c22aa7fc602f5c85b497a6fb2ceb35ee5a5e5ed85ad8170" + url: "https://pub.dev" + source: hosted + version: "2.2.1" + permission_handler: + dependency: "direct main" + description: + name: permission_handler + sha256: "4356882e9abf51aa0d56e8fb886e0d6162719f2310dd71f0b8fa7f34908b128d" + url: "https://pub.dev" + source: hosted + version: "8.3.0" + permission_handler_platform_interface: + dependency: transitive + description: + name: permission_handler_platform_interface + sha256: "6760eb5ef34589224771010805bea6054ad28453906936f843a8cc4d3a55c4a4" + url: "https://pub.dev" + source: hosted + version: "3.12.0" petitparser: dependency: transitive description: @@ -360,6 +720,14 @@ packages: url: "https://pub.dev" source: hosted version: "5.1.0" + platform: + dependency: transitive + description: + name: platform + sha256: "0a279f0707af40c890e80b1e9df8bb761694c074ba7e1d4ab1bc4b728e200b59" + url: "https://pub.dev" + source: hosted + version: "3.1.3" plugin_platform_interface: dependency: transitive description: @@ -384,6 +752,14 @@ packages: url: "https://pub.dev" source: hosted version: "3.2.1" + rxdart: + dependency: transitive + description: + name: rxdart + sha256: "0c7c0cedd93788d996e33041ffecda924cc54389199cde4e6a34b440f50044cb" + url: "https://pub.dev" + source: hosted + version: "0.27.7" sky_engine: dependency: transitive description: flutter @@ -397,6 +773,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.9.1" + sprintf: + dependency: transitive + description: + name: sprintf + sha256: "1fc9ffe69d4df602376b52949af107d8f5703b77cda567c4d7d86a0693120f23" + url: "https://pub.dev" + source: hosted + version: "7.0.0" stack_trace: dependency: transitive description: @@ -437,6 +821,14 @@ packages: url: "https://pub.dev" source: hosted version: "0.4.16" + timezone: + dependency: transitive + description: + name: timezone + sha256: "1cfd8ddc2d1cfd836bc93e67b9be88c3adaeca6f40a00ca999104c30693cdca0" + url: "https://pub.dev" + source: hosted + version: "0.9.2" typed_data: dependency: transitive description: @@ -445,14 +837,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.3.2" - universal_io: + uuid: dependency: transitive description: - name: universal_io - sha256: "06866290206d196064fd61df4c7aea1ffe9a4e7c4ccaa8fcded42dd41948005d" + name: uuid + sha256: b715b8d3858b6fa9f68f87d20d98830283628014750c2b09b6f516c1da4af2a7 url: "https://pub.dev" source: hosted - version: "2.2.0" + version: "4.1.0" vector_math: dependency: transitive description: @@ -461,6 +853,30 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.4" + win32: + dependency: transitive + description: + name: win32 + sha256: "5a751eddf9db89b3e5f9d50c20ab8612296e4e8db69009788d6c8b060a84191c" + url: "https://pub.dev" + source: hosted + version: "4.1.4" + word_cloud: + dependency: "direct main" + description: + name: word_cloud + sha256: "72fe356a4534ee24d84d0b2a1dc7f93f5cebf3f909bacd9762569643c835ce74" + url: "https://pub.dev" + source: hosted + version: "1.0.1" + xdg_directories: + dependency: transitive + description: + name: xdg_directories + sha256: "589ada45ba9e39405c198fe34eb0f607cddb2108527e658136120892beac46d2" + url: "https://pub.dev" + source: hosted + version: "1.0.3" xml: dependency: transitive description: @@ -479,4 +895,4 @@ packages: version: "3.1.2" sdks: dart: ">=2.19.6 <3.0.0" - flutter: ">=3.3.0" + flutter: ">=3.7.0" diff --git a/client/pubspec.yaml b/client/pubspec.yaml index 5c8cb56..a086993 100644 --- a/client/pubspec.yaml +++ b/client/pubspec.yaml @@ -9,15 +9,50 @@ environment: dependencies: flutter: sdk: flutter - cloud_firestore: ^4.7.0 - custom_navigation_bar: ^0.8.2 - firebase_auth: ^4.6.0 - firebase_core: ^2.12.0 + exif: ^3.1.4 + + http: ^0.13.3 + + cupertino_icons: ^1.0.2 + get: ^4.6.5 + flutter_scatter: ^0.2.0 + word_cloud: ^1.0.1 + #image_picker: ^1.0.2 + image_picker: ^0.8.4+2 + dio: ^4.0.6 + + #flutter_secure_storage: ^9.0.0 + firebase_core: ^2.15.1 + firebase_auth: ^4.9.0 + google_sign_in: ^6.1.0 - http: ^0.13.6 - flutter_native_splash: ^2.2.19 - change_app_package_name: ^1.1.0 + + flutter_svg: ^1.0.1 + + intl: ^0.17.0 + fluttertoast: ^8.2.2 + flutter_animation_progress_bar: ^2.3.1 + + flutter_local_notifications: ^16.1.0 + flutter_exif_rotation: ^0.4.1 + permission_handler: ^8.3.0 + + flutter_image_slideshow: ^0.1.6 + + just_audio: ^0.9.35 + + animated_text_kit: ^4.2.2 + flutter_spinkit: ^5.2.0 + delayed_display: ^2.0.0 + + flutter_gif: ^0.0.4 + + path_provider: ^2.0.14 + + flutter_launcher_icons: ^0.13.1 + + input_slider: ^0.3.1 # assets: # - images/conversation_button.png @@ -32,6 +67,9 @@ flutter: uses-material-design: true assets: - assets/images/conversation_button.png + - assets/images/logo/pup_logo.svg + - assets/images/logo/testlogo.svg + - assets/images/logo/logotest.svg - assets/images/illust_test.png - assets/images/background_test.png - assets/images/left_arrow.png @@ -45,4 +83,530 @@ flutter: - assets/images/home_right_arrow.png - assets/images/proto_recommend1.png + - assets/images/bottom_navigation/home.png + - assets/images/bottom_navigation/help.png + - assets/images/bottom_navigation/gallery.png + - assets/images/bottom_navigation/my_page.png + - assets/images/bottom_navigation/feed.png + - assets/images/logo/pupmory_logo.png + - assets/images/logo/pupmory_logo2.png + - assets/images/logo/home_main_logo.png + - assets/images/logo/changed_logo.png + - assets/images/logo/google_logo.png + - assets/images/logo/pupmory_logo3.svg + - assets/images/home/conversation_button.png + - assets/images/home/home_image1.png + - assets/images/home/help_main.png + - assets/images/user_null.svg + - assets/images/user_null2.svg + - assets/images/home/home_img_main.svg + - assets/images/home/help_main.svg + - assets/images/home/home_main_logo.svg + - assets/images/home/home_illust1.svg + - assets/images/home/go_icon.svg + - assets/images/home/go_icon1.svg + - assets/images/home/home_muji.svg + - assets/images/home/home_muji.gif + - assets/images/home/home_muji2.gif + - assets/images/home/lev1.svg + - assets/images/home/lev2.svg + - assets/images/home/lev3.svg + - assets/images/home/lev4.svg + - assets/images/help/help_heart.svg + - assets/images/help/help_request.png + - assets/images/help/help_pop_up.png + - assets/images/help/help_record_button.png + - assets/images/help/introduce_request_help.png + - assets/images/help/introduce_ask_help.png + - assets/images/help/introduce_send_help.png + - assets/images/help/no_help.svg + - assets/images/help/no_send_help.svg + - assets/images/help/ask_help.svg + - assets/images/help/send_help.svg + - assets/images/help/help_count_y.svg + - assets/images/help/help_count_n.svg + - assets/images/help/send_help.svg + - assets/images/help/attention.svg + - assets/images/help/dropdown_down.svg + - assets/images/help/dropdown_up.svg + - assets/images/help/sendmuji.svg + - assets/images/help/write_help_muji.svg + - assets/images/help/no_send.svg + - assets/images/memorial/camera.png + - assets/images/memorial/memorial_upload.png + - assets/images/memorial/memorial_write.png + - assets/images/memorial/heart.png + - assets/images/memorial/comment.png + - assets/images/memorial/look_others_arrow.png + - assets/images/memorial/character_head.png + - assets/images/memorial/wordcloud.jpg + - assets/images/memorial/more_memorial.png + - assets/images/memorial/more_memorial.svg + - assets/images/memorial/paw.svg + - assets/images/memorial/blue_arrow.svg + - assets/images/memorial/white_heart.png + - assets/images/memorial/no_result.svg + - assets/images/no_result.svg + - assets/images/memorial/upload_icon.png + - assets/images/memorial/image_rep.svg + - assets/images/memorial/upload_button.svg + - assets/images/memorial/private.svg + - assets/images/memorial/upload_icon.svg + - assets/images/memorial/upload_icon2.svg + - assets/images/memorial/heart-fill.svg + - assets/images/memorial/heart-empty.svg + - assets/images/memorial/comments.svg + - assets/images/memorial/reset.svg + - assets/images/memorial/memorial_img.svg + - assets/images/memorial/foot.svg + - assets/images/memorial/delete_bt.svg + - assets/images/memorial/cloud.svg + - assets/images/memorial/help_btn2.svg + - assets/images/memorial/delete.svg + - assets/images/memorial/deletecom.svg + - assets/images/home/help_page.png + - assets/images/home/arrow.svg + - assets/images/home/con_btn.svg + - assets/images/home/con_btn2.svg + - assets/images/home/con_btn2.png + - assets/images/home/conbtn.svg + - assets/images/home/cl_con.svg + - assets/images/home/after_con.svg + - assets/images/home/btnframe.svg + - assets/images/cancel_icon.svg + - assets/images/conversation/home_icon.svg + - assets/images/conversation/bubble.svg + - assets/images/conversation/con_tail.svg + - assets/images/conversation/muji1.svg + - assets/images/conversation/user.svg + - assets/images/conversation/user2.svg + - assets/images/conversation/user3.svg + - assets/images/conversation/user4.svg + - assets/images/conversation/user5.svg + - assets/images/conversation/user6.svg + - assets/images/conversation/user7.svg + - assets/images/conversation/shadow.svg + - assets/images/conversation/user_hand.svg + - assets/images/conversation/intro/miss.svg + - assets/images/conversation/intro/grief.svg + - assets/images/conversation/intro/intro_cloud.svg + - assets/images/conversation/intro/intro_star.svg + - assets/images/conversation/intro/intro_bubble.svg + - assets/images/conversation/early/yes.svg + - assets/images/conversation/early/no.svg + - assets/images/conversation/middle/good.svg + - assets/images/conversation/middle/good_un.svg + - assets/images/conversation/middle/little.svg + - assets/images/conversation/middle/little_un.svg + - assets/images/conversation/middle/hard.svg + - assets/images/conversation/middle/hard_un.svg + - assets/images/conversation/middle/cool.svg + - assets/images/conversation/middle/cool_min.svg + - assets/images/conversation/middle/rainy.svg + - assets/images/conversation/middle/rainy_min.svg + - assets/images/conversation/middle/sunny_min.svg + - assets/images/conversation/middle/sunny.svg + - assets/images/conversation/middle/snow.svg + - assets/images/conversation/middle/snow_min.svg + - assets/images/conversation/middle/sno.svg + - assets/images/conversation/middle/sun.svg + - assets/images/conversation/middle/realmuji.svg + - assets/images/conversation/middle/myletter.svg + - assets/images/conversation/con_muji.svg + - assets/images/conversation/con_user.svg + - assets/images/conversation/con_user_desk.svg + - assets/images/conversation/con_desk.svg + - assets/images/conversation/gif/muji_base.gif + - assets/images/conversation/gif/muji_base_eye.gif + - assets/images/conversation/gif/muji_ear.gif + - assets/images/conversation/gif/muji_mouth1.gif + - assets/images/conversation/gif/think_mouth.gif + - assets/images/conversation/gif/think_muji.gif + - assets/images/conversation/gif/think_back.gif + - assets/images/conversation/gif/think_face.gif + - assets/images/conversation/gif/think_body.gif + - assets/images/conversation/gif/think_eye.gif + - assets/images/conversation/gif/think_ear.gif + - assets/images/conversation/gif/sad_muji.gif + - assets/images/conversation/gif/smile_muji.gif + - assets/images/conversation/gif/thinking1.gif + - assets/images/sign/google_logo.svg + - assets/images/appbar/home.svg + - assets/images/appbar/memorial.svg + - assets/images/appbar/my.svg + - assets/images/conversation/end/add_btn.svg + - assets/images/conversation/end/paper.svg + - assets/images/conversation/end/future.svg + - assets/images/conversation/end/one.svg + - assets/images/conversation/end/two.svg + - assets/images/conversation/end/three.svg + - assets/images/conversation/end/five.svg + - assets/images/conversation/end/future.png + - assets/images/conversation/end/sc1.png + - assets/images/conversation/end/sc2.png + - assets/images/conversation/done_cloud.svg + - assets/images/conversation/done_con.svg + - assets/images/conversation/done_drop.svg + - assets/images/appbar/together.svg + - assets/images/mypage/announce.svg + - assets/images/mypage/comment.svg + - assets/images/mypage/help.svg + - assets/images/mypage/setting.png + - assets/images/mypage/smart.svg + - assets/images/mypage/cloud.png + - assets/images/story/background.png + - assets/images/story/background2.png + - assets/images/story/board1.png + - assets/images/story/board2.png + - assets/images/story/bbk1.png + - assets/images/story/bbk2.png + - assets/images/story/bbkcloud.png + - assets/images/story/muji.svg + - assets/images/story/muji3.svg + - assets/images/story/st1.svg + - assets/images/story/st2.svg + - assets/images/story/st3.svg + - assets/images/story/st4.svg + - assets/images/story/st5.svg + - assets/images/story/st6.svg + - assets/images/story/st7.svg + - assets/images/story/st8.svg + - assets/images/story/st9.svg + - assets/images/conversation/intro/coach1.svg + - assets/images/conversation/intro/screen1.png + - assets/images/conversation/intro/iscreen1.png + - assets/images/conversation/intro/iscreen2.png + - assets/images/conversation/intro/iscreen3.png + - assets/images/conversation/intro/iscreen4.png + - assets/images/conversation/intro/coach3.svg + - assets/images/conversation/intro/coach01.svg + - assets/images/conversation/intro/screen01.svg + - assets/images/conversation/intro/sc1.png + - assets/images/conversation/intro/sc01.svg + - assets/images/conversation/intro/sc001.svg + - assets/images/conversation/intro/scr01.svg + - assets/images/conversation/early/screen01.png + - assets/images/conversation/early/screen02.png + - assets/images/conversation/early/screen03.png + - assets/images/conversation/early/screen04.png + + - assets/voice/intro/intro1.mp3 + - assets/voice/intro/intro2.mp3 + - assets/voice/intro/intro3.mp3 + - assets/voice/intro/intro4.mp3 + - assets/voice/intro/intro5.mp3 + - assets/voice/intro/intro6.mp3 + - assets/voice/intro/intro7.mp3 + - assets/voice/intro/intro8.mp3 + - assets/voice/intro/intro9.mp3 + - assets/voice/intro/intro10.mp3 + - assets/voice/intro/intro11.mp3 + - assets/voice/intro/intro12.mp3 + - assets/voice/intro/intro13.mp3 + - assets/voice/intro/intro14.mp3 + - assets/voice/intro/intro15.mp3 + - assets/voice/intro/intro16.mp3 + - assets/voice/intro/intro17.mp3 + - assets/voice/intro/intro_grief1.mp3 + - assets/voice/intro/intro_grief2.mp3 + - assets/voice/intro/intro_grief3.mp3 + - assets/voice/intro/intro_grief4.mp3 + - assets/voice/intro/intro_grief5.mp3 + - assets/voice/intro/intro_miss1.mp3 + - assets/voice/intro/intro_miss2.mp3 + - assets/voice/intro/intro_miss3.mp3 + - assets/voice/intro/intro_miss4.mp3 + - assets/voice/intro/intro2_1.mp3 + - assets/voice/intro/intro2_2.mp3 + - assets/voice/intro/intro2_3.mp3 + - assets/voice/intro/intro2_4.mp3 + - assets/voice/intro/intro2_5.mp3 + - assets/voice/intro/intro2_6.mp3 + - assets/voice/intro/intro2_7.mp3 + - assets/voice/intro/intro2_8.mp3 + - assets/voice/intro/intro2_9.mp3 + - assets/voice/start1.mp3 + - assets/voice/yes.mp3 + - assets/voice/no1.mp3 + - assets/voice/no2.mp3 + - assets/voice/early/memory/memory1.mp3 + - assets/voice/early/memory/memory2.mp3 + - assets/voice/early/memory/memory3.mp3 + - assets/voice/early/memory/memory4.mp3 + - assets/voice/early/memory/memory5.mp3 + - assets/voice/early/memory/memory6.mp3 + - assets/voice/early/memory/memory7.mp3 + - assets/voice/early/memory/memory8.mp3 + - assets/voice/early/memory/memory9.mp3 + - assets/voice/early/memory/memory10.mp3 + - assets/voice/early/memory/memory11.mp3 + - assets/voice/early/memory/memory12.mp3 + - assets/voice/early/memory/memory13.mp3 + - assets/voice/early/memory/memory14.mp3 + - assets/voice/early/memory/memory15.mp3 + - assets/voice/early/memory/memoryhappy1.mp3 + - assets/voice/early/memory/memoryhappy2.mp3 + - assets/voice/early/memory/memoryhappy3.mp3 + - assets/voice/early/memory/memoryhappy4.mp3 + - assets/voice/early/memory/memoryhappy5.mp3 + - assets/voice/early/memory/memoryhappy6.mp3 + - assets/voice/early/memory/memoryhappy7.mp3 + - assets/voice/early/memory/memoryhappy8.mp3 + - assets/voice/early/memory/memoryhappy9.mp3 + - assets/voice/early/memory/memoryhappy10.mp3 + - assets/voice/early/memory/memoryhappy11.mp3 + - assets/voice/early/memory/memorysad1.mp3 + - assets/voice/early/memory/memorysad2.mp3 + - assets/voice/early/memory/memorysad3.mp3 + - assets/voice/early/memory/memorysad4.mp3 + - assets/voice/early/memory/memorysad5.mp3 + - assets/voice/early/memory/memorysad6.mp3 + - assets/voice/early/memory/memorysad7.mp3 + - assets/voice/early/farewell/farewell1.mp3 + - assets/voice/early/farewell/farewell2.mp3 + - assets/voice/early/farewell/farewell3.mp3 + - assets/voice/early/farewell/farewell3-1.mp3 + - assets/voice/early/farewell/farewell3-2.mp3 + - assets/voice/early/farewell/farewell_modi.mp3 + - assets/voice/early/farewell/farewell4.mp3 + - assets/voice/early/farewell/farewell5.mp3 + - assets/voice/early/farewell/farewell6.mp3 + - assets/voice/early/farewell/farewell7.mp3 + - assets/voice/early/farewell/farewell8.mp3 + - assets/voice/early/farewell/farewell9.mp3 + - assets/voice/early/farewell/farewell10.mp3 + - assets/voice/early/farewell/farewell11.mp3 + - assets/voice/early/farewell/farewell12.mp3 + - assets/voice/early/farewell/regno1.mp3 + - assets/voice/early/farewell/regno2.mp3 + - assets/voice/early/farewell/regno3.mp3 + - assets/voice/early/farewell/regno4.mp3 + - assets/voice/early/farewell/regno5.mp3 + - assets/voice/early/farewell/regno6.mp3 + - assets/voice/early/farewell/regno7.mp3 + - assets/voice/early/farewell/regno8.mp3 + - assets/voice/early/farewell/regno9.mp3 + - assets/voice/early/farewell/regno10.mp3 + - assets/voice/early/farewell/regno11.mp3 + - assets/voice/early/farewell/regno12.mp3 + - assets/voice/early/farewell/regyes1.mp3 + - assets/voice/early/farewell/regyes2.mp3 + - assets/voice/early/farewell/regyes3.mp3 + - assets/voice/early/farewell/regyes4.mp3 + - assets/voice/early/farewell/regyes5.mp3 + - assets/voice/early/farewell/regyes6.mp3 + - assets/voice/early/farewell/regyes7.mp3 + - assets/voice/early/farewell/regyes8.mp3 + - assets/voice/early/farewell/regyes9.mp3 + - assets/voice/early/farewell/endfarewell1.mp3 + - assets/voice/early/farewell/endfarewell2.mp3 + - assets/voice/early/farewell/endfarewell3.mp3 + - assets/voice/middle/sadness/start1.mp3 + - assets/voice/middle/sadness/start2.mp3 + - assets/voice/middle/sadness/start3.mp3 + - assets/voice/middle/sadness/start4.mp3 + - assets/voice/middle/sadness/start5.mp3 + - assets/voice/middle/sadness/start6.mp3 + - assets/voice/middle/sadness/start7.mp3 + - assets/voice/middle/sadness/good1.mp3 + - assets/voice/middle/sadness/good2.mp3 + - assets/voice/middle/sadness/good3.mp3 + - assets/voice/middle/sadness/good4.mp3 + - assets/voice/middle/sadness/little1.mp3 + - assets/voice/middle/sadness/little2.mp3 + - assets/voice/middle/sadness/little3.mp3 + - assets/voice/middle/sadness/little4.mp3 + - assets/voice/middle/sadness/little_1.mp3 + - assets/voice/middle/sadness/little_2.mp3 + - assets/voice/middle/sadness/little_3.mp3 + - assets/voice/middle/sadness/little_4.mp3 + - assets/voice/middle/sadness/hard1.mp3 + - assets/voice/middle/sadness/hard2.mp3 + - assets/voice/middle/sadness/hard3.mp3 + - assets/voice/middle/sadness/next1.mp3 + - assets/voice/middle/sadness/next2.mp3 + - assets/voice/middle/sadness/next3.mp3 + - assets/voice/middle/sadness/next4.mp3 + - assets/voice/middle/sadness/sad1.mp3 + - assets/voice/middle/sadness/sad2.mp3 + - assets/voice/middle/sadness/sad3.mp3 + - assets/voice/middle/sadness/endure1.mp3 + - assets/voice/middle/sadness/endure2.mp3 + - assets/voice/middle/sadness/endure3.mp3 + - assets/voice/middle/sadness/endure4.mp3 + - assets/voice/middle/sadness/endure5.mp3 + - assets/voice/middle/sadness/endure6.mp3 + - assets/voice/middle/sadness/last1.mp3 + - assets/voice/middle/sadness/last2.mp3 + - assets/voice/middle/sadness/last3.mp3 + - assets/voice/middle/sadness/last4.mp3 + - assets/voice/middle/sadness/last5.mp3 + - assets/voice/middle/sadness/last6.mp3 + - assets/voice/middle/sadness/last7.mp3 + - assets/voice/middle/sadness/last8.mp3 + - assets/voice/middle/sadness/last9.mp3 + - assets/voice/middle/sadness/last10.mp3 + - assets/voice/middle/sadness/last11.mp3 + - assets/voice/middle/sadness/last12.mp3 + - assets/voice/middle/sadness/last13.mp3 + - assets/voice/middle/sadness/end1.mp3 + - assets/voice/middle/sadness/end2.mp3 + - assets/voice/middle/sadness/end3.mp3 + - assets/voice/middle/sadness/end4.mp3 + - assets/voice/middle/truth/truth1.mp3 + - assets/voice/middle/truth/truth2.mp3 + - assets/voice/middle/truth/truth3.mp3 + - assets/voice/middle/truth/truth4.mp3 + - assets/voice/middle/truth/truth5.mp3 + - assets/voice/middle/truth/truth6.mp3 + - assets/voice/middle/truth/truth7.mp3 + - assets/voice/middle/truth/truth8.mp3 + - assets/voice/middle/truth/truth9.mp3 + - assets/voice/middle/truth/truth10.mp3 + - assets/voice/middle/truth/truth11.mp3 + - assets/voice/middle/truth/truth12.mp3 + - assets/voice/middle/truth/truth13.mp3 + - assets/voice/middle/truth/truth14.mp3 + - assets/voice/middle/truth/truth15.mp3 + - assets/voice/middle/truth/truth16.mp3 + - assets/voice/middle/truth/truth17.mp3 + - assets/voice/middle/truth/truth18.mp3 + - assets/voice/middle/truth/truth19.mp3 + - assets/voice/middle/truth/truth20.mp3 + - assets/voice/middle/truth/truth21.mp3 + - assets/voice/middle/truth/truth22.mp3 + - assets/voice/middle/truth/truth23.mp3 + - assets/voice/middle/truth/truth24.mp3 + - assets/voice/middle/truth/truth25.mp3 + - assets/voice/middle/truth/truth26.mp3 + - assets/voice/middle/truth/truth27.mp3 + - assets/voice/middle/truth/truth28.mp3 + - assets/voice/middle/truth/truth29.mp3 + - assets/voice/middle/truth/truth30.mp3 + - assets/voice/middle/truth/truth31.mp3 + - assets/voice/late/late1.mp3 + - assets/voice/late/late2.mp3 + - assets/voice/late/late3.mp3 + - assets/voice/late/late4.mp3 + - assets/voice/late/late5.mp3 + - assets/voice/late/late6.mp3 + - assets/voice/late/late7.mp3 + - assets/voice/late/late8.mp3 + - assets/voice/late/late9.mp3 + - assets/voice/late/late10.mp3 + - assets/voice/late/late11.mp3 + - assets/voice/late/late12.mp3 + - assets/voice/late/late13.mp3 + - assets/voice/late/late14.mp3 + - assets/voice/late/late15.mp3 + - assets/voice/late/late16.mp3 + - assets/voice/late/late17.mp3 + - assets/voice/late/late18.mp3 + - assets/voice/late/late19.mp3 + - assets/voice/late/late20.mp3 + - assets/voice/late/late21.mp3 + - assets/voice/late/late22.mp3 + - assets/voice/late/late23.mp3 + - assets/voice/late/late24.mp3 + - assets/voice/late/late25.mp3 + - assets/voice/late/late26.mp3 + - assets/voice/late/late27.mp3 + - assets/voice/late/late28.mp3 + - assets/voice/late/late29.mp3 + - assets/voice/late/late30.mp3 + - assets/voice/late/late31.mp3 + - assets/voice/late/late32.mp3 + - assets/voice/late/late33.mp3 + - assets/voice/late/late34.mp3 + - assets/voice/end/endp2_1.mp3 + - assets/voice/end/endp2_2.mp3 + - assets/voice/end/endp2_3.mp3 + - assets/voice/end/endp2_4.mp3 + - assets/voice/end/endp2_5.mp3 + - assets/voice/end/endp2_6.mp3 + - assets/voice/end/the_end.mp3 + - assets/voice/story/muji1.mp3 + - assets/voice/story/muji2.mp3 + - assets/voice/story/pup1.mp3 + - assets/voice/story/pup2.mp3 + - assets/voice/story/pup3.mp3 + - assets/voice/story/pup4.mp3 + - assets/voice/story/pup5.mp3 + - assets/voice/story/pup6.mp3 + - assets/voice/end/endp1.mp3 + - assets/voice/end/endp2.mp3 + - assets/voice/end/endp3.mp3 + - assets/voice/end/endp4.mp3 + - assets/voice/end/endp5.mp3 + - assets/voice/end/endp6.mp3 + - assets/voice/end/endp7.mp3 + - assets/voice/end/endp8.mp3 + - assets/voice/end/endp9.mp3 + - assets/voice/end/endp10.mp3 + - assets/voice/end/endp11.mp3 + - assets/voice/end/endp12.mp3 + - assets/voice/end/endp13.mp3 + - assets/voice/end/endp15.mp3 + - assets/voice/end/endp16.mp3 + - assets/voice/end/endp17.mp3 + - assets/voice/end/endp18.mp3 + - assets/voice/end/endp19.mp3 + - assets/voice/end/endp20.mp3 + - assets/voice/end/endp21.mp3 + - assets/voice/end/endp22.mp3 + - assets/voice/end/endp23.mp3 + - assets/voice/end/endp24.mp3 + - assets/voice/end/endp25.mp3 + - assets/voice/end/endp26.mp3 + - assets/voice/end/endp27.mp3 + - assets/musics/intro_music.mp3 + - assets/musics/intro_music_1.mp3 + - assets/musics/early_music.mp3 + - assets/musics/middle_music.mp3 + - assets/musics/late_music.mp3 + - assets/musics/end_music.mp3 + + + + # TmoneyRoundWindExtraBold, Cafe24Ssurround-v2.0, Cafe24SsurroundAir-v1.1 + + fonts: + - family: Bameuihaebyun + fonts: + - asset: assets/font/Bameuihaebyun.ttf + weight: 200 + + - family: Pretendard + fonts: + - asset: assets/font/Pretendard-Bold.ttf + weight: 700 + - asset: assets/font/Pretendard-Light.ttf + weight: 300 + - asset: assets/font/Pretendard-Medium.ttf + weight: 500 + - asset: assets/font/Pretendard-Regular.ttf + weight: 400 + - asset: assets/font/Pretendard-SemiBold.ttf + weight: 600 + + - family: Nanum-BaReunHiPi + fonts: + - asset: assets/font/Nanum-BaReunHiPi.ttf + weight: 600 + + - family: TmoneyRoundWindExtraBold + fonts: + - asset: assets/font/TmoneyRoundWindExtraBold.ttf + weight: 600 + + - family: Cafe24Ssurround-v2.0 + fonts: + - asset: assets/font/Cafe24Ssurround-v2.0.ttf + weight: 200 + + - family: Cafe24SsurroundAir-v1.1 + fonts: + - asset: assets/font/Cafe24SsurroundAir-v1.1.ttf + weight: 500 +