diff --git a/assets/icons/verified_badge_green.svg b/assets/icons/verified_badge_green.svg index 98c69ac..db73051 100644 --- a/assets/icons/verified_badge_green.svg +++ b/assets/icons/verified_badge_green.svg @@ -1,4 +1,3 @@ - - - - \ No newline at end of file + + + diff --git a/assets/icons/verified_badge_red.svg b/assets/icons/verified_badge_red.svg index 6e70a82..2b03833 100644 --- a/assets/icons/verified_badge_red.svg +++ b/assets/icons/verified_badge_red.svg @@ -1,4 +1,3 @@ - - - - \ No newline at end of file + + + diff --git a/lib/src/localization/generated/app_localizations.dart b/lib/src/localization/generated/app_localizations.dart index 23758af..5f28518 100644 --- a/lib/src/localization/generated/app_localizations.dart +++ b/lib/src/localization/generated/app_localizations.dart @@ -2842,6 +2842,12 @@ abstract class AppLocalizations { /// **'Scan other profile'** String get scanOtherProfile; + /// No description provided for @openYourOwnQRcode. + /// + /// In en, this message translates to: + /// **'Open your own QR code'** + String get openYourOwnQRcode; + /// No description provided for @skipForNow. /// /// In en, this message translates to: diff --git a/lib/src/localization/generated/app_localizations_de.dart b/lib/src/localization/generated/app_localizations_de.dart index 32faea1..f6bafbd 100644 --- a/lib/src/localization/generated/app_localizations_de.dart +++ b/lib/src/localization/generated/app_localizations_de.dart @@ -1568,6 +1568,9 @@ class AppLocalizationsDe extends AppLocalizations { @override String get scanOtherProfile => 'Scanne ein anderes Profil'; + @override + String get openYourOwnQRcode => 'Eigenen QR-Code öffnen'; + @override String get skipForNow => 'Vorerst überspringen'; diff --git a/lib/src/localization/generated/app_localizations_en.dart b/lib/src/localization/generated/app_localizations_en.dart index 3d8ab05..535dcaa 100644 --- a/lib/src/localization/generated/app_localizations_en.dart +++ b/lib/src/localization/generated/app_localizations_en.dart @@ -1558,6 +1558,9 @@ class AppLocalizationsEn extends AppLocalizations { @override String get scanOtherProfile => 'Scan other profile'; + @override + String get openYourOwnQRcode => 'Open your own QR code'; + @override String get skipForNow => 'Skip for now'; diff --git a/lib/src/localization/generated/app_localizations_sv.dart b/lib/src/localization/generated/app_localizations_sv.dart index e4de68c..a41fb8b 100644 --- a/lib/src/localization/generated/app_localizations_sv.dart +++ b/lib/src/localization/generated/app_localizations_sv.dart @@ -1558,6 +1558,9 @@ class AppLocalizationsSv extends AppLocalizations { @override String get scanOtherProfile => 'Scan other profile'; + @override + String get openYourOwnQRcode => 'Open your own QR code'; + @override String get skipForNow => 'Skip for now'; diff --git a/lib/src/views/chats/chat_list_components/group_list_item.dart b/lib/src/views/chats/chat_list_components/group_list_item.dart index 863b058..78efe08 100644 --- a/lib/src/views/chats/chat_list_components/group_list_item.dart +++ b/lib/src/views/chats/chat_list_components/group_list_item.dart @@ -17,6 +17,7 @@ import 'package:twonly/src/views/chats/chat_messages_components/message_send_sta import 'package:twonly/src/views/components/avatar_icon.component.dart'; import 'package:twonly/src/views/components/flame.dart'; import 'package:twonly/src/views/components/group_context_menu.component.dart'; +import 'package:twonly/src/views/components/verified_shield.dart'; class GroupListItem extends StatefulWidget { const GroupListItem({ @@ -206,8 +207,18 @@ class _UserListItem extends State { return GroupContextMenu( group: widget.group, child: ListTile( - title: Text( - substringBy(widget.group.groupName, 30), + title: Row( + children: [ + Text( + substringBy(widget.group.groupName, 30), + ), + const SizedBox(width: 3), + VerifiedShield( + group: widget.group, + showOnlyIfVerified: true, + size: 12, + ), + ], ), subtitle: (_currentMessage == null) ? (widget.group.totalMediaCounter == 0) diff --git a/lib/src/views/components/verified_shield.dart b/lib/src/views/components/verified_shield.dart index f2042d7..6a6cca7 100644 --- a/lib/src/views/components/verified_shield.dart +++ b/lib/src/views/components/verified_shield.dart @@ -12,11 +12,14 @@ class VerifiedShield extends StatefulWidget { this.group, super.key, this.size = 15, + this.showOnlyIfVerified = false, }); final Group? group; final Contact? contact; final double size; + final bool showOnlyIfVerified; + @override State createState() => _VerifiedShieldState(); } @@ -33,13 +36,13 @@ class _VerifiedShieldState extends State { stream = twonlyDB.groupsDao .watchGroupContact(widget.group!.groupId) .listen((contacts) { - if (contacts.length == 1) { - contact = contacts.first; - } - setState(() { - isVerified = contacts.every((t) => t.verified); - }); - }); + if (contacts.length == 1) { + contact = contacts.first; + } + setState(() { + isVerified = contacts.every((t) => t.verified); + }); + }); } else if (widget.contact != null) { isVerified = widget.contact!.verified; contact = widget.contact; @@ -56,19 +59,24 @@ class _VerifiedShieldState extends State { @override Widget build(BuildContext context) { + if (!isVerified && widget.showOnlyIfVerified) return Container(); return GestureDetector( onTap: (contact == null) ? null - : () => context.push(Routes.settingsPublicProfile), - child: Tooltip( - message: isVerified - ? 'You verified this contact' - : 'You have not verifies this contact.', + : () => context.push(Routes.settingsHelpFaqVerifyBadge), + child: ColoredBox( + color: Colors.transparent, child: Padding( - padding: const EdgeInsetsGeometry.only(top: 2), + padding: const EdgeInsetsGeometry.only( + top: 4, + left: 3, + right: 3, + bottom: 3, + ), child: SvgIcon( - assetPath: - isVerified ? SvgIcons.verifiedGreen : SvgIcons.verifiedRed, + assetPath: isVerified + ? SvgIcons.verifiedGreen + : SvgIcons.verifiedRed, size: widget.size, ), ), diff --git a/lib/src/views/contact/contact.view.dart b/lib/src/views/contact/contact.view.dart index 079c246..f0f29b3 100644 --- a/lib/src/views/contact/contact.view.dart +++ b/lib/src/views/contact/contact.view.dart @@ -210,18 +210,18 @@ class _ContactViewState extends State { MaxFlameListTitle( contactId: widget.userId, ), - BetterListTile( - leading: SvgIcon( - assetPath: SvgIcons.verifiedGreen, - size: 20, - color: IconTheme.of(context).color, + if (!contact.verified) + BetterListTile( + leading: VerifiedShield( + contact: contact, + size: 20, + ), + text: context.lang.contactVerifyNumberTitle, + onTap: () async { + await context.push(Routes.settingsHelpFaqVerifyBadge); + setState(() {}); + }, ), - text: context.lang.contactVerifyNumberTitle, - onTap: () async { - await context.push(Routes.settingsPublicProfile); - setState(() {}); - }, - ), BetterListTile( icon: FontAwesomeIcons.flag, text: context.lang.reportUser, diff --git a/lib/src/views/settings/help/faq/verifybadge.dart b/lib/src/views/settings/help/faq/verifybadge.dart index b0568a7..4bb9e17 100644 --- a/lib/src/views/settings/help/faq/verifybadge.dart +++ b/lib/src/views/settings/help/faq/verifybadge.dart @@ -1,7 +1,13 @@ import 'package:flutter/material.dart'; +import 'package:font_awesome_flutter/font_awesome_flutter.dart'; +import 'package:go_router/go_router.dart'; +import 'package:twonly/src/constants/routes.keys.dart'; import 'package:twonly/src/utils/misc.dart'; +import 'package:twonly/src/views/components/better_list_title.dart'; import 'package:twonly/src/views/components/svg_icon.dart'; +const colorVerificationBadgeYellow = Color(0xffffa500); + class VerificationBadeFaqView extends StatefulWidget { const VerificationBadeFaqView({super.key}); @@ -33,7 +39,7 @@ class _VerificationBadeFaqViewState extends State { icon: const SvgIcon( assetPath: SvgIcons.verifiedGreen, size: 40, - color: Color.fromARGB(255, 227, 227, 3), + color: colorVerificationBadgeYellow, ), description: context.lang.verificationBadgeYellowDesc, ), @@ -41,6 +47,18 @@ class _VerificationBadeFaqViewState extends State { icon: const SvgIcon(assetPath: SvgIcons.verifiedRed, size: 40), description: context.lang.verificationBadgeRedDesc, ), + const SizedBox(height: 20), + const SizedBox(height: 20), + BetterListTile( + leading: const FaIcon(FontAwesomeIcons.camera), + text: context.lang.scanOtherProfile, + onTap: () => context.push(Routes.cameraQRScanner), + ), + BetterListTile( + leading: const FaIcon(FontAwesomeIcons.qrcode), + text: context.lang.openYourOwnQRcode, + onTap: () => context.push(Routes.settingsPublicProfile), + ), ], ), );