LCOV - code coverage report
Current view: top level - lib/pages/home/widgets - app_bar.dart Coverage Total Hit
Test: lcov.info Lines: 0.0 % 45 0
Test Date: 2025-05-10 20:26:13 Functions: - 0 0

            Line data    Source code
       1              : import 'package:amadeus_proto/app_state.dart';
       2              : import 'package:amadeus_proto/api/models/profile.dart';
       3              : import 'package:amadeus_proto/pages/profile/pages/profile_page.dart';
       4              : import 'package:amadeus_proto/utils/number_abbreviation.dart';
       5              : import 'package:amadeus_proto/widget/padded_card.dart';
       6              : import 'package:amadeus_proto/widget/sub_page.dart';
       7              : import 'package:flutter/material.dart';
       8              : import 'package:flutter_svg/svg.dart';
       9              : import 'package:localization/localization.dart';
      10              : import 'package:provider/provider.dart';
      11              : 
      12              : class AmadeusAppBar extends StatelessWidget {
      13            0 :   const AmadeusAppBar({super.key, required this.user});
      14              : 
      15              :   final Profile user;
      16              : 
      17            0 :   @override
      18              :   Widget build(BuildContext context) {
      19            0 :     final appState = context.read<AppState>();
      20            0 :     return Padding(
      21              :       padding: const EdgeInsets.symmetric(horizontal: 15, vertical: 7),
      22            0 :       child: GestureDetector(
      23            0 :         child: Row(
      24              :           mainAxisAlignment: MainAxisAlignment.spaceBetween,
      25            0 :           children: [
      26            0 :             GestureDetector(
      27            0 :                 onTap: () {
      28            0 :                   appState.haveHeader = false;
      29            0 :                   Navigator.of(context).push(MaterialPageRoute(
      30            0 :                       builder: (context) => SubPage(
      31            0 :                               page: ProfilePage(
      32            0 :                             userId: user.id,
      33              :                           ))));
      34              :                 },
      35            0 :                 child: _ProfilePreview(user: user)),
      36            0 :             _CoinsPreview(user: user)
      37              :           ],
      38              :         ),
      39              :       ),
      40              :     );
      41              :   }
      42              : }
      43              : 
      44              : class _CoinsPreview extends StatelessWidget {
      45            0 :   const _CoinsPreview({
      46              :     required this.user,
      47              :   });
      48              : 
      49              :   final Profile user;
      50              : 
      51            0 :   @override
      52              :   Widget build(BuildContext context) {
      53            0 :     return PaddedCard(
      54            0 :       child: Row(
      55              :         crossAxisAlignment: CrossAxisAlignment.center,
      56            0 :         children: [
      57            0 :           SvgPicture.asset(
      58              :             "assets/FigmaDesign/Asset/SVG/Coins.svg",
      59              :             width: 25,
      60              :           ),
      61              :           const SizedBox(
      62              :             width: 3,
      63              :           ),
      64            0 :           Text(
      65            0 :             user.coins.toStringAsAbbreviation(uppercase: true),
      66              :             style: const TextStyle(fontSize: 13, fontWeight: FontWeight.bold),
      67              :           ),
      68              :         ],
      69              :       ),
      70              :     );
      71              :   }
      72              : }
      73              : 
      74              : class _ProfilePreview extends StatelessWidget {
      75            0 :   const _ProfilePreview({
      76              :     required this.user,
      77              :   });
      78              : 
      79              :   final Profile user;
      80              : 
      81            0 :   @override
      82              :   Widget build(BuildContext context) {
      83            0 :     return Row(
      84            0 :       children: [
      85            0 :         Container(
      86            0 :           decoration: BoxDecoration(
      87            0 :               borderRadius: BorderRadius.circular(50),
      88            0 :               border: Border.all(color: Colors.white, width: 1)),
      89            0 :           child: ClipOval(
      90              :             // child: Image.network(
      91              :             //   user.imageUrl,
      92              :             //   height: 50,
      93              :             //   loadingBuilder: imageLoader,
      94              :             // ),
      95            0 :             child: Image.asset(
      96              :               // Use local storage for demo
      97            0 :               user.imageUrl ?? "assets/images/fake users/user.png",
      98              :               height: 50,
      99              :             ),
     100              :           ),
     101              :         ),
     102              :         const SizedBox(
     103              :           width: 5,
     104              :         ),
     105            0 :         Column(
     106              :           crossAxisAlignment: CrossAxisAlignment.start,
     107              :           mainAxisAlignment: MainAxisAlignment.center,
     108            0 :           children: [
     109            0 :             Text(
     110            0 :               user.username,
     111              :               textAlign: TextAlign.start,
     112            0 :               style: TextStyle(
     113            0 :                 color: Theme.of(context).colorScheme.onSurface,
     114              :                 fontSize: 18,
     115              :                 height: 1.2,
     116              :                 fontWeight: FontWeight.bold,
     117              :               ),
     118              :             ),
     119            0 :             Text(
     120            0 :               "profile.level".i18n([user.level.level.toString()]),
     121              :               textAlign: TextAlign.start,
     122            0 :               style: TextStyle(
     123              :                 height: 1.2,
     124            0 :                 color: Theme.of(context).colorScheme.onSurfaceVariant,
     125              :                 fontSize: 15,
     126              :               ),
     127              :             )
     128              :           ],
     129              :         )
     130              :       ],
     131              :     );
     132              :   }
     133              : }
        

Generated by: LCOV version 2.3-1