diff --git a/front/capstone_front/lib/main.dart b/front/capstone_front/lib/main.dart index 97459d79dd..d85090a36a 100644 --- a/front/capstone_front/lib/main.dart +++ b/front/capstone_front/lib/main.dart @@ -6,6 +6,7 @@ import 'package:capstone_front/screens/login/login_screen.dart'; import 'package:capstone_front/screens/login/signup_screen.dart'; import 'package:capstone_front/screens/notice/notice_screen.dart'; import 'package:capstone_front/screens/notice_detail/notice_detail_screen.dart'; +import 'package:capstone_front/screens/qna_list_screen/qna_list_screen.dart'; import 'package:capstone_front/screens/speeking_practice/pronunciation_practice_screen.dart'; import 'package:capstone_front/screens/speeking_practice/pronunciation_select_sentence_screen.dart'; import 'package:capstone_front/utils/page_animation.dart'; @@ -124,6 +125,11 @@ final GoRouter router = GoRouter( const {"title": "temp", "date": "temp", "kind": "temp"}, ), ), + GoRoute( + name: 'qnalist', + path: '/qnalist', + builder: (context, state) => const QnaListScreen(), + ), ], ); diff --git a/front/capstone_front/lib/screens/home_screen.dart b/front/capstone_front/lib/screens/home_screen.dart index 18c5a77056..fe323f7b25 100644 --- a/front/capstone_front/lib/screens/home_screen.dart +++ b/front/capstone_front/lib/screens/home_screen.dart @@ -138,7 +138,7 @@ class _HomeScreenState extends State { MenuButton( title: tr("mainScreen.qna"), icon: Icons.question_answer_outlined, - routeCallbackFun: () => context.push("/login"), + routeCallbackFun: () => context.push("/qnalist"), ), MenuButton( title: tr("mainScreen.faq"), diff --git a/front/capstone_front/lib/screens/qna_list_screen/qna_list_screen.dart b/front/capstone_front/lib/screens/qna_list_screen/qna_list_screen.dart new file mode 100644 index 0000000000..a7cff58ba2 --- /dev/null +++ b/front/capstone_front/lib/screens/qna_list_screen/qna_list_screen.dart @@ -0,0 +1,92 @@ +import 'package:capstone_front/screens/qna_list_screen/question_card.dart'; +import 'package:capstone_front/screens/qna_list_screen/test_question_data.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/widgets.dart'; + +class QnaListScreen extends StatefulWidget { + const QnaListScreen({super.key}); + + @override + State createState() => _QnaListScreenState(); +} + +class _QnaListScreenState extends State { + final _controller = TextEditingController(); + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: TextField( + controller: _controller, + onChanged: (text) { + setState(() {}); + }, + decoration: InputDecoration( + hintText: "검색어를 입력하세요", + border: InputBorder.none, + hintStyle: const TextStyle( + color: Color(0XFFd7d7d7), + ), + suffixIcon: _controller.text.isNotEmpty + ? IconButton( + onPressed: () { + _controller.clear(); + setState(() {}); + }, + icon: const Icon( + Icons.cancel, + color: Colors.grey, + ), + ) + : null, + ), + style: const TextStyle( + color: Colors.black, + fontSize: 18.0, + ), + ), + actions: [ + IconButton( + icon: Icon( + Icons.search, + color: Theme.of(context).primaryColor, + ), + onPressed: () => {}, + ), + ], + ), + body: Container( + color: const Color(0xFFF8F8F8), + child: Expanded( + child: SingleChildScrollView( + child: Padding( + padding: const EdgeInsets.all(20), + child: Column( + children: [ + ...questionDatas.map( + (item) => Column( + children: [ + QuestionCard( + title: item['title'], + content: item['content'], + name: item['name'], + country: item['country'], + tag: item['tag'], + ), + const SizedBox( + height: 20, + ) + ], + ), + ), + ], + ), + ), + ), + ), + ), + ); + } +} diff --git a/front/capstone_front/lib/screens/qna_list_screen/question_card.dart b/front/capstone_front/lib/screens/qna_list_screen/question_card.dart new file mode 100644 index 0000000000..0f2292e8c6 --- /dev/null +++ b/front/capstone_front/lib/screens/qna_list_screen/question_card.dart @@ -0,0 +1,117 @@ +import 'package:flutter/material.dart'; + +class QuestionCard extends StatelessWidget { + final String title, content, name, country, tag; + + const QuestionCard({ + super.key, + required this.title, + required this.content, + required this.name, + required this.country, + required this.tag, + }); + + @override + Widget build(BuildContext context) { + return Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(14), + boxShadow: [ + BoxShadow( + color: Colors.grey.withOpacity(0.2), + spreadRadius: 2, + blurRadius: 5, + offset: const Offset(0, 3), + ), + ]), + child: Padding( + padding: const EdgeInsets.all(20), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(6), + color: const Color(0xfff3f1fe), + ), + padding: const EdgeInsets.symmetric( + vertical: 4, + horizontal: 6, + ), + child: Text( + tag, + style: const TextStyle( + color: Color(0xFF9375e6), + fontSize: 16, + fontWeight: FontWeight.w600, + ), + ), + ), + const SizedBox( + height: 16, + ), + Row( + children: [ + Text( + "Q. ", + style: TextStyle( + fontSize: 20, + color: Theme.of(context).primaryColor, + ), + ), + Expanded( + child: Text( + title, + style: const TextStyle( + fontSize: 20, + fontWeight: FontWeight.w600, + ), + overflow: TextOverflow.ellipsis, + ), + ), + ], + ), + const SizedBox( + height: 20, + ), + Text( + content, + style: const TextStyle( + fontSize: 16, + fontWeight: FontWeight.w500, + ), + maxLines: 2, + overflow: TextOverflow.ellipsis, + ), + const SizedBox( + height: 20, + ), + Row( + children: [ + Text( + name, + style: const TextStyle( + fontSize: 16, + color: Color(0xff7b7b89), + ), + ), + const SizedBox( + width: 10, + ), + Text( + country, + style: const TextStyle( + fontSize: 16, + color: Color(0xFFa1a1ad), + ), + ), + ], + ) + ], + ), + ), + ); + } +} diff --git a/front/capstone_front/lib/screens/qna_list_screen/test_question_data.dart b/front/capstone_front/lib/screens/qna_list_screen/test_question_data.dart new file mode 100644 index 0000000000..56fbbf5888 --- /dev/null +++ b/front/capstone_front/lib/screens/qna_list_screen/test_question_data.dart @@ -0,0 +1,37 @@ +final List> questionDatas = [ + { + 'title': '가상대학 로그인 어떻게 하나요?', + 'content': '가상대학에 로그인을 하려고 하는데 어떻게 하는지 모르겠습니다. 도와주세요. 나는 북조선에서 온 사람입니다.', + 'name': '최지훈', + 'country': '북한', + 'tag': '대학생활', + }, + { + 'title': '도서관 대출 규정이 궁금해요', + 'content': '도서관 책을 얼마나 오래 대출할 수 있나요? 연체 시 벌금은 어떻게 되나요?', + 'name': '김서영', + 'country': '아제르바이잔', + 'tag': '대학생활', + }, + { + 'title': '식당 운영시간 알려주세요', + 'content': '캠퍼스 내 식당의 운영시간이 어떻게 되나요? 주말에도 열어요?', + 'name': '박준혁', + 'country': '대한민국', + 'tag': '학사안내', + }, + { + 'title': '체육시설 이용 방법', + 'content': '학교 체육시설을 이용하고 싶은데, 예약은 어떻게 하나요? 이용 요금은 있나요?', + 'name': '이하늘', + 'country': '대한민국', + 'tag': '학사안내', + }, + { + 'title': '수강신청 팁 좀 알려주세요', + 'content': '수강신청 잘하는 방법이 있나요? 매번 원하는 수업을 못 듣게 되네요.', + 'name': '정민수', + 'country': '남아프리카공화국', + 'tag': '대학생활', + }, +];