mirror of
				https://gitlab.com/famedly/fluffychat.git
				synced 2025-11-04 06:17:26 +01:00 
			
		
		
		
	Merge branch 'krille/refactor-avatar' into 'main'
refactor: Avatar widget See merge request famedly/fluffychat!555
This commit is contained in:
		
						commit
						a49b21c603
					
				@ -287,44 +287,3 @@ release:
 | 
			
		||||
        --assets-link "{\"name\":\"fluffychat-linux-arm64.tar.gz\",\"url\":\"${PACKAGE_REGISTRY_URL}/fluffychat-linux-arm64.tar.gz\"}" \
 | 
			
		||||
        --assets-link "{\"name\":\"fluffychat-windows.zip\",\"url\":\"${PACKAGE_REGISTRY_URL}/fluffychat-windows.zip\"}" \
 | 
			
		||||
        --assets-link "{\"name\":\"fluffychat-web.tar.gz\",\"url\":\"${PACKAGE_REGISTRY_URL}/fluffychat-web.tar.gz\"}"
 | 
			
		||||
 | 
			
		||||
.docker: &docker_template
 | 
			
		||||
  image: docker:latest
 | 
			
		||||
  tags:
 | 
			
		||||
    - docker
 | 
			
		||||
    - famedly
 | 
			
		||||
  stage: deploy
 | 
			
		||||
  services:
 | 
			
		||||
    - docker:dind
 | 
			
		||||
 | 
			
		||||
docker-releases:
 | 
			
		||||
  <<: *docker_template
 | 
			
		||||
  script:
 | 
			
		||||
    - docker build --pull -t "${CI_REGISTRY_IMAGE}:latest" -t "${CI_REGISTRY_IMAGE}:${CI_COMMIT_TAG}" .
 | 
			
		||||
    - docker push "${CI_REGISTRY_IMAGE}:latest"
 | 
			
		||||
    - docker push "${CI_REGISTRY_IMAGE}:${CI_COMMIT_TAG}"
 | 
			
		||||
  rules:
 | 
			
		||||
    - if: '$CI_COMMIT_TAG && $CI_COMMIT_TAG =~ /^v\d+\.\d+\.\d+$/'
 | 
			
		||||
  before_script:
 | 
			
		||||
    - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
 | 
			
		||||
 | 
			
		||||
docker-tags:
 | 
			
		||||
  <<: *docker_template
 | 
			
		||||
  script:
 | 
			
		||||
    - docker build --pull -t "${CI_REGISTRY_IMAGE}:${CI_COMMIT_TAG}" .
 | 
			
		||||
    - docker push "${CI_REGISTRY_IMAGE}:${CI_COMMIT_TAG}"
 | 
			
		||||
  rules:
 | 
			
		||||
    - if: '$CI_COMMIT_TAG && $CI_COMMIT_TAG !~ /^v\d+\.\d+\.\d+$/'
 | 
			
		||||
  before_script:
 | 
			
		||||
    - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
 | 
			
		||||
 | 
			
		||||
docker-branches:
 | 
			
		||||
  <<: *docker_template
 | 
			
		||||
  script:
 | 
			
		||||
    - docker build --pull -t "${CI_REGISTRY_IMAGE}:${CI_COMMIT_REF_SLUG}" -t "${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHA}" .
 | 
			
		||||
    - docker push "${CI_REGISTRY_IMAGE}:${CI_COMMIT_REF_SLUG}"
 | 
			
		||||
  rules:
 | 
			
		||||
    - if: $CI_COMMIT_TAG == null
 | 
			
		||||
  before_script:
 | 
			
		||||
    - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
 | 
			
		||||
  allow_failure: true
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										16
									
								
								Dockerfile
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								Dockerfile
									
									
									
									
									
								
							@ -1,16 +0,0 @@
 | 
			
		||||
# Based upon https://github.com/Starbix/dockerimages/commit/b0c3e408263a90ee467d30aed0e855a610eb537a
 | 
			
		||||
 | 
			
		||||
FROM cirrusci/flutter:2.2.3 AS builder
 | 
			
		||||
 | 
			
		||||
RUN mkdir /fluffychat
 | 
			
		||||
WORKDIR /fluffychat
 | 
			
		||||
 | 
			
		||||
COPY ./ /fluffychat
 | 
			
		||||
 | 
			
		||||
RUN ./scripts/prepare-web.sh
 | 
			
		||||
RUN ./scripts/build-web.sh
 | 
			
		||||
 | 
			
		||||
FROM nginx:alpine
 | 
			
		||||
 | 
			
		||||
COPY --from=builder /fluffychat/build/web/ /usr/share/nginx/html
 | 
			
		||||
COPY --from=builder /fluffychat/config.sample.json /usr/share/nginx/html/config.json
 | 
			
		||||
@ -21,7 +21,10 @@ class ChatAppBarTitle extends StatelessWidget {
 | 
			
		||||
      return Text(controller.selectedEvents.length.toString());
 | 
			
		||||
    }
 | 
			
		||||
    return ListTile(
 | 
			
		||||
      leading: Avatar(controller.room.avatar, controller.room.displayname),
 | 
			
		||||
      leading: Avatar(
 | 
			
		||||
        mxContent: controller.room.avatar,
 | 
			
		||||
        name: controller.room.displayname,
 | 
			
		||||
      ),
 | 
			
		||||
      contentPadding: EdgeInsets.zero,
 | 
			
		||||
      onTap: controller.room.isDirectChat
 | 
			
		||||
          ? () => showModalBottomSheet(
 | 
			
		||||
 | 
			
		||||
@ -268,8 +268,9 @@ class _ChatAccountPicker extends StatelessWidget {
 | 
			
		||||
                      future: client.ownProfile,
 | 
			
		||||
                      builder: (context, snapshot) => ListTile(
 | 
			
		||||
                        leading: Avatar(
 | 
			
		||||
                          snapshot.data?.avatarUrl,
 | 
			
		||||
                          snapshot.data?.displayName ?? client.userID.localpart,
 | 
			
		||||
                          mxContent: snapshot.data?.avatarUrl,
 | 
			
		||||
                          name: snapshot.data?.displayName ??
 | 
			
		||||
                              client.userID.localpart,
 | 
			
		||||
                          size: 20,
 | 
			
		||||
                        ),
 | 
			
		||||
                        title:
 | 
			
		||||
@ -280,8 +281,8 @@ class _ChatAccountPicker extends StatelessWidget {
 | 
			
		||||
                  ))
 | 
			
		||||
              .toList(),
 | 
			
		||||
          child: Avatar(
 | 
			
		||||
            snapshot.data?.avatarUrl,
 | 
			
		||||
            snapshot.data?.displayName ??
 | 
			
		||||
            mxContent: snapshot.data?.avatarUrl,
 | 
			
		||||
            name: snapshot.data?.displayName ??
 | 
			
		||||
                controller.matrix.client.userID.localpart,
 | 
			
		||||
            size: 20,
 | 
			
		||||
          ),
 | 
			
		||||
 | 
			
		||||
@ -46,8 +46,10 @@ class EventInfoDialog extends StatelessWidget {
 | 
			
		||||
      body: ListView(
 | 
			
		||||
        children: [
 | 
			
		||||
          ListTile(
 | 
			
		||||
            leading:
 | 
			
		||||
                Avatar(event.sender.avatarUrl, event.sender.calcDisplayname()),
 | 
			
		||||
            leading: Avatar(
 | 
			
		||||
              mxContent: event.sender.avatarUrl,
 | 
			
		||||
              name: event.sender.calcDisplayname(),
 | 
			
		||||
            ),
 | 
			
		||||
            title: Text(L10n.of(context).sender),
 | 
			
		||||
            subtitle:
 | 
			
		||||
                Text('${event.sender.calcDisplayname()} <${event.senderId}>'),
 | 
			
		||||
 | 
			
		||||
@ -121,8 +121,8 @@ class Message extends StatelessWidget {
 | 
			
		||||
                  : null,
 | 
			
		||||
            )
 | 
			
		||||
          : Avatar(
 | 
			
		||||
              event.sender.avatarUrl,
 | 
			
		||||
              event.sender.calcDisplayname(),
 | 
			
		||||
              mxContent: event.sender.avatarUrl,
 | 
			
		||||
              name: event.sender.calcDisplayname(),
 | 
			
		||||
              onTap: () => onAvatarTab(event),
 | 
			
		||||
            ),
 | 
			
		||||
      Expanded(
 | 
			
		||||
 | 
			
		||||
@ -213,8 +213,8 @@ class _AdaptableReactorsDialog extends StatelessWidget {
 | 
			
		||||
          for (var reactor in reactionEntry.reactors)
 | 
			
		||||
            Chip(
 | 
			
		||||
              avatar: Avatar(
 | 
			
		||||
                reactor.avatarUrl,
 | 
			
		||||
                reactor.displayName,
 | 
			
		||||
                mxContent: reactor.avatarUrl,
 | 
			
		||||
                name: reactor.displayName,
 | 
			
		||||
                client: client,
 | 
			
		||||
              ),
 | 
			
		||||
              label: Text(reactor.displayName),
 | 
			
		||||
 | 
			
		||||
@ -259,8 +259,10 @@ class InputBar extends StatelessWidget {
 | 
			
		||||
                  opacity: suggestion['pack_avatar_url'] != null ? 0.8 : 0.5,
 | 
			
		||||
                  child: suggestion['pack_avatar_url'] != null
 | 
			
		||||
                      ? Avatar(
 | 
			
		||||
                          Uri.parse(suggestion['pack_avatar_url']),
 | 
			
		||||
                          suggestion['pack_display_name'],
 | 
			
		||||
                          mxContent: Uri.tryParse(
 | 
			
		||||
                              suggestion.tryGet<String>('pack_avatar_url') ??
 | 
			
		||||
                                  ''),
 | 
			
		||||
                          name: suggestion.tryGet<String>('pack_display_name'),
 | 
			
		||||
                          size: size * 0.9,
 | 
			
		||||
                          client: client,
 | 
			
		||||
                        )
 | 
			
		||||
@ -280,8 +282,9 @@ class InputBar extends StatelessWidget {
 | 
			
		||||
          crossAxisAlignment: CrossAxisAlignment.center,
 | 
			
		||||
          children: <Widget>[
 | 
			
		||||
            Avatar(
 | 
			
		||||
              url,
 | 
			
		||||
              suggestion['displayname'] ?? suggestion['mxid'],
 | 
			
		||||
              mxContent: url,
 | 
			
		||||
              name: suggestion.tryGet<String>('displayname') ??
 | 
			
		||||
                  suggestion.tryGet<String>('mxid'),
 | 
			
		||||
              size: size,
 | 
			
		||||
              client: client,
 | 
			
		||||
            ),
 | 
			
		||||
 | 
			
		||||
@ -42,8 +42,8 @@ class SeenByRow extends StatelessWidget {
 | 
			
		||||
                    : seenByUsers)
 | 
			
		||||
                .map(
 | 
			
		||||
                  (user) => Avatar(
 | 
			
		||||
                    user.avatarUrl,
 | 
			
		||||
                    user.calcDisplayname(),
 | 
			
		||||
                    mxContent: user.avatarUrl,
 | 
			
		||||
                    name: user.calcDisplayname(),
 | 
			
		||||
                    size: 16,
 | 
			
		||||
                    fontSize: 9,
 | 
			
		||||
                  ),
 | 
			
		||||
 | 
			
		||||
@ -49,8 +49,8 @@ class StickerPickerDialogState extends State<StickerPickerDialog> {
 | 
			
		||||
          if (packName != 'user')
 | 
			
		||||
            ListTile(
 | 
			
		||||
              leading: Avatar(
 | 
			
		||||
                pack.pack.avatarUrl,
 | 
			
		||||
                packName,
 | 
			
		||||
                mxContent: pack.pack.avatarUrl,
 | 
			
		||||
                name: packName,
 | 
			
		||||
                client: widget.room.client,
 | 
			
		||||
              ),
 | 
			
		||||
              title: Text(packName),
 | 
			
		||||
 | 
			
		||||
@ -48,17 +48,17 @@ class TypingIndicators extends StatelessWidget {
 | 
			
		||||
                children: [
 | 
			
		||||
                  if (typingUsers.isNotEmpty)
 | 
			
		||||
                    Avatar(
 | 
			
		||||
                      typingUsers.first.avatarUrl,
 | 
			
		||||
                      typingUsers.first.calcDisplayname(),
 | 
			
		||||
                      mxContent: typingUsers.first.avatarUrl,
 | 
			
		||||
                      name: typingUsers.first.calcDisplayname(),
 | 
			
		||||
                    ),
 | 
			
		||||
                  if (typingUsers.length == 2)
 | 
			
		||||
                    Padding(
 | 
			
		||||
                      padding: const EdgeInsets.only(left: 8),
 | 
			
		||||
                      child: Avatar(
 | 
			
		||||
                        typingUsers.length == 2
 | 
			
		||||
                        mxContent: typingUsers.length == 2
 | 
			
		||||
                            ? typingUsers.last.avatarUrl
 | 
			
		||||
                            : null,
 | 
			
		||||
                        typingUsers.length == 2
 | 
			
		||||
                        name: typingUsers.length == 2
 | 
			
		||||
                            ? typingUsers.last.calcDisplayname()
 | 
			
		||||
                            : '+${typingUsers.length - 1}',
 | 
			
		||||
                      ),
 | 
			
		||||
 | 
			
		||||
@ -61,7 +61,7 @@ class ParticipantListItem extends StatelessWidget {
 | 
			
		||||
        ],
 | 
			
		||||
      ),
 | 
			
		||||
      subtitle: Text(user.id),
 | 
			
		||||
      leading: Avatar(user.avatarUrl, user.calcDisplayname()),
 | 
			
		||||
      leading: Avatar(mxContent: user.avatarUrl, name: user.calcDisplayname()),
 | 
			
		||||
    );
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -91,10 +91,10 @@ class ChatEncryptionSettingsView extends StatelessWidget {
 | 
			
		||||
                            },
 | 
			
		||||
                            child: ListTile(
 | 
			
		||||
                              leading: Avatar(
 | 
			
		||||
                                room
 | 
			
		||||
                                mxContent: room
 | 
			
		||||
                                    .getUserByMXIDSync(deviceKeys[i].userId)
 | 
			
		||||
                                    .avatarUrl,
 | 
			
		||||
                                room
 | 
			
		||||
                                name: room
 | 
			
		||||
                                    .getUserByMXIDSync(deviceKeys[i].userId)
 | 
			
		||||
                                    .calcDisplayname(),
 | 
			
		||||
                              ),
 | 
			
		||||
 | 
			
		||||
@ -171,7 +171,11 @@ class ChatListItem extends StatelessWidget {
 | 
			
		||||
                child: const Icon(Icons.check, color: Colors.white),
 | 
			
		||||
              ),
 | 
			
		||||
            )
 | 
			
		||||
          : Avatar(room.avatar, room.displayname, onTap: onLongPress),
 | 
			
		||||
          : Avatar(
 | 
			
		||||
              mxContent: room.avatar,
 | 
			
		||||
              name: room.displayname,
 | 
			
		||||
              onTap: onLongPress,
 | 
			
		||||
            ),
 | 
			
		||||
      title: Row(
 | 
			
		||||
        children: <Widget>[
 | 
			
		||||
          Expanded(
 | 
			
		||||
 | 
			
		||||
@ -48,8 +48,9 @@ class ClientChooserButton extends StatelessWidget {
 | 
			
		||||
                  builder: (context, snapshot) => Row(
 | 
			
		||||
                    children: [
 | 
			
		||||
                      Avatar(
 | 
			
		||||
                        snapshot.data?.avatarUrl,
 | 
			
		||||
                        snapshot.data?.displayName ?? client.userID.localpart,
 | 
			
		||||
                        mxContent: snapshot.data?.avatarUrl,
 | 
			
		||||
                        name: snapshot.data?.displayName ??
 | 
			
		||||
                            client.userID.localpart,
 | 
			
		||||
                        size: 28,
 | 
			
		||||
                        fontSize: 12,
 | 
			
		||||
                      ),
 | 
			
		||||
@ -84,8 +85,8 @@ class ClientChooserButton extends StatelessWidget {
 | 
			
		||||
        future: matrix.client.ownProfile,
 | 
			
		||||
        builder: (context, snapshot) => PopupMenuButton<Object>(
 | 
			
		||||
          child: Avatar(
 | 
			
		||||
            snapshot.data?.avatarUrl,
 | 
			
		||||
            snapshot.data?.displayName ?? matrix.client.userID.localpart,
 | 
			
		||||
            mxContent: snapshot.data?.avatarUrl,
 | 
			
		||||
            name: snapshot.data?.displayName ?? matrix.client.userID.localpart,
 | 
			
		||||
            size: 28,
 | 
			
		||||
            fontSize: 12,
 | 
			
		||||
          ),
 | 
			
		||||
 | 
			
		||||
@ -59,8 +59,8 @@ class SpacesBottomBar extends StatelessWidget {
 | 
			
		||||
                                onLongPress: () =>
 | 
			
		||||
                                    controller.editSpace(context, space.id),
 | 
			
		||||
                                child: Avatar(
 | 
			
		||||
                                  space.avatar,
 | 
			
		||||
                                  space.displayname,
 | 
			
		||||
                                  mxContent: space.avatar,
 | 
			
		||||
                                  name: space.displayname,
 | 
			
		||||
                                  size: 24,
 | 
			
		||||
                                  fontSize: 12,
 | 
			
		||||
                                ),
 | 
			
		||||
 | 
			
		||||
@ -45,8 +45,8 @@ class InvitationSelectionView extends StatelessWidget {
 | 
			
		||||
                itemCount: controller.foundProfiles.length,
 | 
			
		||||
                itemBuilder: (BuildContext context, int i) => ListTile(
 | 
			
		||||
                  leading: Avatar(
 | 
			
		||||
                    controller.foundProfiles[i].avatarUrl,
 | 
			
		||||
                    controller.foundProfiles[i].displayName ??
 | 
			
		||||
                    mxContent: controller.foundProfiles[i].avatarUrl,
 | 
			
		||||
                    name: controller.foundProfiles[i].displayName ??
 | 
			
		||||
                        controller.foundProfiles[i].userId,
 | 
			
		||||
                  ),
 | 
			
		||||
                  title: Text(
 | 
			
		||||
@ -73,8 +73,8 @@ class InvitationSelectionView extends StatelessWidget {
 | 
			
		||||
                    itemCount: contacts.length,
 | 
			
		||||
                    itemBuilder: (BuildContext context, int i) => ListTile(
 | 
			
		||||
                      leading: Avatar(
 | 
			
		||||
                        contacts[i].avatarUrl,
 | 
			
		||||
                        contacts[i].calcDisplayname(),
 | 
			
		||||
                        mxContent: contacts[i].avatarUrl,
 | 
			
		||||
                        name: contacts[i].calcDisplayname(),
 | 
			
		||||
                      ),
 | 
			
		||||
                      title: Text(contacts[i].calcDisplayname()),
 | 
			
		||||
                      subtitle: Text(contacts[i].id),
 | 
			
		||||
 | 
			
		||||
@ -171,7 +171,7 @@ class _KeyVerificationPageState extends State<KeyVerificationDialog> {
 | 
			
		||||
          children: [
 | 
			
		||||
            Row(children: [
 | 
			
		||||
              if (!PlatformInfos.isCupertinoStyle)
 | 
			
		||||
                Avatar(user?.avatarUrl, displayName),
 | 
			
		||||
                Avatar(mxContent: user?.avatarUrl, name: displayName),
 | 
			
		||||
              const SizedBox(width: 12),
 | 
			
		||||
              Expanded(
 | 
			
		||||
                child: Column(
 | 
			
		||||
 | 
			
		||||
@ -195,8 +195,11 @@ class SearchView extends StatelessWidget {
 | 
			
		||||
                              child: Column(
 | 
			
		||||
                                mainAxisSize: MainAxisSize.min,
 | 
			
		||||
                                children: [
 | 
			
		||||
                                  Avatar(publicRoomsResponse.chunk[i].avatarUrl,
 | 
			
		||||
                                      publicRoomsResponse.chunk[i].name),
 | 
			
		||||
                                  Avatar(
 | 
			
		||||
                                    mxContent:
 | 
			
		||||
                                        publicRoomsResponse.chunk[i].avatarUrl,
 | 
			
		||||
                                    name: publicRoomsResponse.chunk[i].name,
 | 
			
		||||
                                  ),
 | 
			
		||||
                                  Text(
 | 
			
		||||
                                    publicRoomsResponse.chunk[i].name,
 | 
			
		||||
                                    style: const TextStyle(
 | 
			
		||||
@ -262,8 +265,8 @@ class SearchView extends StatelessWidget {
 | 
			
		||||
                          }
 | 
			
		||||
                        },
 | 
			
		||||
                        leading: Avatar(
 | 
			
		||||
                          foundProfile.avatarUrl,
 | 
			
		||||
                          foundProfile.displayName ?? foundProfile.userId,
 | 
			
		||||
                          mxContent: foundProfile.avatarUrl,
 | 
			
		||||
                          name: foundProfile.displayName ?? foundProfile.userId,
 | 
			
		||||
                          //size: 24,
 | 
			
		||||
                        ),
 | 
			
		||||
                        title: Text(
 | 
			
		||||
 | 
			
		||||
@ -68,8 +68,8 @@ class SettingsIgnoreListView extends StatelessWidget {
 | 
			
		||||
                            client.getProfileFromUserId(client.ignoredUsers[i]),
 | 
			
		||||
                        builder: (c, s) => ListTile(
 | 
			
		||||
                          leading: Avatar(
 | 
			
		||||
                            s.data?.avatarUrl ?? Uri.parse(''),
 | 
			
		||||
                            s.data?.displayName ?? client.ignoredUsers[i],
 | 
			
		||||
                            mxContent: s.data?.avatarUrl ?? Uri.parse(''),
 | 
			
		||||
                            name: s.data?.displayName ?? client.ignoredUsers[i],
 | 
			
		||||
                          ),
 | 
			
		||||
                          title: Text(
 | 
			
		||||
                              s.data?.displayName ?? client.ignoredUsers[i]),
 | 
			
		||||
 | 
			
		||||
@ -18,9 +18,9 @@ class Avatar extends StatelessWidget {
 | 
			
		||||
  final Client? client;
 | 
			
		||||
  final double fontSize;
 | 
			
		||||
 | 
			
		||||
  const Avatar(
 | 
			
		||||
  const Avatar({
 | 
			
		||||
    this.mxContent,
 | 
			
		||||
    this.name, {
 | 
			
		||||
    this.name,
 | 
			
		||||
    this.size = defaultSize,
 | 
			
		||||
    this.onTap,
 | 
			
		||||
    this.client,
 | 
			
		||||
 | 
			
		||||
@ -87,7 +87,12 @@ class _ContactListTile extends StatelessWidget {
 | 
			
		||||
              height: Avatar.defaultSize,
 | 
			
		||||
              child: Stack(
 | 
			
		||||
                children: [
 | 
			
		||||
                  Center(child: Avatar(avatarUrl, displayname)),
 | 
			
		||||
                  Center(
 | 
			
		||||
                    child: Avatar(
 | 
			
		||||
                      mxContent: avatarUrl,
 | 
			
		||||
                      name: displayname,
 | 
			
		||||
                    ),
 | 
			
		||||
                  ),
 | 
			
		||||
                  Align(
 | 
			
		||||
                    alignment: Alignment.bottomRight,
 | 
			
		||||
                    child: Icon(
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user