LCOV - code coverage report
Current view: top level - lib/exercises/categories/dictation/note_finder - dictation_page.dart Coverage Total Hit
Test: lcov.info Lines: 0.0 % 49 0
Test Date: 2025-05-10 20:26:13 Functions: - 0 0

            Line data    Source code
       1              : import 'package:amadeus_proto/constants.dart';
       2              : import 'package:amadeus_proto/exercises/categories/dictation/note_finder/dictation_audio_play.dart';
       3              : import 'package:amadeus_proto/exercises/exercise_question.dart';
       4              : import 'package:amadeus_proto/exercises/providers/note_finder_provider.dart';
       5              : import 'package:amadeus_proto/exercises/types/single_choice.dart';
       6              : import 'package:amadeus_proto/exercises/widget/animation_dialog_wrapper.dart';
       7              : import 'package:amadeus_proto/exercises/widget/exercise_header.dart';
       8              : import 'package:amadeus_proto/exercises/widget/exercises_end_dialog.dart';
       9              : import 'package:amadeus_proto/api/models/exercise_info.dart';
      10              : import 'package:amadeus_proto/widget/progress_bar.dart';
      11              : import 'package:flutter/material.dart';
      12              : import 'package:provider/provider.dart';
      13              : 
      14              : class DictationPage extends StatefulWidget {
      15            0 :   const DictationPage({super.key, required this.info});
      16              : 
      17              :   final ExerciseInfo info;
      18              : 
      19            0 :   @override
      20            0 :   State<DictationPage> createState() => _DictationPageState();
      21              : }
      22              : 
      23              : class _DictationPageState extends State<DictationPage> {
      24            0 :   @override
      25              :   void initState() {
      26            0 :     super.initState();
      27            0 :     WidgetsBinding.instance.addPostFrameCallback((_) {
      28            0 :       context.read<NoteFinderProvider>().reset();
      29              :     });
      30              :   }
      31              : 
      32            0 :   @override
      33              :   Widget build(BuildContext context) {
      34            0 :     final NoteFinderProvider dictation = context.watch<NoteFinderProvider>();
      35              : 
      36            0 :     WidgetsBinding.instance.addPostFrameCallback((_) {
      37            0 :       if (!dictation.isInitialized) {
      38            0 :         dictation.initializeData(widget.info.exerciseData);
      39            0 :         dictation.exerciseInfo = widget.info;
      40              :       }
      41            0 :       if (!dictation.displayDialog && dictation.checkEndGame()) {
      42            0 :         dictation.displayDialog = true;
      43            0 :         Future.delayed(Duration.zero, () {
      44            0 :           if (!context.mounted) return;
      45            0 :           showGeneralDialog(
      46              :               context: context,
      47              :               transitionDuration: const Duration(milliseconds: fastAnimation),
      48            0 :               pageBuilder: (context, animation1, animation2) {
      49            0 :                 return ExerciseEndDialog<NoteFinderProvider>(
      50            0 :                   leavingExerciseCallback: () {
      51            0 :                     Navigator.of(context).pop();
      52            0 :                     Navigator.of(context).pop();
      53              :                   },
      54            0 :                   resetExerciseCallback: () {
      55            0 :                     Navigator.of(context).pop();
      56            0 :                     Future.delayed(const Duration(milliseconds: fastAnimation),
      57            0 :                         () {
      58            0 :                       if (mounted) {
      59            0 :                         dictation.reset();
      60              :                       }
      61              :                     });
      62              :                   },
      63            0 :                   exerciseTitle: widget.info.exerciseData!["title"],
      64            0 :                   exerciseCategory: widget.info.exerciseData!["category"],
      65              :                 );
      66              :               },
      67              :               transitionBuilder:
      68            0 :                   (context, animation, secondaryAnimation, child) {
      69            0 :                 return ScaleTransition(
      70              :                   scale: animation,
      71            0 :                   child: AnimatedDialogWrapper(
      72              :                     animation: animation,
      73              :                     child: child,
      74              :                   ),
      75              :                 );
      76              :               });
      77              :         });
      78              :       }
      79              :     });
      80              : 
      81            0 :     return Scaffold(
      82              :         // backgroundColor: Colors.white,
      83              :         extendBodyBehindAppBar: true,
      84            0 :         body: SafeArea(
      85            0 :           child: dictation.isInitialized
      86            0 :               ? Column(
      87            0 :                   children: [
      88              :                     const ExerciseHeader<NoteFinderProvider>(),
      89              :                     const SizedBox(
      90              :                       height: 10,
      91              :                     ),
      92              :                     const ProgressBar(
      93              :                         totalAmount: 1,
      94              :                         progressAmount: 0,
      95              :                         width: 300,
      96              :                         height: 15),
      97              :                     const ExerciseQuestion<NoteFinderProvider>(),
      98            0 :                     Container(
      99            0 :                       decoration: BoxDecoration(
     100            0 :                           color: Colors.grey.withOpacity(0.1),
     101            0 :                           border: Border.all(
     102              :                             width: 0.3,
     103            0 :                             color: Colors.grey.shade500,
     104              :                           ),
     105              :                           borderRadius:
     106            0 :                               BorderRadius.circular(smallBorderRadius)),
     107            0 :                       child: Image(
     108            0 :                         image: AssetImage(dictation.questionImage),
     109              :                         width: imageAssetWidth,
     110              :                         height: imageAssetHeight,
     111              :                       ),
     112              :                     ),
     113            0 :                     PlayAudioButton(
     114            0 :                         audioPath: dictation.questions[dictation.answer]),
     115              :                     // const SizedBox(
     116              :                     //   height: 35,
     117              :                     // ),
     118              :                     const Expanded(
     119              :                       child: SingleChoiceExercise<NoteFinderProvider>(),
     120              :                     ),
     121              :                   ],
     122              :                 )
     123              :               : const Center(
     124              :                   child: CircularProgressIndicator(),
     125              :                 ),
     126              :         ));
     127              :   }
     128              : }
        

Generated by: LCOV version 2.3-1