forked from kookmin-sw/cap-template
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
253 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
92 changes: 92 additions & 0 deletions
92
front/capstone_front/lib/screens/qna_list_screen/qna_list_screen.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<QnaListScreen> createState() => _QnaListScreenState(); | ||
} | ||
|
||
class _QnaListScreenState extends State<QnaListScreen> { | ||
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, | ||
) | ||
], | ||
), | ||
), | ||
], | ||
), | ||
), | ||
), | ||
), | ||
), | ||
); | ||
} | ||
} |
117 changes: 117 additions & 0 deletions
117
front/capstone_front/lib/screens/qna_list_screen/question_card.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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), | ||
), | ||
), | ||
], | ||
) | ||
], | ||
), | ||
), | ||
); | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
front/capstone_front/lib/screens/qna_list_screen/test_question_data.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
final List<Map<String, dynamic>> 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': '대학생활', | ||
}, | ||
]; |