mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-11-30 16:29:30 +01:00
chore: Follow up homeserver picker input
This commit is contained in:
parent
51a5e7f9cc
commit
4680a1c507
@ -13,7 +13,6 @@ import 'package:fluffychat/pages/chat_list/stories_header.dart';
|
|||||||
import 'package:fluffychat/widgets/avatar.dart';
|
import 'package:fluffychat/widgets/avatar.dart';
|
||||||
import 'package:fluffychat/widgets/profile_bottom_sheet.dart';
|
import 'package:fluffychat/widgets/profile_bottom_sheet.dart';
|
||||||
import 'package:fluffychat/widgets/public_room_bottom_sheet.dart';
|
import 'package:fluffychat/widgets/public_room_bottom_sheet.dart';
|
||||||
import '../../utils/stream_extension.dart';
|
|
||||||
import '../../widgets/connection_status_header.dart';
|
import '../../widgets/connection_status_header.dart';
|
||||||
import '../../widgets/matrix.dart';
|
import '../../widgets/matrix.dart';
|
||||||
|
|
||||||
@ -42,14 +41,7 @@ class ChatListViewBody extends StatelessWidget {
|
|||||||
child: child,
|
child: child,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
child: StreamBuilder(
|
child: Builder(builder: (context) {
|
||||||
key: ValueKey(client.userID.toString() +
|
|
||||||
controller.activeFilter.toString() +
|
|
||||||
controller.activeSpaceId.toString()),
|
|
||||||
stream: client.onSync.stream
|
|
||||||
.where((s) => s.hasRoomUpdate)
|
|
||||||
.rateLimit(const Duration(seconds: 1)),
|
|
||||||
builder: (context, _) {
|
|
||||||
if (controller.activeFilter == ActiveFilter.spaces &&
|
if (controller.activeFilter == ActiveFilter.spaces &&
|
||||||
!controller.isSearchMode) {
|
!controller.isSearchMode) {
|
||||||
return SpaceView(
|
return SpaceView(
|
||||||
@ -95,8 +87,8 @@ class ChatListViewBody extends StatelessWidget {
|
|||||||
onPressed: () => showModalBottomSheet(
|
onPressed: () => showModalBottomSheet(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (c) => PublicRoomBottomSheet(
|
builder: (c) => PublicRoomBottomSheet(
|
||||||
roomAlias: roomSearchResult
|
roomAlias:
|
||||||
.chunk[i].canonicalAlias ??
|
roomSearchResult.chunk[i].canonicalAlias ??
|
||||||
roomSearchResult.chunk[i].roomId,
|
roomSearchResult.chunk[i].roomId,
|
||||||
outerContext: context,
|
outerContext: context,
|
||||||
chunk: roomSearchResult.chunk[i],
|
chunk: roomSearchResult.chunk[i],
|
||||||
@ -120,10 +112,8 @@ class ChatListViewBody extends StatelessWidget {
|
|||||||
scrollDirection: Axis.horizontal,
|
scrollDirection: Axis.horizontal,
|
||||||
itemCount: userSearchResult.results.length,
|
itemCount: userSearchResult.results.length,
|
||||||
itemBuilder: (context, i) => _SearchItem(
|
itemBuilder: (context, i) => _SearchItem(
|
||||||
title:
|
title: userSearchResult.results[i].displayName ??
|
||||||
userSearchResult.results[i].displayName ??
|
userSearchResult.results[i].userId.localpart ??
|
||||||
userSearchResult
|
|
||||||
.results[i].userId.localpart ??
|
|
||||||
L10n.of(context)!.unknownDevice,
|
L10n.of(context)!.unknownDevice,
|
||||||
avatar: userSearchResult.results[i].avatarUrl,
|
avatar: userSearchResult.results[i].avatarUrl,
|
||||||
onPressed: () => showModalBottomSheet(
|
onPressed: () => showModalBottomSheet(
|
||||||
@ -159,10 +149,8 @@ class ChatListViewBody extends StatelessWidget {
|
|||||||
child: ListTile(
|
child: ListTile(
|
||||||
leading: const Icon(Icons.vpn_key),
|
leading: const Icon(Icons.vpn_key),
|
||||||
title: Text(L10n.of(context)!.dehydrateTor),
|
title: Text(L10n.of(context)!.dehydrateTor),
|
||||||
subtitle:
|
subtitle: Text(L10n.of(context)!.dehydrateTorLong),
|
||||||
Text(L10n.of(context)!.dehydrateTorLong),
|
trailing: const Icon(Icons.chevron_right_outlined),
|
||||||
trailing:
|
|
||||||
const Icon(Icons.chevron_right_outlined),
|
|
||||||
onTap: controller.dehydrate,
|
onTap: controller.dehydrate,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -184,9 +172,7 @@ class ChatListViewBody extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
Divider(
|
Divider(
|
||||||
height: 1,
|
height: 1,
|
||||||
color: Theme.of(context)
|
color: Theme.of(context).colorScheme.onBackground,
|
||||||
.colorScheme
|
|
||||||
.onBackground,
|
|
||||||
),
|
),
|
||||||
const SizedBox(height: 32),
|
const SizedBox(height: 32),
|
||||||
FloatingActionButton.extended(
|
FloatingActionButton.extended(
|
||||||
@ -206,8 +192,10 @@ class ChatListViewBody extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
i--;
|
i--;
|
||||||
if (!rooms[i].displayname.toLowerCase().contains(
|
if (!rooms[i]
|
||||||
controller.searchController.text.toLowerCase())) {
|
.displayname
|
||||||
|
.toLowerCase()
|
||||||
|
.contains(controller.searchController.text.toLowerCase())) {
|
||||||
return Container();
|
return Container();
|
||||||
}
|
}
|
||||||
return ChatListItem(
|
return ChatListItem(
|
||||||
|
@ -4,11 +4,13 @@ import 'package:flutter/services.dart';
|
|||||||
import 'package:badges/badges.dart';
|
import 'package:badges/badges.dart';
|
||||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||||
import 'package:keyboard_shortcuts/keyboard_shortcuts.dart';
|
import 'package:keyboard_shortcuts/keyboard_shortcuts.dart';
|
||||||
|
import 'package:matrix/matrix.dart';
|
||||||
import 'package:vrouter/vrouter.dart';
|
import 'package:vrouter/vrouter.dart';
|
||||||
|
|
||||||
import 'package:fluffychat/config/app_config.dart';
|
import 'package:fluffychat/config/app_config.dart';
|
||||||
import 'package:fluffychat/config/themes.dart';
|
import 'package:fluffychat/config/themes.dart';
|
||||||
import 'package:fluffychat/pages/chat_list/chat_list.dart';
|
import 'package:fluffychat/pages/chat_list/chat_list.dart';
|
||||||
|
import 'package:fluffychat/utils/stream_extension.dart';
|
||||||
import 'package:fluffychat/widgets/avatar.dart';
|
import 'package:fluffychat/widgets/avatar.dart';
|
||||||
import 'package:fluffychat/widgets/unread_rooms_badge.dart';
|
import 'package:fluffychat/widgets/unread_rooms_badge.dart';
|
||||||
import '../../widgets/matrix.dart';
|
import '../../widgets/matrix.dart';
|
||||||
@ -103,12 +105,21 @@ class ChatListView extends StatelessWidget {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: Row(
|
child: StreamBuilder<Object>(
|
||||||
|
key: ValueKey(client.userID.toString() +
|
||||||
|
controller.activeFilter.toString() +
|
||||||
|
controller.activeSpaceId.toString()),
|
||||||
|
stream: client.onSync.stream
|
||||||
|
.where((s) => s.hasRoomUpdate)
|
||||||
|
.rateLimit(const Duration(seconds: 1)),
|
||||||
|
builder: (context, snapshot) {
|
||||||
|
return Row(
|
||||||
children: [
|
children: [
|
||||||
if (FluffyThemes.isColumnMode(context) &&
|
if (FluffyThemes.isColumnMode(context) &&
|
||||||
FluffyThemes.getDisplayNavigationRail(context)) ...[
|
FluffyThemes.getDisplayNavigationRail(context)) ...[
|
||||||
Builder(builder: (context) {
|
Builder(builder: (context) {
|
||||||
final allSpaces = client.rooms.where((room) => room.isSpace);
|
final allSpaces =
|
||||||
|
client.rooms.where((room) => room.isSpace);
|
||||||
final rootSpaces = allSpaces
|
final rootSpaces = allSpaces
|
||||||
.where(
|
.where(
|
||||||
(space) => !allSpaces.any(
|
(space) => !allSpaces.any(
|
||||||
@ -126,7 +137,8 @@ class ChatListView extends StatelessWidget {
|
|||||||
itemCount: rootSpaces.length + destinations.length,
|
itemCount: rootSpaces.length + destinations.length,
|
||||||
itemBuilder: (context, i) {
|
itemBuilder: (context, i) {
|
||||||
if (i < destinations.length) {
|
if (i < destinations.length) {
|
||||||
final isSelected = i == controller.selectedIndex;
|
final isSelected =
|
||||||
|
i == controller.selectedIndex;
|
||||||
return Container(
|
return Container(
|
||||||
height: 64,
|
height: 64,
|
||||||
width: 64,
|
width: 64,
|
||||||
@ -135,12 +147,15 @@ class ChatListView extends StatelessWidget {
|
|||||||
bottom: i == (destinations.length - 1)
|
bottom: i == (destinations.length - 1)
|
||||||
? BorderSide(
|
? BorderSide(
|
||||||
width: 1,
|
width: 1,
|
||||||
color: Theme.of(context).dividerColor,
|
color: Theme.of(context)
|
||||||
|
.dividerColor,
|
||||||
)
|
)
|
||||||
: BorderSide.none,
|
: BorderSide.none,
|
||||||
left: BorderSide(
|
left: BorderSide(
|
||||||
color: isSelected
|
color: isSelected
|
||||||
? Theme.of(context).colorScheme.primary
|
? Theme.of(context)
|
||||||
|
.colorScheme
|
||||||
|
.primary
|
||||||
: Colors.transparent,
|
: Colors.transparent,
|
||||||
width: 4,
|
width: 4,
|
||||||
),
|
),
|
||||||
@ -153,11 +168,15 @@ class ChatListView extends StatelessWidget {
|
|||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
child: IconButton(
|
child: IconButton(
|
||||||
color: isSelected
|
color: isSelected
|
||||||
? Theme.of(context).colorScheme.secondary
|
? Theme.of(context)
|
||||||
|
.colorScheme
|
||||||
|
.secondary
|
||||||
: null,
|
: null,
|
||||||
icon: CircleAvatar(
|
icon: CircleAvatar(
|
||||||
backgroundColor: isSelected
|
backgroundColor: isSelected
|
||||||
? Theme.of(context).colorScheme.secondary
|
? Theme.of(context)
|
||||||
|
.colorScheme
|
||||||
|
.secondary
|
||||||
: Theme.of(context)
|
: Theme.of(context)
|
||||||
.colorScheme
|
.colorScheme
|
||||||
.background,
|
.background,
|
||||||
@ -179,8 +198,8 @@ class ChatListView extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
i -= destinations.length;
|
i -= destinations.length;
|
||||||
final isSelected =
|
final isSelected = controller.activeFilter ==
|
||||||
controller.activeFilter == ActiveFilter.spaces &&
|
ActiveFilter.spaces &&
|
||||||
rootSpaces[i].id == controller.activeSpaceId;
|
rootSpaces[i].id == controller.activeSpaceId;
|
||||||
return Container(
|
return Container(
|
||||||
height: 64,
|
height: 64,
|
||||||
@ -189,7 +208,9 @@ class ChatListView extends StatelessWidget {
|
|||||||
border: Border(
|
border: Border(
|
||||||
left: BorderSide(
|
left: BorderSide(
|
||||||
color: isSelected
|
color: isSelected
|
||||||
? Theme.of(context).colorScheme.secondary
|
? Theme.of(context)
|
||||||
|
.colorScheme
|
||||||
|
.secondary
|
||||||
: Colors.transparent,
|
: Colors.transparent,
|
||||||
width: 4,
|
width: 4,
|
||||||
),
|
),
|
||||||
@ -208,8 +229,8 @@ class ChatListView extends StatelessWidget {
|
|||||||
size: 32,
|
size: 32,
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
),
|
),
|
||||||
onPressed: () =>
|
onPressed: () => controller
|
||||||
controller.setActiveSpace(rootSpaces[i].id),
|
.setActiveSpace(rootSpaces[i].id),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@ -231,10 +252,12 @@ class ChatListView extends StatelessWidget {
|
|||||||
selectedIndex: controller.selectedIndex,
|
selectedIndex: controller.selectedIndex,
|
||||||
onDestinationSelected:
|
onDestinationSelected:
|
||||||
controller.onDestinationSelected,
|
controller.onDestinationSelected,
|
||||||
destinations: getNavigationDestinations(context),
|
destinations:
|
||||||
|
getNavigationDestinations(context),
|
||||||
)
|
)
|
||||||
: null,
|
: null,
|
||||||
floatingActionButton: controller.filteredRooms.isNotEmpty &&
|
floatingActionButton: controller
|
||||||
|
.filteredRooms.isNotEmpty &&
|
||||||
selectMode == SelectMode.normal
|
selectMode == SelectMode.normal
|
||||||
? KeyBoardShortcuts(
|
? KeyBoardShortcuts(
|
||||||
keysToPress: {
|
keysToPress: {
|
||||||
@ -251,7 +274,8 @@ class ChatListView extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
);
|
||||||
|
}),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
@ -17,9 +17,13 @@ class HomeserverPickerView extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final benchmarkResults = controller.benchmarkResults;
|
final benchmarkResults = controller.benchmarkResults;
|
||||||
return LoginScaffold(
|
return LoginScaffold(
|
||||||
body: Column(
|
body: SafeArea(
|
||||||
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
HomeserverAppBar(controller: controller),
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(12.0),
|
||||||
|
child: HomeserverAppBar(controller: controller),
|
||||||
|
),
|
||||||
// display a prominent banner to import session for TOR browser
|
// display a prominent banner to import session for TOR browser
|
||||||
// users. This feature is just some UX sugar as TOR users are
|
// users. This feature is just some UX sugar as TOR users are
|
||||||
// usually forced to logout as TOR browser is non-persistent
|
// usually forced to logout as TOR browser is non-persistent
|
||||||
@ -138,7 +142,8 @@ class HomeserverPickerView extends StatelessWidget {
|
|||||||
tag: 'loginButton',
|
tag: 'loginButton',
|
||||||
child: ElevatedButton(
|
child: ElevatedButton(
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
backgroundColor: Theme.of(context).colorScheme.primary,
|
backgroundColor:
|
||||||
|
Theme.of(context).colorScheme.primary,
|
||||||
foregroundColor:
|
foregroundColor:
|
||||||
Theme.of(context).colorScheme.onPrimary,
|
Theme.of(context).colorScheme.onPrimary,
|
||||||
),
|
),
|
||||||
@ -156,6 +161,7 @@ class HomeserverPickerView extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user