fix: Ignore list

This commit is contained in:
Christian Pauly 2021-01-16 18:09:41 +01:00
parent 5e6226714e
commit 0458064c44

View File

@ -7,15 +7,17 @@ import 'package:flutter_gen/gen_l10n/l10n.dart';
import '../components/matrix.dart'; import '../components/matrix.dart';
class SettingsIgnoreList extends StatelessWidget { class SettingsIgnoreList extends StatelessWidget {
final controller = TextEditingController(); final TextEditingController _controller = TextEditingController();
void _ignoreUser(BuildContext context) { void _ignoreUser(BuildContext context) {
if (controller.text.isEmpty) return; if (_controller.text.isEmpty) return;
final userId = '@${_controller.text}';
showFutureLoadingDialog( showFutureLoadingDialog(
context: context, context: context,
future: () => Matrix.of(context).client.ignoreUser('@${controller.text}'), future: () => Matrix.of(context).client.ignoreUser(userId),
); );
controller.clear(); _controller.clear();
} }
@override @override
@ -34,7 +36,7 @@ class SettingsIgnoreList extends StatelessWidget {
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
TextField( TextField(
controller: controller, controller: _controller,
autocorrect: false, autocorrect: false,
textInputAction: TextInputAction.done, textInputAction: TextInputAction.done,
onSubmitted: (_) => _ignoreUser(context), onSubmitted: (_) => _ignoreUser(context),