chore: Design follow up fixes

This commit is contained in:
Christian Pauly 2022-07-08 15:42:47 +02:00
parent e129e3ecaf
commit 7ad2359214
7 changed files with 70 additions and 43 deletions

View File

@ -59,7 +59,6 @@ class _ChatListViewBodyState extends State<ChatListViewBody> {
child = Column( child = Column(
key: const ValueKey(null), key: const ValueKey(null),
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: <Widget>[ children: <Widget>[
Image.asset( Image.asset(
'assets/private_chat_wallpaper.png', 'assets/private_chat_wallpaper.png',
@ -76,6 +75,7 @@ class _ChatListViewBodyState extends State<ChatListViewBody> {
), ),
), ),
), ),
const SizedBox(height: 160),
], ],
); );
} else { } else {
@ -96,7 +96,10 @@ class _ChatListViewBodyState extends State<ChatListViewBody> {
children: [ children: [
const ConnectionStatusHeader(), const ConnectionStatusHeader(),
if (roomSearchResult != null) ...[ if (roomSearchResult != null) ...[
_SearchTitle(title: L10n.of(context)!.publicRooms), _SearchTitle(
title: L10n.of(context)!.publicRooms,
icon: Icons.explore_outlined,
),
AnimatedContainer( AnimatedContainer(
height: roomSearchResult.chunk.isEmpty ? 0 : 106, height: roomSearchResult.chunk.isEmpty ? 0 : 106,
duration: const Duration(milliseconds: 250), duration: const Duration(milliseconds: 250),
@ -126,7 +129,10 @@ class _ChatListViewBodyState extends State<ChatListViewBody> {
), ),
], ],
if (userSearchResult != null) ...[ if (userSearchResult != null) ...[
_SearchTitle(title: L10n.of(context)!.users), _SearchTitle(
title: L10n.of(context)!.users,
icon: Icons.group_outlined,
),
AnimatedContainer( AnimatedContainer(
height: userSearchResult.results.isEmpty ? 0 : 106, height: userSearchResult.results.isEmpty ? 0 : 106,
duration: const Duration(milliseconds: 250), duration: const Duration(milliseconds: 250),
@ -152,7 +158,10 @@ class _ChatListViewBodyState extends State<ChatListViewBody> {
), ),
], ],
if (widget.controller.isSearchMode) if (widget.controller.isSearchMode)
_SearchTitle(title: L10n.of(context)!.stories), _SearchTitle(
title: L10n.of(context)!.stories,
icon: Icons.camera_alt_outlined,
),
StoriesHeader( StoriesHeader(
filter: widget.controller.searchController.text, filter: widget.controller.searchController.text,
), ),
@ -198,7 +207,10 @@ class _ChatListViewBodyState extends State<ChatListViewBody> {
), ),
), ),
if (widget.controller.isSearchMode) if (widget.controller.isSearchMode)
_SearchTitle(title: L10n.of(context)!.chats), _SearchTitle(
title: L10n.of(context)!.chats,
icon: Icons.chat_outlined,
),
], ],
); );
} }
@ -336,7 +348,12 @@ class _ChatListViewBodyState extends State<ChatListViewBody> {
class _SearchTitle extends StatelessWidget { class _SearchTitle extends StatelessWidget {
final String title; final String title;
const _SearchTitle({required this.title, Key? key}) : super(key: key); final IconData icon;
const _SearchTitle({
required this.title,
required this.icon,
Key? key,
}) : super(key: key);
@override @override
Widget build(BuildContext context) => Container( Widget build(BuildContext context) => Container(
@ -355,13 +372,19 @@ class _SearchTitle extends StatelessWidget {
horizontal: 16, horizontal: 16,
vertical: 8, vertical: 8,
), ),
child: Text(title, child: Row(
textAlign: TextAlign.left, children: [
style: TextStyle( Icon(icon, size: 16),
color: Theme.of(context).colorScheme.onSurface, const SizedBox(width: 16),
fontSize: 12, Text(title,
fontWeight: FontWeight.bold, textAlign: TextAlign.left,
)), style: TextStyle(
color: Theme.of(context).colorScheme.onSurface,
fontSize: 12,
fontWeight: FontWeight.bold,
)),
],
),
), ),
), ),
); );

View File

@ -6,7 +6,9 @@ import 'package:vrouter/vrouter.dart';
import 'package:fluffychat/pages/chat_list/chat_list.dart'; import 'package:fluffychat/pages/chat_list/chat_list.dart';
import 'package:fluffychat/pages/chat_list/spaces_drawer.dart'; import 'package:fluffychat/pages/chat_list/spaces_drawer.dart';
import 'package:fluffychat/utils/fluffy_share.dart'; import 'package:fluffychat/utils/fluffy_share.dart';
import 'package:fluffychat/widgets/avatar.dart';
import 'package:fluffychat/widgets/matrix.dart'; import 'package:fluffychat/widgets/matrix.dart';
import '../../config/app_config.dart';
class ChatListDrawer extends StatelessWidget { class ChatListDrawer extends StatelessWidget {
final ChatListController controller; final ChatListController controller;
@ -17,12 +19,20 @@ class ChatListDrawer extends StatelessWidget {
child: SafeArea( child: SafeArea(
child: Column( child: Column(
children: [ children: [
ListTile(
leading: const CircleAvatar(
radius: Avatar.defaultSize / 2,
backgroundImage: AssetImage('assets/logo.png'),
),
title: Text(AppConfig.applicationName),
),
const Divider(thickness: 1),
Expanded( Expanded(
child: SpacesDrawer( child: SpacesDrawer(
controller: controller, controller: controller,
), ),
), ),
const Divider(), const Divider(thickness: 1),
ListTile( ListTile(
leading: Icon( leading: Icon(
Icons.group_add_outlined, Icons.group_add_outlined,
@ -34,6 +44,17 @@ class ChatListDrawer extends StatelessWidget {
VRouter.of(context).to('/newgroup'); VRouter.of(context).to('/newgroup');
}, },
), ),
ListTile(
leading: Icon(
Icons.group_work_outlined,
color: Theme.of(context).colorScheme.onBackground,
),
title: Text(L10n.of(context)!.createNewSpace),
onTap: () {
Scaffold.of(context).closeDrawer();
VRouter.of(context).to('/newspace');
},
),
ListTile( ListTile(
leading: Icon( leading: Icon(
Icons.adaptive.share_outlined, Icons.adaptive.share_outlined,

View File

@ -17,7 +17,6 @@ class ChatListHeader extends StatelessWidget implements PreferredSizeWidget {
final selectMode = controller.selectMode; final selectMode = controller.selectMode;
return AppBar( return AppBar(
titleSpacing: 8,
automaticallyImplyLeading: false, automaticallyImplyLeading: false,
leading: selectMode == SelectMode.normal leading: selectMode == SelectMode.normal
? null ? null
@ -47,7 +46,7 @@ class ChatListHeader extends StatelessWidget implements PreferredSizeWidget {
borderRadius: BorderRadius.circular(90), borderRadius: BorderRadius.circular(90),
borderSide: BorderSide.none, borderSide: BorderSide.none,
), ),
hintText: L10n.of(context)!.search, hintText: controller.activeSpacesEntry.getName(context),
prefixIcon: controller.isSearchMode prefixIcon: controller.isSearchMode
? IconButton( ? IconButton(
tooltip: L10n.of(context)!.cancel, tooltip: L10n.of(context)!.cancel,

View File

@ -24,15 +24,14 @@ class SpacesDrawer extends StatelessWidget {
// TODO(TheOeWithTheBraid): wait for space hierarchy https://gitlab.com/famedly/company/frontend/libraries/matrix_api_lite/-/merge_requests/58 // TODO(TheOeWithTheBraid): wait for space hierarchy https://gitlab.com/famedly/company/frontend/libraries/matrix_api_lite/-/merge_requests/58
return ListView.builder( return ListView.builder(
itemCount: spaceHierarchy.length + 2, itemCount: spaceHierarchy.length + 1,
itemBuilder: (context, i) { itemBuilder: (context, i) {
if (i == spaceHierarchy.length) { if (i == spaceHierarchy.length) {
return ListTile( return ListTile(
leading: CircleAvatar( leading: CircleAvatar(
radius: Avatar.defaultSize / 2, radius: Avatar.defaultSize / 2,
backgroundColor: Theme.of(context).colorScheme.secondaryContainer, backgroundColor: Theme.of(context).colorScheme.secondary,
foregroundColor: foregroundColor: Theme.of(context).colorScheme.onSecondary,
Theme.of(context).colorScheme.onSecondaryContainer,
child: const Icon( child: const Icon(
Icons.archive_outlined, Icons.archive_outlined,
), ),
@ -44,22 +43,6 @@ class SpacesDrawer extends StatelessWidget {
}, },
); );
} }
if (i == spaceHierarchy.length + 1) {
return ListTile(
leading: CircleAvatar(
child: const Icon(Icons.group_work_outlined),
radius: Avatar.defaultSize / 2,
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
foregroundColor:
Theme.of(context).colorScheme.onSecondaryContainer,
),
title: Text(L10n.of(context)!.createNewSpace),
onTap: () {
Scaffold.of(context).closeDrawer();
VRouter.of(context).to('/newspace');
},
);
}
final space = spaceHierarchy.keys.toList()[i]; final space = spaceHierarchy.keys.toList()[i];
final room = space.getSpace(context); final room = space.getSpace(context);
final active = currentIndex == i; final active = currentIndex == i;
@ -69,10 +52,8 @@ class SpacesDrawer extends StatelessWidget {
? CircleAvatar( ? CircleAvatar(
child: space.getIcon(active), child: space.getIcon(active),
radius: Avatar.defaultSize / 2, radius: Avatar.defaultSize / 2,
backgroundColor: backgroundColor: Theme.of(context).colorScheme.secondary,
Theme.of(context).colorScheme.secondaryContainer, foregroundColor: Theme.of(context).colorScheme.onSecondary,
foregroundColor:
Theme.of(context).colorScheme.onSecondaryContainer,
) )
: Avatar( : Avatar(
mxContent: room.avatar, mxContent: room.avatar,
@ -107,7 +88,7 @@ class SpacesDrawer extends StatelessWidget {
onPressed: () => controller.editSpace(context, room.id), onPressed: () => controller.editSpace(context, room.id),
), ),
) )
: null, : const Icon(Icons.arrow_forward_ios_outlined),
); );
}, },
); );

View File

@ -121,7 +121,7 @@ class StoriesHeader extends StatelessWidget {
return SizedBox( return SizedBox(
height: 98, height: 98,
child: ListView.builder( child: ListView.builder(
padding: const EdgeInsets.symmetric(horizontal: 2), padding: const EdgeInsets.symmetric(horizontal: 8),
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
itemCount: stories.length, itemCount: stories.length,
itemBuilder: (context, i) { itemBuilder: (context, i) {

View File

@ -349,6 +349,7 @@ class StoryView extends StatelessWidget {
onPressed: controller.replyAction, onPressed: controller.replyAction,
icon: const Icon(Icons.send_outlined), icon: const Icon(Icons.send_outlined),
), ),
fillColor: Theme.of(context).colorScheme.background,
), ),
), ),
), ),

View File

@ -128,7 +128,9 @@ class UserBottomSheetView extends StatelessWidget {
subtitle: Text(user.id), subtitle: Text(user.id),
trailing: Icon(Icons.adaptive.share_outlined), trailing: Icon(Icons.adaptive.share_outlined),
onTap: () => FluffyShare.share( onTap: () => FluffyShare.share(
user.id, controller.widget.outerContext), user.id,
context,
),
), ),
if (presence != null) if (presence != null)
ListTile( ListTile(