LCOV - code coverage report
Current view: top level - lib/utils - searchbar.dart Coverage Total Hit
Test: lcov.info Lines: 3.8 % 26 1
Test Date: 2025-05-10 20:26:13 Functions: - 0 0

            Line data    Source code
       1              : import 'dart:async';
       2              : 
       3              : import 'package:amadeus_proto/constants.dart';
       4              : import 'package:flutter/material.dart';
       5              : import 'package:flutter_keyboard_visibility/flutter_keyboard_visibility.dart';
       6              : import 'package:localization/localization.dart';
       7              : 
       8              : class SearchBarWidget extends StatefulWidget {
       9           36 :   const SearchBarWidget({super.key});
      10              : 
      11            0 :   @override
      12            0 :   State<SearchBarWidget> createState() => _SearchBarState();
      13              : }
      14              : 
      15              : class _SearchBarState extends State<SearchBarWidget> {
      16              :   late FocusNode _focusNode;
      17              :   late StreamSubscription<bool> keyboardSubscription;
      18              : 
      19            0 :   @override
      20              :   void initState() {
      21            0 :     super.initState();
      22            0 :     final controller = KeyboardVisibilityController();
      23            0 :     keyboardSubscription = controller.onChange.listen((bool visible) {});
      24            0 :     _focusNode = FocusNode();
      25            0 :     _focusNode.attach(context);
      26              :   }
      27              : 
      28            0 :   @override
      29              :   void dispose() {
      30            0 :     _focusNode.dispose();
      31            0 :     keyboardSubscription.cancel();
      32            0 :     super.dispose();
      33              :   }
      34              : 
      35            0 :   void onInputChanged(String newInput) {}
      36              : 
      37            0 :   @override
      38              :   Widget build(BuildContext context) {
      39            0 :     return Padding(
      40              :       padding: const EdgeInsets.symmetric(
      41              :           horizontal: smallPadding, vertical: mediumPadding),
      42            0 :       child: TextField(
      43            0 :         onChanged: (String newInput) => onInputChanged(newInput),
      44            0 :         onTapOutside: (event) => _focusNode.unfocus(),
      45            0 :         focusNode: _focusNode,
      46            0 :         decoration: InputDecoration(
      47            0 :           hintText: "search".i18n(),
      48              :           floatingLabelBehavior: FloatingLabelBehavior.never,
      49              :           filled: true,
      50              :           fillColor: Colors.white,
      51            0 :           enabledBorder: OutlineInputBorder(
      52            0 :             borderRadius: BorderRadius.circular(smallBorderRadius),
      53              :             borderSide: const BorderSide(
      54              :                 width: 0.5, color: Color.fromARGB(255, 236, 231, 251)),
      55              :           ),
      56            0 :           focusedBorder: OutlineInputBorder(
      57            0 :             borderRadius: BorderRadius.circular(smallBorderRadius),
      58              :             borderSide: const BorderSide(
      59              :                 width: 0.5, color: Color.fromARGB(255, 236, 231, 251)),
      60              :           ),
      61              :           prefixIcon: const Icon(Icons.search),
      62              :         ),
      63              :       ),
      64              :     );
      65              :   }
      66              : }
        

Generated by: LCOV version 2.3-1