chore: Follow up pinned events
This commit is contained in:
parent
b20cee34d4
commit
8128c960dc
3 changed files with 37 additions and 34 deletions
|
|
@ -2,7 +2,6 @@ import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import 'package:flutter_linkify/flutter_linkify.dart';
|
import 'package:flutter_linkify/flutter_linkify.dart';
|
||||||
|
|
||||||
import 'package:fluffychat/config/app_config.dart';
|
|
||||||
import 'package:fluffychat/utils/url_launcher.dart';
|
import 'package:fluffychat/utils/url_launcher.dart';
|
||||||
|
|
||||||
class ChatAppBarListTile extends StatelessWidget {
|
class ChatAppBarListTile extends StatelessWidget {
|
||||||
|
|
@ -11,6 +10,8 @@ class ChatAppBarListTile extends StatelessWidget {
|
||||||
final Widget? trailing;
|
final Widget? trailing;
|
||||||
final void Function()? onTap;
|
final void Function()? onTap;
|
||||||
|
|
||||||
|
static const double fixedHeight = 40.0;
|
||||||
|
|
||||||
const ChatAppBarListTile({
|
const ChatAppBarListTile({
|
||||||
super.key,
|
super.key,
|
||||||
this.leading,
|
this.leading,
|
||||||
|
|
@ -23,38 +24,40 @@ class ChatAppBarListTile extends StatelessWidget {
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final leading = this.leading;
|
final leading = this.leading;
|
||||||
final trailing = this.trailing;
|
final trailing = this.trailing;
|
||||||
final fontSize = AppConfig.messageFontSize * AppConfig.fontSizeFactor;
|
return SizedBox(
|
||||||
return InkWell(
|
height: fixedHeight,
|
||||||
onTap: onTap,
|
child: InkWell(
|
||||||
child: Row(
|
onTap: onTap,
|
||||||
children: [
|
child: Row(
|
||||||
if (leading != null) leading,
|
children: [
|
||||||
Expanded(
|
if (leading != null) leading,
|
||||||
child: Padding(
|
Expanded(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 4.0),
|
child: Padding(
|
||||||
child: Linkify(
|
padding: const EdgeInsets.symmetric(horizontal: 4.0),
|
||||||
text: title,
|
child: Linkify(
|
||||||
options: const LinkifyOptions(humanize: false),
|
text: title,
|
||||||
maxLines: 1,
|
options: const LinkifyOptions(humanize: false),
|
||||||
overflow: TextOverflow.ellipsis,
|
maxLines: 1,
|
||||||
style: TextStyle(
|
|
||||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
fontSize: fontSize,
|
style: TextStyle(
|
||||||
|
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
fontSize: 14,
|
||||||
|
),
|
||||||
|
linkStyle: TextStyle(
|
||||||
|
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||||
|
fontSize: 14,
|
||||||
|
decoration: TextDecoration.underline,
|
||||||
|
decorationColor:
|
||||||
|
Theme.of(context).colorScheme.onSurfaceVariant,
|
||||||
|
),
|
||||||
|
onOpen: (url) => UrlLauncher(context, url.url).launchUrl(),
|
||||||
),
|
),
|
||||||
linkStyle: TextStyle(
|
|
||||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
|
||||||
fontSize: fontSize,
|
|
||||||
decoration: TextDecoration.underline,
|
|
||||||
decorationColor:
|
|
||||||
Theme.of(context).colorScheme.onSurfaceVariant,
|
|
||||||
),
|
|
||||||
onOpen: (url) => UrlLauncher(context, url.url).launchUrl(),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
if (trailing != null) trailing,
|
||||||
if (trailing != null) trailing,
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -158,15 +158,15 @@ class ChatView extends StatelessWidget {
|
||||||
builder: (BuildContext context, snapshot) {
|
builder: (BuildContext context, snapshot) {
|
||||||
var appbarBottomHeight = 0.0;
|
var appbarBottomHeight = 0.0;
|
||||||
if (controller.room.pinnedEventIds.isNotEmpty) {
|
if (controller.room.pinnedEventIds.isNotEmpty) {
|
||||||
appbarBottomHeight += 42;
|
appbarBottomHeight += ChatAppBarListTile.fixedHeight;
|
||||||
}
|
}
|
||||||
if (scrollUpBannerEventId != null) {
|
if (scrollUpBannerEventId != null) {
|
||||||
appbarBottomHeight += 42;
|
appbarBottomHeight += ChatAppBarListTile.fixedHeight;
|
||||||
}
|
}
|
||||||
final tombstoneEvent =
|
final tombstoneEvent =
|
||||||
controller.room.getState(EventTypes.RoomTombstone);
|
controller.room.getState(EventTypes.RoomTombstone);
|
||||||
if (tombstoneEvent != null) {
|
if (tombstoneEvent != null) {
|
||||||
appbarBottomHeight += 42;
|
appbarBottomHeight += ChatAppBarListTile.fixedHeight;
|
||||||
}
|
}
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
|
|
|
||||||
|
|
@ -71,8 +71,8 @@ class PinnedEvents extends StatelessWidget {
|
||||||
) ??
|
) ??
|
||||||
L10n.of(context)!.loadingPleaseWait,
|
L10n.of(context)!.loadingPleaseWait,
|
||||||
leading: IconButton(
|
leading: IconButton(
|
||||||
splashRadius: 20,
|
splashRadius: 18,
|
||||||
iconSize: 20,
|
iconSize: 18,
|
||||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||||
icon: const Icon(Icons.push_pin),
|
icon: const Icon(Icons.push_pin),
|
||||||
tooltip: L10n.of(context)!.unpin,
|
tooltip: L10n.of(context)!.unpin,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue