2021-11-13 10:20:09 +01:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
|
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
|
|
|
import 'package:matrix/matrix.dart';
|
|
|
|
|
|
|
|
import 'chat.dart';
|
|
|
|
|
|
|
|
class TombstoneDisplay extends StatelessWidget {
|
|
|
|
final ChatController controller;
|
2022-01-29 12:35:03 +01:00
|
|
|
const TombstoneDisplay(this.controller, {Key? key}) : super(key: key);
|
2021-11-13 10:20:09 +01:00
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2022-01-29 12:35:03 +01:00
|
|
|
if (controller.room!.getState(EventTypes.RoomTombstone) == null) {
|
2021-11-13 10:20:09 +01:00
|
|
|
return Container();
|
|
|
|
}
|
|
|
|
return SizedBox(
|
|
|
|
height: 72,
|
|
|
|
child: Material(
|
2022-07-08 10:19:07 +02:00
|
|
|
color: Theme.of(context).colorScheme.surfaceVariant,
|
2021-11-13 10:20:09 +01:00
|
|
|
elevation: 1,
|
|
|
|
child: ListTile(
|
|
|
|
leading: CircleAvatar(
|
2022-07-08 10:19:07 +02:00
|
|
|
foregroundColor: Theme.of(context).colorScheme.onSecondary,
|
|
|
|
backgroundColor: Theme.of(context).colorScheme.secondary,
|
2021-11-13 10:20:09 +01:00
|
|
|
child: const Icon(Icons.upgrade_outlined),
|
|
|
|
),
|
|
|
|
title: Text(
|
2022-01-29 12:35:03 +01:00
|
|
|
controller.room!
|
|
|
|
.getState(EventTypes.RoomTombstone)!
|
2021-11-13 10:20:09 +01:00
|
|
|
.parsedTombstoneContent
|
|
|
|
.body,
|
|
|
|
maxLines: 1,
|
|
|
|
overflow: TextOverflow.ellipsis,
|
2022-07-08 10:19:07 +02:00
|
|
|
style: TextStyle(
|
|
|
|
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
|
|
|
),
|
2021-11-13 10:20:09 +01:00
|
|
|
),
|
2022-01-29 12:35:03 +01:00
|
|
|
subtitle: Text(L10n.of(context)!.goToTheNewRoom),
|
2021-11-13 10:20:09 +01:00
|
|
|
onTap: controller.goToNewRoomAction,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|