product_filter_widget 0.1.0-dev.2 copy "product_filter_widget: ^0.1.0-dev.2" to clipboard
product_filter_widget: ^0.1.0-dev.2 copied to clipboard

A Flutter product filter allowing users to add and filter by size, colors, brands, and more, providing a customizable and enhanced filtering experience shopping.

example/lib/main.dart

import 'dart:developer';

import 'package:flutter/material.dart';
import 'package:product_filter_widget/product_filter_widget.dart';
import 'data_source.dart';

void main() {
  runApp(const MyApp());
}

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

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  late List<FilterModel> filterModelList;

  @override
  void initState() {
    super.initState();
    filterModelList = [
      FilterModelUtils.buildFilterModel(
        filterType: FilterType.checkBox,
        'Size',
        sizes,
      ),
      FilterModelUtils.buildFilterModel(
        filterType: FilterType.colorCheckBox,
        'Color',
        colors,
      ),
      FilterModelUtils.buildFilterModel(
        filterType: FilterType.checkBox,
        'Brand',
        brands,
      ),
      FilterModelUtils.buildFilterModel(
        filterType: FilterType.checkBox,
        'Categories',
        categories,
      ),
      FilterModelUtils.buildPriceRangeFilter(
        title: 'Price',
        priceRangeTitle: 'Price Range',
        currency: "\$",
        range: const RangeValues(
          0,
          10000,
        ),
      ),
      FilterModelUtils.buildFilterModel(
        filterType: FilterType.radio,
        'Country of Origin',
        countryOfOrigin,
      ),
      FilterModelUtils.buildFilterModel(
        filterType: FilterType.radio,
        'Discount',
        discounts,
      ),
    ];
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        useMaterial3: true,
        colorScheme: ColorScheme.fromSeed(
          seedColor: Colors.deepPurple,
        ),
      ),
      home: ProductFilterWidget(
        onSubmit: (selectedValues) {
          log(selectedValues);
        },
        isResetFieldsAfterSubmit: false,
        filterModelList: filterModelList,
        theme: const FilterTheme(
          submitButtonBackgroundColor: Colors.blueGrey,
          submitButtonTextColor: Colors.white,
          resetButtonBackgroundColor: Colors.black,
          resetButtonTextColor: Colors.white,
        ),
      ),
    );
  }
}
2
likes
150
points
8
downloads

Publisher

verified publisheroaktreeapps.com

Weekly Downloads

A Flutter product filter allowing users to add and filter by size, colors, brands, and more, providing a customizable and enhanced filtering experience shopping.

Repository (GitHub)
View/report issues

Documentation

API reference

License

Apache-2.0 (license)

Dependencies

crypto, cupertino_range_slider_improved, flutter, google_fonts, plugin_platform_interface

More

Packages that depend on product_filter_widget