feat(ui): revamp onboarding, map, capture/review, and theme

- Redesign WelcomeScreen and OnboardingFlow with gradients, branding,
  and updated messaging; refresh bottom navigation styling and
  animations
- Enhance MapScreen with severity-based marker styling, category
  icons, improved cluster bubbles, legend overlay, and polished
  filter modal; refine camera fit and device centering logic
- Revamp CaptureScreen and ReviewScreen UX with modern cards,
  AI analysis section, improved selection controls, and clearer
  notes/location presentation
- Update theme to civic palette with expanded neutrals, surface
  containers, and refined button styles
- Expand design tokens: add civic colors, light variants, and
  gradient definitions; align semantic mappings
- Refresh English copy in en.json for welcome and onboarding
- Redesign ReportCard with icons, severity/status chips, improved
  layout, and action menus

Note: some new UI strings are temporarily hardcoded (English) and
will be moved to i18n assets in a follow-up.
This commit is contained in:
2025-09-26 14:38:27 +08:00
parent 6d6e9300f6
commit 7085a54290
9 changed files with 2643 additions and 738 deletions

View File

@@ -7,23 +7,23 @@ import '../../services/mock_ai.dart';
import '../../models/report.dart';
import '../../models/enums.dart';
import 'review_screen.dart';
class CaptureScreen extends StatefulWidget {
const CaptureScreen({super.key});
@override
State<CaptureScreen> createState() => _CaptureScreenState();
}
class _CaptureScreenState extends State<CaptureScreen> {
final ImagePicker _picker = ImagePicker();
bool _isLoading = false;
Future<void> _pickImage(ImageSource source) async {
setState(() {
_isLoading = true;
});
try {
final XFile? image = await _picker.pickImage(
source: source,
@@ -31,15 +31,15 @@ class _CaptureScreenState extends State<CaptureScreen> {
maxHeight: 1080,
imageQuality: 85,
);
if (image != null) {
await _processImage(image, source);
}
} catch (e) {
if (mounted) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text('Error picking image: $e')),
);
ScaffoldMessenger.of(
context,
).showSnackBar(SnackBar(content: Text('Error picking image: $e')));
}
} finally {
if (mounted) {
@@ -49,24 +49,26 @@ class _CaptureScreenState extends State<CaptureScreen> {
}
}
}
Future<void> _processImage(XFile image, ImageSource source) async {
try {
// Get current position (Geolocator.Position)
final position = await LocationService.getCurrentPosition();
if (position == null) {
if (mounted) {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('Unable to get location. Please try again.')),
const SnackBar(
content: Text('Unable to get location. Please try again.'),
),
);
}
return;
}
// Convert Position -> LocationData (app model)
final locationData = LocationService.positionToLocationData(position);
// Generate AI suggestion (seeded deterministic)
final aiSuggestion = MockAIService.generateSuggestion(
id: DateTime.now().millisecondsSinceEpoch.toString(),
@@ -75,7 +77,7 @@ class _CaptureScreenState extends State<CaptureScreen> {
lng: locationData.lng,
photoSizeBytes: await image.length(),
);
// Create report with AI suggestion
final report = Report(
id: DateTime.now().millisecondsSinceEpoch.toString(),
@@ -96,72 +98,204 @@ class _CaptureScreenState extends State<CaptureScreen> {
aiSuggestion: aiSuggestion,
schemaVersion: 1,
);
if (mounted) {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ReviewScreen(report: report, imageFile: File(image.path)),
builder: (context) =>
ReviewScreen(report: report, imageFile: File(image.path)),
),
);
}
} catch (e) {
if (mounted) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text('Error processing image: $e')),
);
ScaffoldMessenger.of(
context,
).showSnackBar(SnackBar(content: Text('Error processing image: $e')));
}
}
}
@override
Widget build(BuildContext context) {
debugPrint('[i18n] CaptureScreen: locale=${I18n.currentLocale} prompt=${I18n.t('capture.prompt')}');
debugPrint(
'[i18n] CaptureScreen: locale=${I18n.currentLocale} prompt=${I18n.t('capture.prompt')}',
);
final cs = Theme.of(context).colorScheme;
return Scaffold(
appBar: AppBar(
title: Text(I18n.t('nav.report')),
title: Text(
'Report Issue',
style: const TextStyle(fontWeight: FontWeight.w600),
),
elevation: 0,
backgroundColor: Colors.transparent,
foregroundColor: cs.onSurface,
),
body: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
I18n.t('capture.prompt'),
style: Theme.of(context).textTheme.headlineSmall,
textAlign: TextAlign.center,
body: Container(
decoration: const BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [Color(0xFFF8FAFC), Color(0xFFF1F5F9)],
),
),
child: SafeArea(
child: Padding(
padding: const EdgeInsets.all(24.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
// Enhanced header section
Container(
padding: const EdgeInsets.all(24),
decoration: BoxDecoration(
color: cs.surface,
borderRadius: BorderRadius.circular(24),
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.1),
blurRadius: 20,
offset: const Offset(0, 8),
),
],
),
child: Column(
children: [
// Camera icon with gradient
Container(
padding: const EdgeInsets.all(20),
decoration: BoxDecoration(
gradient: const LinearGradient(
colors: [Color(0xFF22C55E), Color(0xFF4ADE80)],
),
borderRadius: BorderRadius.circular(20),
),
child: const Icon(
Icons.camera_alt,
color: Colors.white,
size: 48,
),
),
const SizedBox(height: 20),
Text(
'Report City Issues',
style: Theme.of(context).textTheme.headlineSmall
?.copyWith(
fontWeight: FontWeight.w700,
color: cs.onSurface,
),
textAlign: TextAlign.center,
),
const SizedBox(height: 8),
Text(
'Take a photo of any urban maintenance issue like potholes, broken streetlights, or damaged signage.',
style: Theme.of(context).textTheme.bodyLarge?.copyWith(
color: cs.onSurface.withOpacity(0.7),
height: 1.5,
),
textAlign: TextAlign.center,
),
],
),
),
const SizedBox(height: 32),
if (_isLoading)
Container(
padding: const EdgeInsets.all(24),
decoration: BoxDecoration(
color: cs.surface,
borderRadius: BorderRadius.circular(16),
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.1),
blurRadius: 10,
offset: const Offset(0, 4),
),
],
),
child: const Column(
children: [
CircularProgressIndicator(),
SizedBox(height: 16),
Text(
'Processing image...',
style: TextStyle(fontSize: 16),
),
],
),
)
else ...[
// Enhanced camera button
Container(
width: double.infinity,
height: 64,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20),
gradient: const LinearGradient(
colors: [Color(0xFF2563EB), Color(0xFF3B82F6)],
),
boxShadow: [
BoxShadow(
color: const Color(0xFF2563EB).withOpacity(0.3),
blurRadius: 12,
offset: const Offset(0, 6),
),
],
),
child: ElevatedButton.icon(
onPressed: () => _pickImage(ImageSource.camera),
icon: const Icon(Icons.camera_alt, size: 24),
label: const Text(
'Take Photo',
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.w600,
),
),
style: ElevatedButton.styleFrom(
backgroundColor: Colors.transparent,
foregroundColor: Colors.white,
shadowColor: Colors.transparent,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20),
),
),
),
),
const SizedBox(height: 16),
// Enhanced gallery button
Container(
width: double.infinity,
height: 64,
child: OutlinedButton.icon(
onPressed: () => _pickImage(ImageSource.gallery),
icon: const Icon(Icons.photo_library, size: 24),
label: const Text(
'Choose from Gallery',
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.w600,
),
),
style: OutlinedButton.styleFrom(
side: BorderSide(color: cs.primary, width: 2),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20),
),
foregroundColor: cs.primary,
padding: const EdgeInsets.symmetric(vertical: 20),
),
),
),
],
],
),
const SizedBox(height: 32),
if (_isLoading)
const CircularProgressIndicator()
else ...[
SizedBox(
width: double.infinity,
child: ElevatedButton.icon(
onPressed: () => _pickImage(ImageSource.camera),
icon: const Icon(Icons.camera_alt),
label: Text(I18n.t('btn.camera')),
style: ElevatedButton.styleFrom(
padding: const EdgeInsets.symmetric(vertical: 16),
),
),
),
const SizedBox(height: 16),
SizedBox(
width: double.infinity,
child: OutlinedButton.icon(
onPressed: () => _pickImage(ImageSource.gallery),
icon: const Icon(Icons.photo_library),
label: Text(I18n.t('btn.gallery')),
style: OutlinedButton.styleFrom(
padding: const EdgeInsets.symmetric(vertical: 16),
),
),
),
],
],
),
),
),
);
}
}
}

View File

@@ -57,18 +57,18 @@ class _ReviewScreenState extends State<ReviewScreen> {
await StorageService.saveReport(updatedReport);
if (mounted) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text(I18n.t('toast.reportSaved'))),
);
ScaffoldMessenger.of(
context,
).showSnackBar(SnackBar(content: Text(I18n.t('toast.reportSaved'))));
// Navigate back to main screen
Navigator.of(context).popUntil((route) => route.isFirst);
}
} catch (e) {
if (mounted) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text('Error saving report: $e')),
);
ScaffoldMessenger.of(
context,
).showSnackBar(SnackBar(content: Text('Error saving report: $e')));
}
} finally {
if (mounted) {
@@ -81,9 +81,17 @@ class _ReviewScreenState extends State<ReviewScreen> {
@override
Widget build(BuildContext context) {
final cs = Theme.of(context).colorScheme;
return Scaffold(
appBar: AppBar(
title: Text(I18n.t('btn.submit')),
title: Text(
'Review & Submit',
style: const TextStyle(fontWeight: FontWeight.w600),
),
elevation: 0,
backgroundColor: Colors.transparent,
foregroundColor: cs.onSurface,
actions: [
TextButton(
onPressed: _isSubmitting ? null : _submitReport,
@@ -93,90 +101,233 @@ class _ReviewScreenState extends State<ReviewScreen> {
height: 20,
child: CircularProgressIndicator(strokeWidth: 2),
)
: Text(I18n.t('btn.submit')),
: Text(
'Submit',
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
color: cs.primary,
),
),
),
],
),
body: SingleChildScrollView(
padding: const EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Image preview
Container(
height: 200,
width: double.infinity,
decoration: BoxDecoration(
border: Border.all(color: Colors.grey),
borderRadius: BorderRadius.circular(8),
body: Container(
decoration: const BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [Color(0xFFF8FAFC), Color(0xFFF1F5F9)],
),
),
child: SingleChildScrollView(
padding: const EdgeInsets.all(24),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Enhanced image preview
Container(
height: 240,
width: double.infinity,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20),
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.15),
blurRadius: 12,
offset: const Offset(0, 6),
),
],
),
child: ClipRRect(
borderRadius: BorderRadius.circular(20),
child: Image.file(widget.imageFile, fit: BoxFit.cover),
),
),
child: Image.file(
widget.imageFile,
fit: BoxFit.cover,
),
),
const SizedBox(height: 24),
const SizedBox(height: 32),
// AI Suggestion Card
Card(
child: Padding(
padding: const EdgeInsets.all(16),
// AI Suggestion Card
Container(
padding: const EdgeInsets.all(24),
decoration: BoxDecoration(
gradient: const LinearGradient(
colors: [Color(0xFFF0F9FF), Color(0xFFE0F2FE)],
),
borderRadius: BorderRadius.circular(24),
border: Border.all(
color: const Color(0xFF0EA5E9).withOpacity(0.3),
width: 1,
),
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.1),
blurRadius: 12,
offset: const Offset(0, 6),
),
],
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Icon(
Icons.lightbulb,
color: Theme.of(context).primaryColor,
),
const SizedBox(width: 8),
Text(
I18n.t('label.aiSuggestion'),
style: Theme.of(context).textTheme.titleMedium,
),
],
),
const SizedBox(height: 12),
Row(
children: [
_buildSuggestionChip(
widget.report.aiSuggestion.category.displayName,
Colors.blue.shade100,
),
const SizedBox(width: 8),
_buildSuggestionChip(
widget.report.aiSuggestion.severity.displayName,
_getSeverityColor(widget.report.aiSuggestion.severity),
),
const SizedBox(width: 8),
_buildSuggestionChip(
'${(widget.report.aiSuggestion.confidence * 100).round()}%',
Colors.grey.shade100,
),
],
),
const SizedBox(height: 12),
Row(
children: [
Expanded(
child: ElevatedButton(
onPressed: () {
setState(() {
_selectedCategory = widget.report.aiSuggestion.category;
_selectedSeverity = widget.report.aiSuggestion.severity;
});
},
child: Text(I18n.t('btn.useSuggestion')),
Container(
padding: const EdgeInsets.all(8),
decoration: BoxDecoration(
gradient: const LinearGradient(
colors: [Color(0xFF0EA5E9), Color(0xFF38BDF8)],
),
borderRadius: BorderRadius.circular(12),
),
child: const Icon(
Icons.smart_toy,
color: Colors.white,
size: 20,
),
),
const SizedBox(width: 8),
const SizedBox(width: 12),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'AI Analysis Complete',
style: Theme.of(context).textTheme.titleMedium
?.copyWith(
fontWeight: FontWeight.w600,
color: cs.onSurface,
),
),
Text(
'Smart detection with ${(widget.report.aiSuggestion.confidence * 100).round()}% confidence',
style: Theme.of(context).textTheme.bodySmall
?.copyWith(
color: cs.onSurface.withOpacity(0.7),
),
),
],
),
],
),
const SizedBox(height: 20),
Row(
children: [
Container(
padding: const EdgeInsets.symmetric(
horizontal: 16,
vertical: 10,
),
decoration: BoxDecoration(
color: const Color(0xFF0EA5E9),
borderRadius: BorderRadius.circular(20),
boxShadow: [
BoxShadow(
color: const Color(0xFF0EA5E9).withOpacity(0.3),
blurRadius: 6,
offset: const Offset(0, 2),
),
],
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
const Icon(
Icons.category,
size: 16,
color: Colors.white,
),
const SizedBox(width: 8),
Text(
widget.report.aiSuggestion.category.displayName,
style: const TextStyle(
color: Colors.white,
fontWeight: FontWeight.w600,
fontSize: 14,
),
),
],
),
),
const SizedBox(width: 12),
Container(
padding: const EdgeInsets.symmetric(
horizontal: 16,
vertical: 10,
),
decoration: BoxDecoration(
color: const Color(0xFF16A34A),
borderRadius: BorderRadius.circular(20),
boxShadow: [
BoxShadow(
color: const Color(0xFF16A34A).withOpacity(0.3),
blurRadius: 6,
offset: const Offset(0, 2),
),
],
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
const Icon(
Icons.warning,
size: 16,
color: Colors.white,
),
const SizedBox(width: 8),
Text(
widget.report.aiSuggestion.severity.displayName,
style: const TextStyle(
color: Colors.white,
fontWeight: FontWeight.w600,
fontSize: 14,
),
),
],
),
),
],
),
const SizedBox(height: 20),
Row(
children: [
Expanded(
child: OutlinedButton(
child: ElevatedButton.icon(
onPressed: () {
// Keep manual selections
setState(() {
_selectedCategory =
widget.report.aiSuggestion.category;
_selectedSeverity =
widget.report.aiSuggestion.severity;
});
},
child: Text(I18n.t('btn.keepManual')),
icon: const Icon(Icons.check_circle, size: 18),
label: const Text('Use AI Suggestion'),
style: ElevatedButton.styleFrom(
backgroundColor: const Color(0xFF0EA5E9),
foregroundColor: Colors.white,
padding: const EdgeInsets.symmetric(vertical: 16),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16),
),
),
),
),
const SizedBox(width: 12),
Expanded(
child: OutlinedButton.icon(
onPressed: () {},
icon: const Icon(Icons.edit, size: 18),
label: const Text('Edit Manually'),
style: OutlinedButton.styleFrom(
side: BorderSide(
color: const Color(0xFF0EA5E9),
width: 1.5,
),
padding: const EdgeInsets.symmetric(vertical: 16),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16),
),
foregroundColor: const Color(0xFF0EA5E9),
),
),
),
],
@@ -184,106 +335,349 @@ class _ReviewScreenState extends State<ReviewScreen> {
],
),
),
),
const SizedBox(height: 24),
const SizedBox(height: 32),
// Category Selection
Text(
I18n.t('label.category'),
style: Theme.of(context).textTheme.titleMedium,
),
const SizedBox(height: 8),
Wrap(
spacing: 8,
children: Category.values.map((category) {
return ChoiceChip(
label: Text(category.displayName),
selected: _selectedCategory == category,
onSelected: (selected) {
if (selected) {
setState(() {
_selectedCategory = category;
});
}
},
);
}).toList(),
),
const SizedBox(height: 24),
// Severity Selection
Text(
I18n.t('label.severity'),
style: Theme.of(context).textTheme.titleMedium,
),
const SizedBox(height: 8),
Wrap(
spacing: 8,
children: Severity.values.map((severity) {
return ChoiceChip(
label: Text(severity.displayName),
selected: _selectedSeverity == severity,
onSelected: (selected) {
if (selected) {
setState(() {
_selectedSeverity = severity;
});
}
},
);
}).toList(),
),
const SizedBox(height: 24),
// Notes
Text(
I18n.t('label.notes'),
style: Theme.of(context).textTheme.titleMedium,
),
const SizedBox(height: 8),
TextField(
controller: _notesController,
decoration: InputDecoration(
hintText: 'Add any additional notes...',
border: const OutlineInputBorder(),
// Category Selection
Container(
padding: const EdgeInsets.all(20),
decoration: BoxDecoration(
color: cs.surface,
borderRadius: BorderRadius.circular(20),
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.1),
blurRadius: 8,
offset: const Offset(0, 4),
),
],
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Icon(Icons.category, color: cs.primary, size: 20),
const SizedBox(width: 8),
Text(
'Issue Category',
style: Theme.of(context).textTheme.titleMedium
?.copyWith(
fontWeight: FontWeight.w600,
color: cs.onSurface,
),
),
],
),
const SizedBox(height: 16),
Wrap(
spacing: 12,
runSpacing: 12,
children: Category.values.map((category) {
final isSelected = _selectedCategory == category;
return Container(
decoration: BoxDecoration(
border: Border.all(
color: isSelected ? cs.primary : cs.outline,
width: isSelected ? 2 : 1,
),
borderRadius: BorderRadius.circular(16),
color: isSelected
? cs.primary.withOpacity(0.1)
: cs.surface,
),
child: Material(
color: Colors.transparent,
child: InkWell(
onTap: () {
setState(() {
_selectedCategory = category;
});
},
borderRadius: BorderRadius.circular(16),
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 16,
vertical: 12,
),
child: Text(
category.displayName,
style: TextStyle(
color: isSelected
? cs.primary
: cs.onSurface,
fontWeight: isSelected
? FontWeight.w600
: FontWeight.normal,
),
),
),
),
),
);
}).toList(),
),
],
),
),
maxLines: 3,
),
const SizedBox(height: 24),
const SizedBox(height: 24),
// Location info
Text(
I18n.t('label.location'),
style: Theme.of(context).textTheme.titleMedium,
),
const SizedBox(height: 8),
Text(
'Lat: ${widget.report.location.lat.toStringAsFixed(6)}, '
'Lng: ${widget.report.location.lng.toStringAsFixed(6)}',
),
if (widget.report.location.accuracy != null)
Text('Accuracy: ${widget.report.location.accuracy!.toStringAsFixed(1)}m'),
],
// Severity Selection
Container(
padding: const EdgeInsets.all(20),
decoration: BoxDecoration(
color: cs.surface,
borderRadius: BorderRadius.circular(20),
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.1),
blurRadius: 8,
offset: const Offset(0, 4),
),
],
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Icon(Icons.warning, color: cs.secondary, size: 20),
const SizedBox(width: 8),
Text(
'Severity Level',
style: Theme.of(context).textTheme.titleMedium
?.copyWith(
fontWeight: FontWeight.w600,
color: cs.onSurface,
),
),
],
),
const SizedBox(height: 16),
Wrap(
spacing: 12,
runSpacing: 12,
children: Severity.values.map((severity) {
final isSelected = _selectedSeverity == severity;
final color = severity == Severity.high
? const Color(0xFFDC2626)
: severity == Severity.medium
? const Color(0xFFF59E0B)
: const Color(0xFF16A34A);
return Container(
decoration: BoxDecoration(
border: Border.all(
color: isSelected ? color : cs.outline,
width: isSelected ? 2 : 1,
),
borderRadius: BorderRadius.circular(16),
color: isSelected
? color.withOpacity(0.1)
: cs.surface,
),
child: Material(
color: Colors.transparent,
child: InkWell(
onTap: () {
setState(() {
_selectedSeverity = severity;
});
},
borderRadius: BorderRadius.circular(16),
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 16,
vertical: 12,
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(Icons.circle, size: 12, color: color),
const SizedBox(width: 8),
Text(
severity.displayName,
style: TextStyle(
color: isSelected
? color
: cs.onSurface,
fontWeight: isSelected
? FontWeight.w600
: FontWeight.normal,
),
),
],
),
),
),
),
);
}).toList(),
),
],
),
),
const SizedBox(height: 24),
// Notes Section
Container(
padding: const EdgeInsets.all(20),
decoration: BoxDecoration(
color: cs.surface,
borderRadius: BorderRadius.circular(20),
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.1),
blurRadius: 8,
offset: const Offset(0, 4),
),
],
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Icon(Icons.note, color: cs.primary, size: 20),
const SizedBox(width: 8),
Text(
'Additional Notes',
style: Theme.of(context).textTheme.titleMedium
?.copyWith(
fontWeight: FontWeight.w600,
color: cs.onSurface,
),
),
],
),
const SizedBox(height: 16),
TextField(
controller: _notesController,
decoration: InputDecoration(
hintText: 'Add any additional details or context...',
hintStyle: TextStyle(
color: cs.onSurface.withOpacity(0.6),
),
filled: true,
fillColor: cs.surfaceContainerHighest.withOpacity(0.3),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(16),
borderSide: BorderSide(color: cs.outline),
),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(16),
borderSide: BorderSide(color: cs.outline),
),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(16),
borderSide: BorderSide(color: cs.primary, width: 2),
),
contentPadding: const EdgeInsets.all(16),
),
maxLines: 4,
style: TextStyle(color: cs.onSurface),
),
],
),
),
const SizedBox(height: 24),
// Location Info
Container(
padding: const EdgeInsets.all(20),
decoration: BoxDecoration(
color: cs.surface,
borderRadius: BorderRadius.circular(20),
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.1),
blurRadius: 8,
offset: const Offset(0, 4),
),
],
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Icon(Icons.location_on, color: cs.secondary, size: 20),
const SizedBox(width: 8),
Text(
'Location Details',
style: Theme.of(context).textTheme.titleMedium
?.copyWith(
fontWeight: FontWeight.w600,
color: cs.onSurface,
),
),
],
),
const SizedBox(height: 16),
Container(
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: cs.surfaceContainerHighest.withOpacity(0.3),
borderRadius: BorderRadius.circular(12),
border: Border.all(color: cs.outlineVariant),
),
child: Column(
children: [
Row(
children: [
Icon(
Icons.gps_fixed,
size: 16,
color: cs.onSurface.withOpacity(0.7),
),
const SizedBox(width: 8),
Text(
'Coordinates',
style: Theme.of(context).textTheme.bodySmall
?.copyWith(
color: cs.onSurface.withOpacity(0.7),
fontWeight: FontWeight.w500,
),
),
],
),
const SizedBox(height: 8),
Text(
'${widget.report.location.lat.toStringAsFixed(6)}, ${widget.report.location.lng.toStringAsFixed(6)}',
style: Theme.of(context).textTheme.bodyLarge
?.copyWith(
color: cs.onSurface,
fontFamily: 'monospace',
),
),
if (widget.report.location.accuracy != null) ...[
const SizedBox(height: 12),
Row(
children: [
Icon(
Icons.my_location,
size: 16,
color: cs.onSurface.withOpacity(0.7),
),
const SizedBox(width: 8),
Text(
'Accuracy: ${widget.report.location.accuracy!.toStringAsFixed(1)}m',
style: Theme.of(context).textTheme.bodySmall
?.copyWith(
color: cs.onSurface.withOpacity(0.7),
),
),
],
),
],
],
),
),
],
),
),
],
),
),
),
);
}
Widget _buildSuggestionChip(String label, Color color) {
return Chip(
label: Text(label),
backgroundColor: color,
);
}
Color _getSeverityColor(Severity severity) {
switch (severity) {
case Severity.high:
return Colors.red.shade100;
case Severity.medium:
return Colors.orange.shade100;
case Severity.low:
return Colors.green.shade100;
}
}
}
}