2022-02-02 14:31:15 +01:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
|
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
|
|
|
import 'package:matrix/matrix.dart';
|
|
|
|
import 'package:url_launcher/link.dart';
|
|
|
|
|
|
|
|
class WidgetsBottomSheet extends StatelessWidget {
|
|
|
|
final Room room;
|
|
|
|
|
|
|
|
const WidgetsBottomSheet({Key? key, required this.room}) : super(key: key);
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return ListView.builder(
|
|
|
|
shrinkWrap: true,
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
if (index == room.widgets.length) {
|
|
|
|
return ListTile(
|
|
|
|
title: Text(L10n.of(context)!.integrationsNotImplemented),
|
|
|
|
leading: const Icon(Icons.info),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
final widget = room.widgets[index];
|
|
|
|
return Link(
|
|
|
|
builder: (context, callback) {
|
|
|
|
return ListTile(
|
2022-02-14 09:25:29 +01:00
|
|
|
title: Text(widget.name ?? widget.url),
|
2022-02-02 14:31:15 +01:00
|
|
|
subtitle: Text(widget.type),
|
|
|
|
onTap: callback,
|
|
|
|
);
|
|
|
|
},
|
|
|
|
target: LinkTarget.blank,
|
|
|
|
uri: Uri.parse(widget.url),
|
|
|
|
);
|
|
|
|
},
|
|
|
|
itemCount: room.widgets.length + 1,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|