Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/HEAD' into Feature/#125-UpdatePr…
Browse files Browse the repository at this point in the history
…ofileScreen
  • Loading branch information
choichangyeon committed Jun 5, 2024
2 parents 6fb5de7 + ddac3ec commit 32cc6d7
Show file tree
Hide file tree
Showing 4 changed files with 371 additions and 68 deletions.
183 changes: 156 additions & 27 deletions lib/screens/home/map/filter/smoking_area_filter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,111 @@ import 'package:damyo/screens/home/map/filter/smoking_area_filter_listview.dart'
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:go_router/go_router.dart';

Future<dynamic> filterScreen(BuildContext context,
Map<String, dynamic> searchFilterMap, Function applyFilter) {
List<int> filterIndexList = [-1, -1, -1, -1, -1, -1, -1, -1];

// 실내 실외
if (searchFilterMap['indoor'] == true) {
filterIndexList[1] = 0;
} else if (searchFilterMap['indoor'] == false) {
filterIndexList[1] = 1;
}
// 개방 폐쇄
if (searchFilterMap['opened'] == true) {
filterIndexList[2] = 0;
} else if (searchFilterMap['opened'] == false) {
filterIndexList[2] = 1;
}
// 커요 작아요
if (searchFilterMap['big'] == true) {
filterIndexList[3] = 0;
} else if (searchFilterMap['big'] == false) {
filterIndexList[3] = 1;
}
// 청결해요
if (searchFilterMap['hygiene'] == true) {
filterIndexList[4] = 0;
}
// 한산해요
if (searchFilterMap['quite'] == true) {
filterIndexList[5] = 0;
}
// 의자가 있어요
if (searchFilterMap['chair'] == true) {
filterIndexList[6] = 0;
}
// 환기성이 좋아요
if (searchFilterMap['airOut'] == true) {
filterIndexList[7] = 0;
}

void setIndex(int index, int value) {
filterIndexList[index] = value;
}

void setFilter() {
// 실내 실외
if (filterIndexList[1] == 0) {
searchFilterMap['indoor'] = true;
searchFilterMap['outdoor'] = false;
} else if (filterIndexList[1] == 1) {
searchFilterMap['indoor'] = false;
searchFilterMap['outdoor'] = true;
} else {
searchFilterMap['indoor'] = null;
searchFilterMap['outdoor'] = null;
}
// 개방 폐쇄
if (filterIndexList[2] == 0) {
searchFilterMap['opened'] = true;
searchFilterMap['closed'] = false;
} else if (filterIndexList[2] == 1) {
searchFilterMap['opened'] = false;
searchFilterMap['closed'] = true;
} else {
searchFilterMap['opened'] = null;
searchFilterMap['closed'] = null;
}
// 커요 작아요
if (filterIndexList[3] == 0) {
searchFilterMap['big'] = true;
searchFilterMap['small'] = false;
} else if (filterIndexList[3] == 1) {
searchFilterMap['big'] = false;
searchFilterMap['small'] = true;
} else {
searchFilterMap['big'] = null;
searchFilterMap['small'] = null;
}
// 청결해요
if (filterIndexList[4] == 0) {
searchFilterMap['hygiene'] = true;
} else {
searchFilterMap['hygiene'] = null;
}
// 한산해요
if (filterIndexList[5] == 0) {
searchFilterMap['quite'] = true;
} else {
searchFilterMap['quite'] = null;
}
// 의자가 있어요
if (filterIndexList[6] == 0) {
searchFilterMap['chair'] = true;
} else {
searchFilterMap['chair'] = null;
}
// 환기성이 좋아요
if (filterIndexList[7] == 0) {
searchFilterMap['airOut'] = true;
} else {
searchFilterMap['airOut'] = null;
}
}

Future<dynamic> filterScreen(BuildContext context) {
return showModalBottomSheet(
context: context,
isScrollControlled: true,
Expand All @@ -20,7 +123,7 @@ Future<dynamic> filterScreen(BuildContext context) {
topRight: Radius.circular(20),
),
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 20),
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Column(
children: [
SizedBox(height: 14.h),
Expand All @@ -41,21 +144,21 @@ Future<dynamic> filterScreen(BuildContext context) {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"별점",
style: Theme.of(context).textTheme.displaySmall,
),
const SizedBox(height: 20),
FilterListview(
characterList: const [
'1점 이상',
'2점 이상',
'3점 이상',
'4점 이상',
'5점 이상'
],
selectedCharacterIndex: -1,
),
// Text(
// "별점",
// style: Theme.of(context).textTheme.displaySmall,
// ),
// const SizedBox(height: 20),
// FilterListview(
// characterList: const [
// '1점 이상',
// '2점 이상',
// '3점 이상',
// '4점 이상',
// '5점 이상'
// ],
// selectedCharacterIndex: -1,
// ),
const SizedBox(height: 20),
Text(
"실내 여부",
Expand All @@ -67,7 +170,10 @@ Future<dynamic> filterScreen(BuildContext context) {
'실내',
'실외',
],
selectedCharacterIndex: -1,
selectedCharacterIndex: filterIndexList[1],
setIndex: (v) {
setIndex(1, v);
},
),
const SizedBox(height: 20),
Text(
Expand All @@ -80,7 +186,10 @@ Future<dynamic> filterScreen(BuildContext context) {
'개방형',
'폐쇄형',
],
selectedCharacterIndex: -1,
selectedCharacterIndex: filterIndexList[2],
setIndex: (v) {
setIndex(2, v);
},
),
const SizedBox(height: 20),
Text(
Expand All @@ -93,49 +202,69 @@ Future<dynamic> filterScreen(BuildContext context) {
'흡연구역이 커요',
'흡연구역이 작아요',
],
selectedCharacterIndex: -1,
selectedCharacterIndex: filterIndexList[3],
setIndex: (v) {
setIndex(3, v);
},
),
const SizedBox(height: 20),
FilterListview(
characterList: const [
'흡연실이 청결해요',
],
selectedCharacterIndex: -1,
selectedCharacterIndex: filterIndexList[4],
setIndex: (v) {
setIndex(4, v);
},
),
const SizedBox(height: 20),
FilterListview(
characterList: const [
'흡연실이 한산해요',
],
selectedCharacterIndex: -1,
selectedCharacterIndex: filterIndexList[5],
setIndex: (v) {
setIndex(5, v);
},
),
const SizedBox(height: 20),
FilterListview(
characterList: const [
'의자가 있어요',
],
selectedCharacterIndex: -1,
selectedCharacterIndex: filterIndexList[6],
setIndex: (v) {
setIndex(6, v);
},
),
const SizedBox(height: 20),
FilterListview(
characterList: const [
'환기성이 좋아요',
],
selectedCharacterIndex: -1,
selectedCharacterIndex: filterIndexList[7],
setIndex: (v) {
setIndex(7, v);
},
),
const SizedBox(height: 10),
],
),
),
),
const SizedBox(height: 20),
const SizedBox(height: 10),
InkWell(
onTap: () {},
onTap: () async {
setFilter();
applyFilter();
context.pop();
},
child: Ink(
width: double.infinity,
height: 47.h,
decoration: const BoxDecoration(
color: Colors.blue,
borderRadius: BorderRadius.all(Radius.circular(16)),
borderRadius: BorderRadius.all(Radius.circular(26)),
),
child: const Align(
alignment: Alignment.center,
Expand Down
4 changes: 4 additions & 0 deletions lib/screens/home/map/filter/smoking_area_filter_listview.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,12 @@ import 'package:flutter/material.dart';
class FilterListview extends StatefulWidget {
final List<String> characterList;
int selectedCharacterIndex;
Function(int) setIndex;
FilterListview({
super.key,
required this.characterList,
required this.selectedCharacterIndex,
required this.setIndex,
});

@override
Expand Down Expand Up @@ -85,8 +87,10 @@ class _FilterListviewState extends State<FilterListview> {
setState(() {
if (widget.selectedCharacterIndex == index) {
widget.selectedCharacterIndex = -1;
widget.setIndex(-1);
} else {
widget.selectedCharacterIndex = index;
widget.setIndex(index);
}
});
},
Expand Down
Loading

0 comments on commit 32cc6d7

Please sign in to comment.