Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/bulletin search page separating consonants vowels #90

Merged
merged 7 commits into from
Feb 18, 2024
114 changes: 75 additions & 39 deletions lib/pages/bulletin_search_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -223,15 +223,13 @@ class _BulletinSearchPageState extends State<BulletinSearchPage> {
controller: _textEdtingController,
onSubmitted: (String text) {
setState(() {
_textEdtingController.text = text;
_searchWord = text;
_isLoading = true;
});
refreshPostList(text);
},
onChanged: (String text) {
setState(() {
_textEdtingController.text = text;
_searchWord = text;
});
refreshPostList(text);
Expand Down Expand Up @@ -311,45 +309,83 @@ class _BulletinSearchPageState extends State<BulletinSearchPage> {
child: Center(
child: SizedBox(
width: MediaQuery.of(context).size.width - 18,
child: ListView.builder(
controller: _scrollController,
itemCount: postPreviewList.length +
(_isLoadingNextPage ? 1 : 0), // 아이템 개수
itemBuilder: (BuildContext context, int index) {
// 각 아이템을 위한 위젯 생성

// 숨겨진 게시물이면 일단 표현 안하는 걸로 함.
if (_isLoadingNextPage &&
index == postPreviewList.length) {
return const SizedBox(
height: 63,
child: Column(
children: [

// 검색어가 없을 때와 검색 결과가 없을 때의 처리
if (_textEdtingController.text == "" &&
postPreviewList.isEmpty)
const SizedBox(
height: 100,
child: Center(
child: Text(
"검색어를 입력해주세요.",
style: TextStyle(
color: Colors.black,
fontSize: 16,
fontWeight: FontWeight.w500),
),
),
),
// 검색어가 있는데 검색 결과가 없을 때의 처리
if (_textEdtingController.text != "" &&
postPreviewList.isEmpty)
const SizedBox(
height: 100,
child: Center(
child: LoadingIndicator(),
child: Text(
"검색 결과가 없습니다.",
style: TextStyle(
color: ColorsInfo.newara,
fontSize: 16,
fontWeight: FontWeight.w500),
),
),
);
}
return postPreviewList[index].is_hidden
? Container()
: InkWell(
onTap: () {
Navigator.of(context).push(slideRoute(
PostViewPage(
id: postPreviewList[index].id)));
},
child: Column(
children: [
Padding(
padding: const EdgeInsets.all(11.0),
child: PostPreview(
model: postPreviewList[index]),
),
Container(
height: 1,
color: const Color(0xFFF0F0F0),
),
],
));
},
),

Expanded(
child: ListView.builder(
controller: _scrollController,
itemCount: postPreviewList.length +
(_isLoadingNextPage ? 1 : 0), // 아이템 개수
itemBuilder: (BuildContext context, int index) {
// 각 아이템을 위한 위젯 생성

// 숨겨진 게시물이면 일단 표현 안하는 걸로 함.
skykhs3 marked this conversation as resolved.
Show resolved Hide resolved
if (_isLoadingNextPage &&
index == postPreviewList.length) {
return const SizedBox(
height: 63,
child: Center(
child: LoadingIndicator(),
),
);
}
return postPreviewList[index].is_hidden
skykhs3 marked this conversation as resolved.
Show resolved Hide resolved
? Container()
: InkWell(
onTap: () {
Navigator.of(context).push(slideRoute(
PostViewPage(
id: postPreviewList[index].id)));
},
child: Column(
children: [
Padding(
padding: const EdgeInsets.all(11.0),
child: PostPreview(
model: postPreviewList[index]),
),
Container(
height: 1,
color: const Color(0xFFF0F0F0),
),
],
));
},
),
),
],
),
),
),
Expand Down
2 changes: 0 additions & 2 deletions lib/providers/user_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,6 @@ class UserProvider with ChangeNotifier {
late dynamic response;
try {
response = await dio.get(totUrl);
debugPrint(
"GET $totUrl success: ${response.data.toString().substring(0, min(300, response.data.toString().length))}");
} on DioException catch (e) {
debugPrint("getApiRes failed with DioException: $e");
// 서버에서 response를 보냈지만 invalid한 statusCode일 때
Expand Down