add auth, format

This commit is contained in:
Phuoc Nguyen
2025-11-07 11:52:06 +07:00
parent 24a8508fce
commit 3803bd26e0
173 changed files with 8505 additions and 7116 deletions

View File

@@ -38,15 +38,16 @@ class _QuotesPageState extends ConsumerState<QuotesPage> {
@override
void dispose() {
_searchController..removeListener(_onSearchChanged)
..dispose();
_searchController
..removeListener(_onSearchChanged)
..dispose();
super.dispose();
}
void _onSearchChanged() {
ref.read(quoteSearchQueryProvider.notifier).updateQuery(
_searchController.text,
);
ref
.read(quoteSearchQueryProvider.notifier)
.updateQuery(_searchController.text);
}
@override
@@ -104,13 +105,10 @@ class _QuotesPageState extends ConsumerState<QuotesPage> {
}
return SliverList(
delegate: SliverChildBuilderDelegate(
(context, index) {
final quote = quotes[index];
return _buildQuoteCard(quote);
},
childCount: quotes.length,
),
delegate: SliverChildBuilderDelegate((context, index) {
final quote = quotes[index];
return _buildQuoteCard(quote);
}, childCount: quotes.length),
);
},
loading: () => _buildLoadingState(),
@@ -149,10 +147,7 @@ class _QuotesPageState extends ConsumerState<QuotesPage> {
color: AppColors.grey500,
fontSize: 14,
),
prefixIcon: const Icon(
Icons.search,
color: AppColors.grey500,
),
prefixIcon: const Icon(Icons.search, color: AppColors.grey500),
suffixIcon: _searchController.text.isNotEmpty
? IconButton(
icon: const Icon(Icons.clear, color: AppColors.grey500),
@@ -190,16 +185,10 @@ class _QuotesPageState extends ConsumerState<QuotesPage> {
onPressed: () {
_showFilterDialog();
},
icon: Icon(
Icons.filter_list,
color: AppColors.primaryBlue,
),
icon: Icon(Icons.filter_list, color: AppColors.primaryBlue),
iconSize: 24,
padding: const EdgeInsets.all(12),
constraints: const BoxConstraints(
minWidth: 48,
minHeight: 48,
),
constraints: const BoxConstraints(minWidth: 48, minHeight: 48),
),
),
],
@@ -213,9 +202,7 @@ class _QuotesPageState extends ConsumerState<QuotesPage> {
return Card(
margin: const EdgeInsets.only(bottom: 12),
elevation: 1,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
clipBehavior: Clip.antiAlias,
child: InkWell(
onTap: () {
@@ -270,10 +257,7 @@ class _QuotesPageState extends ConsumerState<QuotesPage> {
// Additional Info (placeholder for now)
const Text(
'5 sản phẩm - Diện tích: 200m²',
style: TextStyle(
fontSize: 13,
color: AppColors.grey500,
),
style: TextStyle(fontSize: 13, color: AppColors.grey500),
),
const SizedBox(height: 8),
@@ -455,10 +439,7 @@ class _QuotesPageState extends ConsumerState<QuotesPage> {
const SizedBox(height: 8),
const Text(
'Kéo xuống để làm mới',
style: TextStyle(
fontSize: 14,
color: AppColors.grey500,
),
style: TextStyle(fontSize: 14, color: AppColors.grey500),
),
],
),
@@ -469,9 +450,7 @@ class _QuotesPageState extends ConsumerState<QuotesPage> {
/// Build loading state
Widget _buildLoadingState() {
return const SliverFillRemaining(
child: Center(
child: CircularProgressIndicator(),
),
child: Center(child: CircularProgressIndicator()),
);
}
@@ -499,10 +478,7 @@ class _QuotesPageState extends ConsumerState<QuotesPage> {
const SizedBox(height: 8),
Text(
error.toString(),
style: const TextStyle(
fontSize: 14,
color: AppColors.grey500,
),
style: const TextStyle(fontSize: 14, color: AppColors.grey500),
textAlign: TextAlign.center,
),
],

View File

@@ -95,7 +95,9 @@ Future<List<QuoteModel>> filteredQuotes(Ref ref) async {
if (searchQuery.isNotEmpty) {
final lowerQuery = searchQuery.toLowerCase();
filtered = filtered.where((quote) {
final matchesNumber = quote.quoteNumber.toLowerCase().contains(lowerQuery);
final matchesNumber = quote.quoteNumber.toLowerCase().contains(
lowerQuery,
);
final matchesProject =
quote.projectName?.toLowerCase().contains(lowerQuery) ?? false;
return matchesNumber || matchesProject;
@@ -104,7 +106,9 @@ Future<List<QuoteModel>> filteredQuotes(Ref ref) async {
// Filter by status
if (selectedStatus != null) {
filtered = filtered.where((quote) => quote.status == selectedStatus).toList();
filtered = filtered
.where((quote) => quote.status == selectedStatus)
.toList();
}
// Sort by creation date (newest first)