fix: Status design
This commit is contained in:
parent
effb5b62cc
commit
f7930febba
|
@ -28,6 +28,7 @@ class PresenceListItem extends StatelessWidget {
|
|||
final user = room.getUserByMXIDSync(room.directChatMatrixID);
|
||||
final presence =
|
||||
Matrix.of(context).client.presences[room.directChatMatrixID];
|
||||
final hasStatus = presence?.presence?.statusMsg != null;
|
||||
return InkWell(
|
||||
onTap: () => presence?.presence?.statusMsg == null
|
||||
? _startChatAction(context, user.id)
|
||||
|
@ -45,14 +46,29 @@ class PresenceListItem extends StatelessWidget {
|
|||
children: <Widget>[
|
||||
SizedBox(height: 16),
|
||||
Container(
|
||||
child: Avatar(user.avatarUrl, user.calcDisplayname()),
|
||||
child: Stack(
|
||||
children: [
|
||||
Avatar(user.avatarUrl, user.calcDisplayname()),
|
||||
if (presence?.presence?.currentlyActive == true)
|
||||
Positioned(
|
||||
bottom: 0,
|
||||
right: 0,
|
||||
child: Container(
|
||||
width: 10,
|
||||
height: 10,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
color: Colors.green,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
width: 1,
|
||||
color: presence?.presence?.statusMsg == null
|
||||
? presence?.presence?.currentlyActive == true
|
||||
? Colors.blue
|
||||
: Theme.of(context).secondaryHeaderColor
|
||||
color: !hasStatus
|
||||
? Theme.of(context).secondaryHeaderColor
|
||||
: Theme.of(context).primaryColor,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(80),
|
||||
|
@ -70,7 +86,7 @@ class PresenceListItem extends StatelessWidget {
|
|||
.textTheme
|
||||
.bodyText2
|
||||
.color
|
||||
.withOpacity(0.66),
|
||||
.withOpacity(hasStatus ? 1 : 0.66),
|
||||
fontSize: 13,
|
||||
),
|
||||
),
|
||||
|
|
|
@ -8,11 +8,14 @@ extension PresenceExtension on Presence {
|
|||
if (presence.statusMsg?.isNotEmpty ?? false) {
|
||||
return presence.statusMsg;
|
||||
}
|
||||
if (presence.lastActiveAgo != null) {
|
||||
if (presence.lastActiveAgo != null ?? presence.lastActiveAgo != 0) {
|
||||
return L10n.of(context).lastActiveAgo(
|
||||
DateTime.fromMillisecondsSinceEpoch(presence.lastActiveAgo)
|
||||
.localizedTimeShort(context));
|
||||
}
|
||||
if (presence.currentlyActive) {
|
||||
return L10n.of(context).currentlyActive;
|
||||
}
|
||||
return L10n.of(context).lastSeenLongTimeAgo;
|
||||
}
|
||||
}
|
||||
|
|
67
pubspec.lock
67
pubspec.lock
|
@ -49,7 +49,7 @@ packages:
|
|||
name: async
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.4.2"
|
||||
version: "2.5.0-nullsafety"
|
||||
base58check:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -63,7 +63,7 @@ packages:
|
|||
name: boolean_selector
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.0"
|
||||
version: "2.1.0-nullsafety"
|
||||
bot_toast:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
@ -91,14 +91,14 @@ packages:
|
|||
name: characters
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.0"
|
||||
version: "1.1.0-nullsafety.2"
|
||||
charcode:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: charcode
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.1.3"
|
||||
version: "1.2.0-nullsafety"
|
||||
cli_util:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -112,14 +112,14 @@ packages:
|
|||
name: clock
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.1"
|
||||
version: "1.1.0-nullsafety"
|
||||
collection:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: collection
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.14.13"
|
||||
version: "1.15.0-nullsafety.2"
|
||||
convert:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -175,13 +175,13 @@ packages:
|
|||
name: fake_async
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.1.0"
|
||||
version: "1.1.0-nullsafety"
|
||||
famedlysdk:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
path: "."
|
||||
ref: "50d97ebeb224dcbfa8e306b8cb50adcaee12d4db"
|
||||
resolved-ref: "50d97ebeb224dcbfa8e306b8cb50adcaee12d4db"
|
||||
ref: "09ffa0940484862139c3fe431d4c3ef3392f2232"
|
||||
resolved-ref: "09ffa0940484862139c3fe431d4c3ef3392f2232"
|
||||
url: "https://gitlab.com/famedly/famedlysdk.git"
|
||||
source: git
|
||||
version: "0.0.1"
|
||||
|
@ -425,7 +425,7 @@ packages:
|
|||
name: js
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.6.2"
|
||||
version: "0.6.3-nullsafety"
|
||||
link_text:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
@ -460,7 +460,7 @@ packages:
|
|||
name: matcher
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.12.8"
|
||||
version: "0.12.10-nullsafety"
|
||||
matrix_file_e2ee:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -481,7 +481,7 @@ packages:
|
|||
name: meta
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.1.8"
|
||||
version: "1.3.0-nullsafety.2"
|
||||
mime:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -502,14 +502,7 @@ packages:
|
|||
name: moor
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "3.3.0"
|
||||
moor_ffi:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: moor_ffi
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.5.0"
|
||||
version: "3.3.1"
|
||||
node_interop:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -565,7 +558,7 @@ packages:
|
|||
name: path
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.7.0"
|
||||
version: "1.8.0-nullsafety"
|
||||
path_drawing:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -614,7 +607,7 @@ packages:
|
|||
name: pedantic
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.9.0"
|
||||
version: "1.10.0-nullsafety"
|
||||
petitparser:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -663,7 +656,7 @@ packages:
|
|||
name: pool
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.4.0"
|
||||
version: "1.5.0-nullsafety"
|
||||
process:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -738,21 +731,21 @@ packages:
|
|||
name: source_map_stack_trace
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.0"
|
||||
version: "2.1.0-nullsafety.1"
|
||||
source_maps:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: source_maps
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.10.9"
|
||||
version: "0.10.10-nullsafety"
|
||||
source_span:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: source_span
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.7.0"
|
||||
version: "1.8.0-nullsafety"
|
||||
sqflite:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
@ -768,7 +761,7 @@ packages:
|
|||
source: hosted
|
||||
version: "1.0.2+1"
|
||||
sqlite3:
|
||||
dependency: transitive
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: sqlite3
|
||||
url: "https://pub.dartlang.org"
|
||||
|
@ -780,21 +773,21 @@ packages:
|
|||
name: stack_trace
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.9.5"
|
||||
version: "1.10.0-nullsafety"
|
||||
stream_channel:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: stream_channel
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.0"
|
||||
version: "2.1.0-nullsafety"
|
||||
string_scanner:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: string_scanner
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.5"
|
||||
version: "1.1.0-nullsafety"
|
||||
synchronized:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -808,35 +801,35 @@ packages:
|
|||
name: term_glyph
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.1.0"
|
||||
version: "1.2.0-nullsafety"
|
||||
test:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: test
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.15.2"
|
||||
version: "1.16.0-nullsafety.1"
|
||||
test_api:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: test_api
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.2.17"
|
||||
version: "0.2.19-nullsafety"
|
||||
test_core:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: test_core
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.3.10"
|
||||
version: "0.3.12-nullsafety.1"
|
||||
typed_data:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: typed_data
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.2.0"
|
||||
version: "1.3.0-nullsafety.2"
|
||||
universal_html:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
@ -899,7 +892,7 @@ packages:
|
|||
name: vector_math
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.8"
|
||||
version: "2.1.0-nullsafety.2"
|
||||
vm_service:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -964,5 +957,5 @@ packages:
|
|||
source: hosted
|
||||
version: "0.1.2"
|
||||
sdks:
|
||||
dart: ">=2.9.0-14.0.dev <3.0.0"
|
||||
dart: ">=2.10.0-0.0.dev <2.10.0"
|
||||
flutter: ">=1.18.0-6.0.pre <2.0.0"
|
||||
|
|
Loading…
Reference in a new issue