-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
a94cb18
commit c37a497
Showing
6 changed files
with
231 additions
and
82 deletions.
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
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
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,102 @@ | ||
import 'package:findgamemates/get/game_get.dart'; | ||
import 'package:findgamemates/model/game_types.dart'; | ||
import 'package:findgamemates/utils/utils_data.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:get/get.dart'; | ||
|
||
class GameScreenFilter extends StatefulWidget { | ||
const GameScreenFilter({Key? key}) : super(key: key); | ||
|
||
@override | ||
_GameScreenFilterState createState() => _GameScreenFilterState(); | ||
} | ||
|
||
class _GameScreenFilterState extends State<GameScreenFilter> { | ||
|
||
GameGet gameGet = Get.put(GameGet()); | ||
List<GameType> gameTypeList = GameType.values; | ||
GameType? selectedGameType; | ||
List<String> gameProvinceList= UtilData.provienceList; | ||
String? selectedGameProvince; | ||
String currFilter = ""; | ||
|
||
@override | ||
void initState() { | ||
super.initState(); | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Column( | ||
mainAxisSize: MainAxisSize.min, | ||
children: [ | ||
Padding( | ||
padding: const EdgeInsets.only(left: 6,right: 6,top: 6), | ||
child: TextField( | ||
decoration: const InputDecoration( | ||
hintText: "Arama", | ||
suffixIcon: Icon(Icons.search), | ||
border: OutlineInputBorder() | ||
), | ||
onChanged: (value){ | ||
currFilter = value; | ||
gameGet.filterGameList(currFilter, selectedGameType, selectedGameProvince); | ||
}, | ||
), | ||
), | ||
Padding( | ||
padding: const EdgeInsets.symmetric(horizontal: 12,vertical: 12), | ||
child: IntrinsicHeight( | ||
child: Row( | ||
mainAxisAlignment: MainAxisAlignment.spaceEvenly, | ||
children: [ | ||
Expanded( | ||
child: DropdownButton<String?>( | ||
hint: Text("Oyun lokasyonu"), | ||
icon: Icon(Icons.location_on), | ||
isExpanded: true, | ||
value: selectedGameProvince, | ||
onChanged: (String? gameProvince){ | ||
setState(() { | ||
selectedGameProvince = gameProvince!; | ||
gameGet.filterGameList(currFilter, selectedGameType, selectedGameProvince); | ||
}); | ||
}, | ||
items: gameProvinceList.map((e) => DropdownMenuItem(child: Text(e),value: e,)).toList(), | ||
), | ||
), | ||
VerticalDivider(), | ||
Expanded( | ||
child: DropdownButton<GameType?>( | ||
isExpanded: true, | ||
hint: Text("Oyun türü"), | ||
icon: Icon(Icons.extension), | ||
value: selectedGameType, | ||
onChanged: (GameType? gameType){ | ||
setState(() { | ||
selectedGameType = gameType!; | ||
gameGet.filterGameList(currFilter, selectedGameType, selectedGameProvince); | ||
}); | ||
}, | ||
items: gameTypeList.map( | ||
(e) => DropdownMenuItem( | ||
child: Text(e == GameType.frp | ||
? "FRP" | ||
: e == GameType.boardGame | ||
? "Kutu oyunu" | ||
: e == GameType.tcg | ||
? "TCG" | ||
: "Hata"), | ||
value: e, | ||
), | ||
).toList(), | ||
), | ||
) | ||
], | ||
), | ||
), | ||
) | ||
], | ||
); | ||
} | ||
} |
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,91 @@ | ||
import 'package:findgamemates/get/game_get.dart'; | ||
import 'package:findgamemates/model/game_post.dart'; | ||
import 'package:findgamemates/model/game_types.dart'; | ||
import 'package:findgamemates/screen/game_detail_screen.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:get/get.dart'; | ||
|
||
class GameScreenList extends StatefulWidget { | ||
const GameScreenList({Key? key}) : super(key: key); | ||
|
||
@override | ||
_GameScreenListState createState() => _GameScreenListState(); | ||
} | ||
|
||
class _GameScreenListState extends State<GameScreenList> { | ||
GameGet gameGet = Get.put(GameGet()); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Obx( | ||
() => ListView.builder( | ||
itemCount: gameGet.postList.value.length, | ||
itemBuilder: (context, index) { | ||
GamePost post = gameGet.postList.value[index]; | ||
String gameType = post.gameType == GameType.frp | ||
? "FRP" | ||
: post.gameType == GameType.boardGame | ||
? "Kutu oyunu" | ||
: post.gameType == GameType.tcg | ||
? "TCG" | ||
: "Hata"; | ||
return Padding( | ||
padding: const EdgeInsets.all(8), | ||
child: Card( | ||
elevation: 8, | ||
child: ListTile( | ||
title: Text(post.title), | ||
subtitle: Text( | ||
post.desc, | ||
maxLines: 2, | ||
overflow: TextOverflow.ellipsis, | ||
), | ||
isThreeLine: true, | ||
trailing: Column( | ||
mainAxisAlignment: MainAxisAlignment.spaceEvenly, | ||
children: [ | ||
Row( | ||
mainAxisSize: MainAxisSize.min, | ||
children: [ | ||
Icon( | ||
Icons.extension, | ||
size: 20, | ||
), | ||
SizedBox( | ||
width: 4, | ||
), | ||
Text( | ||
gameType, | ||
style: const TextTheme().bodyText2, | ||
), | ||
], | ||
), | ||
Row( | ||
mainAxisSize: MainAxisSize.min, | ||
children: [ | ||
Icon( | ||
Icons.location_on, | ||
size: 20, | ||
), | ||
SizedBox( | ||
width: 4, | ||
), | ||
Text( | ||
post.province, | ||
style: const TextTheme().bodyText2, | ||
), | ||
], | ||
), | ||
], | ||
), | ||
onTap: () { | ||
Get.to(() => GameDetailScreen()); | ||
}, | ||
), | ||
), | ||
); | ||
}, | ||
), | ||
); | ||
} | ||
} |