update theme
This commit is contained in:
@@ -20,25 +20,26 @@ class SubmissionsPage extends ConsumerWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
final submissionsAsync = ref.watch(filteredSubmissionsProvider);
|
||||
final statusListAsync = ref.watch(projectStatusListProvider);
|
||||
final filter = ref.watch(submissionsFilterProvider);
|
||||
final selectedStatus = filter.selectedStatus;
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: const Color(0xFFF4F6F8),
|
||||
backgroundColor: colorScheme.surfaceContainerLowest,
|
||||
appBar: AppBar(
|
||||
leading: IconButton(
|
||||
icon: const FaIcon(FontAwesomeIcons.arrowLeft, color: Colors.black, size: 20),
|
||||
icon: FaIcon(FontAwesomeIcons.arrowLeft, color: colorScheme.onSurface, size: 20),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
),
|
||||
title: const Text(
|
||||
title: Text(
|
||||
'Danh sách Dự án',
|
||||
style: TextStyle(color: Colors.black),
|
||||
style: TextStyle(color: colorScheme.onSurface),
|
||||
),
|
||||
actions: [
|
||||
IconButton(
|
||||
icon: const FaIcon(FontAwesomeIcons.plus, color: Colors.black, size: 20),
|
||||
icon: FaIcon(FontAwesomeIcons.plus, color: colorScheme.onSurface, size: 20),
|
||||
onPressed: () async {
|
||||
final result = await context.push<bool>(RouteNames.submissionCreate);
|
||||
if (result == true) {
|
||||
@@ -50,7 +51,7 @@ class SubmissionsPage extends ConsumerWidget {
|
||||
const SizedBox(width: AppSpacing.sm),
|
||||
],
|
||||
elevation: AppBarSpecs.elevation,
|
||||
backgroundColor: AppColors.white,
|
||||
backgroundColor: colorScheme.surface,
|
||||
centerTitle: false,
|
||||
),
|
||||
body: Column(
|
||||
@@ -61,16 +62,16 @@ class SubmissionsPage extends ConsumerWidget {
|
||||
child: TextField(
|
||||
decoration: InputDecoration(
|
||||
hintText: 'Mã dự án hoặc tên công trình',
|
||||
prefixIcon: const Icon(Icons.search, color: AppColors.grey500),
|
||||
prefixIcon: Icon(Icons.search, color: colorScheme.onSurfaceVariant),
|
||||
filled: true,
|
||||
fillColor: AppColors.white,
|
||||
fillColor: colorScheme.surface,
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
borderSide: const BorderSide(color: AppColors.grey100),
|
||||
borderSide: BorderSide(color: colorScheme.surfaceContainerHighest),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
borderSide: const BorderSide(color: AppColors.grey100),
|
||||
borderSide: BorderSide(color: colorScheme.surfaceContainerHighest),
|
||||
),
|
||||
),
|
||||
onChanged: (value) {
|
||||
@@ -88,6 +89,7 @@ class SubmissionsPage extends ConsumerWidget {
|
||||
_buildFilterChip(
|
||||
context,
|
||||
ref,
|
||||
colorScheme,
|
||||
label: 'Tất cả',
|
||||
isSelected: selectedStatus == null,
|
||||
onTap: () => ref.read(submissionsFilterProvider.notifier).clearStatusFilter(),
|
||||
@@ -101,6 +103,7 @@ class SubmissionsPage extends ConsumerWidget {
|
||||
child: _buildFilterChip(
|
||||
context,
|
||||
ref,
|
||||
colorScheme,
|
||||
label: status.label,
|
||||
isSelected: selectedStatus == status.label,
|
||||
onTap: () => ref.read(submissionsFilterProvider.notifier).selectStatus(status.label),
|
||||
@@ -130,28 +133,28 @@ class SubmissionsPage extends ConsumerWidget {
|
||||
children: [
|
||||
SizedBox(
|
||||
height: MediaQuery.of(context).size.height * 0.5,
|
||||
child: const Center(
|
||||
child: Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
FaIcon(
|
||||
FontAwesomeIcons.folderOpen,
|
||||
size: 64,
|
||||
color: AppColors.grey500,
|
||||
color: colorScheme.onSurfaceVariant,
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
const SizedBox(height: 16),
|
||||
Text(
|
||||
'Không có dự án nào',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColors.grey900,
|
||||
color: colorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
'Không tìm thấy dự án phù hợp',
|
||||
style: TextStyle(color: AppColors.grey500),
|
||||
style: TextStyle(color: colorScheme.onSurfaceVariant),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -171,7 +174,7 @@ class SubmissionsPage extends ConsumerWidget {
|
||||
itemCount: submissions.length,
|
||||
itemBuilder: (context, index) {
|
||||
final submission = submissions[index];
|
||||
return _buildSubmissionCard(context, ref, submission);
|
||||
return _buildSubmissionCard(context, ref, colorScheme, submission);
|
||||
},
|
||||
),
|
||||
);
|
||||
@@ -198,24 +201,24 @@ class SubmissionsPage extends ConsumerWidget {
|
||||
color: AppColors.danger,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
const Text(
|
||||
Text(
|
||||
'Có lỗi xảy ra',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColors.grey900,
|
||||
color: colorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
error.toString(),
|
||||
style: const TextStyle(color: AppColors.grey500),
|
||||
style: TextStyle(color: colorScheme.onSurfaceVariant),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
const Text(
|
||||
Text(
|
||||
'Kéo xuống để thử lại',
|
||||
style: TextStyle(color: AppColors.grey500),
|
||||
style: TextStyle(color: colorScheme.onSurfaceVariant),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -233,7 +236,8 @@ class SubmissionsPage extends ConsumerWidget {
|
||||
|
||||
Widget _buildFilterChip(
|
||||
BuildContext context,
|
||||
WidgetRef ref, {
|
||||
WidgetRef ref,
|
||||
ColorScheme colorScheme, {
|
||||
required String label,
|
||||
required bool isSelected,
|
||||
required VoidCallback onTap,
|
||||
@@ -243,16 +247,16 @@ class SubmissionsPage extends ConsumerWidget {
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
decoration: BoxDecoration(
|
||||
color: isSelected ? AppColors.primaryBlue : AppColors.white,
|
||||
color: isSelected ? colorScheme.primary : colorScheme.surface,
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
border: Border.all(
|
||||
color: isSelected ? AppColors.primaryBlue : AppColors.grey100,
|
||||
color: isSelected ? colorScheme.primary : colorScheme.surfaceContainerHighest,
|
||||
),
|
||||
),
|
||||
child: Text(
|
||||
label,
|
||||
style: TextStyle(
|
||||
color: isSelected ? AppColors.white : AppColors.grey900,
|
||||
color: isSelected ? colorScheme.onPrimary : colorScheme.onSurface,
|
||||
fontWeight: isSelected ? FontWeight.w600 : FontWeight.normal,
|
||||
),
|
||||
),
|
||||
@@ -260,7 +264,7 @@ class SubmissionsPage extends ConsumerWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildSubmissionCard(BuildContext context, WidgetRef ref, ProjectSubmission submission) {
|
||||
Widget _buildSubmissionCard(BuildContext context, WidgetRef ref, ColorScheme colorScheme, ProjectSubmission submission) {
|
||||
return Card(
|
||||
margin: const EdgeInsets.only(bottom: 12),
|
||||
elevation: 1,
|
||||
@@ -288,13 +292,13 @@ class SubmissionsPage extends ConsumerWidget {
|
||||
children: [
|
||||
Text(
|
||||
submission.designedArea,
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: AppColors.grey900,
|
||||
color: colorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
_buildStatusBadge(submission.status, submission.statusColor),
|
||||
_buildStatusBadge(colorScheme, submission.status, submission.statusColor),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
@@ -308,17 +312,17 @@ class SubmissionsPage extends ConsumerWidget {
|
||||
// const SizedBox(height: 4),
|
||||
Text(
|
||||
'Ngày nộp: ${DateFormat('dd/MM/yyyy HH:mm').format(submission.requestDate)}',
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: AppColors.grey900,
|
||||
color: colorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
'Diện tích: ${submission.designArea} m²',
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: AppColors.grey900,
|
||||
color: colorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
if (submission.reasonForRejection != null) ...[
|
||||
@@ -357,8 +361,8 @@ class SubmissionsPage extends ConsumerWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildStatusBadge(String status, String statusColor) {
|
||||
final color = _getColorFromStatusColor(statusColor);
|
||||
Widget _buildStatusBadge(ColorScheme colorScheme, String status, String statusColor) {
|
||||
final color = _getColorFromStatusColor(colorScheme, statusColor);
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 4),
|
||||
decoration: BoxDecoration(
|
||||
@@ -376,7 +380,7 @@ class SubmissionsPage extends ConsumerWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Color _getColorFromStatusColor(String statusColor) {
|
||||
Color _getColorFromStatusColor(ColorScheme colorScheme, String statusColor) {
|
||||
switch (statusColor) {
|
||||
case 'Warning':
|
||||
return AppColors.warning;
|
||||
@@ -387,7 +391,7 @@ class SubmissionsPage extends ConsumerWidget {
|
||||
case 'Info':
|
||||
return AppColors.info;
|
||||
default:
|
||||
return AppColors.grey500;
|
||||
return colorScheme.onSurfaceVariant;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user