Untitled

mail@pastecode.io avatar
unknown
plain_text
10 days ago
4.5 kB
3
Indexable
Never
import 'package:clean_architecture_tdd_flutter_template/core/res/colours.dart';
import 'package:clean_architecture_tdd_flutter_template/core/res/media_res.dart';
import 'package:clean_architecture_tdd_flutter_template/src/find/presentation/widgets/filter_dialog.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:flutter_svg/svg.dart';

class ChargerstationSearchBar extends StatefulWidget {
  const ChargerstationSearchBar({super.key});

  @override
  State<ChargerstationSearchBar> createState() =>
      _ChargerstationSearchBarState();
}

class _ChargerstationSearchBarState extends State<ChargerstationSearchBar> {
  final TextEditingController controller = TextEditingController();

  @override
  void dispose() {
    controller.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    var width = MediaQuery.of(context).size.width;
    return Padding(
      padding: const EdgeInsets.only(top: 55, bottom: 20),
      child: Container(
        width: 390,
        height: 50,
        decoration: BoxDecoration(
          borderRadius: BorderRadius.circular(12),
          border: Border.all(color: Colours.searchBorder, width: 2),
          color: Colors.white,
          // boxShadow: const [
          //   BoxShadow(
          //     color: Color.fromARGB(100, 89, 83, 98),
          //     blurRadius: 5,
          //     offset: Offset(0, 10),
          //     spreadRadius: 1,
          //   ),
          // ],
        ),
        child: Row(children: [
          Padding(
            padding: const EdgeInsets.only(left: 30.0),
            child: Row(
              children: [
                const Icon(
                  Icons.search,
                  color: Colours.greyColour,
                ),
                SizedBox(
                  width: 270,
                  height: 50,
                  child: TextField(
                      controller: controller,
                      onChanged: (query) {
                        // context.activityProvider.setSearchText(query);
                        // context.activityProvider.setSearchText(query);
                      },
                      style: const TextStyle(
                        fontSize: 16,
                        color: Colours.secondaryColourDisabled,
                        fontWeight: FontWeight.w500,
                      ),
                      decoration: InputDecoration(
                        contentPadding:
                            EdgeInsets.symmetric(horizontal: width * 0.04),
                        floatingLabelBehavior: FloatingLabelBehavior.never,
                        labelStyle: const TextStyle(fontSize: 12),
                        label: const Row(
                          mainAxisAlignment: MainAxisAlignment.spaceBetween,
                          children: [
                            Text(
                              'Find chargerstation',
                              style: TextStyle(
                                  fontSize: 16,
                                  color: Colours.secondaryColourDisabled,
                                  fontWeight: FontWeight.w500),
                            ),
                          ],
                        ),
                        focusColor: Colours.blackColour,
                        // border: const OutlineInputBorder(
                        //   borderSide:
                        //       BorderSide(color: Colours.primaryColour, width: 1),
                        //   borderRadius: BorderRadius.all(
                        //     Radius.circular(10),
                        //   ),
                        // ),
                      )),
                ),
              ],
            ),
          ),
          InkWell(
            onTap: () {
              // context.activityProvider.setSearchText('');

              showModalBottomSheet(
                  context: context, builder: (_) => const FilterDialog());
              // navigate to logout screen
            },
            child: Padding(
              padding: const EdgeInsets.only(right: 15.0),
              child: SvgPicture.asset(
                MediaRes.filterIcon,
                height: 24,
                width: 20,
              ),
            ),
          ),
        ]),
      ),
    );
  }
}
Leave a Comment