-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TW-777: refactor all messages content
- Loading branch information
Showing
12 changed files
with
172 additions
and
131 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,61 @@ | ||
import 'package:fluffychat/pages/chat/events/button_content_style.dart'; | ||
import 'package:flutter/material.dart'; | ||
|
||
class ButtonContent extends StatelessWidget { | ||
final Function onTap; | ||
final IconData icon; | ||
final String title; | ||
|
||
const ButtonContent({ | ||
Key? key, | ||
required this.onTap, | ||
required this.icon, | ||
required this.title, | ||
}) : super(key: key); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Padding( | ||
padding: ButtonContentStyle.parentPadding, | ||
child: InkWell( | ||
onTap: () => onTap, | ||
child: Row( | ||
crossAxisAlignment: CrossAxisAlignment.start, | ||
children: [ | ||
Row( | ||
crossAxisAlignment: CrossAxisAlignment.center, | ||
children: [ | ||
Container( | ||
decoration: BoxDecoration( | ||
color: Theme.of(context).colorScheme.onError, | ||
shape: BoxShape.circle, | ||
), | ||
padding: ButtonContentStyle.leadingIconPadding, | ||
child: Icon( | ||
icon, | ||
color: Theme.of(context).colorScheme.primary, | ||
size: ButtonContentStyle.leadingIconSize, | ||
), | ||
), | ||
const SizedBox(width: ButtonContentStyle.leadingAndTextGap), | ||
Container( | ||
constraints: const BoxConstraints( | ||
maxWidth: ButtonContentStyle.textMaxWidth, | ||
), | ||
child: Text( | ||
title, | ||
maxLines: 2, | ||
overflow: TextOverflow.ellipsis, | ||
style: Theme.of(context).textTheme.bodyMedium!.copyWith( | ||
color: Theme.of(context).colorScheme.onSurface, | ||
), | ||
), | ||
), | ||
], | ||
), | ||
], | ||
), | ||
), | ||
); | ||
} | ||
} |
7 changes: 4 additions & 3 deletions
7
.../chat/events/encrypted_content_style.dart → ...ges/chat/events/button_content_style.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
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,28 @@ | ||
import 'package:fluffychat/pages/chat/events/button_content.dart'; | ||
import 'package:fluffychat/pages/chat/events/message_content_mixin.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:matrix/matrix.dart'; | ||
import 'package:flutter_gen/gen_l10n/l10n.dart'; | ||
|
||
class CallInviteContent extends StatelessWidget with MessageContentMixin { | ||
final Event event; | ||
|
||
const CallInviteContent({Key? key, required this.event}) : super(key: key); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return FutureBuilder<User?>( | ||
future: event.fetchSenderUser(), | ||
builder: (context, snapshot) { | ||
return ButtonContent( | ||
title: L10n.of(context)!.startedACall( | ||
snapshot.data?.calcDisplayname() ?? | ||
event.senderFromMemoryOrFallback.calcDisplayname(), | ||
), | ||
icon: Icons.phone_outlined, | ||
onTap: () => showEventInfo(context, event), | ||
); | ||
}, | ||
); | ||
} | ||
} |
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,8 @@ | ||
import 'package:fluffychat/pages/chat/event_info_dialog.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:matrix/matrix.dart'; | ||
|
||
mixin MessageContentMixin { | ||
void showEventInfo(BuildContext context, Event event) => | ||
event.showInfoDialog(context); | ||
} |
Oops, something went wrong.