Untitled

mail@pastecode.io avatar
unknown
dart
a year ago
1.5 kB
1
Indexable
Never
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:get/get.dart';

import '../../constants/app_colors.dart';

class CommonSearchBar extends StatelessWidget {
  final TextEditingController searchController;
	final Function(String)? onChanged;

  const CommonSearchBar({super.key, required this.searchController, this.onChanged});

  @override
  Widget build(BuildContext context) {
    return TextField(
        controller: searchController,
        style: const TextStyle(color: AppColors.primary, fontSize: 13),
				onChanged: onChanged,
        decoration: InputDecoration(
            prefixIcon: IconButton(
                onPressed: () {},
                icon: SvgPicture.asset('assets/icons/search2.svg')),
            focusedBorder: OutlineInputBorder(
                borderRadius: BorderRadius.circular(15),
                borderSide: BorderSide(
                    width: Get.width * 0.003, color: AppColors.lightGreen)),
            enabledBorder: OutlineInputBorder(
                borderRadius: BorderRadius.circular(15),
                borderSide: BorderSide(
                  width: Get.width * 0.003,
                  color: AppColors.disabledColor.withOpacity(0.5),
                )),
            hintText: 'search by name'.tr,
            hintStyle:
                const TextStyle(color: AppColors.disabledColor, fontSize: 13)));
  }
}