@@ -378,10 +378,8 @@ class BlockContentList extends StatelessWidget {
378
378
return const SizedBox .shrink ();
379
379
}(),
380
380
WebsitePreviewNode () => WebsitePreview (node: node),
381
- UnimplementedBlockContentNode () =>
382
- Text .rich (_errorUnimplemented (node, context: context)),
381
+ UnimplementedBlockContentNode () => ErrorUnimplemented (node: node),
383
382
};
384
-
385
383
}),
386
384
]);
387
385
}
@@ -1302,7 +1300,8 @@ class _InlineContentBuilder {
1302
1300
child: GlobalTime (node: node, ambientTextStyle: widget.style));
1303
1301
1304
1302
case UnimplementedInlineContentNode ():
1305
- return _errorUnimplemented (node, context: _context! );
1303
+ return WidgetSpan (alignment: PlaceholderAlignment .middle,
1304
+ child: ErrorUnimplemented (node: node));
1306
1305
}
1307
1306
}
1308
1307
@@ -1929,35 +1928,52 @@ class _PresenceCircleState extends State<PresenceCircle> with PerAccountStoreAwa
1929
1928
}
1930
1929
}
1931
1930
1932
- //
1933
- // Small helpers.
1934
- //
1931
+ class ErrorUnimplemented extends StatelessWidget {
1932
+ const ErrorUnimplemented ({
1933
+ super .key,
1934
+ required this .node,
1935
+ });
1935
1936
1936
- InlineSpan _errorUnimplemented (UnimplementedNode node, {required BuildContext context}) {
1937
- final contentTheme = ContentTheme .of (context);
1938
- final errorStyle = contentTheme.textStyleError;
1939
- final errorCodeStyle = contentTheme.textStyleErrorCode;
1940
- // For now this shows error-styled HTML code even in release mode,
1941
- // because release mode isn't yet about general users but developer demos,
1942
- // and we want to keep the demos honest.
1943
- // TODO(#194) think through UX for general release
1944
- // TODO(#1285) translate this
1945
- final htmlNode = node.htmlNode;
1946
- if (htmlNode is dom.Element ) {
1947
- return TextSpan (children: [
1948
- TextSpan (text: "(unimplemented:" , style: errorStyle),
1949
- TextSpan (text: htmlNode.outerHtml, style: errorCodeStyle),
1950
- TextSpan (text: ")" , style: errorStyle),
1951
- ]);
1952
- } else if (htmlNode is dom.Text ) {
1953
- return TextSpan (children: [
1954
- TextSpan (text: "(unimplemented: text «" , style: errorStyle),
1955
- TextSpan (text: htmlNode.text, style: errorCodeStyle),
1956
- TextSpan (text: "»)" , style: errorStyle),
1957
- ]);
1958
- } else {
1959
- return TextSpan (
1960
- text: "(unimplemented: DOM node type ${htmlNode .nodeType })" ,
1961
- style: errorStyle);
1937
+ final UnimplementedNode node;
1938
+
1939
+ @override
1940
+ Widget build (BuildContext context) {
1941
+ final zulipLocalizations = ZulipLocalizations .of (context);
1942
+ final htmlNode = node.htmlNode;
1943
+ final text = htmlNode is dom.Element ? htmlNode.outerHtml : htmlNode.text ?? '' ;
1944
+ final header = [
1945
+ ParagraphNode (
1946
+ links: null ,
1947
+ nodes: [TextNode (zulipLocalizations.errorUnimplementedHeader)],
1948
+ ),
1949
+ ];
1950
+ final content = [
1951
+ HeadingNode (
1952
+ links: null ,
1953
+ nodes: [TextNode (zulipLocalizations.errorUnimplementedWhatHappened)],
1954
+ level: HeadingLevel .h3,
1955
+ ),
1956
+ ParagraphNode (
1957
+ links: null ,
1958
+ nodes: [TextNode (zulipLocalizations.errorUnimplementedDescription)],
1959
+ ),
1960
+ HeadingNode (
1961
+ links: null ,
1962
+ nodes: [TextNode (zulipLocalizations.errorUnimplementedHtmlHeading)],
1963
+ level: HeadingLevel .h3,
1964
+ ),
1965
+ ParagraphNode (
1966
+ links: null ,
1967
+ nodes: [InlineCodeNode (nodes: [TextNode (text)])],
1968
+ ),
1969
+ ];
1970
+ return Modal (
1971
+ borderColor: const Color (0xffbb0000 ),
1972
+ expandIconColor: const Color (0xffffff00 ),
1973
+ textColor: const Color (0xffffff00 ),
1974
+ bgColor: const Color (0xffff0000 ),
1975
+ header: header,
1976
+ content: content,
1977
+ );
1962
1978
}
1963
1979
}
0 commit comments