Chat Fixes & User Chat Counter

merge-requests/81/head
Aamir Muhammad 3 years ago
parent 0db4a5a7cd
commit 0f13ab65d6

@ -307,19 +307,19 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
Future<HubConnection> getHubConnection() async {
HubConnection hub;
try {
HttpConnectionOptions httpOp = HttpConnectionOptions(skipNegotiation: false, logMessageContent: true);
hub = HubConnectionBuilder()
.withUrl(ApiConsts.chatHubConnectionUrl + "?UserId=${AppState().chatDetails!.response!.id}&source=Web&access_token=${AppState().chatDetails!.response!.token}", options: httpOp)
.withAutomaticReconnect(retryDelays: <int>[2000, 5000, 10000, 20000]).build();
isChatHubLoding = false;
return hub;
} catch (e) {
getUserAutoLoginToken().whenComplete(() {
getHubConnection();
});
throw e;
}
// try {
HttpConnectionOptions httpOp = HttpConnectionOptions(skipNegotiation: false, logMessageContent: true);
hub = HubConnectionBuilder()
.withUrl(ApiConsts.chatHubConnectionUrl + "?UserId=${AppState().chatDetails!.response!.id}&source=Web&access_token=${AppState().chatDetails!.response!.token}", options: httpOp)
.withAutomaticReconnect(retryDelays: <int>[2000, 5000, 10000, 20000]).build();
isChatHubLoding = false;
return hub;
// } catch (e) {
// getUserAutoLoginToken().whenComplete(() {
// getHubConnection();
// });
// throw e;
// }
}
void notify() {

@ -90,7 +90,7 @@ class _ChatDetailScreenState extends State<ChatDetailScreen> {
body: Consumer<ChatProviderModel>(
builder: (BuildContext context, ChatProviderModel m, Widget? child) {
return (m.isLoading
? ChatHomeShimmer()
? ChatHomeShimmer(isDetailedScreen: true,)
: Column(
children: <Widget>[
SmartRefresher(

@ -21,9 +21,9 @@ class ChatImagePreviewScreen extends StatelessWidget {
children: [
Image.memory(
img,
fit: BoxFit.cover,
height: 400,
width: double.infinity,
fit: BoxFit.fill,
height:500,
width: 500,
).paddingAll(15),
Positioned(
right: 0,

@ -21,6 +21,8 @@ import 'package:mohem_flutter_app/widgets/shimmer/dashboard_shimmer_widget.dart'
import 'package:provider/provider.dart';
class ChatHomeScreen extends StatefulWidget {
const ChatHomeScreen({Key? key}) : super(key: key);
@override
State<ChatHomeScreen> createState() => _ChatHomeScreenState();
}
@ -48,7 +50,7 @@ class _ChatHomeScreenState extends State<ChatHomeScreen> {
body: Consumer<ChatProviderModel>(
builder: (BuildContext context, ChatProviderModel m, Widget? child) {
return m.isLoading
? ChatHomeShimmer()
? ChatHomeShimmer(isDetailedScreen: false,)
: Column(
children: <Widget>[
TextField(
@ -84,7 +86,7 @@ class _ChatHomeScreenState extends State<ChatHomeScreen> {
itemCount: m.searchedChats!.length,
shrinkWrap: true,
physics: const ClampingScrollPhysics(),
padding: EdgeInsets.only(bottom: 80.0),
padding: const EdgeInsets.only(bottom: 80.0),
itemBuilder: (BuildContext context, int index) {
return SizedBox(
height: 55,
@ -96,8 +98,7 @@ class _ChatHomeScreenState extends State<ChatHomeScreen> {
const SizedBox(
height: 48,
width: 48,
child: Center(child: CircularProgressIndicator()),
),
).toShimmer().circle(30),
if (m.searchedChats![index].isImageLoaded! && m.searchedChats![index].image != null && m.searchedChats![index].image.isNotEmpty)
CircularAvatar(
radius: 20,

@ -23,7 +23,7 @@ class ChatFavoriteUsersScreen extends StatelessWidget {
body: Consumer<ChatProviderModel>(
builder: (BuildContext context, ChatProviderModel m, Widget? child) {
if (m.isLoading) {
return ChatHomeShimmer();
return ChatHomeShimmer(isDetailedScreen: false,);
} else {
return m.favUsersList != null && m.favUsersList.isNotEmpty
? ListView.separated(
@ -41,8 +41,7 @@ class ChatFavoriteUsersScreen extends StatelessWidget {
const SizedBox(
height: 48,
width: 48,
child: Center(child: CircularProgressIndicator()),
),
).toShimmer().circle(30),
if (m.favUsersList![index].isImageLoaded! && m.favUsersList![index].image != null && m.favUsersList![index].image.isNotEmpty)
CircularAvatar(
radius: 20,

@ -32,14 +32,7 @@ AppBar AppBarWidget(BuildContext context,
width: 40,
isImageBase64: true,
),
if (image == null)
SvgPicture.asset(
"assets/images/user.svg",
height: 40,
width: 40,
),
if (image != null) 14.width,
if (image == null) 14.width,
title.toText24(color: MyColors.darkTextColor, isBold: true).expanded,
],
),

@ -188,7 +188,6 @@ class ServicesMenuShimmer extends StatelessWidget {
}
}
class MarathonBannerShimmer extends StatelessWidget {
const MarathonBannerShimmer({Key? key}) : super(key: key);
@ -236,6 +235,11 @@ class MarathonBannerShimmer extends StatelessWidget {
}
class ChatHomeShimmer extends StatelessWidget {
bool isDetailedScreen;
ChatHomeShimmer({Key? key, required this.isDetailedScreen}) : super(key: key);
@override
@override
Widget build(BuildContext context) {
return Container(
@ -254,42 +258,42 @@ class ChatHomeShimmer extends StatelessWidget {
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Container(
width: 48.0,
height: 48.0,
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(40))),
),
const Padding(
padding: EdgeInsets.symmetric(horizontal: 8.0),
),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Container(
width: double.infinity,
height: 8.0,
color: Colors.white,
),
const Padding(
padding: EdgeInsets.symmetric(vertical: 2.0),
),
Container(
width: double.infinity,
height: 8.0,
color: Colors.white,
),
const Padding(
padding: EdgeInsets.symmetric(vertical: 2.0),
),
Container(
width: 40.0,
height: 8.0,
color: Colors.white,
),
],
if (!isDetailedScreen)
Container(
width: 48.0,
height: 48.0,
decoration: const BoxDecoration(color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(40))),
),
if (!isDetailedScreen)
const Padding(
padding: EdgeInsets.symmetric(horizontal: 8.0),
),
)
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Container(
width: double.infinity,
height: 8.0,
color: Colors.white,
),
const Padding(
padding: EdgeInsets.symmetric(vertical: 2.0),
),
Container(
width: double.infinity,
height: 8.0,
color: Colors.white,
),
const Padding(
padding: EdgeInsets.symmetric(vertical: 2.0),
),
Container(
width: 40.0,
height: 8.0,
color: Colors.white,
),
],
).expanded
],
),
),

Loading…
Cancel
Save