mirror of
https://github.com/krille-chan/fluffychat
synced 2024-09-10 05:05:10 +00:00
chore: Follow up design typing indicator
This commit is contained in:
parent
6d906ad637
commit
3bc66f87e0
1 changed files with 18 additions and 23 deletions
|
@ -14,6 +14,8 @@ class TypingIndicators extends StatelessWidget {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
const avatarSize = Avatar.defaultSize / 2;
|
||||||
|
|
||||||
return StreamBuilder<Object>(
|
return StreamBuilder<Object>(
|
||||||
stream: controller.room.client.onSync.stream.where(
|
stream: controller.room.client.onSync.stream.where(
|
||||||
(syncUpdate) =>
|
(syncUpdate) =>
|
||||||
|
@ -24,7 +26,7 @@ class TypingIndicators extends StatelessWidget {
|
||||||
builder: (context, _) {
|
builder: (context, _) {
|
||||||
final typingUsers = controller.room.typingUsers
|
final typingUsers = controller.room.typingUsers
|
||||||
..removeWhere((u) => u.stateKey == Matrix.of(context).client.userID);
|
..removeWhere((u) => u.stateKey == Matrix.of(context).client.userID);
|
||||||
const topPadding = 20.0;
|
|
||||||
const bottomPadding = 4.0;
|
const bottomPadding = 4.0;
|
||||||
return Container(
|
return Container(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
|
@ -32,8 +34,7 @@ class TypingIndicators extends StatelessWidget {
|
||||||
child: AnimatedContainer(
|
child: AnimatedContainer(
|
||||||
constraints:
|
constraints:
|
||||||
const BoxConstraints(maxWidth: FluffyThemes.columnWidth * 2.5),
|
const BoxConstraints(maxWidth: FluffyThemes.columnWidth * 2.5),
|
||||||
height:
|
height: typingUsers.isEmpty ? 0 : avatarSize + bottomPadding,
|
||||||
typingUsers.isEmpty ? 0 : Avatar.defaultSize + bottomPadding,
|
|
||||||
duration: FluffyThemes.animationDuration,
|
duration: FluffyThemes.animationDuration,
|
||||||
curve: FluffyThemes.animationCurve,
|
curve: FluffyThemes.animationCurve,
|
||||||
alignment: controller.timeline!.events.isNotEmpty &&
|
alignment: controller.timeline!.events.isNotEmpty &&
|
||||||
|
@ -50,14 +51,13 @@ class TypingIndicators extends StatelessWidget {
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: Avatar.defaultSize,
|
height: avatarSize,
|
||||||
width: typingUsers.length < 2
|
width: typingUsers.length < 2 ? avatarSize : avatarSize + 16,
|
||||||
? Avatar.defaultSize
|
|
||||||
: Avatar.defaultSize + 16,
|
|
||||||
child: Stack(
|
child: Stack(
|
||||||
children: [
|
children: [
|
||||||
if (typingUsers.isNotEmpty)
|
if (typingUsers.isNotEmpty)
|
||||||
Avatar(
|
Avatar(
|
||||||
|
size: avatarSize,
|
||||||
mxContent: typingUsers.first.avatarUrl,
|
mxContent: typingUsers.first.avatarUrl,
|
||||||
name: typingUsers.first.calcDisplayname(),
|
name: typingUsers.first.calcDisplayname(),
|
||||||
),
|
),
|
||||||
|
@ -65,6 +65,7 @@ class TypingIndicators extends StatelessWidget {
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(left: 16),
|
padding: const EdgeInsets.only(left: 16),
|
||||||
child: Avatar(
|
child: Avatar(
|
||||||
|
size: avatarSize,
|
||||||
mxContent: typingUsers.length == 2
|
mxContent: typingUsers.length == 2
|
||||||
? typingUsers.last.avatarUrl
|
? typingUsers.last.avatarUrl
|
||||||
: null,
|
: null,
|
||||||
|
@ -77,22 +78,16 @@ class TypingIndicators extends StatelessWidget {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 8),
|
const SizedBox(width: 8),
|
||||||
Padding(
|
Material(
|
||||||
padding: const EdgeInsets.only(top: topPadding),
|
color:
|
||||||
child: Material(
|
// ignore: deprecated_member_use
|
||||||
color:
|
Theme.of(context).colorScheme.surfaceVariant,
|
||||||
// ignore: deprecated_member_use
|
borderRadius: const BorderRadius.all(
|
||||||
Theme.of(context).colorScheme.surfaceVariant,
|
Radius.circular(AppConfig.borderRadius),
|
||||||
borderRadius: const BorderRadius.only(
|
),
|
||||||
topLeft: Radius.circular(2),
|
child: Padding(
|
||||||
topRight: Radius.circular(AppConfig.borderRadius),
|
padding: const EdgeInsets.symmetric(horizontal: 8),
|
||||||
bottomLeft: Radius.circular(AppConfig.borderRadius),
|
child: typingUsers.isEmpty ? null : const _TypingDots(),
|
||||||
bottomRight: Radius.circular(AppConfig.borderRadius),
|
|
||||||
),
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
|
||||||
child: typingUsers.isEmpty ? null : const _TypingDots(),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|
Loading…
Reference in a new issue