Skip to content

Commit

Permalink
feat: #57-qna, faq 상단 버튼으로 분리
Browse files Browse the repository at this point in the history
  • Loading branch information
ji-hunc committed Apr 28, 2024
1 parent 07ef5b2 commit 0fe1e6b
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 1 deletion.
6 changes: 6 additions & 0 deletions front/capstone_front/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import 'package:capstone_front/screens/helper/helper_write_screen.dart';
import 'package:capstone_front/screens/helper/helper_board/helper_writing_screen.dart';
import 'package:capstone_front/screens/home/home_screen.dart';
import 'package:capstone_front/screens/login/login_screen.dart';
import 'package:capstone_front/screens/question/question_screen.dart';
import 'package:capstone_front/screens/signup/signup_college_screen.dart';
import 'package:capstone_front/screens/signup/signup_country_screen.dart';
import 'package:capstone_front/screens/signup/signup_email_screen.dart';
Expand Down Expand Up @@ -219,6 +220,11 @@ final GoRouter router = GoRouter(
path: '/faq',
builder: (context, state) => const FaqScreen(),
),
GoRoute(
name: 'question',
path: '/question',
builder: (context, state) => const QuestionScreen(),
),
],
);

Expand Down
3 changes: 2 additions & 1 deletion front/capstone_front/lib/screens/main_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:capstone_front/screens/helper/helper_screen.dart';
import 'package:capstone_front/screens/home/home_screen.dart';
import 'package:capstone_front/screens/notice/notice_screen.dart';
import 'package:capstone_front/screens/qna/qna_list_screen/qna_list_screen.dart';
import 'package:capstone_front/screens/question/question_screen.dart';
import 'package:capstone_front/screens/speech_practice/speech_screen.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
Expand All @@ -18,7 +19,7 @@ class MainScreen extends StatefulWidget {
class _MainScreenState extends State<MainScreen> {
final screenList = [
const NoticeScreen(),
const QnaListScreen(),
const QuestionScreen(),
const HomeScreen(),
const HelperScreen(),
const SpeechScreen(),
Expand Down
62 changes: 62 additions & 0 deletions front/capstone_front/lib/screens/question/question_screen.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import 'package:capstone_front/screens/faq/faq_screen.dart';
import 'package:capstone_front/screens/qna/qna_list_screen/qna_list_screen.dart';
import 'package:flutter/material.dart';

class QuestionScreen extends StatefulWidget {
const QuestionScreen({super.key});

@override
State<QuestionScreen> createState() => _QuestionScreenState();
}

class _QuestionScreenState extends State<QuestionScreen> {
int _selectedPageIndex = 0;
final _qnaScreenList = [
const QnaListScreen(),
const FaqScreen(),
];

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
centerTitle: false,
scrolledUnderElevation: 0,
title: Row(
children: [
GestureDetector(
onTap: () {
setState(() {
_selectedPageIndex = 0;
});
},
child: Text(
"QnA",
style: TextStyle(
color: _selectedPageIndex == 0 ? Colors.black : Colors.grey,
),
),
),
const Text(' '),
GestureDetector(
onTap: () {
setState(() {
_selectedPageIndex = 1;
});
},
child: Text(
"FAQ",
style: TextStyle(
color: _selectedPageIndex == 1 ? Colors.black : Colors.grey,
),
),
),
],
),
),
body: SafeArea(
child: _qnaScreenList.elementAt(_selectedPageIndex),
),
);
}
}

0 comments on commit 0fe1e6b

Please sign in to comment.