LCOV - code coverage report
Current view: top level - lib/design/generic - loading_widget.dart Coverage Total Hit
Test: lcov.info Lines: 100.0 % 26 26
Test Date: 2026-11-14 15:04:37 Functions: - 0 0

            Line data    Source code
       1              : // Copyright 2023 The terCAD team. All rights reserved.
       2              : // Use of this source code is governed by a CC BY-NC-ND 4.0 license that can be found in the LICENSE file.
       3              : 
       4              : import 'package:app_finance/_ext/build_context_ext.dart';
       5              : import 'package:material_ui/material_ui.dart';
       6              : 
       7              : class LoadingWidget extends StatefulWidget {
       8              :   final bool isLoading;
       9              :   final Size? size;
      10              : 
      11            3 :   const LoadingWidget({
      12              :     super.key,
      13              :     required this.isLoading,
      14              :     this.size,
      15              :   });
      16              : 
      17            2 :   @override
      18            2 :   LoadingWidgetState createState() => LoadingWidgetState();
      19              : }
      20              : 
      21              : class LoadingWidgetState extends State<LoadingWidget> with TickerProviderStateMixin {
      22              :   late AnimationController _controller;
      23              : 
      24            2 :   @override
      25              :   void initState() {
      26            4 :     _controller = AnimationController(
      27              :       vsync: this,
      28              :       duration: const Duration(seconds: 2),
      29            2 :     )..repeat();
      30            2 :     super.initState();
      31              :   }
      32              : 
      33            2 :   @override
      34              :   void dispose() {
      35            4 :     _controller.dispose();
      36            2 :     super.dispose();
      37              :   }
      38              : 
      39            2 :   @override
      40              :   Widget build(BuildContext context) {
      41            5 :     Size side = widget.size ?? MediaQuery.sizeOf(context);
      42            2 :     double width = side.width;
      43            2 :     double height = side.height;
      44            4 :     double size = (height > width ? width : height) * 0.6;
      45            2 :     return AnimatedBuilder(
      46            2 :       animation: _controller,
      47            2 :       builder: (context, child) {
      48            2 :         return Center(
      49            2 :           child: Stack(
      50              :             alignment: Alignment.center,
      51            2 :             children: [
      52            2 :               SizedBox(
      53              :                 height: size,
      54              :                 width: size,
      55            2 :                 child: CircularProgressIndicator(
      56            4 :                   value: _controller.value,
      57            4 :                   color: context.colorScheme.inversePrimary,
      58              :                   strokeWidth: 8,
      59              :                 ),
      60              :               ),
      61            2 :               Image.asset(
      62              :                 'assets/images/logo.png',
      63              :                 width: size,
      64              :                 height: size,
      65              :               ),
      66              :             ],
      67              :           ),
      68              :         );
      69              :       },
      70              :     );
      71              :   }
      72              : }
        

Generated by: LCOV version 2.0-1