LCOV - code coverage report
Current view: top level - lib/exercises/categories/rhythm/beats - rhythm_card.dart Coverage Total Hit
Test: lcov.info Lines: 2.9 % 35 1
Test Date: 2025-05-10 20:26:13 Functions: - 0 0

            Line data    Source code
       1              : import 'package:amadeus_proto/exercises/categories/rhythm/beats/animated_bar.dart';
       2              : import 'package:amadeus_proto/exercises/providers/beats_clicking_provider.dart';
       3              : import 'package:amadeus_proto/exercises/exercise_question.dart';
       4              : import 'package:amadeus_proto/widget/progress_bar.dart';
       5              : import 'package:flutter/material.dart';
       6              : import 'package:provider/provider.dart';
       7              : 
       8              : class RhythmCard extends StatelessWidget {
       9           12 :   const RhythmCard({super.key});
      10              : 
      11            0 :   @override
      12              :   Widget build(BuildContext context) {
      13              :     final BeatsClickingProvider provider =
      14            0 :         context.watch<BeatsClickingProvider>();
      15              : 
      16            0 :     if (provider.isInitialized) {
      17            0 :       return Column(
      18            0 :         children: [
      19              :           const ProgressBar(
      20              :               totalAmount: 1, progressAmount: 0, width: 300, height: 15),
      21              :           const SizedBox(
      22              :             height: 10,
      23              :           ),
      24              :           const ExerciseQuestion<BeatsClickingProvider>(),
      25              :           const Spacer(),
      26            0 :           Expanded(
      27              :             flex: 4,
      28            0 :             child: LayoutBuilder(builder: (context, constraints) {
      29            0 :               return Padding(
      30            0 :                 padding: EdgeInsets.symmetric(
      31            0 :                     horizontal: constraints.maxWidth * 0.1,
      32            0 :                     vertical: constraints.maxHeight * 0.3),
      33            0 :                 child: Stack(
      34            0 :                   children: [
      35            0 :                     Center(
      36            0 :                       child: Image(
      37            0 :                         image: AssetImage(provider.rhythmImage),
      38            0 :                         width: constraints.maxWidth * 0.8,
      39              :                       ),
      40              :                     ),
      41            0 :                     AnimatedBar(constraints: constraints),
      42              :                   ],
      43              :                 ),
      44              :               );
      45              :             }),
      46              :           ),
      47            0 :           Expanded(
      48              :             flex: 2,
      49            0 :             child: LayoutBuilder(builder: (context, constraints) {
      50            0 :               return Container(
      51            0 :                 decoration: BoxDecoration(
      52            0 :                   borderRadius: BorderRadius.circular(70),
      53            0 :                   color: Theme.of(context).colorScheme.primary,
      54            0 :                   border: Border.all(
      55            0 :                     color: Theme.of(context).colorScheme.primary,
      56              :                   ),
      57              :                 ),
      58            0 :                 width: constraints.maxWidth * 0.5,
      59            0 :                 child: IconButton(
      60            0 :                   onPressed: () {
      61              :                     final BeatsClickingProvider rhythm =
      62            0 :                         context.read<BeatsClickingProvider>();
      63            0 :                     if (rhythm.playing == RhythmState.playing) {
      64            0 :                       rhythm.addPressed(DateTime.now().millisecondsSinceEpoch);
      65              :                     }
      66              :                   },
      67            0 :                   icon: Icon(
      68              :                     Icons.pan_tool_alt_rounded,
      69              :                     color: Colors.white,
      70            0 :                     size: constraints.maxHeight * 0.4,
      71              :                   ),
      72              :                 ),
      73              :               );
      74              :             }),
      75              :           ),
      76              :           const Spacer(),
      77              :         ],
      78              :       );
      79              :     } else {
      80              :       return const Center(
      81              :         child: CircularProgressIndicator(),
      82              :       );
      83              :     }
      84              :   }
      85              : }
        

Generated by: LCOV version 2.3-1