From ff09bb97794eb0c8ce68aeb196972127c1d6bdc5 Mon Sep 17 00:00:00 2001 From: ItisNoMatter <702sunnylife@gmail.com> Date: Thu, 31 Mar 2022 13:16:52 +0900 Subject: [PATCH 1/9] =?UTF-8?q?mainAxisAlignment=E3=82=92center=E3=81=AB?= =?UTF-8?q?=E8=A8=AD=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/ProgressDotsBar.dart | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/ProgressDotsBar.dart b/lib/ProgressDotsBar.dart index bd0eb35..f7a5f1a 100644 --- a/lib/ProgressDotsBar.dart +++ b/lib/ProgressDotsBar.dart @@ -141,6 +141,7 @@ class _ProgressDotsBarState extends State { Widget build(BuildContext context) { return Container( child: Row( + mainAxisAlignment: MainAxisAlignment.center, children: [ ProgressDot(questionId: 0), line(), From 05172917de94821c02bed0bd2642a43d6c6f87d1 Mon Sep 17 00:00:00 2001 From: ItisNoMatter <702sunnylife@gmail.com> Date: Thu, 31 Mar 2022 13:25:21 +0900 Subject: [PATCH 2/9] =?UTF-8?q?ProgressDotBar=E3=81=ABpadding=E3=82=92?= =?UTF-8?q?=E8=A8=AD=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/ProgressDotsBar.dart | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/ProgressDotsBar.dart b/lib/ProgressDotsBar.dart index f7a5f1a..21c3722 100644 --- a/lib/ProgressDotsBar.dart +++ b/lib/ProgressDotsBar.dart @@ -139,7 +139,8 @@ class _ProgressDotsBarState extends State { @override Widget build(BuildContext context) { - return Container( + return Padding( + padding: EdgeInsets.all(8), child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ From e476e1c2b0e2221bea5dc4466d1fa6ca18df140c Mon Sep 17 00:00:00 2001 From: ItisNoMatter <702sunnylife@gmail.com> Date: Thu, 31 Mar 2022 13:51:12 +0900 Subject: [PATCH 3/9] =?UTF-8?q?dot=E3=81=AEsize=E3=82=92figma=E3=81=AB?= =?UTF-8?q?=E8=BF=91=E3=81=A5=E3=81=91=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/ProgressDotsBar.dart | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/ProgressDotsBar.dart b/lib/ProgressDotsBar.dart index 21c3722..ab9f3a7 100644 --- a/lib/ProgressDotsBar.dart +++ b/lib/ProgressDotsBar.dart @@ -21,18 +21,18 @@ class _ProgressDotState extends State void updateDotsState(currentId) { if (currentId > widget.questionId) { setState(() { - _size = 20; + _size = 32; // _color = Colors.lightGreen; }); } else if (currentId == widget.questionId) { setState(() { - _size = 40; + _size = 56; _animationChange(); // _color = Colors.lightGreen; }); } else if (currentId < widget.questionId) { setState(() { - _size = 20; + _size = 32; // _color = Colors.grey; }); } From 6f31519c7d484408d601cf1389e43e95d83a5eee Mon Sep 17 00:00:00 2001 From: ItisNoMatter <702sunnylife@gmail.com> Date: Thu, 31 Mar 2022 13:54:30 +0900 Subject: [PATCH 4/9] =?UTF-8?q?padding=E3=81=AE=E5=80=A4=E3=82=92figma?= =?UTF-8?q?=E3=81=AB=E8=BF=91=E3=81=A5=E3=81=91=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/ProgressDotsBar.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ProgressDotsBar.dart b/lib/ProgressDotsBar.dart index ab9f3a7..bd80fbc 100644 --- a/lib/ProgressDotsBar.dart +++ b/lib/ProgressDotsBar.dart @@ -140,7 +140,7 @@ class _ProgressDotsBarState extends State { @override Widget build(BuildContext context) { return Padding( - padding: EdgeInsets.all(8), + padding: EdgeInsets.all(24), child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ From 0ff2b96a74a8249f9f12cf11dffa5d335eb39a22 Mon Sep 17 00:00:00 2001 From: ItisNoMatter <702sunnylife@gmail.com> Date: Thu, 31 Mar 2022 14:04:31 +0900 Subject: [PATCH 5/9] =?UTF-8?q?Dot=E9=96=93=E3=81=AEline=E3=81=ABpadding?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/ProgressDotsBar.dart | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/ProgressDotsBar.dart b/lib/ProgressDotsBar.dart index bd80fbc..6dc0256 100644 --- a/lib/ProgressDotsBar.dart +++ b/lib/ProgressDotsBar.dart @@ -119,12 +119,15 @@ class ProgressDotsBar extends StatefulWidget { class _ProgressDotsBarState extends State { Widget line() { - return Container( - height: 3, - width: 10, - decoration: const BoxDecoration( - shape: BoxShape.rectangle, - color: Colors.grey, + return Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + height: 3, + width: 10, + decoration: const BoxDecoration( + shape: BoxShape.rectangle, + color: Colors.grey, + ), ), ); } From b87a29cfa1e3cc7dfe15775cc642a628ba0b8c91 Mon Sep 17 00:00:00 2001 From: ItisNoMatter <702sunnylife@gmail.com> Date: Thu, 31 Mar 2022 14:05:21 +0900 Subject: [PATCH 6/9] =?UTF-8?q?Dot=E9=96=93=E3=81=AEline=E3=81=AE=E8=89=B2?= =?UTF-8?q?=E3=82=92=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/ProgressDotsBar.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ProgressDotsBar.dart b/lib/ProgressDotsBar.dart index 6dc0256..6585226 100644 --- a/lib/ProgressDotsBar.dart +++ b/lib/ProgressDotsBar.dart @@ -126,7 +126,7 @@ class _ProgressDotsBarState extends State { width: 10, decoration: const BoxDecoration( shape: BoxShape.rectangle, - color: Colors.grey, + color: Color(0xff220f60), ), ), ); From 14df30226b486e8bda2f03402a424561a5714f64 Mon Sep 17 00:00:00 2001 From: yud0uhu <60646787+yud0uhu@users.noreply.github.com> Date: Tue, 26 Apr 2022 09:28:47 +0900 Subject: [PATCH 7/9] =?UTF-8?q?Fix=20=E8=A8=BA=E6=96=AD=E7=B5=90=E6=9E=9C1?= =?UTF-8?q?=E4=BD=8D=E3=81=AE=E3=83=9C=E3=83=83=E3=82=AF=E3=82=B9=E3=83=AC?= =?UTF-8?q?=E3=82=A4=E3=82=A2=E3=82=A6=E3=83=88=E3=82=92=E7=B5=B1=E4=B8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/resultpage.dart | 190 ++++++++++++++++++++++++++++---------------- 1 file changed, 121 insertions(+), 69 deletions(-) diff --git a/lib/resultpage.dart b/lib/resultpage.dart index cfd9cba..cb8d906 100644 --- a/lib/resultpage.dart +++ b/lib/resultpage.dart @@ -73,64 +73,115 @@ class _ResultPage extends State { detailDialog(context, imageUrl, circleName, introduction); }, child: Card( - margin: EdgeInsets.only( - top: 10, - right: 20, - left: 20, - ), - color: Colors.yellow, - child: Column( - children: [ - Align( - alignment: Alignment.topLeft, - child: Stack( - children: [ - Container( - color: Colors.teal, - height: 43, - width: MediaQuery.of(context).size.width * matchingRate, - ), //メーター - - Container( - margin: const EdgeInsets.only(left: 10), - child: Text( - '$circleName', - style: TextStyle( - fontSize: 30, + margin: EdgeInsets.only( + top: 10, + right: 20, + left: 20, + ), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(5), + ), + color: Theme.of(context).primaryColor, + child: Column( + children: [ + Align( + alignment: Alignment.topLeft, + child: Stack( + children: [ + Container( + padding: const EdgeInsets.all(3.0), + margin: const EdgeInsets.only(left: 80, top: 1), + child: Text( + '$circleName', + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 12, + ), ), ), - ), - ], - ), - ), - Container( - color: Colors.lightGreen, - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Image.network( - imageUrl, - width: 100, - height: 100, - ), - Flexible( - child: Container( + Container( + padding: const EdgeInsets.all(3.0), + margin: const EdgeInsets.only(left: 10, top: 1), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(30), + color: Colors.white, + ), child: Text( - '$introduction', + '1位', style: TextStyle( - fontSize: 15, + color: Theme.of(context).primaryColor, + fontSize: 12, ), ), - color: Colors.lightBlue, - height: 110, ), - ) - ], + Container( + padding: const EdgeInsets.all(3.0), + margin: const EdgeInsets.only(left: 240, top: 1), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(30), + color: Colors.white, + ), + child: Text( + 'おすすめ度' + (matchingRate.round() * 100).toString() + '%', + style: TextStyle( + color: Theme.of(context).primaryColor, + fontSize: 12, + ), + ), + ), + ], + ), ), - ), - ], - ), - ), + Container( + color: Colors.white, + child: Column( + //パーセントバーと「画像と説明Row」 + children: [ + Padding( + padding: EdgeInsets.only(top: 3.0, bottom: 3.0), + child: PercentageBar( + matchingRate: matchingRate, + ), + ), + Padding( + padding: const EdgeInsets.all(8.0), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Align( + alignment: Alignment.topLeft, + child: Stack( + children: [ + Image.network( + imageUrl, + width: 100, + height: 100, + ), + ], + ), + ), + Flexible( + child: Container( + child: Text( + '$introduction', + style: TextStyle( + fontSize: 15, + color: Theme.of(context).primaryColor, + ), + ), + height: 110, + margin: EdgeInsets.only(left: 8.0), + ), + ) + ], + ), + ), + ], + ), + ), + ], + )), ); } @@ -177,7 +228,7 @@ class _ResultPage extends State { color: Colors.white, ), child: Text( - '1位', + '2位', style: TextStyle( color: Theme.of(context).primaryColor, fontSize: 12, @@ -204,12 +255,14 @@ class _ResultPage extends State { ), Container( color: Colors.white, - child: Column(//パーセントバーと「画像と説明Row」 + child: Column( + //パーセントバーと「画像と説明Row」 children: [ Padding( - padding: EdgeInsets.only(top: 3.0,bottom: 3.0), - child: PercentageBar(matchingRate: matchingRate,), - + padding: EdgeInsets.only(top: 3.0, bottom: 3.0), + child: PercentageBar( + matchingRate: matchingRate, + ), ), Padding( padding: const EdgeInsets.all(8.0), @@ -394,27 +447,26 @@ class PercentageBar extends StatelessWidget { required this.matchingRate, }) : super(key: key); final double matchingRate; - int toPercent(double rate){//0~1の少数を0~100の整数に変換 - return (rate * 100).toInt();//切り捨て + int toPercent(double rate) { + //0~1の少数を0~100の整数に変換 + return (rate * 100).toInt(); //切り捨て } + @override Widget build(BuildContext context) { return Stack( children: [ - Container(color:Color(0xff220f60),height: height), + Container(color: Color(0xff220f60), height: height), Container( - decoration: BoxDecoration( - gradient: LinearGradient( - colors: [ - Color(0xff7BD4F1).withOpacity(matchingRate), - Color(0xff7BD4F1).withOpacity(matchingRate), - Color(0xff220f60), - ] - ) + decoration: BoxDecoration( + gradient: LinearGradient(colors: [ + Color(0xff7BD4F1).withOpacity(matchingRate), + Color(0xff7BD4F1).withOpacity(matchingRate), + Color(0xff220f60), + ])), + height: height, ), - height: height, - ), ], ); } -} \ No newline at end of file +} From 862d75135b2d18032b55d01bb23794a20780e969 Mon Sep 17 00:00:00 2001 From: yud0uhu <60646787+yud0uhu@users.noreply.github.com> Date: Tue, 26 Apr 2022 12:22:48 +0900 Subject: [PATCH 8/9] =?UTF-8?q?Fix=20=E9=A0=86=E4=BD=8D=E3=82=92=E5=8F=96?= =?UTF-8?q?=E5=BE=97=E3=81=97=E3=81=A6=E8=A1=A8=E7=A4=BA=E3=81=99=E3=82=8B?= =?UTF-8?q?=E5=87=A6=E7=90=86=E3=81=AE=E5=AE=9F=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/model/api.dart | 39 ++++++++++++--------------------------- lib/resultdata.dart | 33 +++++++++++++++++++++------------ lib/resultpage.dart | 40 +++++++++++++++++++++++----------------- 3 files changed, 56 insertions(+), 56 deletions(-) diff --git a/lib/model/api.dart b/lib/model/api.dart index f72ac1b..76bb40e 100644 --- a/lib/model/api.dart +++ b/lib/model/api.dart @@ -32,7 +32,8 @@ void getGameId() async { // print(gameId); QuestionData.gameId = gameId; } -Future questionPost(int num) async{ + +Future questionPost(int num) async { http.Response response; var url = Uri.parse('https://quiet-eyrie-21766.herokuapp.com/question'); Map headers = {'content-type': 'application/json'}; @@ -58,11 +59,11 @@ Future getQuestion() async { await Future.delayed(Duration(microseconds: 20)); print("wait"); } - List> future=[]; + List> future = []; for (int i = 1; i <= 6; i++) { future.add(questionPost(i)); } - var futureAll =Future.wait(future); + var futureAll = Future.wait(future); futureAll.then((results) => controller.sink.add(true)); } @@ -123,7 +124,7 @@ Future getResult() async { var rankingData = data["ranking"]; // 要素分割してリストにする - int circlerank = rankingData[0]["circlerank"]; + int circle_ranking = i + 1; String circle_name = jsonDecode(rankingData[0]["circle_name"]); double percent = rankingData[0]["percent"]; print(percent); @@ -131,31 +132,15 @@ Future getResult() async { String circle_description = jsonDecode(rankingData[0]["circle_description"]); - // var jsonsentence = json.encode(rankingData); - // var utf8sentence = utf8.decode(jsonsentence.runes.toList()); - // print(utf8sentence); - // print(rankingData); - - // String image = rankingData[0]["circle_image_url"]; - // print(image); - - // int circlerank = utf8sentence[0]["circlerank"]; - // String circlename = rankingData[0]["circlename"]; - // double percent = rankingData[0]["percent"]; - // String circle_image_url = rankingData[0]["circle_image_url"]; - // String circle_description = rankingData[0]["circle_description"]; - - // int circlerank = 1; - // String circlename = "cistLT"; - // double percent = 0.3333333333333333; - // String circle_image_url = - // "http://www.itagaki.net/pc/imagefile/memo_0043/photo008.jpg"; - // String circle_description = - // "IT技術系の勉強をしています!初心者大歓迎です!所属メンバーはバイオ系、電子工学系、情報工学系と様々なメンバーで構成されています!!みんなで興味のあることを勉強し、アウトプットすることを目標にしています!一人で悩まないで!一緒に技術力を高めませんか??"; ResultData().set( i, - Result(circlerank, circle_name, percent, circle_image_url, - circle_description)); + Result( + circle_ranking, + circle_name, + percent, + circle_image_url, + circle_description, + )); Resultcontroller.sink.add(true); } diff --git a/lib/resultdata.dart b/lib/resultdata.dart index 64f15bf..8993847 100644 --- a/lib/resultdata.dart +++ b/lib/resultdata.dart @@ -1,12 +1,12 @@ //Questionの情報を持つクラス class Result { - int circlerank; - String circlename; + int circle_ranking; + String circle_name; double percent; String circle_image_url; String circle_description; - Result(this.circlerank, this.circlename, this.percent, this.circle_image_url, - this.circle_description) {} + Result(this.circle_ranking, this.circle_name, this.percent, + this.circle_image_url, this.circle_description) {} } //Singletonでデータをキャッシュする @@ -30,28 +30,37 @@ class ResultData { set(int key, Result value) => _item[key] = value; get(int key) => _item[key]; //サークルを返す - GetCircle(int num){ - if(ResultData().get(num)==null){ + GetCircle(int num) { + if (ResultData().get(num) == null) { return ResultData().get(-1); } return ResultData().get(num); } + //サークル名を返す - GetName(int num){ - return ResultData().get(num).circlename; + GetName(int num) { + return ResultData().get(num).circle_name; } + //画像を返す - GetImage(int num){ + GetImage(int num) { return ResultData().get(num).circle_image_url; } - //説明文を返す - GetDC(int num){ + + //マッチング度を返す + GetDC(int num) { return ResultData().get(num).percent; } + //説明文を返す - Getper(int num){ + Getper(int num) { return ResultData().get(num).circle_description; } + + //順位を返す + GetRank(int num) { + return ResultData().get(num).circle_ranking; + } /* //質問数を返す getlength()=>_item.length; diff --git a/lib/resultpage.dart b/lib/resultpage.dart index cb8d906..3bdde5d 100644 --- a/lib/resultpage.dart +++ b/lib/resultpage.dart @@ -24,8 +24,8 @@ class _ResultPage extends State { }); } - detailDialog( - context, String imageUrl, String circleName, String introduction) { + detailDialog(context, String imageUrl, String circleName, String introduction, + int circleRanking) { showDialog( context: context, builder: (BuildContext context) => AlertDialog( @@ -66,11 +66,12 @@ class _ResultPage extends State { } Widget firstCard(context, String circleName, double matchingRate, - String introduction, String imageUrl) { + String introduction, String imageUrl, int circleRanking) { return GestureDetector( onTap: () { print('タップされました'); - detailDialog(context, imageUrl, circleName, introduction); + detailDialog( + context, imageUrl, circleName, introduction, circleRanking); }, child: Card( margin: EdgeInsets.only( @@ -108,7 +109,7 @@ class _ResultPage extends State { color: Colors.white, ), child: Text( - '1位', + '$circleRanking' + "位", style: TextStyle( color: Theme.of(context).primaryColor, fontSize: 12, @@ -186,11 +187,12 @@ class _ResultPage extends State { } Widget secondThirdCard(context, String circleName, double matchingRate, - String introduction, String imageUrl) { + String introduction, String imageUrl, int circleRanking) { return GestureDetector( onTap: () { print('タップされました'); - detailDialog(context, imageUrl, circleName, introduction); + detailDialog( + context, imageUrl, circleName, introduction, circleRanking); }, child: Card( margin: EdgeInsets.only( @@ -228,7 +230,7 @@ class _ResultPage extends State { color: Colors.white, ), child: Text( - '2位', + '$circleRanking' + "位", style: TextStyle( color: Theme.of(context).primaryColor, fontSize: 12, @@ -400,23 +402,27 @@ class _ResultPage extends State { child: Column( children: [ firstCard( - context, - resultLoad(0).circlename, - resultLoad(0).percent, - resultLoad(0).circle_description, - resultLoad(0).circle_image_url), + context, + resultLoad(0).circle_name, + resultLoad(0).percent, + resultLoad(0).circle_description, + resultLoad(0).circle_image_url, + resultLoad(0).circle_ranking, + ), secondThirdCard( context, - resultLoad(1).circlename, + resultLoad(1).circle_name, resultLoad(1).percent, resultLoad(1).circle_description, - resultLoad(1).circle_image_url), + resultLoad(1).circle_image_url, + resultLoad(1).circle_ranking), secondThirdCard( context, - resultLoad(2).circlename, + resultLoad(2).circle_name, resultLoad(2).percent, resultLoad(2).circle_description, - resultLoad(2).circle_image_url) + resultLoad(2).circle_image_url, + resultLoad(2).circle_ranking) ], ), ), From 102721436a88b53b31ded97569f8935e5f175834 Mon Sep 17 00:00:00 2001 From: yud0uhu <60646787+yud0uhu@users.noreply.github.com> Date: Tue, 26 Apr 2022 12:31:26 +0900 Subject: [PATCH 9/9] =?UTF-8?q?Fix=20rankingData=E3=81=A7=E3=83=90?= =?UTF-8?q?=E3=83=83=E3=82=AF=E3=82=A8=E3=83=B3=E3=83=89=E3=81=8B=E3=82=89?= =?UTF-8?q?=E3=81=99=E3=81=B9=E3=81=A6=E3=81=AE=E8=A8=BA=E6=96=AD=E7=B5=90?= =?UTF-8?q?=E6=9E=9C=E3=82=92=E5=8F=96=E5=BE=97=E3=81=99=E3=82=8B=E3=82=88?= =?UTF-8?q?=E3=81=86=E3=81=AB=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/model/api.dart | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/model/api.dart b/lib/model/api.dart index 76bb40e..a1ff70b 100644 --- a/lib/model/api.dart +++ b/lib/model/api.dart @@ -125,12 +125,12 @@ Future getResult() async { // 要素分割してリストにする int circle_ranking = i + 1; - String circle_name = jsonDecode(rankingData[0]["circle_name"]); - double percent = rankingData[0]["percent"]; + String circle_name = jsonDecode(rankingData[i]["circle_name"]); + double percent = rankingData[i]["percent"]; print(percent); - String circle_image_url = jsonDecode(rankingData[0]["circle_image_url"]); + String circle_image_url = jsonDecode(rankingData[i]["circle_image_url"]); String circle_description = - jsonDecode(rankingData[0]["circle_description"]); + jsonDecode(rankingData[i]["circle_description"]); ResultData().set( i,