pull/2168/merge
Kelrap 2 weeks ago committed by GitHub
commit 3bda91657b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -345,207 +345,210 @@ class _SpaceViewState extends State<SpaceView> {
.whereType<Room>()
.toList();
final filter = _filterController.text.trim().toLowerCase();
return CustomScrollView(
slivers: [
SliverAppBar(
floating: true,
toolbarHeight: 72,
scrolledUnderElevation: 0,
backgroundColor: Colors.transparent,
automaticallyImplyLeading: false,
title: TextField(
controller: _filterController,
onChanged: (_) => setState(() {}),
textInputAction: TextInputAction.search,
decoration: InputDecoration(
filled: true,
fillColor: theme.colorScheme.secondaryContainer,
border: OutlineInputBorder(
borderSide: BorderSide.none,
borderRadius: BorderRadius.circular(99),
),
contentPadding: EdgeInsets.zero,
hintText: L10n.of(context).search,
hintStyle: TextStyle(
color: theme.colorScheme.onPrimaryContainer,
fontWeight: FontWeight.normal,
),
floatingLabelBehavior: FloatingLabelBehavior.never,
prefixIcon: IconButton(
onPressed: () {},
icon: Icon(
Icons.search_outlined,
return SafeArea(
child: CustomScrollView(
slivers: [
SliverAppBar(
floating: true,
toolbarHeight: 72,
scrolledUnderElevation: 0,
backgroundColor: Colors.transparent,
automaticallyImplyLeading: false,
title: TextField(
controller: _filterController,
onChanged: (_) => setState(() {}),
textInputAction: TextInputAction.search,
decoration: InputDecoration(
filled: true,
fillColor: theme.colorScheme.secondaryContainer,
border: OutlineInputBorder(
borderSide: BorderSide.none,
borderRadius: BorderRadius.circular(99),
),
contentPadding: EdgeInsets.zero,
hintText: L10n.of(context).search,
hintStyle: TextStyle(
color: theme.colorScheme.onPrimaryContainer,
fontWeight: FontWeight.normal,
),
floatingLabelBehavior: FloatingLabelBehavior.never,
prefixIcon: IconButton(
onPressed: () {},
icon: Icon(
Icons.search_outlined,
color: theme.colorScheme.onPrimaryContainer,
),
),
),
),
),
),
SliverList.builder(
itemCount: joinedParents.length,
itemBuilder: (context, i) {
final displayname =
joinedParents[i].getLocalizedDisplayname();
return Padding(
padding: const EdgeInsets.symmetric(
horizontal: 8,
vertical: 1,
),
child: Material(
borderRadius:
BorderRadius.circular(AppConfig.borderRadius),
clipBehavior: Clip.hardEdge,
child: ListTile(
minVerticalPadding: 0,
leading: Icon(
Icons.adaptive.arrow_back_outlined,
size: 16,
),
title: Row(
children: [
Avatar(
mxContent: joinedParents[i].avatar,
name: displayname,
size: Avatar.defaultSize / 2,
borderRadius: BorderRadius.circular(
AppConfig.borderRadius / 4,
SliverList.builder(
itemCount: joinedParents.length,
itemBuilder: (context, i) {
final displayname =
joinedParents[i].getLocalizedDisplayname();
return Padding(
padding: const EdgeInsets.symmetric(
horizontal: 8,
vertical: 1,
),
child: Material(
borderRadius:
BorderRadius.circular(AppConfig.borderRadius),
clipBehavior: Clip.hardEdge,
child: ListTile(
minVerticalPadding: 0,
leading: Icon(
Icons.adaptive.arrow_back_outlined,
size: 16,
),
title: Row(
children: [
Avatar(
mxContent: joinedParents[i].avatar,
name: displayname,
size: Avatar.defaultSize / 2,
borderRadius: BorderRadius.circular(
AppConfig.borderRadius / 4,
),
),
),
const SizedBox(width: 8),
Expanded(child: Text(displayname)),
],
const SizedBox(width: 8),
Expanded(child: Text(displayname)),
],
),
onTap: () =>
widget.toParentSpace(joinedParents[i].id),
),
onTap: () =>
widget.toParentSpace(joinedParents[i].id),
),
),
);
},
),
SliverList.builder(
itemCount: joinedRooms.length,
itemBuilder: (context, i) {
final joinedRoom = joinedRooms[i];
return ChatListItem(
joinedRoom,
filter: filter,
onTap: () => widget.onChatTab(joinedRoom),
onLongPress: (context) => widget.onChatContext(
);
},
),
SliverList.builder(
itemCount: joinedRooms.length,
itemBuilder: (context, i) {
final joinedRoom = joinedRooms[i];
return ChatListItem(
joinedRoom,
context,
),
activeChat: widget.activeChat == joinedRoom.id,
);
},
),
SliverList.builder(
itemCount: _discoveredChildren.length + 2,
itemBuilder: (context, i) {
if (i == 0) {
return SearchTitle(
title: L10n.of(context).discover,
icon: const Icon(Icons.explore_outlined),
filter: filter,
onTap: () => widget.onChatTab(joinedRoom),
onLongPress: (context) => widget.onChatContext(
joinedRoom,
context,
),
activeChat: widget.activeChat == joinedRoom.id,
);
}
i--;
if (i == _discoveredChildren.length) {
if (_noMoreRooms) {
return Padding(
padding: const EdgeInsets.all(12.0),
child: Center(
child: Text(
L10n.of(context).noMoreChatsFound,
style: const TextStyle(fontSize: 13),
},
),
SliverList.builder(
itemCount: _discoveredChildren.length + 2,
itemBuilder: (context, i) {
if (i == 0) {
return SearchTitle(
title: L10n.of(context).discover,
icon: const Icon(Icons.explore_outlined),
);
}
i--;
if (i == _discoveredChildren.length) {
if (_noMoreRooms) {
return Padding(
padding: const EdgeInsets.all(12.0),
child: Center(
child: Text(
L10n.of(context).noMoreChatsFound,
style: const TextStyle(fontSize: 13),
),
),
);
}
return Padding(
padding: const EdgeInsets.symmetric(
horizontal: 12.0,
vertical: 2.0,
),
child: TextButton(
onPressed: _isLoading ? null : _loadHierarchy,
child: _isLoading
? LinearProgressIndicator(
borderRadius: BorderRadius.circular(
AppConfig.borderRadius,
),
)
: Text(L10n.of(context).loadMore),
),
);
}
final item = _discoveredChildren[i];
final displayname = item.name ??
item.canonicalAlias ??
L10n.of(context).emptyChat;
if (!displayname.toLowerCase().contains(filter)) {
return const SizedBox.shrink();
}
return Padding(
padding: const EdgeInsets.symmetric(
horizontal: 12.0,
vertical: 2.0,
horizontal: 8,
vertical: 1,
),
child: TextButton(
onPressed: _isLoading ? null : _loadHierarchy,
child: _isLoading
? LinearProgressIndicator(
borderRadius: BorderRadius.circular(
AppConfig.borderRadius,
child: Material(
borderRadius:
BorderRadius.circular(AppConfig.borderRadius),
clipBehavior: Clip.hardEdge,
child: ListTile(
visualDensity:
const VisualDensity(vertical: -0.5),
contentPadding:
const EdgeInsets.symmetric(horizontal: 8),
onTap: () => _joinChildRoom(item),
leading: Avatar(
mxContent: item.avatarUrl,
name: displayname,
borderRadius: item.roomType == 'm.space'
? BorderRadius.circular(
AppConfig.borderRadius / 2,
)
: null,
),
title: Row(
children: [
Expanded(
child: Text(
displayname,
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
)
: Text(L10n.of(context).loadMore),
),
);
}
final item = _discoveredChildren[i];
final displayname = item.name ??
item.canonicalAlias ??
L10n.of(context).emptyChat;
if (!displayname.toLowerCase().contains(filter)) {
return const SizedBox.shrink();
}
return Padding(
padding: const EdgeInsets.symmetric(
horizontal: 8,
vertical: 1,
),
child: Material(
borderRadius:
BorderRadius.circular(AppConfig.borderRadius),
clipBehavior: Clip.hardEdge,
child: ListTile(
visualDensity:
const VisualDensity(vertical: -0.5),
contentPadding:
const EdgeInsets.symmetric(horizontal: 8),
onTap: () => _joinChildRoom(item),
leading: Avatar(
mxContent: item.avatarUrl,
name: displayname,
borderRadius: item.roomType == 'm.space'
? BorderRadius.circular(
AppConfig.borderRadius / 2,
)
: null,
),
title: Row(
children: [
Expanded(
child: Text(
displayname,
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
Text(
item.numJoinedMembers.toString(),
style: TextStyle(
fontSize: 13,
color: theme.textTheme.bodyMedium!.color,
Text(
item.numJoinedMembers.toString(),
style: TextStyle(
fontSize: 13,
color:
theme.textTheme.bodyMedium!.color,
),
),
),
const SizedBox(width: 4),
const Icon(
Icons.people_outlined,
size: 14,
),
],
),
subtitle: Text(
item.topic ??
L10n.of(context).countParticipants(
item.numJoinedMembers,
const SizedBox(width: 4),
const Icon(
Icons.people_outlined,
size: 14,
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
],
),
subtitle: Text(
item.topic ??
L10n.of(context).countParticipants(
item.numJoinedMembers,
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
),
),
);
},
),
const SliverPadding(padding: EdgeInsets.only(top: 32)),
],
);
},
),
const SliverPadding(padding: EdgeInsets.only(top: 32)),
],
),
);
},
),

@ -59,205 +59,208 @@ class SettingsView extends StatelessWidget {
),
body: ListTileTheme(
iconColor: theme.colorScheme.onSurface,
child: ListView(
key: const Key('SettingsListViewContent'),
children: <Widget>[
FutureBuilder<Profile>(
future: controller.profileFuture,
builder: (context, snapshot) {
final profile = snapshot.data;
final avatar = profile?.avatarUrl;
final mxid = Matrix.of(context).client.userID ??
L10n.of(context).user;
final displayname =
profile?.displayName ?? mxid.localpart ?? mxid;
return Row(
children: [
Padding(
padding: const EdgeInsets.all(32.0),
child: Stack(
children: [
Avatar(
mxContent: avatar,
name: displayname,
size: Avatar.defaultSize * 2.5,
onTap: avatar != null
? () => showDialog(
context: context,
builder: (_) =>
MxcImageViewer(avatar),
)
: null,
),
if (profile != null)
Positioned(
bottom: 0,
right: 0,
child: FloatingActionButton.small(
elevation: 2,
onPressed: controller.setAvatarAction,
heroTag: null,
child: const Icon(
Icons.camera_alt_outlined,
child: SafeArea(
child: ListView(
key: const Key('SettingsListViewContent'),
children: <Widget>[
FutureBuilder<Profile>(
future: controller.profileFuture,
builder: (context, snapshot) {
final profile = snapshot.data;
final avatar = profile?.avatarUrl;
final mxid = Matrix.of(context).client.userID ??
L10n.of(context).user;
final displayname =
profile?.displayName ?? mxid.localpart ?? mxid;
return Row(
children: [
Padding(
padding: const EdgeInsets.all(32.0),
child: Stack(
children: [
Avatar(
mxContent: avatar,
name: displayname,
size: Avatar.defaultSize * 2.5,
onTap: avatar != null
? () => showDialog(
context: context,
builder: (_) =>
MxcImageViewer(avatar),
)
: null,
),
if (profile != null)
Positioned(
bottom: 0,
right: 0,
child: FloatingActionButton.small(
elevation: 2,
onPressed: controller.setAvatarAction,
heroTag: null,
child: const Icon(
Icons.camera_alt_outlined,
),
),
),
),
],
],
),
),
),
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
TextButton.icon(
onPressed: controller.setDisplaynameAction,
icon: const Icon(
Icons.edit_outlined,
size: 16,
),
style: TextButton.styleFrom(
foregroundColor:
theme.colorScheme.onSurface,
iconColor: theme.colorScheme.onSurface,
),
label: Text(
displayname,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: const TextStyle(
fontSize: 18,
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
TextButton.icon(
onPressed: controller.setDisplaynameAction,
icon: const Icon(
Icons.edit_outlined,
size: 16,
),
style: TextButton.styleFrom(
foregroundColor:
theme.colorScheme.onSurface,
iconColor: theme.colorScheme.onSurface,
),
label: Text(
displayname,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: const TextStyle(
fontSize: 18,
),
),
),
),
TextButton.icon(
onPressed: () =>
FluffyShare.share(mxid, context),
icon: const Icon(
Icons.copy_outlined,
size: 14,
),
style: TextButton.styleFrom(
foregroundColor:
theme.colorScheme.secondary,
iconColor: theme.colorScheme.secondary,
),
label: Text(
mxid,
maxLines: 1,
overflow: TextOverflow.ellipsis,
// style: const TextStyle(fontSize: 12),
TextButton.icon(
onPressed: () =>
FluffyShare.share(mxid, context),
icon: const Icon(
Icons.copy_outlined,
size: 14,
),
style: TextButton.styleFrom(
foregroundColor:
theme.colorScheme.secondary,
iconColor: theme.colorScheme.secondary,
),
label: Text(
mxid,
maxLines: 1,
overflow: TextOverflow.ellipsis,
// style: const TextStyle(fontSize: 12),
),
),
),
],
],
),
),
),
],
);
},
),
if (accountManageUrl != null)
ListTile(
leading: const Icon(Icons.account_circle_outlined),
title: Text(L10n.of(context).manageAccount),
trailing: const Icon(Icons.open_in_new_outlined),
onTap: () => launchUrlString(
accountManageUrl,
mode: LaunchMode.inAppBrowserView,
],
);
},
),
if (accountManageUrl != null)
ListTile(
leading: const Icon(Icons.account_circle_outlined),
title: Text(L10n.of(context).manageAccount),
trailing: const Icon(Icons.open_in_new_outlined),
onTap: () => launchUrlString(
accountManageUrl,
mode: LaunchMode.inAppBrowserView,
),
),
Divider(color: theme.dividerColor),
if (showChatBackupBanner == null)
ListTile(
leading: const Icon(Icons.backup_outlined),
title: Text(L10n.of(context).chatBackup),
trailing: const CircularProgressIndicator.adaptive(),
)
else
SwitchListTile.adaptive(
controlAffinity: ListTileControlAffinity.trailing,
value: controller.showChatBackupBanner == false,
secondary: const Icon(Icons.backup_outlined),
title: Text(L10n.of(context).chatBackup),
onChanged: controller.firstRunBootstrapAction,
),
Divider(
color: theme.dividerColor,
),
Divider(color: theme.dividerColor),
if (showChatBackupBanner == null)
ListTile(
leading: const Icon(Icons.backup_outlined),
title: Text(L10n.of(context).chatBackup),
trailing: const CircularProgressIndicator.adaptive(),
)
else
SwitchListTile.adaptive(
controlAffinity: ListTileControlAffinity.trailing,
value: controller.showChatBackupBanner == false,
secondary: const Icon(Icons.backup_outlined),
title: Text(L10n.of(context).chatBackup),
onChanged: controller.firstRunBootstrapAction,
leading: const Icon(Icons.format_paint_outlined),
title: Text(L10n.of(context).changeTheme),
tileColor: activeRoute.startsWith('/rooms/settings/style')
? theme.colorScheme.surfaceContainerHigh
: null,
onTap: () => context.go('/rooms/settings/style'),
),
Divider(
color: theme.dividerColor,
),
ListTile(
leading: const Icon(Icons.format_paint_outlined),
title: Text(L10n.of(context).changeTheme),
tileColor: activeRoute.startsWith('/rooms/settings/style')
? theme.colorScheme.surfaceContainerHigh
: null,
onTap: () => context.go('/rooms/settings/style'),
),
ListTile(
leading: const Icon(Icons.notifications_outlined),
title: Text(L10n.of(context).notifications),
tileColor:
activeRoute.startsWith('/rooms/settings/notifications')
? theme.colorScheme.surfaceContainerHigh
: null,
onTap: () => context.go('/rooms/settings/notifications'),
),
ListTile(
leading: const Icon(Icons.devices_outlined),
title: Text(L10n.of(context).devices),
onTap: () => context.go('/rooms/settings/devices'),
tileColor: activeRoute.startsWith('/rooms/settings/devices')
? theme.colorScheme.surfaceContainerHigh
: null,
),
ListTile(
leading: const Icon(Icons.forum_outlined),
title: Text(L10n.of(context).chat),
onTap: () => context.go('/rooms/settings/chat'),
tileColor: activeRoute.startsWith('/rooms/settings/chat')
? theme.colorScheme.surfaceContainerHigh
: null,
),
ListTile(
leading: const Icon(Icons.shield_outlined),
title: Text(L10n.of(context).security),
onTap: () => context.go('/rooms/settings/security'),
tileColor:
activeRoute.startsWith('/rooms/settings/security')
? theme.colorScheme.surfaceContainerHigh
: null,
),
Divider(color: theme.dividerColor),
ListTile(
leading: const Icon(Icons.dns_outlined),
title: Text(
L10n.of(context).aboutHomeserver(
Matrix.of(context).client.userID?.domain ??
'homeserver',
ListTile(
leading: const Icon(Icons.notifications_outlined),
title: Text(L10n.of(context).notifications),
tileColor: activeRoute
.startsWith('/rooms/settings/notifications')
? theme.colorScheme.surfaceContainerHigh
: null,
onTap: () => context.go('/rooms/settings/notifications'),
),
ListTile(
leading: const Icon(Icons.devices_outlined),
title: Text(L10n.of(context).devices),
onTap: () => context.go('/rooms/settings/devices'),
tileColor:
activeRoute.startsWith('/rooms/settings/devices')
? theme.colorScheme.surfaceContainerHigh
: null,
),
ListTile(
leading: const Icon(Icons.forum_outlined),
title: Text(L10n.of(context).chat),
onTap: () => context.go('/rooms/settings/chat'),
tileColor: activeRoute.startsWith('/rooms/settings/chat')
? theme.colorScheme.surfaceContainerHigh
: null,
),
ListTile(
leading: const Icon(Icons.shield_outlined),
title: Text(L10n.of(context).security),
onTap: () => context.go('/rooms/settings/security'),
tileColor:
activeRoute.startsWith('/rooms/settings/security')
? theme.colorScheme.surfaceContainerHigh
: null,
),
Divider(color: theme.dividerColor),
ListTile(
leading: const Icon(Icons.dns_outlined),
title: Text(
L10n.of(context).aboutHomeserver(
Matrix.of(context).client.userID?.domain ??
'homeserver',
),
),
onTap: () => context.go('/rooms/settings/homeserver'),
tileColor:
activeRoute.startsWith('/rooms/settings/homeserver')
? theme.colorScheme.surfaceContainerHigh
: null,
),
onTap: () => context.go('/rooms/settings/homeserver'),
tileColor:
activeRoute.startsWith('/rooms/settings/homeserver')
? theme.colorScheme.surfaceContainerHigh
: null,
),
ListTile(
leading: const Icon(Icons.privacy_tip_outlined),
title: Text(L10n.of(context).privacy),
onTap: () => launchUrlString(AppConfig.privacyUrl),
),
ListTile(
leading: const Icon(Icons.info_outline_rounded),
title: Text(L10n.of(context).about),
onTap: () => PlatformInfos.showDialog(context),
),
Divider(color: theme.dividerColor),
ListTile(
leading: const Icon(Icons.logout_outlined),
title: Text(L10n.of(context).logout),
onTap: controller.logoutAction,
),
],
ListTile(
leading: const Icon(Icons.privacy_tip_outlined),
title: Text(L10n.of(context).privacy),
onTap: () => launchUrlString(AppConfig.privacyUrl),
),
ListTile(
leading: const Icon(Icons.info_outline_rounded),
title: Text(L10n.of(context).about),
onTap: () => PlatformInfos.showDialog(context),
),
Divider(color: theme.dividerColor),
ListTile(
leading: const Icon(Icons.logout_outlined),
title: Text(L10n.of(context).logout),
onTap: controller.logoutAction,
),
],
),
),
),
),

Loading…
Cancel
Save