From d1bd45c8253b50a084c6617c56e7cb2cb34b853a Mon Sep 17 00:00:00 2001 From: MohammadTaha Basiri Date: Mon, 6 Jun 2022 14:58:28 +0430 Subject: [PATCH] bug fixes + comments status --- lib/models/comment/comment.dart | 3 + lib/models/comment/reply.dart | 3 + .../authentication/screens/username.dart | 14 +- lib/views/home/comments/comments_state.dart | 4 + lib/views/home/comments/widgets/comment.dart | 22 ++++ lib/views/home/settings/settings.dart | 7 +- .../statistic_details/statistic_details.dart | 2 +- .../widgets/studio_details_widget.dart | 2 +- lib/views/widgets/didvan/page_view.dart | 2 +- pubspec.lock | 120 +++++++++--------- pubspec.yaml | 21 ++- 11 files changed, 117 insertions(+), 83 deletions(-) diff --git a/lib/models/comment/comment.dart b/lib/models/comment/comment.dart index 0d58166..1fbf8d3 100644 --- a/lib/models/comment/comment.dart +++ b/lib/models/comment/comment.dart @@ -8,6 +8,7 @@ class CommentData { final String createdAt; bool liked; bool disliked; + int status; final FeedbackData feedback; final UserOverview user; final List replies; @@ -21,6 +22,7 @@ class CommentData { required this.feedback, required this.user, required this.replies, + required this.status, }); factory CommentData.fromJson(Map json) => CommentData( @@ -36,6 +38,7 @@ class CommentData { (reply) => Reply.fromJson(reply), ), ), + status: json['status'], ); Map toJson() => { diff --git a/lib/models/comment/reply.dart b/lib/models/comment/reply.dart index e2fb35d..a5804f9 100644 --- a/lib/models/comment/reply.dart +++ b/lib/models/comment/reply.dart @@ -3,6 +3,7 @@ import 'user.dart'; class Reply { int id; + int status; final String text; final String createdAt; final bool liked; @@ -20,6 +21,7 @@ class Reply { required this.feedback, required this.user, required this.toUser, + required this.status, }); factory Reply.fromJson(Map json) => Reply( @@ -31,6 +33,7 @@ class Reply { feedback: FeedbackData.fromJson(json['feedback']), user: UserOverview.fromJson(json['user']), toUser: UserOverview.fromJson(json['toUser']), + status: json['status'], ); Map toJson() => { diff --git a/lib/views/authentication/screens/username.dart b/lib/views/authentication/screens/username.dart index cd28681..ebc696a 100644 --- a/lib/views/authentication/screens/username.dart +++ b/lib/views/authentication/screens/username.dart @@ -73,8 +73,11 @@ class _UsernameInputState extends State { .caption! .copyWith(color: Theme.of(context).colorScheme.primary), recognizer: TapGestureRecognizer() - ..onTap = () => - launch('https://didvan.app/termsOfUse.html#conditions'), + ..onTap = () => launchUrl( + Uri.parse( + 'https://didvan.app/termsOfUse.html#conditions', + ), + ), ), const TextSpan(text: 'و\n'), TextSpan( @@ -84,8 +87,11 @@ class _UsernameInputState extends State { .caption! .copyWith(color: Theme.of(context).colorScheme.primary), recognizer: TapGestureRecognizer() - ..onTap = () => - launch('https://didvan.app/termsOfUse.html#privacy'), + ..onTap = () => launchUrl( + Uri.parse( + 'https://didvan.app/termsOfUse.html#privacy', + ), + ), ), const TextSpan(text: 'را می‌پذیرم'), ], diff --git a/lib/views/home/comments/comments_state.dart b/lib/views/home/comments/comments_state.dart index 03e04bc..a817171 100644 --- a/lib/views/home/comments/comments_state.dart +++ b/lib/views/home/comments/comments_state.dart @@ -102,6 +102,7 @@ class CommentsState extends CoreProvier { fullName: user.fullName, photo: user.photo, ), + status: 2, ), ); } else { @@ -120,6 +121,7 @@ class CommentsState extends CoreProvier { photo: user.photo, ), replies: [], + status: 2, ), ); } @@ -135,6 +137,7 @@ class CommentsState extends CoreProvier { if (replyingTo != null) { body.addAll({'replyUserId': replyingTo!.id}); } + body.addAll({'status': 2}); showReplyBox = false; update(); @@ -190,6 +193,7 @@ class CommentsState extends CoreProvier { feedback: rep.feedback, user: rep.user, replies: [], + status: 2, ), ), ); diff --git a/lib/views/home/comments/widgets/comment.dart b/lib/views/home/comments/widgets/comment.dart index 4181abd..7d439db 100644 --- a/lib/views/home/comments/widgets/comment.dart +++ b/lib/views/home/comments/widgets/comment.dart @@ -119,6 +119,28 @@ class CommentState extends State { const SizedBox(height: 8), DidvanText(comment.text), const SizedBox(height: 8), + if (comment.status == 2) + Row( + children: [ + Icon( + Icons.circle, + color: Theme.of(context) + .colorScheme + .secondary + .withOpacity(0.3), + size: 18, + ), + const SizedBox(width: 4), + DidvanText( + 'در انتظار تایید', + color: Theme.of(context) + .colorScheme + .secondary + .withOpacity(0.3), + ), + ], + ), + const SizedBox(height: 8), Row( children: [ InkWrapper( diff --git a/lib/views/home/settings/settings.dart b/lib/views/home/settings/settings.dart index adde21a..e476188 100644 --- a/lib/views/home/settings/settings.dart +++ b/lib/views/home/settings/settings.dart @@ -87,7 +87,7 @@ class Settings extends StatelessWidget { MenuOption( icon: DidvanIcons.didvan_solid, title: 'معرفی دیدوان', - onTap: () => launch('https://didvan.app/#info'), + onTap: () => launchUrl(Uri.parse('https://didvan.app/#info')), ), const DidvanDivider(), MenuOption( @@ -104,8 +104,9 @@ class Settings extends StatelessWidget { MenuOption( icon: DidvanIcons.alert_regular, title: 'حریم خصوصی', - onTap: () => - launch('https://didvan.app/termsOfUse.html#privacy'), + onTap: () => launchUrl( + Uri.parse('https://didvan.app/termsOfUse.html#privacy'), + ), ), ], ), diff --git a/lib/views/home/statistic/statistic_details/statistic_details.dart b/lib/views/home/statistic/statistic_details/statistic_details.dart index fbf92f4..bab72b0 100644 --- a/lib/views/home/statistic/statistic_details/statistic_details.dart +++ b/lib/views/home/statistic/statistic_details/statistic_details.dart @@ -109,7 +109,7 @@ class _StatisticDetailsState extends State { minX: 0, maxX: state.datas.length.toDouble() - 1, maxY: state.maxValue * 1.02, - minY: state.minValue! * 0.98, + minY: (state.minValue ?? 0) * 0.98, gridData: FlGridData(show: false), borderData: FlBorderData(show: false), titlesData: FlTitlesData(show: false), diff --git a/lib/views/home/studio/studio_details/widgets/studio_details_widget.dart b/lib/views/home/studio/studio_details/widgets/studio_details_widget.dart index 268309f..42e4141 100644 --- a/lib/views/home/studio/studio_details/widgets/studio_details_widget.dart +++ b/lib/views/home/studio/studio_details/widgets/studio_details_widget.dart @@ -65,7 +65,7 @@ class StudioDetailsWidget extends StatelessWidget { key: ValueKey(state.studio.id), data: state.studio.description, onAnchorTap: (href, context, map, element) => - launch(href!), + launchUrl(Uri.parse(href!)), style: { '*': Style( direction: TextDirection.rtl, diff --git a/lib/views/widgets/didvan/page_view.dart b/lib/views/widgets/didvan/page_view.dart index d256d10..637537d 100644 --- a/lib/views/widgets/didvan/page_view.dart +++ b/lib/views/widgets/didvan/page_view.dart @@ -268,7 +268,7 @@ class _DidvanPageViewState extends State { ), ); } else { - launch(href); + launchUrl(Uri.parse(href)); } }, style: { diff --git a/pubspec.lock b/pubspec.lock index c3bc526..bfa5047 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -7,14 +7,14 @@ packages: name: assets_audio_player url: "https://pub.dartlang.org" source: hosted - version: "3.0.4+1" + version: "3.0.4+3" assets_audio_player_web: dependency: transitive description: name: assets_audio_player_web url: "https://pub.dartlang.org" source: hosted - version: "3.0.4+1" + version: "3.0.4+3" async: dependency: transitive description: @@ -35,7 +35,7 @@ packages: name: better_player url: "https://pub.dartlang.org" source: hosted - version: "0.0.81" + version: "0.0.83" boolean_selector: dependency: transitive description: @@ -49,14 +49,14 @@ packages: name: bot_toast url: "https://pub.dartlang.org" source: hosted - version: "4.0.1" + version: "4.0.2" cached_network_image: dependency: "direct main" description: name: cached_network_image url: "https://pub.dartlang.org" source: hosted - version: "3.2.0" + version: "3.2.1" cached_network_image_platform_interface: dependency: transitive description: @@ -77,7 +77,7 @@ packages: name: carousel_slider url: "https://pub.dartlang.org" source: hosted - version: "4.0.0" + version: "4.1.1" characters: dependency: transitive description: @@ -112,28 +112,28 @@ packages: name: cross_file url: "https://pub.dartlang.org" source: hosted - version: "0.3.2" + version: "0.3.3+1" crypto: dependency: transitive description: name: crypto url: "https://pub.dartlang.org" source: hosted - version: "3.0.1" + version: "3.0.2" csslib: dependency: transitive description: name: csslib url: "https://pub.dartlang.org" source: hosted - version: "0.17.1" + version: "0.17.2" cupertino_icons: dependency: "direct main" description: name: cupertino_icons url: "https://pub.dartlang.org" source: hosted - version: "1.0.4" + version: "1.0.5" day_night_time_picker: dependency: "direct main" description: @@ -168,7 +168,7 @@ packages: name: ffi url: "https://pub.dartlang.org" source: hosted - version: "1.1.2" + version: "2.0.0" file: dependency: transitive description: @@ -182,49 +182,49 @@ packages: name: firebase_core url: "https://pub.dartlang.org" source: hosted - version: "1.15.0" + version: "1.17.1" firebase_core_platform_interface: dependency: transitive description: name: firebase_core_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "4.2.5" + version: "4.4.0" firebase_core_web: dependency: transitive description: name: firebase_core_web url: "https://pub.dartlang.org" source: hosted - version: "1.6.2" + version: "1.6.4" firebase_messaging: dependency: "direct main" description: name: firebase_messaging url: "https://pub.dartlang.org" source: hosted - version: "11.2.14" + version: "11.4.1" firebase_messaging_platform_interface: dependency: transitive description: name: firebase_messaging_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "3.3.0" + version: "3.5.1" firebase_messaging_web: dependency: transitive description: name: firebase_messaging_web url: "https://pub.dartlang.org" source: hosted - version: "2.2.12" + version: "2.4.1" fl_chart: dependency: "direct main" description: name: fl_chart url: "https://pub.dartlang.org" source: hosted - version: "0.50.1" + version: "0.50.6" flutter: dependency: "direct main" description: flutter @@ -236,7 +236,7 @@ packages: name: flutter_blurhash url: "https://pub.dartlang.org" source: hosted - version: "0.6.8" + version: "0.7.0" flutter_cache_manager: dependency: transitive description: @@ -269,7 +269,7 @@ packages: name: flutter_plugin_android_lifecycle url: "https://pub.dartlang.org" source: hosted - version: "2.0.5" + version: "2.0.6" flutter_secure_storage: dependency: "direct main" description: @@ -325,7 +325,7 @@ packages: name: flutter_svg url: "https://pub.dartlang.org" source: hosted - version: "1.0.3" + version: "1.1.0" flutter_test: dependency: "direct dev" description: flutter @@ -349,14 +349,14 @@ packages: name: flutter_widget_from_html_core url: "https://pub.dartlang.org" source: hosted - version: "0.8.5+1" + version: "0.8.5+3" fwfh_text_style: dependency: transitive description: name: fwfh_text_style url: "https://pub.dartlang.org" source: hosted - version: "2.7.3+1" + version: "2.7.3+2" graphs: dependency: transitive description: @@ -384,7 +384,7 @@ packages: name: http_parser url: "https://pub.dartlang.org" source: hosted - version: "4.0.0" + version: "4.0.1" image_cropper: dependency: "direct main" description: @@ -398,35 +398,35 @@ packages: name: image_picker url: "https://pub.dartlang.org" source: hosted - version: "0.8.5" + version: "0.8.5+3" image_picker_android: dependency: transitive description: name: image_picker_android url: "https://pub.dartlang.org" source: hosted - version: "0.8.4+11" + version: "0.8.5" image_picker_for_web: dependency: transitive description: name: image_picker_for_web url: "https://pub.dartlang.org" source: hosted - version: "2.1.6" + version: "2.1.8" image_picker_ios: dependency: transitive description: name: image_picker_ios url: "https://pub.dartlang.org" source: hosted - version: "0.8.4+11" + version: "0.8.5+5" image_picker_platform_interface: dependency: transitive description: name: image_picker_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "2.4.4" + version: "2.5.0" intl: dependency: transitive description: @@ -489,7 +489,7 @@ packages: name: octo_image url: "https://pub.dartlang.org" source: hosted - version: "1.0.1" + version: "1.0.2" path: dependency: transitive description: @@ -517,49 +517,49 @@ packages: name: path_provider url: "https://pub.dartlang.org" source: hosted - version: "2.0.9" + version: "2.0.10" path_provider_android: dependency: transitive description: name: path_provider_android url: "https://pub.dartlang.org" source: hosted - version: "2.0.12" + version: "2.0.14" path_provider_ios: dependency: transitive description: name: path_provider_ios url: "https://pub.dartlang.org" source: hosted - version: "2.0.8" + version: "2.0.9" path_provider_linux: dependency: transitive description: name: path_provider_linux url: "https://pub.dartlang.org" source: hosted - version: "2.1.5" + version: "2.1.7" path_provider_macos: dependency: transitive description: name: path_provider_macos url: "https://pub.dartlang.org" source: hosted - version: "2.0.5" + version: "2.0.6" path_provider_platform_interface: dependency: transitive description: name: path_provider_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "2.0.3" + version: "2.0.4" path_provider_windows: dependency: transitive description: name: path_provider_windows url: "https://pub.dartlang.org" source: hosted - version: "2.0.5" + version: "2.1.0" pedantic: dependency: transitive description: @@ -608,21 +608,21 @@ packages: name: persian_datetime_picker url: "https://pub.dartlang.org" source: hosted - version: "2.4.0" + version: "2.5.0" persian_number_utility: dependency: "direct main" description: name: persian_number_utility url: "https://pub.dartlang.org" source: hosted - version: "1.1.1" + version: "1.1.2" petitparser: dependency: transitive description: name: petitparser url: "https://pub.dartlang.org" source: hosted - version: "4.4.0" + version: "5.0.0" pin_code_fields: dependency: "direct main" description: @@ -657,7 +657,7 @@ packages: name: provider url: "https://pub.dartlang.org" source: hosted - version: "6.0.2" + version: "6.0.3" record: dependency: "direct main" description: @@ -692,7 +692,7 @@ packages: name: rxdart url: "https://pub.dartlang.org" source: hosted - version: "0.27.3" + version: "0.27.4" skeleton_text: dependency: "direct main" description: @@ -774,7 +774,7 @@ packages: name: typed_data url: "https://pub.dartlang.org" source: hosted - version: "1.3.0" + version: "1.3.1" universal_html: dependency: "direct main" description: @@ -795,35 +795,35 @@ packages: name: url_launcher url: "https://pub.dartlang.org" source: hosted - version: "6.0.20" + version: "6.1.2" url_launcher_android: dependency: transitive description: name: url_launcher_android url: "https://pub.dartlang.org" source: hosted - version: "6.0.15" + version: "6.0.17" url_launcher_ios: dependency: transitive description: name: url_launcher_ios url: "https://pub.dartlang.org" source: hosted - version: "6.0.15" + version: "6.0.17" url_launcher_linux: dependency: transitive description: name: url_launcher_linux url: "https://pub.dartlang.org" source: hosted - version: "3.0.0" + version: "3.0.1" url_launcher_macos: dependency: transitive description: name: url_launcher_macos url: "https://pub.dartlang.org" source: hosted - version: "3.0.0" + version: "3.0.1" url_launcher_platform_interface: dependency: transitive description: @@ -837,14 +837,14 @@ packages: name: url_launcher_web url: "https://pub.dartlang.org" source: hosted - version: "2.0.9" + version: "2.0.11" url_launcher_windows: dependency: transitive description: name: url_launcher_windows url: "https://pub.dartlang.org" source: hosted - version: "3.0.0" + version: "3.0.1" uuid: dependency: transitive description: @@ -865,14 +865,14 @@ packages: name: visibility_detector url: "https://pub.dartlang.org" source: hosted - version: "0.2.2" + version: "0.3.3" wakelock: dependency: transitive description: name: wakelock url: "https://pub.dartlang.org" source: hosted - version: "0.5.6" + version: "0.6.1+2" wakelock_macos: dependency: transitive description: @@ -907,35 +907,35 @@ packages: name: webview_flutter url: "https://pub.dartlang.org" source: hosted - version: "3.0.2" + version: "3.0.4" webview_flutter_android: dependency: transitive description: name: webview_flutter_android url: "https://pub.dartlang.org" source: hosted - version: "2.8.5" + version: "2.8.9" webview_flutter_platform_interface: dependency: transitive description: name: webview_flutter_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "1.8.1" + version: "1.9.1" webview_flutter_wkwebview: dependency: transitive description: name: webview_flutter_wkwebview url: "https://pub.dartlang.org" source: hosted - version: "2.7.2" + version: "2.8.1" win32: dependency: transitive description: name: win32 url: "https://pub.dartlang.org" source: hosted - version: "2.5.1" + version: "2.7.0" xdg_directories: dependency: transitive description: @@ -949,7 +949,7 @@ packages: name: xml url: "https://pub.dartlang.org" source: hosted - version: "5.3.1" + version: "6.1.0" sdks: - dart: ">=2.17.0-0 <3.0.0" - flutter: ">=2.10.0" + dart: ">=2.17.0 <3.0.0" + flutter: ">=3.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index da9fa42..d79ce1a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -3,7 +3,7 @@ description: چشم همیشه باز مدیران # The following line prevents the package from being accidentally published to # pub.dev using `flutter pub publish`. This is preferred for private packages. -publish_to: 'none' # Remove this line if you wish to publish to pub.dev +publish_to: "none" # Remove this line if you wish to publish to pub.dev # The following defines the version and build number for your application. # A version number is three numbers separated by dots, like 1.2.43 @@ -18,7 +18,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev version: 2.1.1+17 environment: - sdk: ">=2.12.0 <3.0.0" + sdk: ">=2.17.0 <3.0.0" # Dependencies specify other packages that your package needs in order to work. # To automatically upgrade your package dependencies to the latest versions @@ -30,8 +30,7 @@ dependencies: flutter: sdk: flutter flutter_localizations: - sdk: flutter - + sdk: flutter # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. @@ -68,7 +67,6 @@ dependencies: assets_audio_player: ^3.0.4+1 fl_chart: ^0.50.1 - dev_dependencies: flutter_test: sdk: flutter @@ -85,7 +83,6 @@ dev_dependencies: # The following section is specific to Flutter. flutter: - # The following line ensures that the Material Icons font is # included with your application, so that you can use the icons in # the material Icons class. @@ -101,8 +98,6 @@ flutter: - lib/assets/animations/ - lib/assets/loading.gif - - # An image asset can refer to one or more resolution-specific "variants", see # https://flutter.dev/assets-and-images/#resolution-aware. @@ -115,7 +110,7 @@ flutter: # list giving the asset and other descriptors for the font. For # example: fonts: - - family: Dana-FA + - family: Dana-FA fonts: - asset: lib/assets/fonts/Dana-FaNum-Black.ttf - asset: lib/assets/fonts/Dana-FaNum-Bold.ttf @@ -135,13 +130,13 @@ flutter: - asset: lib/assets/fonts/IRANSansMobile-FaNum-UltraLight.ttf - asset: lib/assets/fonts/IRANSansMobile-FaNum.ttf - - family: Dana + - family: Dana fonts: - - asset: lib/assets/fonts/Dana.ttf - - family: Iransans + - asset: lib/assets/fonts/Dana.ttf + - family: Iransans fonts: - asset: lib/assets/fonts/IRANSansMobile.ttf - - family: Dicon + - family: Dicon fonts: - asset: lib/assets/icons/Dicon.ttf # fonts: