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

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

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

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

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

@ -32,14 +32,7 @@ AppBar AppBarWidget(BuildContext context,
width: 40, width: 40,
isImageBase64: true, 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,
if (image == null) 14.width,
title.toText24(color: MyColors.darkTextColor, isBold: true).expanded, title.toText24(color: MyColors.darkTextColor, isBold: true).expanded,
], ],
), ),

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