Skip to content

Commit

Permalink
Merge pull request #149 from 4Ailen/fix/#148_fix
Browse files Browse the repository at this point in the history
Fix/#148 fix
  • Loading branch information
KIM-JUHYEON-79 authored Sep 10, 2023
2 parents 3d27526 + 21af90c commit faac41f
Show file tree
Hide file tree
Showing 15 changed files with 250 additions and 51 deletions.
2 changes: 1 addition & 1 deletion lib/views/components/article_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class _ArticleWidgetState extends State<ArticleWidget>{
InkWell(
onTap: (){
showDialog(context: context, builder: (builder){
return BoardDialog(context: context, board: widget.board, memberDetails: widget.memberDetails,);
return BoardDialog(context: context, board: widget.board, memberDetails: widget.memberDetails, boardCategory: "일반게시판",);
});
},
child: Padding(
Expand Down
64 changes: 61 additions & 3 deletions lib/views/components/block_dialog_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'package:flutter/cupertino.dart';
import 'dart:io' show Platform;

import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:web_socket_channel/status.dart';

import '../../apis/apis.dart';
Expand All @@ -29,12 +30,12 @@ class _BlockDialogState extends State<BlockDialog>{
@override
Widget build(BuildContext context) {
if(Platform.isAndroid)
return androidReport();
return androidBlock();
else
return androidReport();
return iosBlock();
}

Widget androidReport(){
Widget androidBlock(){
return AlertDialog(
title: Text('chatting-block2'.tr(), style: TextStyle(
fontWeight: FontWeight.bold
Expand All @@ -56,5 +57,62 @@ class _BlockDialogState extends State<BlockDialog>{
],
);
}

Widget iosBlock(){
return Dialog(
elevation: 0,
backgroundColor: Color(0xffffffff),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20.0).w,
),
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 20).r,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
SizedBox(height: 10,),
Text('chatting-block2'.tr(), style: TextStyle(
fontWeight: FontWeight.bold
),),
SizedBox(height: 10,),
Text('chatting-block3'.tr(),
style: TextStyle(
color: Color(0xff888888)
),),
SizedBox(height: 20,),
Divider(
height: 2.w,),
Container(
height: 60.h,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(child: InkWell(
child: Center(child: Text('cancle'.tr())),
onTap: () {
Navigator.of(context).pop();
},
),),
VerticalDivider(
width: 2.w,
),
Expanded(
child: InkWell(
child: Center(child: Text("chatting-block1".tr())),
onTap: () async {
if(await APIs.blockPartner(widget.partner)){
Navigator.of(context).pushNamedAndRemoveUntil('/loading', (Route<dynamic> route) => false);
}
},
),
)
],
),
)
],
),
),
);
}
}

41 changes: 37 additions & 4 deletions lib/views/components/board_dialog_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ class BoardDialog extends StatelessWidget{
final BuildContext context;
final Board board;
final MemberDetails memberDetails;
final String boardCategory;

const BoardDialog({Key? key, required this.context, required this.board, required this.memberDetails}) : super(key:key);
const BoardDialog({Key? key, required this.context, required this.board, required this.memberDetails, required this.boardCategory}) : super(key:key);

@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -71,6 +72,8 @@ class BoardDialog extends StatelessWidget{
),
),
),

SizedBox(height: 25.h,),
memberDetails.email == board.member!.email ? InkWell(
onTap: (){
showDialog(
Expand All @@ -90,7 +93,22 @@ class BoardDialog extends StatelessWidget{
WidgetsBinding.instance!.addPostFrameCallback((_) {
Navigator.pop(context);
Navigator.pop(context);
boardProvider.getArticles(board.category!);
switch (boardCategory) {
case '전체게시판':
boardProvider.getAllArticles();
break;
case '일반게시판':
boardProvider.getArticles(board.category!);
break;
case '나의 게시글':
boardProvider.getArticles(board.category!);
break;
case '좋아하는 게시글':
boardProvider.getLikedList();
break;
default:
}
//boardProvider.getArticles(board.category!);
});
return Container(
child: Image(
Expand Down Expand Up @@ -139,7 +157,7 @@ class BoardDialog extends StatelessWidget{
Navigator.pop(context);
showDialog(
context: context,
builder: (builder) => iOSReportDialog());
builder: (builder) => iOSReportDialog(memberId: board.member!.memberId!,));
},
child: Container(
height: 80.h,
Expand Down Expand Up @@ -177,7 +195,22 @@ class BoardDialog extends StatelessWidget{
WidgetsBinding.instance!.addPostFrameCallback((_) {
Navigator.pop(context);
Navigator.pop(context);
boardProvider.getArticles(board.category!);
switch (boardCategory) {
case '전체게시판':
boardProvider.getAllArticles();
break;
case '일반게시판':
boardProvider.getArticles(board.category!);
break;
case '나의 게시글':
boardProvider.getArticles(board.category!);
break;
case '좋아하는 게시글':
boardProvider.getLikedList();
break;
default:
}
//boardProvider.getArticles(board.category!);
});
return Container(
child: Image(
Expand Down
61 changes: 60 additions & 1 deletion lib/views/components/chat_dialog_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ import 'package:aliens/models/partner_model.dart';
import 'package:aliens/models/screenArgument.dart';
import 'package:aliens/views/components/block_dialog_widget.dart';
import 'package:aliens/views/components/report_dialog_widget.dart';
import 'package:aliens/views/components/report_iOS_dialog_widget.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/cupertino.dart';
import 'dart:io' show Platform;

import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';


class ChatDialog extends StatelessWidget{
Expand Down Expand Up @@ -102,7 +104,64 @@ class ChatDialog extends StatelessWidget{
}

Widget iOSDialog(){
return Container();
return Dialog(
elevation: 0,
backgroundColor: Color(0xffffffff),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20.0).r,
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
InkWell(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(20.0),
topRight: Radius.circular(20.0),
).r,
onTap: () {
Navigator.pop(context);
showDialog(
context: context,
builder: (builder) => iOSReportDialog(memberId: partner!.memberId!,));
},
child: Container(
height: 80.h,
alignment: Alignment.center,
child: Text(
'chatting-report1'.tr(),
style: TextStyle(
fontSize: 16.0.spMin,
fontWeight: FontWeight.bold,
),
),
),
),
InkWell(
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(20.0),
bottomRight: Radius.circular(20.0),
).r,
onTap: () {
Navigator.pop(context);
showDialog(context: context, builder: (context){
return BlockDialog(partner: partner, context: context);
});
},
child: Container(
height: 80.h,
alignment: Alignment.center,
child: Text(
'chatting-block1'.tr(),
style: TextStyle(
fontSize: 16.0.spMin,
fontWeight: FontWeight.bold,
),
),
),
),
],
)
);
}

}
Expand Down
2 changes: 1 addition & 1 deletion lib/views/components/comment_dialog_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ class CommentDialog extends StatelessWidget{
Navigator.pop(context);
showDialog(
context: context,
builder: (builder) => iOSReportDialog());
builder: (builder) => iOSReportDialog(memberId: comment.member!.memberId!,));
},
child: Container(
height: 80,
Expand Down
13 changes: 8 additions & 5 deletions lib/views/components/home_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,14 @@ class HomeWidget extends StatelessWidget{

recognizer: new TapGestureRecognizer()..onTap = () {
showDialog(context: context, builder: (context){
return InteractiveViewer(
child: Image.asset(
EasyLocalization.of(context)!.locale == Locale.fromSubtags(languageCode: "ko", countryCode: "KR") ?
'assets/character/${screenArguments.memberDetails!.mbti}_ko.PNG' :
'assets/character/${screenArguments.memberDetails!.mbti}_en.PNG'
return GestureDetector(
onTap: (){Navigator.pop(context);},
child: InteractiveViewer(
child: Image.asset(
EasyLocalization.of(context)!.locale == Locale.fromSubtags(languageCode: "ko", countryCode: "KR") ?
'assets/character/${screenArguments.memberDetails!.mbti}_ko.PNG' :
'assets/character/${screenArguments.memberDetails!.mbti}_en.PNG'
),
),
);
});
Expand Down
2 changes: 1 addition & 1 deletion lib/views/components/liked_post_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ class _LikedArticleWidgetWidgetState extends State<LikedArticleWidget>{
context: context,
builder: (builder) {
return BoardDialog(
context: context, board: widget.board, memberDetails: widget.memberDetails,
context: context, board: widget.board, memberDetails: widget.memberDetails, boardCategory: "좋아하는 게시글",
);
});
},
Expand Down
2 changes: 1 addition & 1 deletion lib/views/components/market_dialog_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ class MarketBoardDialog extends StatelessWidget{
Navigator.pop(context);
showDialog(
context: context,
builder: (builder) => iOSReportDialog());
builder: (builder) => iOSReportDialog(memberId: marketBoard.member!.memberId!,));
},
child: Container(
height: 80.h,
Expand Down
2 changes: 1 addition & 1 deletion lib/views/components/marketcomment_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ class MarketCommentDialog extends StatelessWidget{
Navigator.pop(context);
showDialog(
context: context,
builder: (builder) => iOSReportDialog());
builder: (builder) => iOSReportDialog(memberId: marketcomment.member!.memberId!,));
},
child: Container(
height: 80,
Expand Down
6 changes: 4 additions & 2 deletions lib/views/components/my_article_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import 'package:flutter_svg/svg.dart';
import '../../models/board_model.dart';
import '../pages/board/article_page.dart';
import 'board_dialog_widget.dart';

/*
class MyArticleWidget extends StatefulWidget {
MyArticleWidget({super.key, required this.board, required this.nationCode, required this.memberDetails});
Expand Down Expand Up @@ -143,4 +143,6 @@ class _MyArticleWidgetState extends State<MyArticleWidget>{
},
);
}
}
}
*/
26 changes: 24 additions & 2 deletions lib/views/components/report_iOS_dialog_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,14 @@ import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_svg/svg.dart';

import '../../apis/apis.dart';
import '../../models/message_model.dart';
import '../../models/partner_model.dart';

class iOSReportDialog extends StatefulWidget {
const iOSReportDialog({super.key});
const iOSReportDialog({super.key,
required this.memberId,});
final int memberId;

@override
State<iOSReportDialog> createState() => _iOSReportDialogState();
Expand Down Expand Up @@ -149,7 +153,25 @@ class _iOSReportDialogState extends State<iOSReportDialog> {
Expanded(
child: InkWell(
child: Center(child: Text("chatting-report1".tr())),
onTap: () {
onTap: ()async {
var reportCategory;
for(int i = 0; i < reportList.length; i ++){
if(reportList[i][1] == _reportReason){
reportCategory = reportList[i][0];
break;
}
}
if(await APIs.reportPartner(reportCategory, _textEditingController.text, widget.memberId)){
Navigator.pop(context);
showDialog(context: context, builder: (context){
return AlertDialog(
title: Text('chatting-report8'.tr(), style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold
),),
);
});
}
},
),
)
Expand Down
2 changes: 1 addition & 1 deletion lib/views/components/total_article_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ class _TotalArticleWidgetState extends State<TotalArticleWidget>{
context: context,
builder: (builder) {
return BoardDialog(
context: context, board: widget.board, memberDetails: widget.screenArguments.memberDetails!,
context: context, board: widget.board, memberDetails: widget.screenArguments.memberDetails!,boardCategory: "전체게시판",
);
});
},
Expand Down
Loading

0 comments on commit faac41f

Please sign in to comment.