import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:lba/gen/assets.gen.dart';
import 'package:lba/screens/qr_scanner/qr_scanner_page.dart';
import 'package:lba/res/colors.dart';

class SearchBarWidget extends StatelessWidget {
  const SearchBarWidget({super.key});

  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: const EdgeInsets.only(left: 15),
      child: SizedBox(
        height: 50,
        child: TextField(
          decoration: InputDecoration(
            hintText: 'What are you looking for?',
            hintStyle: TextStyle(
              color: AppColors.textSecondary,
              fontSize: 13,
            ),
            prefixIcon: Padding(
              padding: const EdgeInsets.all(10.0),
              child: SvgPicture.asset(
                Assets.icons.riSearch2Line.path,
                width: 18,
                height: 18,
              ),
            ),
            suffixIcon: Padding(
              padding: const EdgeInsets.all(10.0),
              child: GestureDetector(
                onTap: () {
                  Navigator.push(
                    context,
                    MaterialPageRoute(
                      builder: (context) => const QRScannerPage(),
                    ),
                  );
                },
                child: SvgPicture.asset(
                  Assets.icons.phQrCode.path,
                  width: 20,
                  height: 20,
                ),
              ),
            ),
            filled: true,
            fillColor: AppColors.profileField,
            contentPadding: const EdgeInsets.symmetric(
              horizontal: 16.0,
            ),
            focusedBorder: OutlineInputBorder(
              borderRadius: BorderRadius.circular(12.0),
              borderSide: BorderSide(
                color: AppColors.borderPrimary,
                width: 2.0,
              ),
            ),
            enabledBorder: OutlineInputBorder(
              borderRadius: BorderRadius.circular(12.0),
              borderSide: BorderSide(
                color: AppColors.borderPrimary,
                width: 1.0,
              ),
            ),
          ),
        ),
      ),
    );
  }
}