-
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.
Showing
11 changed files
with
431 additions
and
16 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
class GameComment{ | ||
|
||
String id; | ||
String postId; | ||
String senderId; | ||
String senderName; | ||
String sendTime; | ||
String comment; | ||
bool active; | ||
|
||
GameComment({ | ||
required this.id, | ||
required this.postId, | ||
required this.senderId, | ||
required this.senderName, | ||
required this.sendTime, | ||
required this.comment, | ||
required this.active | ||
}); | ||
|
||
Map<String, dynamic> toJson() => { | ||
"id" : id, | ||
"postId" :postId, | ||
"senderId" :senderId, | ||
"senderName": senderName, | ||
"sendTime" : sendTime, | ||
"comment" :comment, | ||
"active": active | ||
}; | ||
|
||
static fromJson(Map<String, dynamic> json){ | ||
return GameComment( | ||
id: json["id"], | ||
postId: json["postId"], | ||
senderId: json["senderId"], | ||
senderName: json["senderName"], | ||
sendTime: json["sendTime"], | ||
comment: json["comment"], | ||
active: json["active"] | ||
); | ||
} | ||
|
||
} |
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 |
---|---|---|
@@ -1,15 +1,142 @@ | ||
import 'package:findgamemates/model/game_post.dart'; | ||
import 'package:findgamemates/model/game_types.dart'; | ||
import 'package:findgamemates/view/game_detail_comments.dart'; | ||
import 'package:findgamemates/view/game_detail_input.dart'; | ||
import 'package:flutter/material.dart'; | ||
|
||
class GameDetailScreen extends StatefulWidget { | ||
const GameDetailScreen({Key? key}) : super(key: key); | ||
|
||
GamePost gamePost; | ||
|
||
GameDetailScreen({Key? key, required this.gamePost}) : super(key: key); | ||
|
||
@override | ||
_GameDetailScreenState createState() => _GameDetailScreenState(); | ||
} | ||
|
||
class _GameDetailScreenState extends State<GameDetailScreen> { | ||
|
||
late String gameType; | ||
|
||
@override | ||
void initState() { | ||
gameType = widget.gamePost.gameType == GameType.frp | ||
? "FRP" | ||
: widget.gamePost.gameType == GameType.boardGame | ||
? "Kutu oyunu" | ||
: widget.gamePost.gameType == GameType.tcg | ||
? "TCG" | ||
: "Hata"; | ||
super.initState(); | ||
} | ||
|
||
@override | ||
void didChangeDependencies() { | ||
gameType = widget.gamePost.gameType == GameType.frp | ||
? "FRP" | ||
: widget.gamePost.gameType == GameType.boardGame | ||
? "Kutu oyunu" | ||
: widget.gamePost.gameType == GameType.tcg | ||
? "TCG" | ||
: "Hata"; | ||
super.didChangeDependencies(); | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Container(); | ||
return Scaffold( | ||
key: widget.key, | ||
appBar: AppBar(title: Text(widget.gamePost.title),), | ||
body: SafeArea( | ||
child: Padding( | ||
padding: const EdgeInsets.all(8.0), | ||
child: NotificationListener<OverscrollIndicatorNotification>( | ||
onNotification: (overScroll){ | ||
overScroll.disallowGlow(); | ||
return false; | ||
}, | ||
child: ListView( | ||
children: [ | ||
Text( | ||
widget.gamePost.title, | ||
style: const TextStyle( | ||
fontWeight: FontWeight.bold, | ||
fontSize: 22, | ||
), | ||
), | ||
const Divider(), | ||
Card( | ||
elevation: 12, | ||
child: Column( | ||
children: [ | ||
Padding( | ||
padding: const EdgeInsets.all(8.0), | ||
child: Text( | ||
widget.gamePost.desc, | ||
), | ||
), | ||
const Divider(), | ||
Padding( | ||
padding: const EdgeInsets.symmetric(vertical: 16), | ||
child: Row( | ||
mainAxisAlignment: MainAxisAlignment.spaceEvenly, | ||
children: [ | ||
Expanded( | ||
child: Row( | ||
mainAxisAlignment: MainAxisAlignment.center, | ||
children: [ | ||
Icon( | ||
Icons.extension, | ||
color: Theme.of(context).primaryColor, | ||
size: 20, | ||
), | ||
const SizedBox( | ||
width: 4, | ||
), | ||
Text( | ||
gameType, | ||
style: const TextTheme().bodyText2, | ||
), | ||
], | ||
), | ||
), | ||
Expanded( | ||
child: Row( | ||
mainAxisAlignment: MainAxisAlignment.center, | ||
children: [ | ||
const Icon( | ||
Icons.location_on, | ||
size: 20, | ||
), | ||
const SizedBox( | ||
width: 4, | ||
), | ||
Text( | ||
widget.gamePost.province, | ||
style: const TextTheme().bodyText2, | ||
), | ||
], | ||
), | ||
), | ||
], | ||
), | ||
) | ||
], | ||
), | ||
), | ||
Card( | ||
elevation: 12, | ||
child: GameDetailComments(gamePostId: widget.gamePost.id, key: UniqueKey(),), | ||
), | ||
Card( | ||
elevation: 12, | ||
child: GameDetailInput(postId: widget.gamePost.id,), | ||
) | ||
], | ||
), | ||
), | ||
), | ||
), | ||
); | ||
} | ||
} |
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,63 @@ | ||
import 'package:findgamemates/model/game_comment.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:intl/intl.dart'; | ||
|
||
class CommentWidget extends StatefulWidget { | ||
|
||
GameComment gameComment; | ||
|
||
CommentWidget({Key? key, required this.gameComment}) : super(key: key); | ||
|
||
@override | ||
_CommentWidgetState createState() => _CommentWidgetState(); | ||
} | ||
|
||
class _CommentWidgetState extends State<CommentWidget> { | ||
|
||
late String date; | ||
|
||
@override | ||
void initState() { | ||
|
||
super.initState(); | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Card( | ||
elevation: 8, | ||
child: Padding( | ||
padding: const EdgeInsets.symmetric(vertical: 16,horizontal: 8), | ||
child: Column( | ||
mainAxisAlignment: MainAxisAlignment.start, | ||
children: [ | ||
Container( | ||
padding: const EdgeInsets.symmetric(horizontal: 12), | ||
alignment: Alignment.centerLeft, | ||
child: Text( | ||
widget.gameComment.senderName, | ||
style: const TextStyle(fontWeight: FontWeight.bold), | ||
), | ||
), | ||
Container( | ||
padding: const EdgeInsets.symmetric(horizontal: 12,vertical: 4), | ||
alignment: Alignment.centerLeft, | ||
child: Text( | ||
widget.gameComment.comment | ||
), | ||
), | ||
Container( | ||
padding: const EdgeInsets.symmetric(horizontal: 12,vertical: 4), | ||
alignment: Alignment.bottomRight, | ||
child: Text( | ||
//todo: check local date time | ||
DateFormat("dd/MM/yyyy HH:mm").format(DateTime.parse(widget.gameComment.sendTime).toLocal()), | ||
style: const TextStyle(color: Colors.grey), | ||
), | ||
) | ||
], | ||
), | ||
), | ||
); | ||
} | ||
} |
Oops, something went wrong.