mirror of
https://github.com/twonlyapp/twonly-app.git
synced 2026-05-25 03:42:13 +00:00
show the number of verified contacts
This commit is contained in:
parent
d32e319c49
commit
65d188c4f2
7 changed files with 27 additions and 11 deletions
|
|
@ -0,0 +1,3 @@
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="#57CC99" class="bi bi-patch-check-fill" viewBox="0 0 16 16">
|
||||||
|
<path d="M10.067.87a2.89 2.89 0 0 0-4.134 0l-.622.638-.89-.011a2.89 2.89 0 0 0-2.924 2.924l.01.89-.636.622a2.89 2.89 0 0 0 0 4.134l.637.622-.011.89a2.89 2.89 0 0 0 2.924 2.924l.89-.01.622.636a2.89 2.89 0 0 0 4.134 0l.622-.637.89.011a2.89 2.89 0 0 0 2.924-2.924l-.01-.89.636-.622a2.89 2.89 0 0 0 0-4.134l-.637-.622.011-.89a2.89 2.89 0 0 0-2.924-2.924l-.89.01zM8.107 4.000L9.339 4.000L9.339 12.000L7.832 12.000L7.832 6.246L7.817 6.232L7.339 6.638L6.948 6.899L6.455 7.159L5.861 7.391L5.861 6.014L6.165 5.899L6.499 5.725L6.861 5.493L7.296 5.159L7.643 4.812L7.832 4.565L8.049 4.174L8.107 4.000Z"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 732 B |
|
|
@ -0,0 +1,3 @@
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="#57CC99" class="bi bi-patch-check-fill" viewBox="0 0 16 16">
|
||||||
|
<path d="M10.067.87a2.89 2.89 0 0 0-4.134 0l-.622.638-.89-.011a2.89 2.89 0 0 0-2.924 2.924l.01.89-.636.622a2.89 2.89 0 0 0 0 4.134l.637.622-.011.89a2.89 2.89 0 0 0 2.924 2.924l.89-.01.622.636a2.89 2.89 0 0 0 4.134 0l.622-.637.89.011a2.89 2.89 0 0 0 2.924-2.924l-.01-.89.636-.622a2.89 2.89 0 0 0 0-4.134l-.637-.622.011-.89a2.89 2.89 0 0 0-2.924-2.924l-.89.01zM7.899 4.000L8.391 4.000L8.768 4.043L9.029 4.101L9.362 4.217L9.623 4.348L9.942 4.580L10.145 4.783L10.304 4.986L10.406 5.145L10.551 5.464L10.652 5.899L10.667 6.406L10.594 6.884L10.478 7.246L10.290 7.638L10.043 8.029L9.812 8.333L9.507 8.667L8.406 9.696L7.928 10.174L7.754 10.391L7.638 10.580L10.667 10.594L10.667 12.000L5.333 12.000L5.391 11.609L5.522 11.159L5.710 10.725L6.000 10.246L6.232 9.942L6.638 9.478L7.464 8.652L8.072 8.087L8.594 7.551L8.870 7.203L9.029 6.899L9.087 6.739L9.145 6.449L9.145 6.174L9.101 5.928L8.986 5.667L8.768 5.435L8.652 5.362L8.522 5.304L8.246 5.246L7.971 5.246L7.783 5.275L7.652 5.319L7.406 5.464L7.232 5.652L7.101 5.913L7.029 6.203L7.000 6.493L5.493 6.348L5.565 5.870L5.725 5.362L5.957 4.942L6.275 4.594L6.638 4.348L6.942 4.203L7.377 4.072L7.899 4.000Z"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 1.3 KiB |
|
|
@ -0,0 +1,3 @@
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="#57CC99" class="bi bi-patch-check-fill" viewBox="0 0 16 16">
|
||||||
|
<path d="M10.067.87a2.89 2.89 0 0 0-4.134 0l-.622.638-.89-.011a2.89 2.89 0 0 0-2.924 2.924l.01.89-.636.622a2.89 2.89 0 0 0 0 4.134l.637.622-.011.89a2.89 2.89 0 0 0 2.924 2.924l.89-.01.622.636a2.89 2.89 0 0 0 4.134 0l.622-.637.89.011a2.89 2.89 0 0 0 2.924-2.924l-.01-.89.636-.622a2.89 2.89 0 0 0 0-4.134l-.637-.622.011-.89a2.89 2.89 0 0 0-2.924-2.924l-.89.01zM7.730 4.000L8.142 4.000L8.555 4.057L8.854 4.142L9.224 4.313L9.523 4.527L9.794 4.797L10.064 5.196L10.206 5.580L10.249 5.851L10.235 6.263L10.149 6.591L10.007 6.875L9.836 7.103L9.566 7.359L9.125 7.644L9.409 7.730L9.708 7.872L9.950 8.043L10.164 8.256L10.335 8.498L10.477 8.797L10.548 9.039L10.591 9.338L10.577 9.836L10.448 10.377L10.249 10.776L10.093 11.004L9.893 11.231L9.523 11.544L9.125 11.772L8.911 11.858L8.598 11.943L8.171 12.000L7.587 11.986L7.146 11.900L6.733 11.744L6.320 11.488L5.950 11.132L5.680 10.733L5.509 10.320L5.409 9.865L5.409 9.808L6.847 9.637L6.861 9.765L6.947 10.064L7.004 10.192L7.160 10.420L7.416 10.633L7.630 10.733L7.843 10.776L8.171 10.762L8.327 10.719L8.498 10.633L8.797 10.363L8.968 10.064L9.039 9.822L9.068 9.609L9.053 9.167L8.954 8.826L8.769 8.541L8.512 8.327L8.214 8.214L7.872 8.199L7.331 8.299L7.488 7.132L7.929 7.089L8.256 6.975L8.384 6.890L8.569 6.705L8.683 6.505L8.754 6.221L8.754 5.979L8.698 5.737L8.598 5.552L8.427 5.381L8.242 5.281L8.000 5.224L7.772 5.224L7.445 5.324L7.317 5.409L7.132 5.594L7.032 5.751L6.947 5.964L6.890 6.278L5.523 6.036L5.623 5.623L5.794 5.181L5.950 4.911L6.235 4.584L6.591 4.327L6.961 4.157L7.302 4.057L7.730 4.000Z"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 1.6 KiB |
|
|
@ -274,9 +274,6 @@ class ApiService {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _onData(dynamic msgBuffer) async {
|
Future<void> _onData(dynamic msgBuffer) async {
|
||||||
if (kDebugMode) {
|
|
||||||
print('API _onData received: $msgBuffer');
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
if (msgBuffer is! Uint8List) {
|
if (msgBuffer is! Uint8List) {
|
||||||
msgBuffer = Uint8List.fromList(msgBuffer as List<int>);
|
msgBuffer = Uint8List.fromList(msgBuffer as List<int>);
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ class VerificationBadgeComp extends StatefulWidget {
|
||||||
|
|
||||||
class _VerificationBadgeCompState extends State<VerificationBadgeComp> {
|
class _VerificationBadgeCompState extends State<VerificationBadgeComp> {
|
||||||
bool _isVerified = false;
|
bool _isVerified = false;
|
||||||
bool _isVerifiedByTransferredTrust = false;
|
int _verifiedByTransferredTrustCount = 0;
|
||||||
|
|
||||||
StreamSubscription<VerificationStatus>? _streamAllVerified;
|
StreamSubscription<VerificationStatus>? _streamAllVerified;
|
||||||
StreamSubscription<List<KeyVerification>>? _streamContactVerification;
|
StreamSubscription<List<KeyVerification>>? _streamContactVerification;
|
||||||
|
|
@ -49,12 +49,12 @@ class _VerificationBadgeCompState extends State<VerificationBadgeComp> {
|
||||||
if (!mounted) return;
|
if (!mounted) return;
|
||||||
setState(() {
|
setState(() {
|
||||||
_isVerified = false;
|
_isVerified = false;
|
||||||
_isVerifiedByTransferredTrust = false;
|
_verifiedByTransferredTrustCount = 0;
|
||||||
if (update == VerificationStatus.trusted) {
|
if (update == VerificationStatus.trusted) {
|
||||||
_isVerified = true;
|
_isVerified = true;
|
||||||
}
|
}
|
||||||
if (update == VerificationStatus.partialTrusted) {
|
if (update == VerificationStatus.partialTrusted) {
|
||||||
_isVerifiedByTransferredTrust = true;
|
_verifiedByTransferredTrustCount = 10;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
@ -73,12 +73,12 @@ class _VerificationBadgeCompState extends State<VerificationBadgeComp> {
|
||||||
.listen((update) {
|
.listen((update) {
|
||||||
if (!mounted) return;
|
if (!mounted) return;
|
||||||
setState(() {
|
setState(() {
|
||||||
_isVerifiedByTransferredTrust = update.isNotEmpty;
|
_verifiedByTransferredTrustCount = update.length;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} else if (widget.isVerifiedByTransferredTrust != null) {
|
} else if (widget.isVerifiedByTransferredTrust != null) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_isVerifiedByTransferredTrust = widget.isVerifiedByTransferredTrust!;
|
_verifiedByTransferredTrustCount = 10;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -94,7 +94,7 @@ class _VerificationBadgeCompState extends State<VerificationBadgeComp> {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
if (!_isVerified &&
|
if (!_isVerified &&
|
||||||
!_isVerifiedByTransferredTrust &&
|
_verifiedByTransferredTrustCount == 0 &&
|
||||||
widget.showOnlyIfVerified) {
|
widget.showOnlyIfVerified) {
|
||||||
return Container();
|
return Container();
|
||||||
}
|
}
|
||||||
|
|
@ -112,10 +112,12 @@ class _VerificationBadgeCompState extends State<VerificationBadgeComp> {
|
||||||
bottom: 3,
|
bottom: 3,
|
||||||
),
|
),
|
||||||
child: SvgIcon(
|
child: SvgIcon(
|
||||||
assetPath: (_isVerified || _isVerifiedByTransferredTrust)
|
assetPath: _isVerified
|
||||||
? SvgIcons.verifiedGreen
|
? SvgIcons.verifiedGreen
|
||||||
|
: _verifiedByTransferredTrustCount > 0
|
||||||
|
? SvgIcons.verifiedNumeric(_verifiedByTransferredTrustCount)
|
||||||
: SvgIcons.verifiedRed,
|
: SvgIcons.verifiedRed,
|
||||||
color: (_isVerifiedByTransferredTrust && !_isVerified)
|
color: (_verifiedByTransferredTrustCount > 0 && !_isVerified)
|
||||||
? colorVerificationBadgeYellow
|
? colorVerificationBadgeYellow
|
||||||
: null,
|
: null,
|
||||||
size: widget.size,
|
size: widget.size,
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,13 @@ import 'package:flutter_svg/flutter_svg.dart';
|
||||||
class SvgIcons {
|
class SvgIcons {
|
||||||
static const String verifiedGreen = 'assets/icons/verified_badge_green.svg';
|
static const String verifiedGreen = 'assets/icons/verified_badge_green.svg';
|
||||||
static const String verifiedRed = 'assets/icons/verified_badge_red.svg';
|
static const String verifiedRed = 'assets/icons/verified_badge_red.svg';
|
||||||
|
|
||||||
|
static String verifiedNumeric(int value) {
|
||||||
|
if (value >= 4) {
|
||||||
|
return verifiedGreen;
|
||||||
|
}
|
||||||
|
return 'assets/icons/verification_badge_numeric/verified_badge_$value.svg';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class SvgIcon extends StatelessWidget {
|
class SvgIcon extends StatelessWidget {
|
||||||
|
|
|
||||||
|
|
@ -207,6 +207,7 @@ flutter:
|
||||||
# Add assets from the images directory to the application.
|
# Add assets from the images directory to the application.
|
||||||
- assets/images/
|
- assets/images/
|
||||||
- assets/icons/
|
- assets/icons/
|
||||||
|
- assets/icons/verification_badge_numeric/
|
||||||
- assets/animated_icons/
|
- assets/animated_icons/
|
||||||
- assets/animations/
|
- assets/animations/
|
||||||
- assets/filters/
|
- assets/filters/
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue