-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfloating_search_bar.dart
More file actions
141 lines (136 loc) · 5.37 KB
/
Copy pathfloating_search_bar.dart
File metadata and controls
141 lines (136 loc) · 5.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
// import 'package:flutter/material.dart';
// import '../models/product.dart';
// import '../data/products_data.dart'; // your hardcoded product list
// import 'product_details_page.dart';
// class ProductsPage extends StatefulWidget {
// const ProductsPage({Key? key}) : super(key: key);
// @override
// State<ProductsPage> createState() => _ProductsPageState();
// }
// class _ProductsPageState extends State<ProductsPage> {
// String searchQuery = "";
// @override
// Widget build(BuildContext context) {
// // Filter products by search
// List<Product> filteredProducts = products.where((p) {
// return p.name.toLowerCase().contains(searchQuery.toLowerCase());
// }).toList();
// return Scaffold(
// appBar: AppBar(
// title: const Text("Products"),
// ),
// body: Stack(
// children: [
// Padding(
// padding: const EdgeInsets.only(top: 80),
// child: GridView.builder(
// padding: const EdgeInsets.all(8),
// gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
// crossAxisCount: 2,
// crossAxisSpacing: 8,
// mainAxisSpacing: 8,
// childAspectRatio: 0.65,
// ),
// itemCount: filteredProducts.length,
// itemBuilder: (context, index) {
// final product = filteredProducts[index];
// return GestureDetector(
// onTap: () {
// Navigator.push(
// context,
// MaterialPageRoute(
// builder: (context) => ProductDetailsPage(product: product),
// ),
// );
// },
// child: Card(
// elevation: 3,
// clipBehavior: Clip.hardEdge,
// shape: RoundedRectangleBorder(
// borderRadius: BorderRadius.circular(12),
// ),
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// AspectRatio(
// aspectRatio: 1,
// child: Image.asset(
// product.images.first,
// fit: BoxFit.contain,
// ),
// ),
// Padding(
// padding: const EdgeInsets.all(8),
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Text(
// product.name,
// maxLines: 2,
// overflow: TextOverflow.ellipsis,
// style: const TextStyle(fontWeight: FontWeight.bold),
// ),
// const SizedBox(height: 2),
// Text(
// "RM ${product.price.toStringAsFixed(2)}",
// style: const TextStyle(
// fontSize: 16,
// fontWeight: FontWeight.bold,
// color: Colors.red,
// ),
// ),
// const SizedBox(height: 2),
// Text(
// "Sales: ${product.sales}",
// style: const TextStyle(
// fontSize: 12,
// color: Colors.grey,
// ),
// ),
// ],
// ),
// ),
// ],
// ),
// ),
// );
// },
// ),
// ),
// Positioned(
// top: 16,
// left: 16,
// right: 16,
// child: Container(
// decoration: BoxDecoration(
// color: Colors.white,
// borderRadius: BorderRadius.circular(25),
// boxShadow: [
// BoxShadow(
// color: Colors.black12,
// blurRadius: 8,
// offset: Offset(0, 2),
// ),
// ],
// ),
// child: TextField(
// decoration: InputDecoration(
// hintText: "Search products...",
// prefixIcon: Icon(Icons.search, color: Colors.grey),
// suffixIcon: Icon(Icons.mic, color: Colors.grey),
// border: InputBorder.none,
// contentPadding: EdgeInsets.symmetric(horizontal: 20, vertical: 15),
// ),
// onChanged: (value) {
// setState(() {
// searchQuery = value;
// });
// },
// ),
// ),
// ),
// ],
// ),
// );
// }
// }