@@ -4,6 +4,9 @@ import 'package:flutter/services.dart';
44import 'package:flutter_animate/flutter_animate.dart' ;
55import 'package:flutter_resizable_container/flutter_resizable_container.dart' ;
66import 'package:google_fonts/google_fonts.dart' ;
7+ import 'package:flutter_highlight/flutter_highlight.dart' ;
8+ import 'package:flutter_highlight/themes/github.dart' ;
9+ import 'package:flutter_highlight/themes/dracula.dart' ;
710import 'package:llm_json_stream/classes/json_stream_parser.dart' ;
811import 'package:llm_json_stream/classes/property_stream.dart' ;
912import 'package:json_stream_parser_demo/utils/stream_text_in_chunks.dart' ;
@@ -302,8 +305,7 @@ class _OtherDemosPageState extends State<OtherDemosPage> {
302305 _DemoItem (
303306 key: ValueKey ('demo8_$_streamKey ' ),
304307 title: 'List onElement - String Streams' ,
305- code:
306- 'parser.getListProperty("tags", onElement: ...) [Stream<String>];' ,
308+ code: 'parser.getListProperty("tags", onElement: ...);' ,
307309 json:
308310 '{"tags": ["flutter", "dart", "json", "streaming"]}' ,
309311 interval: _interval,
@@ -467,16 +469,17 @@ class _DemoItemState extends State<_DemoItem> {
467469 ),
468470 ),
469471 const SizedBox (height: 16 ),
470- Container (
471- padding: const EdgeInsets .all (16 ),
472- decoration: BoxDecoration (
473- color: isDark ? Colors .grey[850 ] : Colors .grey[100 ],
474- borderRadius: BorderRadius .circular (8 ),
475- ),
476- child: SelectableText (
477- widget.code,
478- style: GoogleFonts .robotoMono (
479- fontSize: 16 ,
472+ ClipRRect (
473+ borderRadius: BorderRadius .circular (8 ),
474+ child: SelectionArea (
475+ child: HighlightView (
476+ widget.code,
477+ language: 'dart' ,
478+ theme: isDark ? draculaTheme : githubTheme,
479+ padding: const EdgeInsets .all (16 ),
480+ textStyle: GoogleFonts .robotoMono (
481+ fontSize: 16 ,
482+ ),
480483 ),
481484 ),
482485 ),
@@ -530,7 +533,7 @@ class _DemoItemState extends State<_DemoItem> {
530533 style: GoogleFonts .robotoMono (
531534 fontSize: 16 ,
532535 fontWeight: FontWeight .bold,
533- color: Colors .black,
536+ color: isDark ? Colors .white : Colors .black,
534537 letterSpacing: 0.5 ,
535538 ),
536539 ),
@@ -540,7 +543,7 @@ class _DemoItemState extends State<_DemoItem> {
540543 text: fullJson.substring (streamedLength),
541544 style: GoogleFonts .robotoMono (
542545 fontSize: 16 ,
543- color: isDark ? Colors .grey[700 ] : Colors .grey[400 ],
546+ color: isDark ? Colors .grey[600 ] : Colors .grey[400 ],
544547 letterSpacing: 0.5 ,
545548 ),
546549 ),
@@ -569,7 +572,6 @@ class _StringFutureDemo extends StatelessWidget {
569572 style: const TextStyle (
570573 fontSize: 16 ,
571574 fontWeight: FontWeight .bold,
572- color: Colors .black,
573575 ),
574576 )
575577 .animate ()
@@ -612,7 +614,6 @@ class _StringStreamDemoState extends State<_StringStreamDemo> {
612614 style: const TextStyle (
613615 fontSize: 16 ,
614616 fontWeight: FontWeight .bold,
615- color: Colors .black,
616617 ),
617618 );
618619 }
@@ -668,7 +669,9 @@ class _PropertyChip extends StatelessWidget {
668669 label: Text (
669670 '$label : ${snapshot .data }' ,
670671 style: const TextStyle (
671- fontSize: 16 , fontWeight: FontWeight .bold, color: Colors .black),
672+ fontSize: 16 ,
673+ fontWeight: FontWeight .bold,
674+ ),
672675 ),
673676 padding: const EdgeInsets .all (8 ),
674677 )
@@ -698,7 +701,6 @@ class _NestedPropertyDemo extends StatelessWidget {
698701 style: const TextStyle (
699702 fontSize: 16 ,
700703 fontWeight: FontWeight .bold,
701- color: Colors .black,
702704 ),
703705 )
704706 .animate ()
@@ -727,7 +729,6 @@ class _ListIndexDemo extends StatelessWidget {
727729 style: const TextStyle (
728730 fontSize: 16 ,
729731 fontWeight: FontWeight .bold,
730- color: Colors .black,
731732 ),
732733 )
733734 .animate ()
@@ -757,7 +758,6 @@ class _ChainingDemo extends StatelessWidget {
757758 style: const TextStyle (
758759 fontSize: 16 ,
759760 fontWeight: FontWeight .bold,
760- color: Colors .black,
761761 ),
762762 )
763763 .animate ()
@@ -814,7 +814,6 @@ class _ListOnElementObjectsDemoState extends State<_ListOnElementObjectsDemo> {
814814 style: const TextStyle (
815815 fontSize: 16 ,
816816 fontWeight: FontWeight .bold,
817- color: Colors .black,
818817 ),
819818 ),
820819 padding: const EdgeInsets .all (8 ),
@@ -884,8 +883,7 @@ class _ListOnElementStringsDemoState extends State<_ListOnElementStringsDemo> {
884883 return Chip (
885884 label: Text (
886885 tag,
887- style: const TextStyle (
888- fontSize: 16 , fontWeight: FontWeight .bold, color: Colors .black),
886+ style: const TextStyle (fontSize: 16 , fontWeight: FontWeight .bold),
889887 ),
890888 padding: const EdgeInsets .all (8 ),
891889 )
@@ -915,7 +913,6 @@ class _EdgeCaseMultilineDemo extends StatelessWidget {
915913 style: const TextStyle (
916914 fontSize: 16 ,
917915 fontWeight: FontWeight .bold,
918- color: Colors .black,
919916 ),
920917 )
921918 .animate ()
@@ -944,7 +941,6 @@ class _EdgeCaseSpecialCharsDemo extends StatelessWidget {
944941 style: const TextStyle (
945942 fontSize: 16 ,
946943 fontWeight: FontWeight .bold,
947- color: Colors .black,
948944 ),
949945 )
950946 .animate ()
0 commit comments