Merge remote-tracking branch 'origin'
This commit is contained in:
commit
0349a8939b
|
|
@ -1,6 +1,7 @@
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
|
import 'news_attachment.dart';
|
||||||
import 'radar_attachment.dart';
|
import 'radar_attachment.dart';
|
||||||
|
|
||||||
class MessageData {
|
class MessageData {
|
||||||
|
|
@ -10,6 +11,7 @@ class MessageData {
|
||||||
final bool writedByAdmin;
|
final bool writedByAdmin;
|
||||||
final bool readed;
|
final bool readed;
|
||||||
final String createdAt;
|
final String createdAt;
|
||||||
|
final NewsAttachment? news;
|
||||||
final RadarAttachment? radar;
|
final RadarAttachment? radar;
|
||||||
final File? audioFile;
|
final File? audioFile;
|
||||||
final int? audioDuration;
|
final int? audioDuration;
|
||||||
|
|
@ -21,6 +23,7 @@ class MessageData {
|
||||||
required this.createdAt,
|
required this.createdAt,
|
||||||
this.text,
|
this.text,
|
||||||
this.audio,
|
this.audio,
|
||||||
|
this.news,
|
||||||
this.radar,
|
this.radar,
|
||||||
this.audioFile,
|
this.audioFile,
|
||||||
this.audioDuration,
|
this.audioDuration,
|
||||||
|
|
@ -39,6 +42,8 @@ class MessageData {
|
||||||
radar: json['radar'] == null
|
radar: json['radar'] == null
|
||||||
? null
|
? null
|
||||||
: RadarAttachment.fromJson(json['radar']),
|
: RadarAttachment.fromJson(json['radar']),
|
||||||
|
news:
|
||||||
|
json['news'] == null ? null : NewsAttachment.fromJson(json['news']),
|
||||||
);
|
);
|
||||||
|
|
||||||
Map<String, dynamic> toJson() => {
|
Map<String, dynamic> toJson() => {
|
||||||
|
|
@ -48,6 +53,7 @@ class MessageData {
|
||||||
'writedByAdmin': writedByAdmin,
|
'writedByAdmin': writedByAdmin,
|
||||||
'readed': readed,
|
'readed': readed,
|
||||||
'createdAt': createdAt,
|
'createdAt': createdAt,
|
||||||
|
'news': news?.toJson(),
|
||||||
'radar': radar?.toJson(),
|
'radar': radar?.toJson(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
class NewsAttachment {
|
||||||
|
final int id;
|
||||||
|
final String title;
|
||||||
|
final String description;
|
||||||
|
final String image;
|
||||||
|
final String createdAt;
|
||||||
|
|
||||||
|
const NewsAttachment({
|
||||||
|
required this.id,
|
||||||
|
required this.title,
|
||||||
|
required this.description,
|
||||||
|
required this.image,
|
||||||
|
required this.createdAt,
|
||||||
|
});
|
||||||
|
|
||||||
|
factory NewsAttachment.fromJson(Map<String, dynamic> json) => NewsAttachment(
|
||||||
|
id: json['id'],
|
||||||
|
title: json['title'],
|
||||||
|
description: json['description'],
|
||||||
|
image: json['image'],
|
||||||
|
createdAt: json['createdAt'],
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() => {
|
||||||
|
'id': id,
|
||||||
|
'title': title,
|
||||||
|
'description': description,
|
||||||
|
'image': image,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -194,6 +194,7 @@ class ActionSheetUtils {
|
||||||
Row(
|
Row(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
|
if (data.titleIcon != null)
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () => Navigator.of(context).pop(),
|
onTap: () => Navigator.of(context).pop(),
|
||||||
child: Icon(
|
child: Icon(
|
||||||
|
|
@ -202,6 +203,7 @@ class ActionSheetUtils {
|
||||||
color: data.titleColor,
|
color: data.titleColor,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
if (data.titleIcon != null)
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
width: 8,
|
width: 8,
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@ class CommentsState extends CoreProvier {
|
||||||
);
|
);
|
||||||
await service.httpGet();
|
await service.httpGet();
|
||||||
if (service.isSuccess) {
|
if (service.isSuccess) {
|
||||||
|
comments.clear();
|
||||||
final messages = service.result['comments'];
|
final messages = service.result['comments'];
|
||||||
for (var i = 0; i < messages.length; i++) {
|
for (var i = 0; i < messages.length; i++) {
|
||||||
comments.add(CommentData.fromJson(messages[i]));
|
comments.add(CommentData.fromJson(messages[i]));
|
||||||
|
|
@ -126,9 +127,6 @@ class CommentsState extends CoreProvier {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
_count++;
|
|
||||||
onCommentsChanged(_count);
|
|
||||||
|
|
||||||
final body = {};
|
final body = {};
|
||||||
|
|
||||||
if (commentId != null) {
|
if (commentId != null) {
|
||||||
|
|
@ -175,36 +173,35 @@ class CommentsState extends CoreProvier {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void deleteComment(int id, int? rootId) {
|
void deleteComment(int id, int status, int? rootId) async {
|
||||||
final service = RequestService(RequestHelper.deleteComment(id));
|
final service = RequestService(RequestHelper.deleteComment(id));
|
||||||
service.delete();
|
service.delete();
|
||||||
if (rootId == null) {
|
if (rootId == null) {
|
||||||
final comment = comments.firstWhere((element) => element.id == id);
|
final comment = comments.firstWhere((element) => element.id == id);
|
||||||
if (comment.replies.isNotEmpty) {
|
if (comment.replies.isNotEmpty) {
|
||||||
comments.insertAll(
|
_count = 0;
|
||||||
comments.indexOf(comment),
|
await getComments();
|
||||||
comment.replies.map(
|
onCommentsChanged(_count);
|
||||||
(rep) => CommentData(
|
} else {
|
||||||
id: rep.id,
|
|
||||||
text: rep.text,
|
|
||||||
createdAt: rep.createdAt,
|
|
||||||
liked: rep.liked,
|
|
||||||
disliked: rep.disliked,
|
|
||||||
feedback: rep.feedback,
|
|
||||||
user: rep.user,
|
|
||||||
replies: [],
|
|
||||||
status: 2,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
comments.remove(comment);
|
comments.remove(comment);
|
||||||
|
|
||||||
|
if (status != 2) {
|
||||||
|
_count--;
|
||||||
|
onCommentsChanged(_count);
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
comments
|
comments
|
||||||
.firstWhere((element) => element.id == rootId)
|
.firstWhere((element) => element.id == rootId)
|
||||||
.replies
|
.replies
|
||||||
.removeWhere((element) => element.id == id);
|
.removeWhere((element) => element.id == id);
|
||||||
|
|
||||||
|
if (status != 2) {
|
||||||
|
_count--;
|
||||||
|
onCommentsChanged(_count);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -141,6 +141,7 @@ class CommentState extends State<Comment> {
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
|
if (_comment.status != 2)
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
InkWrapper(
|
InkWrapper(
|
||||||
|
|
@ -175,7 +176,8 @@ class CommentState extends State<Comment> {
|
||||||
turns: _showSubComments ? 0.5 : 0,
|
turns: _showSubComments ? 0.5 : 0,
|
||||||
child: Icon(
|
child: Icon(
|
||||||
DidvanIcons.angle_down_regular,
|
DidvanIcons.angle_down_regular,
|
||||||
color: Theme.of(context).colorScheme.primary,
|
color:
|
||||||
|
Theme.of(context).colorScheme.primary,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|
@ -187,7 +189,8 @@ class CommentState extends State<Comment> {
|
||||||
dislikeCount: comment.feedback.dislike,
|
dislikeCount: comment.feedback.dislike,
|
||||||
likeValue: comment.liked,
|
likeValue: comment.liked,
|
||||||
dislikeValue: comment.disliked,
|
dislikeValue: comment.disliked,
|
||||||
onFeedback: (like, dislike, likeCount, dislikeCount) =>
|
onFeedback:
|
||||||
|
(like, dislike, likeCount, dislikeCount) =>
|
||||||
state.feedback(
|
state.feedback(
|
||||||
id: _comment.id,
|
id: _comment.id,
|
||||||
like: like,
|
like: like,
|
||||||
|
|
@ -228,6 +231,7 @@ class CommentState extends State<Comment> {
|
||||||
onTap: () {
|
onTap: () {
|
||||||
state.deleteComment(
|
state.deleteComment(
|
||||||
comment.id,
|
comment.id,
|
||||||
|
comment.status,
|
||||||
comment.runtimeType == Reply ? _comment.id : null,
|
comment.runtimeType == Reply ? _comment.id : null,
|
||||||
);
|
);
|
||||||
ActionSheetUtils.pop();
|
ActionSheetUtils.pop();
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ class _DirectState extends State<Direct> {
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
final state = context.read<DirectState>();
|
final state = context.read<DirectState>();
|
||||||
|
state.replyNews = widget.pageData['newsAttachment'];
|
||||||
state.replyRadar = widget.pageData['radarAttachment'];
|
state.replyRadar = widget.pageData['radarAttachment'];
|
||||||
final typeId = ServerDataProvider.labelToTypeId(widget.pageData['type']);
|
final typeId = ServerDataProvider.labelToTypeId(widget.pageData['type']);
|
||||||
state.typeId = typeId;
|
state.typeId = typeId;
|
||||||
|
|
@ -68,7 +69,8 @@ class _DirectState extends State<Direct> {
|
||||||
slivers: [
|
slivers: [
|
||||||
if (state.appState != AppState.busy)
|
if (state.appState != AppState.busy)
|
||||||
SliverPadding(
|
SliverPadding(
|
||||||
padding: state.replyRadar == null
|
padding:
|
||||||
|
state.replyRadar == null && state.replyNews == null
|
||||||
? EdgeInsets.zero
|
? EdgeInsets.zero
|
||||||
: const EdgeInsets.only(bottom: 68),
|
: const EdgeInsets.only(bottom: 68),
|
||||||
sliver: SliverStateHandler<DirectState>(
|
sliver: SliverStateHandler<DirectState>(
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ import 'dart:io';
|
||||||
|
|
||||||
import 'package:didvan/models/enums.dart';
|
import 'package:didvan/models/enums.dart';
|
||||||
import 'package:didvan/models/message_data/message_data.dart';
|
import 'package:didvan/models/message_data/message_data.dart';
|
||||||
|
import 'package:didvan/models/message_data/news_attachment.dart';
|
||||||
import 'package:didvan/models/message_data/radar_attachment.dart';
|
import 'package:didvan/models/message_data/radar_attachment.dart';
|
||||||
import 'package:didvan/providers/core.dart';
|
import 'package:didvan/providers/core.dart';
|
||||||
import 'package:didvan/services/media/media.dart';
|
import 'package:didvan/services/media/media.dart';
|
||||||
|
|
@ -19,6 +20,7 @@ class DirectState extends CoreProvier {
|
||||||
final List<int> deletionQueue = [];
|
final List<int> deletionQueue = [];
|
||||||
|
|
||||||
String? text;
|
String? text;
|
||||||
|
NewsAttachment? replyNews;
|
||||||
RadarAttachment? replyRadar;
|
RadarAttachment? replyRadar;
|
||||||
File? recordedFile;
|
File? recordedFile;
|
||||||
int? audioDuration;
|
int? audioDuration;
|
||||||
|
|
@ -116,21 +118,30 @@ class DirectState extends CoreProvier {
|
||||||
audio: null,
|
audio: null,
|
||||||
audioFile: recordedFile,
|
audioFile: recordedFile,
|
||||||
radar: replyRadar,
|
radar: replyRadar,
|
||||||
|
news: replyNews,
|
||||||
audioDuration: audioDuration,
|
audioDuration: audioDuration,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
_addToDailyGrouped(messages.first);
|
_addToDailyGrouped(messages.first);
|
||||||
final body = {};
|
final body = {};
|
||||||
|
|
||||||
if (text != null) {
|
if (text != null) {
|
||||||
body.addAll({'text': text});
|
body.addAll({'text': text});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (replyRadar != null) {
|
if (replyRadar != null) {
|
||||||
body.addAll({'radarId': replyRadar!.id});
|
body.addAll({'radarId': replyRadar!.id});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (replyNews != null) {
|
||||||
|
body.addAll({'newsId': replyNews!.id});
|
||||||
|
}
|
||||||
|
|
||||||
final uploadFile = recordedFile;
|
final uploadFile = recordedFile;
|
||||||
text = null;
|
text = null;
|
||||||
recordedFile = null;
|
recordedFile = null;
|
||||||
replyRadar = null;
|
replyRadar = null;
|
||||||
|
replyNews = null;
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
final service =
|
final service =
|
||||||
RequestService(RequestHelper.sendDirectMessage(typeId), body: body);
|
RequestService(RequestHelper.sendDirectMessage(typeId), body: body);
|
||||||
|
|
|
||||||
|
|
@ -89,11 +89,16 @@ class Message extends StatelessWidget {
|
||||||
audioUrl: message.audio,
|
audioUrl: message.audio,
|
||||||
id: message.id,
|
id: message.id,
|
||||||
),
|
),
|
||||||
if (message.radar != null) const DidvanDivider(),
|
if (message.radar != null || message.news != null)
|
||||||
if (message.radar != null) const SizedBox(height: 4),
|
const DidvanDivider(),
|
||||||
|
if (message.radar != null || message.news != null)
|
||||||
|
const SizedBox(height: 4),
|
||||||
if (message.radar != null)
|
if (message.radar != null)
|
||||||
_ReplyRadarOverview(message: message),
|
_ReplyRadarOverview(message: message),
|
||||||
if (message.radar != null) const SizedBox(height: 4),
|
if (message.news != null)
|
||||||
|
_ReplyNewsOverview(message: message),
|
||||||
|
if (message.radar != null || message.news != null)
|
||||||
|
const SizedBox(height: 4),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
@ -168,7 +173,59 @@ class _ReplyRadarOverview extends StatelessWidget {
|
||||||
color: Theme.of(context).colorScheme.focusedBorder,
|
color: Theme.of(context).colorScheme.focusedBorder,
|
||||||
style: Theme.of(context).textTheme.labelSmall,
|
style: Theme.of(context).textTheme.labelSmall,
|
||||||
),
|
),
|
||||||
// DidvanText('text'),
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class _ReplyNewsOverview extends StatelessWidget {
|
||||||
|
final MessageData message;
|
||||||
|
const _ReplyNewsOverview({Key? key, required this.message}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
SkeletonImage(
|
||||||
|
imageUrl: message.news!.image,
|
||||||
|
height: 52,
|
||||||
|
width: 52,
|
||||||
|
),
|
||||||
|
const SizedBox(width: 8),
|
||||||
|
Expanded(
|
||||||
|
child: SizedBox(
|
||||||
|
height: 52,
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
DidvanText(
|
||||||
|
message.news!.title,
|
||||||
|
style: Theme.of(context).textTheme.bodyLarge,
|
||||||
|
maxLines: 1,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
color: Theme.of(context).colorScheme.focusedBorder,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
DidvanText(
|
||||||
|
'خبر',
|
||||||
|
style: Theme.of(context).textTheme.labelSmall,
|
||||||
|
color: Theme.of(context).colorScheme.focusedBorder,
|
||||||
|
),
|
||||||
|
const Spacer(),
|
||||||
|
DidvanText(
|
||||||
|
DateTimeUtils.momentGenerator(message.news!.createdAt),
|
||||||
|
color: Theme.of(context).colorScheme.focusedBorder,
|
||||||
|
style: Theme.of(context).textTheme.labelSmall,
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,8 @@ class MessageBox extends StatelessWidget {
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
Consumer<DirectState>(
|
Consumer<DirectState>(
|
||||||
builder: (context, state, child) => state.replyRadar != null
|
builder: (context, state, child) => state.replyRadar != null ||
|
||||||
|
state.replyNews != null
|
||||||
? _MessageBoxContainer(
|
? _MessageBoxContainer(
|
||||||
isMessage: false,
|
isMessage: false,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
|
|
@ -32,7 +33,9 @@ class MessageBox extends StatelessWidget {
|
||||||
'لینک به مطلب:',
|
'لینک به مطلب:',
|
||||||
),
|
),
|
||||||
DidvanText(
|
DidvanText(
|
||||||
state.replyRadar!.title,
|
state.replyRadar != null
|
||||||
|
? state.replyRadar!.title
|
||||||
|
: state.replyNews!.title,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
color: Theme.of(context).colorScheme.primary,
|
color: Theme.of(context).colorScheme.primary,
|
||||||
|
|
@ -45,6 +48,7 @@ class MessageBox extends StatelessWidget {
|
||||||
gestureSize: 24,
|
gestureSize: 24,
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
state.replyRadar = null;
|
state.replyRadar = null;
|
||||||
|
state.replyNews = null;
|
||||||
state.update();
|
state.update();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
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/message_data/news_attachment.dart';
|
||||||
import 'package:didvan/models/message_data/radar_attachment.dart';
|
import 'package:didvan/models/message_data/radar_attachment.dart';
|
||||||
import 'package:didvan/models/view/action_sheet_data.dart';
|
import 'package:didvan/models/view/action_sheet_data.dart';
|
||||||
import 'package:didvan/routes/routes.dart';
|
import 'package:didvan/routes/routes.dart';
|
||||||
|
|
@ -102,10 +103,9 @@ class _FloatingNavigationBarState extends State<FloatingNavigationBar> {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
if (widget.isRadar)
|
|
||||||
BookmarkButton(
|
BookmarkButton(
|
||||||
itemId: widget.item.id,
|
itemId: widget.item.id,
|
||||||
type: 'radar',
|
type: widget.isRadar ? 'radar' : 'news',
|
||||||
color: DesignConfig.isDark
|
color: DesignConfig.isDark
|
||||||
? Theme.of(context).colorScheme.focusedBorder
|
? Theme.of(context).colorScheme.focusedBorder
|
||||||
: Theme.of(context).colorScheme.focused,
|
: Theme.of(context).colorScheme.focused,
|
||||||
|
|
@ -145,28 +145,10 @@ class _FloatingNavigationBarState extends State<FloatingNavigationBar> {
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (!widget.isRadar) const SizedBox(width: 12),
|
|
||||||
if (!widget.isRadar)
|
|
||||||
BookmarkButton(
|
|
||||||
itemId: widget.item.id,
|
|
||||||
type: 'news',
|
|
||||||
color: DesignConfig.isDark
|
|
||||||
? Theme.of(context).colorScheme.focusedBorder
|
|
||||||
: Theme.of(context).colorScheme.focused,
|
|
||||||
askForConfirmation: widget.hasUnmarkConfirmation,
|
|
||||||
value: widget.item.marked,
|
|
||||||
onMarkChanged: (value) {
|
|
||||||
widget.onMarkChanged(value);
|
|
||||||
if (widget.hasUnmarkConfirmation && !value) {
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
gestureSize: 32,
|
|
||||||
),
|
|
||||||
if (widget.isRadar)
|
|
||||||
DidvanIconButton(
|
DidvanIconButton(
|
||||||
gestureSize: 32,
|
gestureSize: 32,
|
||||||
onPressed: _showMoreOptions,
|
onPressed:
|
||||||
|
widget.isRadar ? _showRadarMoreOptions : _showNewsMoreOptions,
|
||||||
icon: DidvanIcons.menu_regular,
|
icon: DidvanIcons.menu_regular,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|
@ -192,7 +174,7 @@ class _FloatingNavigationBarState extends State<FloatingNavigationBar> {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void _showMoreOptions() {
|
void _showRadarMoreOptions() {
|
||||||
final categories = widget.item.categories!;
|
final categories = widget.item.categories!;
|
||||||
ActionSheetUtils.showBottomSheet(
|
ActionSheetUtils.showBottomSheet(
|
||||||
data: ActionSheetData(
|
data: ActionSheetData(
|
||||||
|
|
@ -293,4 +275,38 @@ class _FloatingNavigationBarState extends State<FloatingNavigationBar> {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _showNewsMoreOptions() {
|
||||||
|
ActionSheetUtils.showBottomSheet(
|
||||||
|
data: ActionSheetData(
|
||||||
|
content: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
MenuOption(
|
||||||
|
title: 'گزارش اشکال',
|
||||||
|
onTap: () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
Navigator.of(context).pushNamed(
|
||||||
|
Routes.direct,
|
||||||
|
arguments: {
|
||||||
|
'newsAttachment': NewsAttachment(
|
||||||
|
id: widget.item.id,
|
||||||
|
title: widget.item.title,
|
||||||
|
description: widget.item.contents.first.text,
|
||||||
|
image: widget.item.image,
|
||||||
|
createdAt: widget.item.createdAt,
|
||||||
|
),
|
||||||
|
'type': 'پشتیبانی'
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
icon: DidvanIcons.description_regular,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
title: 'موارد بیشتر',
|
||||||
|
withoutButtonMode: true,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,8 +31,8 @@ class GeneralSettings extends StatefulWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
class _GeneralSettingsState extends State<GeneralSettings> {
|
class _GeneralSettingsState extends State<GeneralSettings> {
|
||||||
String get _fontScaleSuffix {
|
String fontScaleSuffix(double fontSizeScale) {
|
||||||
final fontScale = DesignConfig.fontScale;
|
final fontScale = fontSizeScale;
|
||||||
if (fontScale == 1) return 'متوسط';
|
if (fontScale == 1) return 'متوسط';
|
||||||
if (fontScale == 1.15) return 'بزرگ';
|
if (fontScale == 1.15) return 'بزرگ';
|
||||||
return 'کوچک';
|
return 'کوچک';
|
||||||
|
|
@ -70,15 +70,14 @@ class _GeneralSettingsState extends State<GeneralSettings> {
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
MenuOption(
|
MenuOption(
|
||||||
suffix: DesignConfig.fontFamily == 'Dana-FA'
|
suffix:
|
||||||
? 'دانا'
|
state.fontFamily == 'Dana-FA' ? 'دانا' : 'ایران سنس',
|
||||||
: 'ایران سنس',
|
|
||||||
title: 'فونت برنامه',
|
title: 'فونت برنامه',
|
||||||
onTap: _showFontFamilyBottomSheet,
|
onTap: _showFontFamilyBottomSheet,
|
||||||
),
|
),
|
||||||
const DidvanDivider(),
|
const DidvanDivider(),
|
||||||
MenuOption(
|
MenuOption(
|
||||||
suffix: _fontScaleSuffix,
|
suffix: fontScaleSuffix(state.fontSizeScale),
|
||||||
title: 'اندازه متن',
|
title: 'اندازه متن',
|
||||||
onTap: _showFontScaleBottomSheet,
|
onTap: _showFontScaleBottomSheet,
|
||||||
),
|
),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue