Skip to content

Commit

Permalink
bumped to version 1.0.1+31
Browse files Browse the repository at this point in the history
  • Loading branch information
nixrajput committed Jan 30, 2023
1 parent bdbbf70 commit 51de1d7
Show file tree
Hide file tree
Showing 12 changed files with 329 additions and 275 deletions.
6 changes: 6 additions & 0 deletions lib/constants/enums.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,9 @@ enum BubbleType {
sendBubble,
receiverBubble,
}

enum ReportType {
user,
post,
comment,
}
1 change: 1 addition & 0 deletions lib/constants/strings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,7 @@ abstract class StringValues {
static const public = 'public';
static const publicPrivacyDesc = 'Anyone can see your posts.';
static const publish = 'Publish';
static const pleaseSelectReason = 'Please select a reason';
static const reactivate = 'Reactivate';
static const reactivateAccount = 'Reactivate Account';
static const reactivateAccountHelp =
Expand Down
13 changes: 7 additions & 6 deletions lib/modules/home/views/widgets/post_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import 'package:get_time_ago/get_time_ago.dart';
import 'package:social_media_app/apis/models/entities/post.dart';
import 'package:social_media_app/constants/colors.dart';
import 'package:social_media_app/constants/dimens.dart';
import 'package:social_media_app/constants/enums.dart';
import 'package:social_media_app/constants/strings.dart';
import 'package:social_media_app/constants/styles.dart';
import 'package:social_media_app/extensions/date_extensions.dart';
Expand Down Expand Up @@ -430,7 +431,7 @@ class PostWidget extends StatelessWidget {
leading: Icon(
Icons.visibility,
color: Theme.of(context).textTheme.bodyLarge!.color,
size: Dimens.twenty,
size: Dimens.twentyFour,
),
title: Text(
StringValues.view,
Expand Down Expand Up @@ -460,7 +461,7 @@ class PostWidget extends StatelessWidget {
leading: Icon(
Icons.delete,
color: Theme.of(context).textTheme.bodyLarge!.color,
size: Dimens.twenty,
size: Dimens.twentyFour,
),
title: Text(
StringValues.delete,
Expand All @@ -485,7 +486,7 @@ class PostWidget extends StatelessWidget {
leading: Icon(
Icons.edit,
color: Theme.of(context).textTheme.bodyLarge!.color,
size: Dimens.twenty,
size: Dimens.twentyFour,
),
title: Text(
StringValues.edit,
Expand All @@ -511,7 +512,7 @@ class PostWidget extends StatelessWidget {
leading: Icon(
Icons.share,
color: Theme.of(context).textTheme.bodyLarge!.color,
size: Dimens.twenty,
size: Dimens.twentyFour,
),
title: Text(
StringValues.share,
Expand All @@ -529,12 +530,12 @@ class PostWidget extends StatelessWidget {
showBorder: false,
onTap: () {
AppUtility.closeBottomSheet();
RouteManagement.goToReportIssueView(post.id!);
RouteManagement.goToReportIssueView(post.id!, ReportType.post);
},
leading: Icon(
Icons.report,
color: Theme.of(context).textTheme.bodyLarge!.color,
size: Dimens.twenty,
size: Dimens.twentyFour,
),
title: Text(
StringValues.report,
Expand Down
172 changes: 86 additions & 86 deletions lib/modules/home/views/widgets/user_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,71 +25,44 @@ class UserWidget extends StatelessWidget {
this.onActionTap,
}) : super(key: key);

final User user;
final int totalLength;
final int index;
final double? bottomMargin;
final VoidCallback? onTap;
final VoidCallback? onActionTap;
final double? avatarSize;
final EdgeInsets? padding;
final Color? bgColor;
final BorderRadius? borderRadius;
final double? bottomMargin;
final Widget? extraActions;
final int index;
final VoidCallback? onActionTap;
final VoidCallback? onTap;
final EdgeInsets? padding;
final int totalLength;
final User user;

@override
Widget build(BuildContext context) {
final profile = ProfileController.find;
return GestureDetector(
onTap: onTap,
child: Container(
margin: Dimens.edgeInsets8_0,
padding: padding ?? Dimens.edgeInsets8,
constraints: BoxConstraints(
maxWidth: Dimens.screenWidth,
),
decoration: BoxDecoration(
color: Theme.of(context).cardColor,
borderRadius: BorderRadius.circular(Dimens.four),
boxShadow: AppStyles.defaultShadow,
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: [
Hero(
tag: user.id,
child: AvatarWidget(
avatar: user.avatar,
size: avatarSize ?? Dimens.twentyFour,
),
),
Dimens.boxWidth8,
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
_buildUserUsername(context),
_buildUserFullName(context),
],
),
),
],
),
),
if (user.id != profile.profileDetails!.user!.id)
_buildFollowAction(context),
],
),
),
);
String getFollowStatus(String status, BuildContext context) {
if (status == "following") {
return StringValues.following;
}

if (status == "requested") {
return StringValues.requested;
}

return StringValues.follow;
}

Color getButtonColor(String status, BuildContext context) {
if (status == "following" || status == "requested") {
return Theme.of(context).dividerColor;
}

return ColorValues.primaryColor;
}

Color getLabelColor(String status, BuildContext context) {
if (status == "following" || status == "requested") {
return Theme.of(context).textTheme.bodyLarge!.color!;
}

return ColorValues.whiteColor;
}

Widget _buildUserUsername(BuildContext context) => Row(
Expand Down Expand Up @@ -151,31 +124,58 @@ class UserWidget extends StatelessWidget {
),
);

String getFollowStatus(String status, BuildContext context) {
if (status == "following") {
return StringValues.following;
}

if (status == "requested") {
return StringValues.requested;
}

return StringValues.follow;
}

Color getButtonColor(String status, BuildContext context) {
if (status == "following" || status == "requested") {
return Theme.of(context).dividerColor;
}

return ColorValues.primaryColor;
}

Color getLabelColor(String status, BuildContext context) {
if (status == "following" || status == "requested") {
return Theme.of(context).textTheme.bodyLarge!.color!;
}

return ColorValues.whiteColor;
@override
Widget build(BuildContext context) {
final profile = ProfileController.find;
return GestureDetector(
onTap: onTap,
child: Container(
margin: Dimens.edgeInsets8_0,
padding: padding ?? Dimens.edgeInsets8,
constraints: BoxConstraints(
maxWidth: Dimens.screenWidth,
),
decoration: BoxDecoration(
color: Theme.of(context).cardColor,
borderRadius: BorderRadius.circular(Dimens.four),
boxShadow: AppStyles.defaultShadow,
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: [
Hero(
tag: user.id,
child: AvatarWidget(
avatar: user.avatar,
size: avatarSize ?? Dimens.twentyFour,
),
),
Dimens.boxWidth8,
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
_buildUserUsername(context),
_buildUserFullName(context),
],
),
),
],
),
),
if (user.id != profile.profileDetails!.user!.id)
_buildFollowAction(context),
],
),
),
);
}
}
57 changes: 23 additions & 34 deletions lib/modules/post/views/widgets/post_details_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -193,42 +193,31 @@ class PostDetailsWidget extends StatelessWidget {
.toList(),
),
Dimens.boxHeight4,
Flexible(
child: Padding(
padding: Dimens.edgeInsets0_8,
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: [
Text(
'${post.totalVotes!.toString().toCountingFormat()} votes',
style: AppStyles.style12Normal.copyWith(
color: Theme.of(context).textTheme.titleMedium!.color,
),
Padding(
padding: Dimens.edgeInsets0_8,
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Text(
'${post.totalVotes!.toString().toCountingFormat()} votes',
style: AppStyles.style13Normal.copyWith(
color: Theme.of(context).textTheme.titleMedium!.color,
),
Dimens.boxWidth4,
Container(
width: Dimens.four,
height: Dimens.four,
decoration: BoxDecoration(
color: Theme.of(context).disabledColor,
shape: BoxShape.circle,
),
),
Dimens.boxWidth4,
Flexible(
child: Text(
'${post.pollEndsAt!.getPollDurationLeft()}',
style: AppStyles.style12Normal.copyWith(
color: isExpired
? Theme.of(context).textTheme.titleMedium!.color
: ColorValues.linkColor,
),
),
Dimens.boxHeight8,
Flexible(
child: Text(
'${post.pollEndsAt!.getPollDurationLeft()}',
style: AppStyles.style13Normal.copyWith(
color: isExpired
? Theme.of(context).textTheme.titleMedium!.color
: ColorValues.linkColor,
),
),
],
),
),
],
),
),
],
Expand Down Expand Up @@ -429,7 +418,7 @@ class PostDetailsWidget extends StatelessWidget {

Widget _buildPostTime(BuildContext context) {
return Text(
DateFormat('dd MMM yyyy hh:mm a').format(post.createdAt!.toLocal()),
DateFormat('dd MMM yyyy hh:mm a').format(post.createdAt!.toLocal()),
style: AppStyles.style13Normal.copyWith(
color: Theme.of(context).textTheme.titleMedium!.color,
),
Expand Down
9 changes: 9 additions & 0 deletions lib/modules/report/report_binding.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import 'package:get/get.dart';
import 'package:social_media_app/modules/report/report_controller.dart';

class ReportBinding extends Bindings {
@override
void dependencies() {
Get.lazyPut(ReportController.new);
}
}
Loading

0 comments on commit 51de1d7

Please sign in to comment.