-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TW-503: Update UI chat details for responsive mobile, tablet, web
- Loading branch information
Showing
9 changed files
with
497 additions
and
431 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import 'package:fluffychat/pages/chat_details/chat_details_actions_enum.dart'; | ||
import 'package:flutter/material.dart'; | ||
|
||
import 'chat_details_actions_button.dart'; | ||
|
||
typedef OnTapIconButtonCallbackAction = Function(ChatDetailsActions); | ||
|
||
class ActionsHeaderBuilder extends StatelessWidget { | ||
final List<ChatDetailsActions> actions; | ||
|
||
final double? width; | ||
|
||
final double? iconSize; | ||
|
||
final double? borderRadius; | ||
|
||
final BorderSide? borderSide; | ||
|
||
final EdgeInsetsDirectional? padding; | ||
|
||
final Color? buttonColor; | ||
|
||
final Color? iconColor; | ||
|
||
final OnTapIconButtonCallbackAction? onTap; | ||
|
||
const ActionsHeaderBuilder({ | ||
super.key, | ||
required this.actions, | ||
this.width, | ||
this.iconSize, | ||
this.borderRadius, | ||
this.borderSide, | ||
this.padding, | ||
this.buttonColor, | ||
this.iconColor, | ||
this.onTap, | ||
}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Padding( | ||
padding: const EdgeInsetsDirectional.all(16.0), | ||
child: Wrap( | ||
spacing: 16, | ||
children: actions.map((action) { | ||
return ChatDetailsActionsButton( | ||
title: action.getTitle(context), | ||
onTap: () => onTap!(action), | ||
iconData: action.getIconData(), | ||
iconSize: iconSize, | ||
width: width, | ||
borderRadius: borderRadius, | ||
borderSide: borderSide, | ||
padding: padding, | ||
buttonColor: buttonColor, | ||
iconColor: iconColor, | ||
); | ||
}).toList(), | ||
), | ||
); | ||
} | ||
} |
117 changes: 117 additions & 0 deletions
117
lib/pages/chat_details/chat_details_page_view/chat_details_members_page.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
import 'package:fluffychat/pages/chat_details/participant_list_item.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:linagora_design_flutter/linagora_design_flutter.dart'; | ||
import 'package:flutter_gen/gen_l10n/l10n.dart'; | ||
import 'package:matrix/matrix.dart'; | ||
|
||
class ChatDetailsMembersPage extends StatelessWidget { | ||
final List<User> members; | ||
final int actualMembersCount; | ||
final VoidCallback openDialogInvite; | ||
final VoidCallback requestMoreMembersAction; | ||
final bool canRequestMoreMembers; | ||
final bool isMobileAndTablet; | ||
|
||
const ChatDetailsMembersPage({ | ||
super.key, | ||
required this.members, | ||
required this.actualMembersCount, | ||
required this.openDialogInvite, | ||
required this.requestMoreMembersAction, | ||
required this.canRequestMoreMembers, | ||
required this.isMobileAndTablet, | ||
}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Column( | ||
children: [ | ||
_listMemberInfoMobileAndTablet(context), | ||
Expanded( | ||
child: ListView.builder( | ||
shrinkWrap: true, | ||
itemCount: members.length + (canRequestMoreMembers ? 1 : 0), | ||
itemBuilder: (BuildContext context, int index) { | ||
if (index < members.length) { | ||
return ParticipantListItem(members[index]); | ||
} | ||
|
||
return ListTile( | ||
title: Text( | ||
L10n.of(context)!.loadCountMoreParticipants( | ||
(actualMembersCount - members.length).toString(), | ||
), | ||
), | ||
leading: CircleAvatar( | ||
backgroundColor: Theme.of(context).scaffoldBackgroundColor, | ||
child: const Icon( | ||
Icons.refresh, | ||
color: Colors.grey, | ||
), | ||
), | ||
onTap: requestMoreMembersAction, | ||
); | ||
}, | ||
), | ||
), | ||
], | ||
); | ||
} | ||
|
||
Widget _listMemberInfoMobileAndTablet(BuildContext context) { | ||
if (!isMobileAndTablet) return const SizedBox.shrink(); | ||
return Column( | ||
children: [ | ||
Container( | ||
padding: const EdgeInsetsDirectional.all(16), | ||
color: LinagoraSysColors.material().surface, | ||
child: Align( | ||
alignment: Alignment.centerLeft, | ||
child: Text( | ||
L10n.of(context)!.membersInfo( | ||
actualMembersCount.toString(), | ||
), | ||
maxLines: 1, | ||
overflow: TextOverflow.ellipsis, | ||
style: Theme.of(context).textTheme.labelLarge?.copyWith( | ||
color: LinagoraRefColors.material().neutral[40], | ||
), | ||
), | ||
), | ||
), | ||
InkWell( | ||
onTap: openDialogInvite, | ||
child: Container( | ||
padding: const EdgeInsetsDirectional.only( | ||
start: 16.0, | ||
top: 8.0, | ||
bottom: 8.0, | ||
), | ||
margin: const EdgeInsetsDirectional.symmetric( | ||
horizontal: 16.0, | ||
vertical: 10.0, | ||
), | ||
child: Row( | ||
children: [ | ||
Icon( | ||
Icons.person_add, | ||
size: 18, | ||
color: LinagoraSysColors.material().primary, | ||
), | ||
const SizedBox(width: 8), | ||
Text( | ||
L10n.of(context)!.addMembers, | ||
maxLines: 1, | ||
overflow: TextOverflow.ellipsis, | ||
style: Theme.of(context).textTheme.labelLarge?.copyWith( | ||
color: LinagoraSysColors.material().primary, | ||
), | ||
), | ||
], | ||
), | ||
), | ||
), | ||
], | ||
); | ||
} | ||
} |
Oops, something went wrong.