|
@@ -323,6 +323,19 @@ class CategoryFilters extends StatefulWidget {
|
|
|
}
|
|
|
|
|
|
class CategoryFiltersState extends State<CategoryFilters> {
|
|
|
+ int _selectedNavIndex = 0;
|
|
|
+
|
|
|
+ @override
|
|
|
+ void initState() {
|
|
|
+ super.initState();
|
|
|
+ }
|
|
|
+
|
|
|
+ void _closeFilterView() {
|
|
|
+ setState(() {
|
|
|
+ _selectedNavIndex = 0;
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
@override
|
|
|
Widget build(BuildContext context) {
|
|
|
return Container(
|
|
@@ -330,47 +343,160 @@ class CategoryFiltersState extends State<CategoryFilters> {
|
|
|
decoration: BoxDecoration(
|
|
|
border: Border(bottom: BorderSide(color: Colors.grey.shade300)),
|
|
|
),
|
|
|
- child: Row(
|
|
|
+ child: Column(
|
|
|
+ mainAxisSize: MainAxisSize.min,
|
|
|
children: [
|
|
|
- // Buscador
|
|
|
- Expanded(
|
|
|
- child: Container(
|
|
|
- height: 40,
|
|
|
- padding: const EdgeInsets.symmetric(horizontal: 12),
|
|
|
- decoration: BoxDecoration(
|
|
|
- color: Colors.grey.shade200,
|
|
|
- borderRadius: BorderRadius.circular(20),
|
|
|
- ),
|
|
|
- child: Row(
|
|
|
- children: [
|
|
|
- Icon(Icons.search, color: Colors.grey.shade600),
|
|
|
- const SizedBox(width: 8),
|
|
|
- Text('Buscar', style: TextStyle(color: Colors.grey.shade600)),
|
|
|
- ],
|
|
|
+ Row(
|
|
|
+ children: [
|
|
|
+ // Buscador
|
|
|
+ Expanded(
|
|
|
+ child: Container(
|
|
|
+ height: 40,
|
|
|
+ padding: const EdgeInsets.symmetric(horizontal: 12),
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ color: Colors.grey.shade200,
|
|
|
+ borderRadius: BorderRadius.circular(20),
|
|
|
+ ),
|
|
|
+ child: Row(
|
|
|
+ children: [
|
|
|
+ Icon(Icons.search, color: Colors.grey.shade600),
|
|
|
+ const SizedBox(width: 8),
|
|
|
+ Text('Buscar',
|
|
|
+ style: TextStyle(color: Colors.grey.shade600)),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ),
|
|
|
),
|
|
|
- ),
|
|
|
+ const SizedBox(width: 10),
|
|
|
+ // Botones de filtro
|
|
|
+ _buildFilterButton(1, 'Categoría'),
|
|
|
+ const SizedBox(width: 10),
|
|
|
+ _buildFilterButton(2, 'Topics'),
|
|
|
+ const SizedBox(width: 10),
|
|
|
+ _buildFilterButton(3, 'Extras'),
|
|
|
+ ],
|
|
|
),
|
|
|
- const SizedBox(width: 10),
|
|
|
-
|
|
|
- // Botones de filtro
|
|
|
- _FilterButtonPLaceHolder('Categoría'),
|
|
|
- const SizedBox(width: 10),
|
|
|
- _FilterButtonPLaceHolder('Topics'),
|
|
|
- const SizedBox(width: 10),
|
|
|
- _FilterButtonPLaceHolder('Extras'),
|
|
|
+ const SizedBox(height: 5),
|
|
|
+ if (_selectedNavIndex != 0)
|
|
|
+ Column(
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
+ children: [
|
|
|
+ Row(
|
|
|
+ children: [
|
|
|
+ Text(
|
|
|
+ _getFilterTitle(_selectedNavIndex),
|
|
|
+ style: const TextStyle(
|
|
|
+ fontWeight: FontWeight.bold,
|
|
|
+ fontSize: 16,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ const Spacer(),
|
|
|
+ GestureDetector(
|
|
|
+ onTap: _closeFilterView,
|
|
|
+ child: Container(
|
|
|
+ padding: const EdgeInsets.all(4),
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ color: Colors.grey.shade300,
|
|
|
+ shape: BoxShape.circle,
|
|
|
+ ),
|
|
|
+ child: Icon(
|
|
|
+ Icons.close,
|
|
|
+ size: 16,
|
|
|
+ color: Colors.grey.shade800,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ const SizedBox(height: 8),
|
|
|
+ SizedBox(
|
|
|
+ height: 50,
|
|
|
+ child: ListView.builder(
|
|
|
+ scrollDirection: Axis.horizontal,
|
|
|
+ itemCount: 10,
|
|
|
+ itemBuilder: (context, index) {
|
|
|
+ return Container(
|
|
|
+ margin: const EdgeInsets.only(right: 8),
|
|
|
+ padding: const EdgeInsets.symmetric(
|
|
|
+ horizontal: 20, vertical: 10),
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ color: Colors.grey.shade200,
|
|
|
+ borderRadius: BorderRadius.circular(4),
|
|
|
+ border: Border.all(
|
|
|
+ color: Colors.grey.shade400,
|
|
|
+ width: 1,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ child: Text(
|
|
|
+ 'Item $index',
|
|
|
+ style: const TextStyle(fontSize: 16),
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ },
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ )
|
|
|
],
|
|
|
),
|
|
|
);
|
|
|
}
|
|
|
-}
|
|
|
|
|
|
-Widget _FilterButtonPLaceHolder(String text) {
|
|
|
- return Container(
|
|
|
- padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10),
|
|
|
- decoration: BoxDecoration(
|
|
|
- color: Colors.grey.shade200,
|
|
|
- borderRadius: BorderRadius.circular(4),
|
|
|
- ),
|
|
|
- child: Text(text, style: const TextStyle(fontSize: 16)),
|
|
|
- );
|
|
|
+ String _getFilterTitle(int index) {
|
|
|
+ switch (index) {
|
|
|
+ case 1:
|
|
|
+ return 'Categorías';
|
|
|
+ case 2:
|
|
|
+ return 'Topics';
|
|
|
+ case 3:
|
|
|
+ return 'Extras';
|
|
|
+ default:
|
|
|
+ return '';
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ Widget _buildFilterButton(int index, String text) {
|
|
|
+ final bool isSelected = _selectedNavIndex == index;
|
|
|
+ return GestureDetector(
|
|
|
+ onTap: () {
|
|
|
+ setState(() {
|
|
|
+ if (_selectedNavIndex == index) {
|
|
|
+ _selectedNavIndex = 0;
|
|
|
+ } else {
|
|
|
+ _selectedNavIndex = index;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ child: Container(
|
|
|
+ padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ color: isSelected ? Colors.blue.shade100 : Colors.grey.shade200,
|
|
|
+ borderRadius: BorderRadius.circular(16),
|
|
|
+ border: Border.all(
|
|
|
+ color: isSelected ? Colors.blue : Colors.transparent,
|
|
|
+ width: 1,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ child: Row(
|
|
|
+ children: [
|
|
|
+ Text(
|
|
|
+ text,
|
|
|
+ style: TextStyle(
|
|
|
+ color: isSelected ? Colors.blue.shade800 : Colors.grey.shade800,
|
|
|
+ fontWeight: isSelected ? FontWeight.bold : FontWeight.normal,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ if (isSelected) ...[
|
|
|
+ const SizedBox(width: 4),
|
|
|
+ Icon(
|
|
|
+ Icons.keyboard_arrow_down,
|
|
|
+ size: 16,
|
|
|
+ color: Colors.blue.shade800,
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ }
|
|
|
}
|