build method

  1. @override
dynamic build(
  1. dynamic context,
  2. dynamic ref
)

Implementation

@override
Widget build(BuildContext context, WidgetRef ref) {
  final aliased = aliasedHttpRegexp.firstMatch(searchVal) ??
      idAliasRegexp.firstMatch(searchVal);
  if (canMatchAlias && aliased != null) {
    final alias = aliased.namedGroup('alias')!;
    final server = aliased.namedGroup('server')!;
    return renderAliased(context, ref, alias, server);
  }

  final id = idHttpRegexp.firstMatch(searchVal) ??
      idMatrixRegexp.firstMatch(searchVal);

  if (canMatchId && id != null) {
    final roomId = id.namedGroup('id')!;
    final List<String> servers = [
      id.namedGroup('server_name') ?? '',
      id.namedGroup('server_name2') ?? '',
      id.namedGroup('server_name3') ?? '',
    ].where((e) => e.isNotEmpty).toList();
    return Padding(
      padding: const EdgeInsets.symmetric(
        horizontal: 10,
        vertical: 10,
      ),
      child: renderForRoomId(context, ref, '!$roomId', servers),
    );
  }

  return const SizedBox.shrink();
}