feat: allow to create widgets
- supported widget types: therpad, jitsi, video, custom - update Matrix SDK Signed-off-by: TheOneWithTheBraid <the-one@with-the-braid.cf>
This commit is contained in:
parent
f335cdbaf6
commit
0ddaff75db
9 changed files with 241 additions and 18 deletions
71
lib/pages/chat/add_widget_tile_view.dart
Normal file
71
lib/pages/chat/add_widget_tile_view.dart
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
|
||||
import 'package:fluffychat/pages/chat/add_widget_tile.dart';
|
||||
|
||||
class AddWidgetTileView extends StatelessWidget {
|
||||
final AddWidgetTileState controller;
|
||||
|
||||
const AddWidgetTileView({Key? key, required this.controller})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ExpansionTile(
|
||||
title: Text(L10n.of(context)!.addWidget),
|
||||
leading: const Icon(Icons.add),
|
||||
initiallyExpanded: controller.initiallyExpanded,
|
||||
children: [
|
||||
CupertinoSegmentedControl(
|
||||
groupValue: controller.widgetType,
|
||||
padding: const EdgeInsets.all(8),
|
||||
children: {
|
||||
'm.etherpad': Text(L10n.of(context)!.widgetEtherpad),
|
||||
'm.jitsi': Text(L10n.of(context)!.widgetJitsi),
|
||||
'm.video': Text(L10n.of(context)!.widgetVideo),
|
||||
'm.custom': Text(L10n.of(context)!.widgetCustom),
|
||||
}.map((key, value) => MapEntry(
|
||||
key,
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 4.0),
|
||||
child: value,
|
||||
))),
|
||||
onValueChanged: controller.setWidgetType,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: TextField(
|
||||
controller: controller.nameController,
|
||||
autofocus: true,
|
||||
decoration: InputDecoration(
|
||||
prefixIcon: const Icon(Icons.label),
|
||||
label: Text(L10n.of(context)!.widgetName),
|
||||
errorText: controller.nameError,
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: TextField(
|
||||
controller: controller.urlController,
|
||||
decoration: InputDecoration(
|
||||
prefixIcon: const Icon(Icons.add_link),
|
||||
label: Text(L10n.of(context)!.link),
|
||||
errorText: controller.urlError,
|
||||
),
|
||||
),
|
||||
),
|
||||
ButtonBar(
|
||||
children: [
|
||||
TextButton(
|
||||
onPressed: controller.addWidget,
|
||||
child: Text(L10n.of(context)!.addWidget),
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue