From 639544cc5233ed8c9c4f245876a13439fcd12f21 Mon Sep 17 00:00:00 2001 From: HariRags Date: Mon, 11 Dec 2023 17:56:58 +0530 Subject: [PATCH 1/4] not claimed no longer overflowing in lost and found --- lib/src/api/apiclient.dart | 2 +- lib/src/api/apiclient.g.dart | 2 +- lib/src/routes/lostandfoundfeedpage.dart | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/src/api/apiclient.dart b/lib/src/api/apiclient.dart index fe3deb05..613e0642 100644 --- a/lib/src/api/apiclient.dart +++ b/lib/src/api/apiclient.dart @@ -48,7 +48,7 @@ part 'apiclient.g.dart'; //@rt.RestApi(baseUrl: "http://192.168.1.103:8000/api") // @rt.RestApi(baseUrl: "http://10.105.177.150/api") -@rt.RestApi(baseUrl: "https://2ba5-103-21-127-77.ngrok-free.app/api") +@rt.RestApi(baseUrl: "https://5ee5-117-214-129-83.ngrok-free.app/api") // @rt.RestApi(baseUrl: "https://272c-2405-201-5004-3c2f-d836-b028-6ac-ad9.ngrok-free.app/api") abstract class InstiAppApi { factory InstiAppApi(Dio dio, {String baseUrl}) = _InstiAppApi; diff --git a/lib/src/api/apiclient.g.dart b/lib/src/api/apiclient.g.dart index 92e4739d..c67f34be 100644 --- a/lib/src/api/apiclient.g.dart +++ b/lib/src/api/apiclient.g.dart @@ -8,7 +8,7 @@ part of 'apiclient.dart'; class _InstiAppApi implements InstiAppApi { _InstiAppApi(this._dio, {this.baseUrl}) { - baseUrl ??= 'https://2ba5-103-21-127-77.ngrok-free.app/api'; + baseUrl ??= 'https://5ee5-117-214-129-83.ngrok-free.app/api'; } final Dio _dio; diff --git a/lib/src/routes/lostandfoundfeedpage.dart b/lib/src/routes/lostandfoundfeedpage.dart index 05d4d207..d3e8753a 100644 --- a/lib/src/routes/lostandfoundfeedpage.dart +++ b/lib/src/routes/lostandfoundfeedpage.dart @@ -4,6 +4,7 @@ import 'package:InstiApp/src/blocs/lost_and_found_bloc.dart'; import 'package:InstiApp/src/drawer.dart'; import 'package:InstiApp/src/utils/common_widgets.dart'; import 'package:cached_network_image/cached_network_image.dart'; +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import '../api/model/lostandfoundPost.dart'; @@ -238,8 +239,9 @@ class _LostpageState extends State { Text( (posts[index].claimed == true ? "Claimed" - : "Not claimed"), + : "Not\nclaimed"), style: theme.textTheme.bodyText1, + textAlign: TextAlign.center, ) ], )), From d3d9eb23b79822e5eda565c469319d72fbd84249 Mon Sep 17 00:00:00 2001 From: HariRags Date: Wed, 13 Dec 2023 22:21:25 +0530 Subject: [PATCH 2/4] community page refreshes when you switch between communities --- README.md | 2 +- lib/src/api/apiclient.dart | 2 +- lib/src/api/apiclient.g.dart | 2 +- lib/src/routes/communitydetails.dart | 12 +++++++++++- lib/src/routes/communitypostpage.dart | 2 ++ 5 files changed, 16 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 1e020fcd..e2436a34 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# InstiApp +512167# InstiApp Flutter App for Indian Institute of Technology, Bombay (for iOS support) diff --git a/lib/src/api/apiclient.dart b/lib/src/api/apiclient.dart index 613e0642..6ed84066 100644 --- a/lib/src/api/apiclient.dart +++ b/lib/src/api/apiclient.dart @@ -48,7 +48,7 @@ part 'apiclient.g.dart'; //@rt.RestApi(baseUrl: "http://192.168.1.103:8000/api") // @rt.RestApi(baseUrl: "http://10.105.177.150/api") -@rt.RestApi(baseUrl: "https://5ee5-117-214-129-83.ngrok-free.app/api") +@rt.RestApi(baseUrl: "https://0d01-2405-201-5004-3e45-7431-160c-1fa7-d48.ngrok-free.app/api") // @rt.RestApi(baseUrl: "https://272c-2405-201-5004-3c2f-d836-b028-6ac-ad9.ngrok-free.app/api") abstract class InstiAppApi { factory InstiAppApi(Dio dio, {String baseUrl}) = _InstiAppApi; diff --git a/lib/src/api/apiclient.g.dart b/lib/src/api/apiclient.g.dart index c67f34be..7b1c5dc5 100644 --- a/lib/src/api/apiclient.g.dart +++ b/lib/src/api/apiclient.g.dart @@ -8,7 +8,7 @@ part of 'apiclient.dart'; class _InstiAppApi implements InstiAppApi { _InstiAppApi(this._dio, {this.baseUrl}) { - baseUrl ??= 'https://5ee5-117-214-129-83.ngrok-free.app/api'; + baseUrl ??= 'https://0d01-2405-201-5004-3e45-7431-160c-1fa7-d48.ngrok-free.app/api'; } final Dio _dio; diff --git a/lib/src/routes/communitydetails.dart b/lib/src/routes/communitydetails.dart index a517f5e4..fb773bcd 100644 --- a/lib/src/routes/communitydetails.dart +++ b/lib/src/routes/communitydetails.dart @@ -60,6 +60,7 @@ class _CommunityDetailsState extends State { }); } }); + } @override @@ -493,7 +494,16 @@ class _CommunityPostSectionState extends State { var theme = Theme.of(context); var bloc = BlocProvider.of(context)!.bloc; var communityPostBloc = bloc.communityPostBloc; - + () async { + setState(() { + loading = true; + cpType = CPType.All; + }); + await communityPostBloc.refresh( + type: CPType.All, + id: widget.community?.id); + }; + loading=false; if (firstBuild) { communityPostBloc.query = ""; communityPostBloc.refresh(id: widget.community?.id); diff --git a/lib/src/routes/communitypostpage.dart b/lib/src/routes/communitypostpage.dart index 38429493..197b1bac 100644 --- a/lib/src/routes/communitypostpage.dart +++ b/lib/src/routes/communitypostpage.dart @@ -22,6 +22,7 @@ class CommunityPostPage extends StatefulWidget { static void navigateWith(BuildContext context, CommunityPostBloc bloc, CommunityPost communityPost) { + Navigator.push( context, @@ -61,6 +62,7 @@ class _CommunityPostPageState extends State { @override Widget build(BuildContext context) { + initState(); ThemeData theme = Theme.of(context); InstiAppBloc bloc = BlocProvider.of(context)!.bloc; From ac76c0c4832d36e6ab58593649cf3bebebd97529 Mon Sep 17 00:00:00 2001 From: VIBR0X <44766005+vedant-github@users.noreply.github.com> Date: Fri, 15 Dec 2023 14:11:08 +0530 Subject: [PATCH 3/4] communities:the stream is now emptied on each call --- lib/src/api/apiclient.dart | 2 +- lib/src/api/apiclient.g.dart | 2 +- lib/src/blocs/community_post_bloc.dart | 7 ++++--- lib/src/routes/communitydetails.dart | 18 +++++------------- 4 files changed, 11 insertions(+), 18 deletions(-) diff --git a/lib/src/api/apiclient.dart b/lib/src/api/apiclient.dart index 6ed84066..8a4fa461 100644 --- a/lib/src/api/apiclient.dart +++ b/lib/src/api/apiclient.dart @@ -48,7 +48,7 @@ part 'apiclient.g.dart'; //@rt.RestApi(baseUrl: "http://192.168.1.103:8000/api") // @rt.RestApi(baseUrl: "http://10.105.177.150/api") -@rt.RestApi(baseUrl: "https://0d01-2405-201-5004-3e45-7431-160c-1fa7-d48.ngrok-free.app/api") +@rt.RestApi(baseUrl: "https://gymkhana.iitb.ac.in/instiapp/api") // @rt.RestApi(baseUrl: "https://272c-2405-201-5004-3c2f-d836-b028-6ac-ad9.ngrok-free.app/api") abstract class InstiAppApi { factory InstiAppApi(Dio dio, {String baseUrl}) = _InstiAppApi; diff --git a/lib/src/api/apiclient.g.dart b/lib/src/api/apiclient.g.dart index 7b1c5dc5..c98d3d20 100644 --- a/lib/src/api/apiclient.g.dart +++ b/lib/src/api/apiclient.g.dart @@ -8,7 +8,7 @@ part of 'apiclient.dart'; class _InstiAppApi implements InstiAppApi { _InstiAppApi(this._dio, {this.baseUrl}) { - baseUrl ??= 'https://0d01-2405-201-5004-3e45-7431-160c-1fa7-d48.ngrok-free.app/api'; + baseUrl ??= 'https://gymkhana.iitb.ac.in/instiapp/api'; } final Dio _dio; diff --git a/lib/src/blocs/community_post_bloc.dart b/lib/src/blocs/community_post_bloc.dart index 83ac4c00..9ca72ad8 100644 --- a/lib/src/blocs/community_post_bloc.dart +++ b/lib/src/blocs/community_post_bloc.dart @@ -45,8 +45,9 @@ class CommunityPostBloc { // _communityPosts = defCommunities; // _communitySubject.add(defCommunities); // print("refresh"); + + _communitySubject.add([]); if (id == null) { - _communitySubject.add([]); return; } @@ -66,8 +67,8 @@ class CommunityPostBloc { break; } _communityPosts = (await bloc.client.getCommunityPosts( - bloc.getSessionIdHeader(), status, query, id)) - .data ?? + bloc.getSessionIdHeader(), status, query, id)) + .data ?? []; // print("community" + _communityPosts.toString()); diff --git a/lib/src/routes/communitydetails.dart b/lib/src/routes/communitydetails.dart index fb773bcd..44d180d0 100644 --- a/lib/src/routes/communitydetails.dart +++ b/lib/src/routes/communitydetails.dart @@ -1,17 +1,17 @@ import 'dart:async'; import 'package:InstiApp/src/api/model/community.dart'; +import 'package:InstiApp/src/api/model/communityPost.dart'; import 'package:InstiApp/src/api/model/user.dart'; import 'package:InstiApp/src/blocs/community_bloc.dart'; import 'package:InstiApp/src/blocs/community_post_bloc.dart'; -import 'package:InstiApp/src/api/model/communityPost.dart'; -import 'package:InstiApp/src/routes/createpost_form.dart'; -import 'package:InstiApp/src/utils/customappbar.dart'; import 'package:InstiApp/src/drawer.dart'; +import 'package:InstiApp/src/routes/createpost_form.dart'; import 'package:InstiApp/src/utils/common_widgets.dart'; +import 'package:InstiApp/src/utils/customappbar.dart'; import 'package:cached_network_image/cached_network_image.dart'; -import 'package:flutter/material.dart'; import 'package:flutter/gestures.dart'; +import 'package:flutter/material.dart'; import '../bloc_provider.dart'; @@ -494,15 +494,7 @@ class _CommunityPostSectionState extends State { var theme = Theme.of(context); var bloc = BlocProvider.of(context)!.bloc; var communityPostBloc = bloc.communityPostBloc; - () async { - setState(() { - loading = true; - cpType = CPType.All; - }); - await communityPostBloc.refresh( - type: CPType.All, - id: widget.community?.id); - }; + loading=false; if (firstBuild) { communityPostBloc.query = ""; From 9e43e371ad9acf5f4c61a71e2d2e5bf571b2ff05 Mon Sep 17 00:00:00 2001 From: VIBR0X <44766005+vedant-github@users.noreply.github.com> Date: Fri, 15 Dec 2023 14:23:36 +0530 Subject: [PATCH 4/4] lost&found:remove unnecessary imports --- lib/src/routes/lostandfoundfeedpage.dart | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/src/routes/lostandfoundfeedpage.dart b/lib/src/routes/lostandfoundfeedpage.dart index d3e8753a..2f178af9 100644 --- a/lib/src/routes/lostandfoundfeedpage.dart +++ b/lib/src/routes/lostandfoundfeedpage.dart @@ -4,7 +4,6 @@ import 'package:InstiApp/src/blocs/lost_and_found_bloc.dart'; import 'package:InstiApp/src/drawer.dart'; import 'package:InstiApp/src/utils/common_widgets.dart'; import 'package:cached_network_image/cached_network_image.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import '../api/model/lostandfoundPost.dart';