build method

  1. @override
dynamic build(
  1. dynamic context,
  2. dynamic ref
)

Implementation

@override
Widget build(BuildContext context, WidgetRef ref) {
  final spaceAvatarInfo = ref.watch(roomAvatarInfoProvider(spaceId));
  final parentBadges =
      ref.watch(parentAvatarInfosProvider(spaceId)).valueOrNull;
  final curNotifStatus =
      ref.watch(roomNotificationStatusProvider(spaceId)).valueOrNull;

  final spaceName = spaceAvatarInfo.displayName ?? spaceId;

  return Scaffold(
    appBar: AppBar(
      automaticallyImplyLeading: isFullPage,
      leading: !isFullPage
          ? InkWell(
              child: const Icon(Icons.close),
              onTap: () {
                context.pop();
                context.pop();
              },
            )
          : null,
      title: FittedBox(
        fit: BoxFit.fitWidth,
        child: Row(
          mainAxisAlignment: MainAxisAlignment.start,
          children: [
            ActerAvatar(
              options: AvatarOptions(
                AvatarInfo(
                  uniqueId: spaceId,
                  displayName: spaceAvatarInfo.displayName,
                  avatar: spaceAvatarInfo.avatar,
                ),
                parentBadges: parentBadges,
                badgesSize: 18,
              ),
            ),
            const SizedBox(width: 10),
            Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                Text(L10n.of(context).settings),
                Text(
                  '($spaceName)',
                  overflow: TextOverflow.ellipsis,
                  style: Theme.of(context).textTheme.labelLarge,
                ),
              ],
            ),
          ],
        ),
      ),
    ),
    body: Center(
      child: ConstrainedBox(
        constraints: const BoxConstraints(maxWidth: 500),
        child: SettingsList(
          sections: [
            SettingsSection(
              title: Text(L10n.of(context).personalSettings),
              tiles: [
                SettingsTile(
                  key: appsMenu,
                  title: Text(L10n.of(context).notificationsOverwrites),
                  description: Text(
                    L10n.of(context).notificationsOverwritesDescription,
                  ),
                  leading: curNotifStatus == 'muted'
                      ? const Icon(Atlas.bell_dash_bold, size: 18)
                      : const Icon(Atlas.bell_thin, size: 18),
                  onPressed: (context) {
                    if (!isFullPage && context.isLargeScreen) {
                      context.pushReplacementNamed(
                        Routes.spaceSettingsNotifications.name,
                        pathParameters: {'spaceId': spaceId},
                      );
                    } else {
                      context.pushNamed(
                        Routes.spaceSettingsNotifications.name,
                        pathParameters: {'spaceId': spaceId},
                      );
                    }
                  },
                ),
              ],
            ),
            SettingsSection(
              title: Text(L10n.of(context).spaceConfiguration),
              tiles: <SettingsTile>[
                SettingsTile(
                  title: Text(L10n.of(context).accessAndVisibility),
                  description: Text(
                    L10n.of(context).spaceConfigurationDescription,
                  ),
                  leading: const Icon(Atlas.lab_appliance_thin),
                  onPressed: (context) {
                    if (!isFullPage && context.isLargeScreen) {
                      context.pushReplacementNamed(
                        Routes.spaceSettingsVisibility.name,
                        pathParameters: {'spaceId': spaceId},
                      );
                    } else {
                      context.pushNamed(
                        Routes.spaceSettingsVisibility.name,
                        pathParameters: {'spaceId': spaceId},
                      );
                    }
                  },
                ),
                SettingsTile(
                  key: appsMenu,
                  title: Text(L10n.of(context).apps),
                  description: Text(
                    L10n.of(context).customizeAppsAndTheirFeatures,
                  ),
                  leading: const Icon(Atlas.info_circle_thin),
                  onPressed: (context) {
                    if (!isFullPage && context.isLargeScreen) {
                      context.pushReplacementNamed(
                        Routes.spaceSettingsApps.name,
                        pathParameters: {'spaceId': spaceId},
                      );
                    } else {
                      context.pushNamed(
                        Routes.spaceSettingsApps.name,
                        pathParameters: {'spaceId': spaceId},
                      );
                    }
                  },
                ),
              ],
            ),
          ],
        ),
      ),
    ),
  );
}