Complete mention section
This commit is contained in:
parent
f4689f3391
commit
f9745a792a
Binary file not shown.
|
|
@ -17,6 +17,7 @@
|
||||||
///
|
///
|
||||||
|
|
||||||
import 'package:flutter/widgets.dart';
|
import 'package:flutter/widgets.dart';
|
||||||
|
|
||||||
class DidvanIcons {
|
class DidvanIcons {
|
||||||
DidvanIcons._();
|
DidvanIcons._();
|
||||||
|
|
||||||
|
|
@ -551,4 +552,6 @@ class DidvanIcons {
|
||||||
IconData(0xe906, fontFamily: _kFontFam, fontPackage: _kFontPkg);
|
IconData(0xe906, fontFamily: _kFontFam, fontPackage: _kFontPkg);
|
||||||
static const IconData video_solid =
|
static const IconData video_solid =
|
||||||
IconData(0xe907, fontFamily: _kFontFam, fontPackage: _kFontPkg);
|
IconData(0xe907, fontFamily: _kFontFam, fontPackage: _kFontPkg);
|
||||||
|
static const IconData mention_icon =
|
||||||
|
IconData(0xe908, fontFamily: _kFontFam, fontPackage: _kFontPkg);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,30 +1,33 @@
|
||||||
|
import 'package:didvan/models/comment/user.dart';
|
||||||
|
|
||||||
class MentionData {
|
class MentionData {
|
||||||
int id;
|
int id;
|
||||||
String fullName;
|
|
||||||
String text;
|
String text;
|
||||||
String createdAt;
|
String createdAt;
|
||||||
List<String> mentions;
|
List<String> mentions;
|
||||||
|
final UserOverview user;
|
||||||
|
|
||||||
MentionData(
|
MentionData({
|
||||||
{required this.id,
|
required this.id,
|
||||||
required this.text,
|
required this.text,
|
||||||
required this.createdAt,
|
required this.createdAt,
|
||||||
required this.fullName,
|
required this.mentions,
|
||||||
required this.mentions});
|
required this.user,
|
||||||
|
});
|
||||||
|
|
||||||
factory MentionData.fromJson(Map<String, dynamic> json) => MentionData(
|
factory MentionData.fromJson(Map<String, dynamic> json) => MentionData(
|
||||||
id: json['id'],
|
id: json['id'],
|
||||||
text: json['text'],
|
text: json['text'],
|
||||||
createdAt: json['createdAt'],
|
createdAt: json['createdAt'],
|
||||||
fullName: json['fullName'],
|
mentions: List<String>.from(json['mentions']),
|
||||||
mentions: json['mentions'],
|
user: UserOverview.fromJson(json['user']),
|
||||||
);
|
);
|
||||||
|
|
||||||
Map<String, dynamic> toJson() => {
|
Map<String, dynamic> toJson() => {
|
||||||
'id': id,
|
'id': id,
|
||||||
'text': text,
|
'text': text,
|
||||||
'createdAt': createdAt,
|
'createdAt': createdAt,
|
||||||
'fullName': fullName,
|
|
||||||
'mentions': mentions,
|
'mentions': mentions,
|
||||||
|
'user': user.toJson(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -84,8 +84,16 @@ class CustomizeCategoryState extends CoreProvier {
|
||||||
);
|
);
|
||||||
await service.put();
|
await service.put();
|
||||||
if (service.isSuccess) {
|
if (service.isSuccess) {
|
||||||
Navigator.of(context).pushNamed(Routes.notificationStatusStep,
|
if (toTimer) {
|
||||||
arguments: {"toTimer": toTimer});
|
Navigator.of(context).pushNamed(Routes.notificationTime,
|
||||||
|
arguments: {"fromFav": toTimer});
|
||||||
|
} else {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
ActionSheetUtils.showAlert(AlertData(
|
||||||
|
message: "تغییرات شما با موفقیت اعمال شد.",
|
||||||
|
aLertType: ALertType.success));
|
||||||
|
}
|
||||||
|
|
||||||
appState = AppState.idle;
|
appState = AppState.idle;
|
||||||
await HomeWidgetRepository.fetchWidget();
|
await HomeWidgetRepository.fetchWidget();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -153,11 +153,11 @@ class InfographyItem extends StatelessWidget {
|
||||||
Routes.mentions,
|
Routes.mentions,
|
||||||
arguments: {
|
arguments: {
|
||||||
'id': id,
|
'id': id,
|
||||||
'type': 'infography',
|
'type': 'banner',
|
||||||
'title': title,
|
'title': title,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
icon: DidvanIcons.chats_light,
|
icon: DidvanIcons.mention_icon,
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
width: 8.0,
|
width: 8.0,
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
import 'dart:math';
|
||||||
import 'dart:ui';
|
import 'dart:ui';
|
||||||
|
|
||||||
import 'package:didvan/config/design_config.dart';
|
import 'package:didvan/config/design_config.dart';
|
||||||
|
|
@ -5,10 +6,10 @@ import 'package:didvan/config/theme_data.dart';
|
||||||
import 'package:didvan/constants/app_icons.dart';
|
import 'package:didvan/constants/app_icons.dart';
|
||||||
import 'package:didvan/constants/assets.dart';
|
import 'package:didvan/constants/assets.dart';
|
||||||
import 'package:didvan/models/view/app_bar_data.dart';
|
import 'package:didvan/models/view/app_bar_data.dart';
|
||||||
|
import 'package:didvan/providers/user.dart';
|
||||||
import 'package:didvan/views/mentions/mentions_state.dart';
|
import 'package:didvan/views/mentions/mentions_state.dart';
|
||||||
import 'package:didvan/views/mentions/widgets/mention.dart';
|
import 'package:didvan/views/mentions/widgets/mention.dart';
|
||||||
import 'package:didvan/views/widgets/animated_visibility.dart';
|
import 'package:didvan/views/widgets/animated_visibility.dart';
|
||||||
import 'package:didvan/views/widgets/didvan/checkbox.dart';
|
|
||||||
import 'package:didvan/views/widgets/didvan/icon_button.dart';
|
import 'package:didvan/views/widgets/didvan/icon_button.dart';
|
||||||
import 'package:didvan/views/widgets/didvan/scaffold.dart';
|
import 'package:didvan/views/widgets/didvan/scaffold.dart';
|
||||||
import 'package:didvan/views/widgets/didvan/text.dart';
|
import 'package:didvan/views/widgets/didvan/text.dart';
|
||||||
|
|
@ -17,7 +18,6 @@ import 'package:didvan/views/widgets/state_handlers/empty_state.dart';
|
||||||
import 'package:didvan/views/widgets/state_handlers/sliver_state_handler.dart';
|
import 'package:didvan/views/widgets/state_handlers/sliver_state_handler.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import '../comments/comments_state.dart';
|
|
||||||
import '../widgets/user_mention.dart';
|
import '../widgets/user_mention.dart';
|
||||||
|
|
||||||
class Mentions extends StatefulWidget {
|
class Mentions extends StatefulWidget {
|
||||||
|
|
@ -54,13 +54,13 @@ class _MentionsState extends State<Mentions> {
|
||||||
|
|
||||||
void _onChange(MentionsState state, value) {
|
void _onChange(MentionsState state, value) {
|
||||||
state.searchUsers = value;
|
state.searchUsers = value;
|
||||||
state.getUsersMention();
|
state.getUsersMention(context.read<UserProvider>().user.id);
|
||||||
state.update();
|
state.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final commentsState = context.watch<MentionsState>();
|
final mentionsState = context.watch<MentionsState>();
|
||||||
|
|
||||||
final bottomViewInset = MediaQuery.of(context).viewInsets.bottom;
|
final bottomViewInset = MediaQuery.of(context).viewInsets.bottom;
|
||||||
if (bottomViewInset == 0) {
|
if (bottomViewInset == 0) {
|
||||||
|
|
@ -94,7 +94,7 @@ class _MentionsState extends State<Mentions> {
|
||||||
state: state,
|
state: state,
|
||||||
itemPadding: const EdgeInsets.symmetric(vertical: 16),
|
itemPadding: const EdgeInsets.symmetric(vertical: 16),
|
||||||
childCount: state.comments.length,
|
childCount: state.comments.length,
|
||||||
placeholder: const _CommentPlaceholder(),
|
placeholder: const _MentionPlaceholder(),
|
||||||
centerEmptyState: _isPage,
|
centerEmptyState: _isPage,
|
||||||
enableEmptyState: state.comments.isEmpty,
|
enableEmptyState: state.comments.isEmpty,
|
||||||
emptyState: EmptyState(
|
emptyState: EmptyState(
|
||||||
|
|
@ -114,7 +114,7 @@ class _MentionsState extends State<Mentions> {
|
||||||
),
|
),
|
||||||
AnimatedVisibility(
|
AnimatedVisibility(
|
||||||
duration: DesignConfig.lowAnimationDuration,
|
duration: DesignConfig.lowAnimationDuration,
|
||||||
isVisible: commentsState.showUsersForMentionsLayout,
|
isVisible: mentionsState.showUsersForMentionsLayout,
|
||||||
child: BackdropFilter(
|
child: BackdropFilter(
|
||||||
filter: ImageFilter.blur(sigmaX: 8.0, sigmaY: 8.0),
|
filter: ImageFilter.blur(sigmaX: 8.0, sigmaY: 8.0),
|
||||||
child: Container(
|
child: Container(
|
||||||
|
|
@ -131,7 +131,10 @@ class _MentionsState extends State<Mentions> {
|
||||||
Consumer<MentionsState>(
|
Consumer<MentionsState>(
|
||||||
builder: (context, state, child) =>
|
builder: (context, state, child) =>
|
||||||
SliverStateHandler<MentionsState>(
|
SliverStateHandler<MentionsState>(
|
||||||
onRetry: state.getUsersMention,
|
onRetry: () {
|
||||||
|
state.getUsersMention(
|
||||||
|
context.read<UserProvider>().user.id);
|
||||||
|
},
|
||||||
state: state,
|
state: state,
|
||||||
childCount: state.users.length,
|
childCount: state.users.length,
|
||||||
placeholder: const _UsersPlaceholder(),
|
placeholder: const _UsersPlaceholder(),
|
||||||
|
|
@ -159,7 +162,7 @@ class _MentionsState extends State<Mentions> {
|
||||||
textInputAction: TextInputAction.send,
|
textInputAction: TextInputAction.send,
|
||||||
style: Theme.of(context).textTheme.bodyMedium,
|
style: Theme.of(context).textTheme.bodyMedium,
|
||||||
onEditingComplete: () {},
|
onEditingComplete: () {},
|
||||||
onChanged: (val) => _onChange(commentsState, val),
|
onChanged: (val) => _onChange(mentionsState, val),
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
icon: const Icon(DidvanIcons.search_regular),
|
icon: const Icon(DidvanIcons.search_regular),
|
||||||
border: InputBorder.none,
|
border: InputBorder.none,
|
||||||
|
|
@ -177,8 +180,8 @@ class _MentionsState extends State<Mentions> {
|
||||||
DidvanIconButton(
|
DidvanIconButton(
|
||||||
icon: DidvanIcons.close_regular,
|
icon: DidvanIcons.close_regular,
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
commentsState.showUsersForMentionsLayout = false;
|
mentionsState.showUsersForMentionsLayout = false;
|
||||||
commentsState.update();
|
mentionsState.update();
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
@ -329,10 +332,17 @@ class _MessageBoxState extends State<_MessageBox> {
|
||||||
),
|
),
|
||||||
DidvanText(
|
DidvanText(
|
||||||
state.mentionedUsers
|
state.mentionedUsers
|
||||||
.map((user) => user.name)
|
.sublist(0,
|
||||||
.join("، "),
|
min(state.mentionedUsers.length, 2))
|
||||||
|
.map((user) => user.name)
|
||||||
|
.join("، ") +
|
||||||
|
(state.mentionedUsers.length > 2
|
||||||
|
? " و ${state.mentionedUsers.length - 2} مورد دیگر"
|
||||||
|
: ""),
|
||||||
color: Theme.of(context).colorScheme.text,
|
color: Theme.of(context).colorScheme.text,
|
||||||
style: Theme.of(context).textTheme.bodySmall,
|
style: Theme.of(context).textTheme.bodySmall,
|
||||||
|
maxLines: 1,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
@ -378,7 +388,7 @@ class _MessageBoxState extends State<_MessageBox> {
|
||||||
Expanded(
|
Expanded(
|
||||||
child: TextField(
|
child: TextField(
|
||||||
focusNode: widget.focusNode,
|
focusNode: widget.focusNode,
|
||||||
controller: state.commentTextFieldController,
|
controller: state.textFieldController,
|
||||||
keyboardType: TextInputType.multiline,
|
keyboardType: TextInputType.multiline,
|
||||||
textInputAction: TextInputAction.send,
|
textInputAction: TextInputAction.send,
|
||||||
style: Theme.of(context).textTheme.bodyMedium,
|
style: Theme.of(context).textTheme.bodyMedium,
|
||||||
|
|
@ -399,7 +409,7 @@ class _MessageBoxState extends State<_MessageBox> {
|
||||||
state.showUsersForMentionsLayout = true;
|
state.showUsersForMentionsLayout = true;
|
||||||
state.update();
|
state.update();
|
||||||
},
|
},
|
||||||
icon: DidvanIcons.user_shield_regular,
|
icon: DidvanIcons.mention_icon,
|
||||||
size: 24,
|
size: 24,
|
||||||
color: Theme.of(context).colorScheme.focusedBorder,
|
color: Theme.of(context).colorScheme.focusedBorder,
|
||||||
),
|
),
|
||||||
|
|
@ -411,17 +421,15 @@ class _MessageBoxState extends State<_MessageBox> {
|
||||||
}
|
}
|
||||||
|
|
||||||
void _onSend(MentionsState state) {
|
void _onSend(MentionsState state) {
|
||||||
if (state.commentTextFieldController.text.replaceAll(' ', '').isNotEmpty) {
|
if (state.textFieldController.text.replaceAll(' ', '').isNotEmpty &&
|
||||||
state.addComment();
|
state.mentionedUsers.isNotEmpty) {
|
||||||
state.commentTextFieldController.text = '';
|
state.addMention();
|
||||||
state.searchUsers = '';
|
|
||||||
state.mentionedUsers.clear();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class _CommentPlaceholder extends StatelessWidget {
|
class _MentionPlaceholder extends StatelessWidget {
|
||||||
const _CommentPlaceholder({Key? key}) : super(key: key);
|
const _MentionPlaceholder({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ import 'package:flutter/cupertino.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
class MentionsState extends CoreProvier {
|
class MentionsState extends CoreProvier {
|
||||||
TextEditingController commentTextFieldController = TextEditingController();
|
TextEditingController textFieldController = TextEditingController();
|
||||||
List<UsersMention> mentionedUsers = [];
|
List<UsersMention> mentionedUsers = [];
|
||||||
String searchUsers = '';
|
String searchUsers = '';
|
||||||
int? commentId;
|
int? commentId;
|
||||||
|
|
@ -20,7 +20,6 @@ class MentionsState extends CoreProvier {
|
||||||
bool showUsersForMentionsLayout = false;
|
bool showUsersForMentionsLayout = false;
|
||||||
bool showPrivates = false;
|
bool showPrivates = false;
|
||||||
bool hideMentionedUser = false;
|
bool hideMentionedUser = false;
|
||||||
int _count = 0;
|
|
||||||
late String type;
|
late String type;
|
||||||
|
|
||||||
final List<MentionData> comments = [];
|
final List<MentionData> comments = [];
|
||||||
|
|
@ -32,14 +31,15 @@ class MentionsState extends CoreProvier {
|
||||||
final service = RequestService(
|
final service = RequestService(
|
||||||
RequestHelper.mention(itemId, type),
|
RequestHelper.mention(itemId, type),
|
||||||
);
|
);
|
||||||
|
|
||||||
await service.httpGet();
|
await service.httpGet();
|
||||||
|
|
||||||
if (service.isSuccess) {
|
if (service.isSuccess) {
|
||||||
comments.clear();
|
comments.clear();
|
||||||
final messages = service.result['comments'];
|
final List<dynamic> messages = service.result['comments'];
|
||||||
|
|
||||||
for (var i = 0; i < messages.length; i++) {
|
for (var i = 0; i < messages.length; i++) {
|
||||||
comments.add(MentionData.fromJson(messages[i]));
|
comments.add(MentionData.fromJson(messages[i]));
|
||||||
_count++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
appState = AppState.idle;
|
appState = AppState.idle;
|
||||||
|
|
@ -49,7 +49,7 @@ class MentionsState extends CoreProvier {
|
||||||
appState = AppState.failed;
|
appState = AppState.failed;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> getUsersMention() async {
|
Future<void> getUsersMention(int id) async {
|
||||||
final service = RequestService(
|
final service = RequestService(
|
||||||
RequestHelper.usersMentions(searchUsers),
|
RequestHelper.usersMentions(searchUsers),
|
||||||
);
|
);
|
||||||
|
|
@ -60,8 +60,16 @@ class MentionsState extends CoreProvier {
|
||||||
users.clear();
|
users.clear();
|
||||||
final List<dynamic> resUsers = service.data('users');
|
final List<dynamic> resUsers = service.data('users');
|
||||||
|
|
||||||
users
|
users.addAll(mentionedUsers);
|
||||||
.addAll(resUsers.map((user) => UsersMention.fromJson(user)).toList());
|
|
||||||
|
for (var i = 0; i < resUsers.length; i++) {
|
||||||
|
final user = UsersMention.fromJson(resUsers[i]);
|
||||||
|
|
||||||
|
if (!mentionedUsers.map((e) => e.id).contains(user.id) &&
|
||||||
|
user.id != id) {
|
||||||
|
users.add(user);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
appState = AppState.idle;
|
appState = AppState.idle;
|
||||||
return;
|
return;
|
||||||
|
|
@ -69,7 +77,7 @@ class MentionsState extends CoreProvier {
|
||||||
appState = AppState.failed;
|
appState = AppState.failed;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> addComment() async {
|
Future<void> addMention() async {
|
||||||
late List<MentionData> cList = comments;
|
late List<MentionData> cList = comments;
|
||||||
final user = DesignConfig.context!.read<UserProvider>().user;
|
final user = DesignConfig.context!.read<UserProvider>().user;
|
||||||
|
|
||||||
|
|
@ -77,8 +85,12 @@ class MentionsState extends CoreProvier {
|
||||||
0,
|
0,
|
||||||
MentionData(
|
MentionData(
|
||||||
id: 0,
|
id: 0,
|
||||||
fullName: user.fullName,
|
user: UserOverview(
|
||||||
text: commentTextFieldController.text,
|
id: user.id,
|
||||||
|
fullName: user.fullName,
|
||||||
|
photo: user.photo,
|
||||||
|
),
|
||||||
|
text: textFieldController.text,
|
||||||
createdAt: DateTime.now().toString(),
|
createdAt: DateTime.now().toString(),
|
||||||
mentions: mentionedUsers.map((user) => user.name).toList(),
|
mentions: mentionedUsers.map((user) => user.name).toList(),
|
||||||
),
|
),
|
||||||
|
|
@ -87,8 +99,8 @@ class MentionsState extends CoreProvier {
|
||||||
final body = {};
|
final body = {};
|
||||||
|
|
||||||
body.addAll({
|
body.addAll({
|
||||||
'text': commentTextFieldController.text,
|
'text': textFieldController.text,
|
||||||
"mentions": mentionedUsers.map((user) => user.id.toString()).toList(),
|
"mentions": mentionedUsers.map((user) => user.id).toList(),
|
||||||
});
|
});
|
||||||
|
|
||||||
final service = RequestService(
|
final service = RequestService(
|
||||||
|
|
@ -97,21 +109,28 @@ class MentionsState extends CoreProvier {
|
||||||
);
|
);
|
||||||
|
|
||||||
await service.post();
|
await service.post();
|
||||||
|
|
||||||
if (service.isSuccess) {
|
if (service.isSuccess) {
|
||||||
cList.firstWhere((comment) => comment.id == 0).id =
|
cList.firstWhere((comment) => comment.id == 0).id =
|
||||||
service.result['comment']['id'];
|
service.result['comment']['id'];
|
||||||
|
|
||||||
mentionedUsers = [];
|
mentionedUsers.clear();
|
||||||
|
users.clear();
|
||||||
searchUsers = '';
|
searchUsers = '';
|
||||||
|
textFieldController.text = '';
|
||||||
|
showUsersForMentionsLayout = false;
|
||||||
|
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void deleteComment(int id, int status, int? rootId) async {
|
void deleteMention(int id) async {
|
||||||
final service = RequestService(RequestHelper.deleteComment(id));
|
final service = RequestService(RequestHelper.deleteComment(id));
|
||||||
await service.delete();
|
await service.delete();
|
||||||
|
|
||||||
if (service.isSuccess) await getComments();
|
if (service.isSuccess) {
|
||||||
|
comments.removeWhere((element) => element.id == id);
|
||||||
|
}
|
||||||
|
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
import 'package:didvan/config/design_config.dart';
|
import 'package:didvan/config/design_config.dart';
|
||||||
import 'package:didvan/config/theme_data.dart';
|
import 'package:didvan/config/theme_data.dart';
|
||||||
import 'package:didvan/constants/app_icons.dart';
|
import 'package:didvan/constants/app_icons.dart';
|
||||||
import 'package:didvan/models/comment/reply.dart';
|
|
||||||
import 'package:didvan/models/mention/mention.dart';
|
import 'package:didvan/models/mention/mention.dart';
|
||||||
import 'package:didvan/models/view/action_sheet_data.dart';
|
import 'package:didvan/models/view/action_sheet_data.dart';
|
||||||
import 'package:didvan/providers/user.dart';
|
import 'package:didvan/providers/user.dart';
|
||||||
|
|
@ -95,10 +94,11 @@ class MentionState extends State<Mention> {
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
DidvanText(
|
DidvanText(
|
||||||
comment.mention.toString(),
|
"اشاره به ${comment.mentions.join("، ").toString()}",
|
||||||
color: Theme.of(context).colorScheme.primary,
|
color: Theme.of(context).colorScheme.primary,
|
||||||
style: Theme.of(context).textTheme.titleSmall,
|
style: Theme.of(context).textTheme.titleSmall,
|
||||||
),
|
),
|
||||||
|
DidvanText(comment.text),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
@ -114,14 +114,10 @@ class MentionState extends State<Mention> {
|
||||||
children: [
|
children: [
|
||||||
if (comment.user.id == context.read<UserProvider>().user.id)
|
if (comment.user.id == context.read<UserProvider>().user.id)
|
||||||
MenuOption(
|
MenuOption(
|
||||||
title: 'حذف نظر',
|
title: 'حذف فراخوانی',
|
||||||
color: Theme.of(context).colorScheme.secondary,
|
color: Theme.of(context).colorScheme.secondary,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
state.deleteComment(
|
state.deleteMention(comment.id);
|
||||||
comment.id,
|
|
||||||
comment.status,
|
|
||||||
comment.runtimeType == Reply ? _comment.id : null,
|
|
||||||
);
|
|
||||||
ActionSheetUtils.pop();
|
ActionSheetUtils.pop();
|
||||||
},
|
},
|
||||||
icon: DidvanIcons.trash_solid,
|
icon: DidvanIcons.trash_solid,
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,6 @@ class FloatingNavigationBar extends StatefulWidget {
|
||||||
class _FloatingNavigationBarState extends State<FloatingNavigationBar> {
|
class _FloatingNavigationBarState extends State<FloatingNavigationBar> {
|
||||||
bool _isScrolled = false;
|
bool _isScrolled = false;
|
||||||
int _comments = 0;
|
int _comments = 0;
|
||||||
int _mentions = 0;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void didUpdateWidget(covariant FloatingNavigationBar oldWidget) {
|
void didUpdateWidget(covariant FloatingNavigationBar oldWidget) {
|
||||||
|
|
@ -143,11 +142,6 @@ class _FloatingNavigationBarState extends State<FloatingNavigationBar> {
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
if (_mentions != 0)
|
|
||||||
DidvanText(
|
|
||||||
_mentions.toString(),
|
|
||||||
color: foregroundColor,
|
|
||||||
),
|
|
||||||
DidvanIconButton(
|
DidvanIconButton(
|
||||||
gestureSize: 32,
|
gestureSize: 32,
|
||||||
onPressed: () => Navigator.of(context).pushNamed(
|
onPressed: () => Navigator.of(context).pushNamed(
|
||||||
|
|
@ -158,7 +152,7 @@ class _FloatingNavigationBarState extends State<FloatingNavigationBar> {
|
||||||
'title': widget.item.title,
|
'title': widget.item.title,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
icon: DidvanIcons.chart_light,
|
icon: DidvanIcons.mention_icon,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -122,7 +122,7 @@ class PodcastOverview extends StatelessWidget {
|
||||||
'title': podcast.title,
|
'title': podcast.title,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
icon: DidvanIcons.chats_light,
|
icon: DidvanIcons.mention_icon,
|
||||||
),
|
),
|
||||||
const SizedBox(width: 8.0),
|
const SizedBox(width: 8.0),
|
||||||
BookmarkButton(
|
BookmarkButton(
|
||||||
|
|
|
||||||
|
|
@ -105,7 +105,7 @@ class VideoOverview extends StatelessWidget {
|
||||||
'title': video.title,
|
'title': video.title,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
icon: DidvanIcons.chats_light,
|
icon: DidvanIcons.mention_icon,
|
||||||
),
|
),
|
||||||
const SizedBox(width: 8.0),
|
const SizedBox(width: 8.0),
|
||||||
BookmarkButton(
|
BookmarkButton(
|
||||||
|
|
|
||||||
|
|
@ -80,11 +80,19 @@ class _UserMentionState extends State<UserMention> {
|
||||||
DidvanIcons.avatar_light,
|
DidvanIcons.avatar_light,
|
||||||
size: 40,
|
size: 40,
|
||||||
)
|
)
|
||||||
: SkeletonImage(
|
: SizedBox(
|
||||||
imageUrl: widget.user.photo.toString(),
|
width: 40,
|
||||||
height: 36,
|
child: Row(
|
||||||
width: 36,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
borderRadius: BorderRadius.circular(360),
|
children: [
|
||||||
|
SkeletonImage(
|
||||||
|
imageUrl: widget.user.photo.toString(),
|
||||||
|
height: 32,
|
||||||
|
width: 32,
|
||||||
|
borderRadius: BorderRadius.circular(360),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
width: 8,
|
width: 8,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue