11import 'dart:developer' ;
2+
23import 'package:flutter/material.dart' ;
34import 'package:flutter_html/flutter_html.dart' ;
45import 'package:flutter_inappwebview/flutter_inappwebview.dart' ;
@@ -13,7 +14,6 @@ import 'package:freecodecamp/ui/views/learn/widgets/challenge_widgets/project_pr
1314import 'package:freecodecamp/ui/views/learn/widgets/challenge_widgets/symbol_bar.dart' ;
1415import 'package:freecodecamp/ui/views/learn/widgets/console/console_view.dart' ;
1516import 'package:freecodecamp/ui/views/news/html_handler/html_handler.dart' ;
16- import 'package:phone_ide/phone_ide.dart' ;
1717import 'package:stacked/stacked.dart' ;
1818
1919class ChallengeView extends StatelessWidget {
@@ -550,10 +550,11 @@ class ChallengeView extends StatelessWidget {
550550 );
551551 }
552552
553- Widget _testExpansionTile ({
553+ Widget _testTile ({
554554 required dynamic test,
555555 required BuildContext context,
556556 required ChallengeViewModel model,
557+ required int index,
557558 }) {
558559 final parser = HTMLParser (context: context);
559560 final widgets = parser.parse (
@@ -566,32 +567,27 @@ class ChallengeView extends StatelessWidget {
566567 'p' : Style (margin: Margins .zero),
567568 },
568569 );
569- return ExpansionTile (
570- backgroundColor: FccColors .gray90,
571- collapsedBackgroundColor: FccColors .gray85,
572- title: Column (
573- crossAxisAlignment: CrossAxisAlignment .start,
574- children: widgets,
575- ),
576- children: [
577- Container (
578- color: FccColors .gray80,
579- constraints: const BoxConstraints (minHeight: 10 , maxHeight: 1000 ),
580- padding: const EdgeInsets .symmetric (
581- vertical: 12 ,
582- ),
583- child: Editor (
584- defaultLanguage: 'javascript' ,
585- path: '' ,
586- defaultValue: test.javaScript,
587- options: EditorOptions (
588- isEditable: false ,
589- takeFullHeight: false ,
590- showLinebar: false ,
570+ return Padding (
571+ padding: const EdgeInsets .all (12 ),
572+ child: Row (
573+ children: [
574+ Expanded (
575+ child: Column (
576+ crossAxisAlignment: CrossAxisAlignment .start,
577+ children: widgets,
591578 ),
592579 ),
593- ),
594- ],
580+ if (model.testConsoleMessages.isNotEmpty ||
581+ model.userConsoleMessages.isNotEmpty) ...[
582+ const SizedBox (width: 8 ),
583+ Icon (
584+ model.failedTestIndexes.contains (index)
585+ ? Icons .cancel_rounded
586+ : Icons .check_circle_rounded,
587+ ),
588+ ]
589+ ],
590+ ),
595591 );
596592 }
597593
@@ -640,19 +636,23 @@ class ChallengeView extends StatelessWidget {
640636 }
641637
642638 Widget testList (Challenge challenge, ChallengeViewModel model) {
643- log (challenge.challengeType.toString ());
644- return ListView .builder (
639+ return ListView .separated (
645640 shrinkWrap: true ,
646641 physics: const ClampingScrollPhysics (),
647642 itemCount: challenge.tests.length,
648643 itemBuilder: (context, index) {
649644 final test = challenge.tests[index];
650- return _testExpansionTile (
645+ return _testTile (
651646 test: test,
652647 context: context,
653648 model: model,
649+ index: index,
654650 );
655651 },
652+ separatorBuilder: (BuildContext context, int i) => const Divider (
653+ color: Colors .white,
654+ height: 1 ,
655+ ),
656656 );
657657 }
658658}
0 commit comments