Replace inline Colors.* with SojornColors tokens in beacon_detail, create_beacon_sheet, beacon_bottom_sheet
This commit is contained in:
parent
54fac1eafa
commit
38f0952bc8
|
|
@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
|||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import '../../models/post.dart';
|
||||
import '../../providers/api_provider.dart';
|
||||
import '../../theme/tokens.dart';
|
||||
|
||||
class BeaconBottomSheet extends ConsumerStatefulWidget {
|
||||
final Post post;
|
||||
|
|
@ -40,7 +41,7 @@ class _BeaconBottomSheetState extends ConsumerState<BeaconBottomSheet> {
|
|||
child: Container(
|
||||
width: 40, height: 4,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white.withValues(alpha: 0.3),
|
||||
color: SojornColors.basicWhite.withValues(alpha: 0.3),
|
||||
borderRadius: BorderRadius.circular(2),
|
||||
),
|
||||
),
|
||||
|
|
@ -71,16 +72,16 @@ class _BeaconBottomSheetState extends ConsumerState<BeaconBottomSheet> {
|
|||
if (isRecent)
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
|
||||
decoration: BoxDecoration(color: Colors.red, borderRadius: BorderRadius.circular(4)),
|
||||
child: const Text('LIVE', style: TextStyle(color: Colors.white, fontSize: 9, fontWeight: FontWeight.bold)),
|
||||
decoration: BoxDecoration(color: SojornColors.destructive, borderRadius: BorderRadius.circular(4)),
|
||||
child: const Text('LIVE', style: TextStyle(color: SojornColors.basicWhite, fontSize: 9, fontWeight: FontWeight.bold)),
|
||||
),
|
||||
const Spacer(),
|
||||
// Verification status
|
||||
Icon(isVerified ? Icons.verified : Icons.pending,
|
||||
color: isVerified ? Colors.green : Colors.amber, size: 18),
|
||||
color: isVerified ? const Color(0xFF4CAF50) : SojornColors.nsfwWarningIcon, size: 18),
|
||||
const SizedBox(width: 4),
|
||||
Text('$verCount/3',
|
||||
style: TextStyle(color: Colors.white.withValues(alpha: 0.5), fontSize: 11)),
|
||||
style: TextStyle(color: SojornColors.basicWhite.withValues(alpha: 0.5), fontSize: 11)),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 14),
|
||||
|
|
@ -99,7 +100,7 @@ class _BeaconBottomSheetState extends ConsumerState<BeaconBottomSheet> {
|
|||
const SizedBox(width: 10),
|
||||
Expanded(
|
||||
child: Text(beacon.beaconType.displayName,
|
||||
style: const TextStyle(color: Colors.white, fontSize: 16, fontWeight: FontWeight.w600)),
|
||||
style: const TextStyle(color: SojornColors.basicWhite, fontSize: 16, fontWeight: FontWeight.w600)),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
|
@ -107,23 +108,23 @@ class _BeaconBottomSheetState extends ConsumerState<BeaconBottomSheet> {
|
|||
|
||||
// Body
|
||||
Text(post.body, maxLines: 3, overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(color: Colors.white.withValues(alpha: 0.7), fontSize: 14, height: 1.4)),
|
||||
style: TextStyle(color: SojornColors.basicWhite.withValues(alpha: 0.7), fontSize: 14, height: 1.4)),
|
||||
const SizedBox(height: 10),
|
||||
|
||||
// Meta
|
||||
Row(
|
||||
children: [
|
||||
Icon(Icons.schedule, size: 12, color: Colors.white.withValues(alpha: 0.4)),
|
||||
Icon(Icons.schedule, size: 12, color: SojornColors.basicWhite.withValues(alpha: 0.4)),
|
||||
const SizedBox(width: 3),
|
||||
Text(beacon.getTimeAgo(), style: TextStyle(color: Colors.white.withValues(alpha: 0.4), fontSize: 11)),
|
||||
Text(beacon.getTimeAgo(), style: TextStyle(color: SojornColors.basicWhite.withValues(alpha: 0.4), fontSize: 11)),
|
||||
const SizedBox(width: 12),
|
||||
Icon(Icons.location_on, size: 12, color: Colors.white.withValues(alpha: 0.4)),
|
||||
Icon(Icons.location_on, size: 12, color: SojornColors.basicWhite.withValues(alpha: 0.4)),
|
||||
const SizedBox(width: 3),
|
||||
Text(beacon.getFormattedDistance(), style: TextStyle(color: Colors.white.withValues(alpha: 0.4), fontSize: 11)),
|
||||
Text(beacon.getFormattedDistance(), style: TextStyle(color: SojornColors.basicWhite.withValues(alpha: 0.4), fontSize: 11)),
|
||||
const SizedBox(width: 12),
|
||||
Icon(Icons.radar, size: 12, color: Colors.white.withValues(alpha: 0.4)),
|
||||
Icon(Icons.radar, size: 12, color: SojornColors.basicWhite.withValues(alpha: 0.4)),
|
||||
const SizedBox(width: 3),
|
||||
Text('${beacon.radius}m', style: TextStyle(color: Colors.white.withValues(alpha: 0.4), fontSize: 11)),
|
||||
Text('${beacon.radius}m', style: TextStyle(color: SojornColors.basicWhite.withValues(alpha: 0.4), fontSize: 11)),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 18),
|
||||
|
|
@ -138,14 +139,14 @@ class _BeaconBottomSheetState extends ConsumerState<BeaconBottomSheet> {
|
|||
child: ElevatedButton.icon(
|
||||
onPressed: _isVouching ? null : () => _vouch(post.id),
|
||||
icon: _isVouching
|
||||
? const SizedBox(width: 14, height: 14, child: CircularProgressIndicator(strokeWidth: 2, color: Colors.white))
|
||||
? const SizedBox(width: 14, height: 14, child: CircularProgressIndicator(strokeWidth: 2, color: SojornColors.basicWhite))
|
||||
: const Icon(Icons.visibility, size: 16),
|
||||
label: Text(_isVouching ? '...' : 'I see this too', style: const TextStyle(fontSize: 13, fontWeight: FontWeight.w600)),
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Colors.green.shade700,
|
||||
foregroundColor: Colors.white,
|
||||
backgroundColor: const Color(0xFF388E3C),
|
||||
foregroundColor: SojornColors.basicWhite,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
|
||||
disabledBackgroundColor: Colors.green.withValues(alpha: 0.3),
|
||||
disabledBackgroundColor: const Color(0xFF4CAF50).withValues(alpha: 0.3),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
@ -158,12 +159,12 @@ class _BeaconBottomSheetState extends ConsumerState<BeaconBottomSheet> {
|
|||
child: OutlinedButton.icon(
|
||||
onPressed: _isReporting ? null : () => _report(post.id),
|
||||
icon: _isReporting
|
||||
? const SizedBox(width: 14, height: 14, child: CircularProgressIndicator(strokeWidth: 2, color: Colors.red))
|
||||
: Icon(Icons.flag, size: 16, color: Colors.red.withValues(alpha: 0.7)),
|
||||
? SizedBox(width: 14, height: 14, child: CircularProgressIndicator(strokeWidth: 2, color: SojornColors.destructive))
|
||||
: Icon(Icons.flag, size: 16, color: SojornColors.destructive.withValues(alpha: 0.7)),
|
||||
label: Text(_isReporting ? '...' : 'False alarm',
|
||||
style: TextStyle(color: Colors.red.withValues(alpha: 0.7), fontSize: 12)),
|
||||
style: TextStyle(color: SojornColors.destructive.withValues(alpha: 0.7), fontSize: 12)),
|
||||
style: OutlinedButton.styleFrom(
|
||||
side: BorderSide(color: Colors.red.withValues(alpha: 0.3)),
|
||||
side: BorderSide(color: SojornColors.destructive.withValues(alpha: 0.3)),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
|
||||
),
|
||||
),
|
||||
|
|
@ -183,7 +184,7 @@ class _BeaconBottomSheetState extends ConsumerState<BeaconBottomSheet> {
|
|||
await apiService.vouchBeacon(beaconId);
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('Thanks for confirming this report.'), backgroundColor: Colors.green),
|
||||
const SnackBar(content: Text('Thanks for confirming this report.'), backgroundColor: Color(0xFF4CAF50)),
|
||||
);
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
|
|
@ -205,7 +206,7 @@ class _BeaconBottomSheetState extends ConsumerState<BeaconBottomSheet> {
|
|||
await apiService.reportBeacon(beaconId);
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('Report received. Thanks for keeping the community safe.'), backgroundColor: Colors.orange),
|
||||
const SnackBar(content: Text('Report received. Thanks for keeping the community safe.'), backgroundColor: SojornColors.nsfwWarningIcon),
|
||||
);
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|||
import '../../models/post.dart';
|
||||
import '../../models/beacon.dart';
|
||||
import '../../providers/api_provider.dart';
|
||||
import '../../theme/tokens.dart';
|
||||
|
||||
class BeaconDetailScreen extends ConsumerStatefulWidget {
|
||||
final Post beaconPost;
|
||||
|
|
@ -90,10 +91,10 @@ class _BeaconDetailScreenState extends ConsumerState<BeaconDetailScreen>
|
|||
backgroundColor: const Color(0xFF0F0F23),
|
||||
leading: Container(
|
||||
margin: const EdgeInsets.all(8),
|
||||
decoration: BoxDecoration(color: Colors.black38, borderRadius: BorderRadius.circular(12)),
|
||||
decoration: BoxDecoration(color: const Color(0x61000000), borderRadius: BorderRadius.circular(12)),
|
||||
child: IconButton(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
icon: const Icon(Icons.arrow_back, color: Colors.white),
|
||||
icon: const Icon(Icons.arrow_back, color: SojornColors.basicWhite),
|
||||
),
|
||||
),
|
||||
flexibleSpace: FlexibleSpaceBar(
|
||||
|
|
@ -111,7 +112,7 @@ class _BeaconDetailScreenState extends ConsumerState<BeaconDetailScreen>
|
|||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.topCenter, end: Alignment.bottomCenter,
|
||||
colors: [Colors.black.withValues(alpha: 0.6), Colors.transparent, Colors.black.withValues(alpha: 0.5)],
|
||||
colors: [const Color(0x99000000), SojornColors.transparent, const Color(0x80000000)],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
@ -134,10 +135,10 @@ class _BeaconDetailScreenState extends ConsumerState<BeaconDetailScreen>
|
|||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(_beacon.severity.icon, color: Colors.white, size: 14),
|
||||
Icon(_beacon.severity.icon, color: SojornColors.basicWhite, size: 14),
|
||||
const SizedBox(width: 4),
|
||||
Text(_beacon.severity.label,
|
||||
style: const TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 11)),
|
||||
style: const TextStyle(color: SojornColors.basicWhite, fontWeight: FontWeight.bold, fontSize: 11)),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
|
@ -153,9 +154,9 @@ class _BeaconDetailScreenState extends ConsumerState<BeaconDetailScreen>
|
|||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 3),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.red, borderRadius: BorderRadius.circular(4),
|
||||
color: SojornColors.destructive, borderRadius: BorderRadius.circular(4),
|
||||
),
|
||||
child: const Text('LIVE', style: TextStyle(color: Colors.white, fontSize: 10, fontWeight: FontWeight.bold)),
|
||||
child: const Text('LIVE', style: TextStyle(color: SojornColors.basicWhite, fontSize: 10, fontWeight: FontWeight.bold)),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
|
@ -202,10 +203,10 @@ class _BeaconDetailScreenState extends ConsumerState<BeaconDetailScreen>
|
|||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(_beacon.beaconType.displayName,
|
||||
style: const TextStyle(color: Colors.white, fontSize: 18, fontWeight: FontWeight.bold)),
|
||||
style: const TextStyle(color: SojornColors.basicWhite, fontSize: 18, fontWeight: FontWeight.bold)),
|
||||
const SizedBox(height: 2),
|
||||
Text('${_beacon.getFormattedDistance()} away',
|
||||
style: TextStyle(color: Colors.white.withValues(alpha: 0.5), fontSize: 13)),
|
||||
style: TextStyle(color: SojornColors.basicWhite.withValues(alpha: 0.5), fontSize: 13)),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
|
@ -214,25 +215,25 @@ class _BeaconDetailScreenState extends ConsumerState<BeaconDetailScreen>
|
|||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
|
||||
decoration: BoxDecoration(
|
||||
color: _beacon.incidentStatus == BeaconIncidentStatus.active
|
||||
? Colors.green.withValues(alpha: 0.2)
|
||||
: Colors.grey.withValues(alpha: 0.2),
|
||||
? const Color(0xFF4CAF50).withValues(alpha: 0.2)
|
||||
: SojornColors.textDisabled.withValues(alpha: 0.2),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(
|
||||
color: _beacon.incidentStatus == BeaconIncidentStatus.active
|
||||
? Colors.green.withValues(alpha: 0.5)
|
||||
: Colors.grey.withValues(alpha: 0.3),
|
||||
? const Color(0xFF4CAF50).withValues(alpha: 0.5)
|
||||
: SojornColors.textDisabled.withValues(alpha: 0.3),
|
||||
),
|
||||
),
|
||||
child: Text(_beacon.incidentStatus.label,
|
||||
style: TextStyle(
|
||||
color: _beacon.incidentStatus == BeaconIncidentStatus.active ? Colors.green : Colors.grey,
|
||||
color: _beacon.incidentStatus == BeaconIncidentStatus.active ? const Color(0xFF4CAF50) : SojornColors.textDisabled,
|
||||
fontSize: 11, fontWeight: FontWeight.w600)),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
Text(_post.body,
|
||||
style: TextStyle(color: Colors.white.withValues(alpha: 0.8), fontSize: 15, height: 1.5)),
|
||||
style: TextStyle(color: SojornColors.basicWhite.withValues(alpha: 0.8), fontSize: 15, height: 1.5)),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
|
@ -263,9 +264,9 @@ class _BeaconDetailScreenState extends ConsumerState<BeaconDetailScreen>
|
|||
Widget _metaItem(IconData icon, String label) {
|
||||
return Column(
|
||||
children: [
|
||||
Icon(icon, size: 16, color: Colors.white.withValues(alpha: 0.4)),
|
||||
Icon(icon, size: 16, color: SojornColors.basicWhite.withValues(alpha: 0.4)),
|
||||
const SizedBox(height: 4),
|
||||
Text(label, style: TextStyle(color: Colors.white.withValues(alpha: 0.5), fontSize: 10)),
|
||||
Text(label, style: TextStyle(color: SojornColors.basicWhite.withValues(alpha: 0.5), fontSize: 10)),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
|
@ -280,19 +281,19 @@ class _BeaconDetailScreenState extends ConsumerState<BeaconDetailScreen>
|
|||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text('Community Verification',
|
||||
style: TextStyle(color: Colors.white.withValues(alpha: 0.6), fontSize: 13, fontWeight: FontWeight.w600)),
|
||||
style: TextStyle(color: SojornColors.basicWhite.withValues(alpha: 0.6), fontSize: 13, fontWeight: FontWeight.w600)),
|
||||
const SizedBox(height: 10),
|
||||
Container(
|
||||
padding: const EdgeInsets.all(14),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFF16213E),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(color: isVerified ? Colors.green.withValues(alpha: 0.3) : Colors.white.withValues(alpha: 0.08)),
|
||||
border: Border.all(color: isVerified ? const Color(0xFF4CAF50).withValues(alpha: 0.3) : SojornColors.basicWhite.withValues(alpha: 0.08)),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(isVerified ? Icons.verified : Icons.pending,
|
||||
color: isVerified ? Colors.green : Colors.amber, size: 28),
|
||||
color: isVerified ? const Color(0xFF4CAF50) : SojornColors.nsfwWarningIcon, size: 28),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Column(
|
||||
|
|
@ -300,11 +301,11 @@ class _BeaconDetailScreenState extends ConsumerState<BeaconDetailScreen>
|
|||
children: [
|
||||
Text(isVerified ? 'Verified by community' : 'Awaiting verification',
|
||||
style: TextStyle(
|
||||
color: isVerified ? Colors.green : Colors.amber,
|
||||
color: isVerified ? const Color(0xFF4CAF50) : SojornColors.nsfwWarningIcon,
|
||||
fontSize: 14, fontWeight: FontWeight.w600)),
|
||||
const SizedBox(height: 2),
|
||||
Text('$verCount / 3 neighbors confirmed this report',
|
||||
style: TextStyle(color: Colors.white.withValues(alpha: 0.4), fontSize: 12)),
|
||||
style: TextStyle(color: SojornColors.basicWhite.withValues(alpha: 0.4), fontSize: 12)),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
|
@ -318,8 +319,8 @@ class _BeaconDetailScreenState extends ConsumerState<BeaconDetailScreen>
|
|||
child: LinearProgressIndicator(
|
||||
value: (verCount / 3).clamp(0.0, 1.0),
|
||||
minHeight: 4,
|
||||
backgroundColor: Colors.white.withValues(alpha: 0.1),
|
||||
valueColor: AlwaysStoppedAnimation<Color>(isVerified ? Colors.green : Colors.amber),
|
||||
backgroundColor: SojornColors.basicWhite.withValues(alpha: 0.1),
|
||||
valueColor: AlwaysStoppedAnimation<Color>(isVerified ? const Color(0xFF4CAF50) : SojornColors.nsfwWarningIcon),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
|
@ -339,15 +340,15 @@ class _BeaconDetailScreenState extends ConsumerState<BeaconDetailScreen>
|
|||
child: ElevatedButton.icon(
|
||||
onPressed: _isVouching ? null : _vouchBeacon,
|
||||
icon: _isVouching
|
||||
? const SizedBox(width: 18, height: 18, child: CircularProgressIndicator(strokeWidth: 2, color: Colors.white))
|
||||
? const SizedBox(width: 18, height: 18, child: CircularProgressIndicator(strokeWidth: 2, color: SojornColors.basicWhite))
|
||||
: const Icon(Icons.visibility, size: 20),
|
||||
label: Text(_isVouching ? 'Confirming...' : 'I see this too',
|
||||
style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 15)),
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Colors.green.shade700,
|
||||
foregroundColor: Colors.white,
|
||||
backgroundColor: const Color(0xFF388E3C),
|
||||
foregroundColor: SojornColors.basicWhite,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
||||
disabledBackgroundColor: Colors.green.withValues(alpha: 0.3),
|
||||
disabledBackgroundColor: const Color(0xFF4CAF50).withValues(alpha: 0.3),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
@ -359,12 +360,12 @@ class _BeaconDetailScreenState extends ConsumerState<BeaconDetailScreen>
|
|||
child: OutlinedButton.icon(
|
||||
onPressed: _isReporting ? null : _reportBeacon,
|
||||
icon: _isReporting
|
||||
? const SizedBox(width: 16, height: 16, child: CircularProgressIndicator(strokeWidth: 2, color: Colors.red))
|
||||
: Icon(Icons.flag, size: 18, color: Colors.red.withValues(alpha: 0.7)),
|
||||
? SizedBox(width: 16, height: 16, child: CircularProgressIndicator(strokeWidth: 2, color: SojornColors.destructive))
|
||||
: Icon(Icons.flag, size: 18, color: SojornColors.destructive.withValues(alpha: 0.7)),
|
||||
label: Text(_isReporting ? 'Reporting...' : 'False alarm / Report',
|
||||
style: TextStyle(color: Colors.red.withValues(alpha: 0.7), fontSize: 13)),
|
||||
style: TextStyle(color: SojornColors.destructive.withValues(alpha: 0.7), fontSize: 13)),
|
||||
style: OutlinedButton.styleFrom(
|
||||
side: BorderSide(color: Colors.red.withValues(alpha: 0.3)),
|
||||
side: BorderSide(color: SojornColors.destructive.withValues(alpha: 0.3)),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
||||
),
|
||||
),
|
||||
|
|
@ -382,14 +383,14 @@ class _BeaconDetailScreenState extends ConsumerState<BeaconDetailScreen>
|
|||
await apiService.vouchBeacon(_post.id);
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('Thanks for confirming this report!'), backgroundColor: Colors.green),
|
||||
const SnackBar(content: Text('Thanks for confirming this report!'), backgroundColor: Color(0xFF4CAF50)),
|
||||
);
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
} catch (e) {
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text('Something went wrong: $e'), backgroundColor: Colors.red),
|
||||
SnackBar(content: Text('Something went wrong: $e'), backgroundColor: SojornColors.destructive),
|
||||
);
|
||||
}
|
||||
} finally {
|
||||
|
|
@ -405,14 +406,14 @@ class _BeaconDetailScreenState extends ConsumerState<BeaconDetailScreen>
|
|||
await apiService.reportBeacon(_post.id);
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('Report received. Thanks for keeping the community safe.'), backgroundColor: Colors.orange),
|
||||
const SnackBar(content: Text('Report received. Thanks for keeping the community safe.'), backgroundColor: SojornColors.nsfwWarningIcon),
|
||||
);
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
} catch (e) {
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text('Something went wrong: $e'), backgroundColor: Colors.red),
|
||||
SnackBar(content: Text('Something went wrong: $e'), backgroundColor: SojornColors.destructive),
|
||||
);
|
||||
}
|
||||
} finally {
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import '../../models/beacon.dart';
|
|||
import '../../models/post.dart';
|
||||
import '../../providers/api_provider.dart';
|
||||
import '../../services/image_upload_service.dart';
|
||||
import '../../theme/tokens.dart';
|
||||
|
||||
class CreateBeaconSheet extends ConsumerStatefulWidget {
|
||||
final double centerLat;
|
||||
|
|
@ -182,7 +183,7 @@ class _CreateBeaconSheetState extends ConsumerState<CreateBeaconSheet> {
|
|||
child: Container(
|
||||
width: 40, height: 4,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white.withValues(alpha: 0.3),
|
||||
color: SojornColors.basicWhite.withValues(alpha: 0.3),
|
||||
borderRadius: BorderRadius.circular(2),
|
||||
),
|
||||
),
|
||||
|
|
@ -192,26 +193,26 @@ class _CreateBeaconSheetState extends ConsumerState<CreateBeaconSheet> {
|
|||
// Header
|
||||
Row(
|
||||
children: [
|
||||
const Icon(Icons.warning_rounded, color: Colors.red, size: 24),
|
||||
const Icon(Icons.warning_rounded, color: SojornColors.destructive, size: 24),
|
||||
const SizedBox(width: 8),
|
||||
const Expanded(
|
||||
child: Text('Report Incident',
|
||||
style: TextStyle(color: Colors.white, fontSize: 20, fontWeight: FontWeight.bold)),
|
||||
style: TextStyle(color: SojornColors.basicWhite, fontSize: 20, fontWeight: FontWeight.bold)),
|
||||
),
|
||||
IconButton(
|
||||
onPressed: _isSubmitting ? null : () => Navigator.of(context).pop(),
|
||||
icon: Icon(Icons.close, color: Colors.white.withValues(alpha: 0.6)),
|
||||
icon: Icon(Icons.close, color: SojornColors.basicWhite.withValues(alpha: 0.6)),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text('Near ${widget.centerLat.toStringAsFixed(4)}, ${widget.centerLong.toStringAsFixed(4)}',
|
||||
style: TextStyle(color: Colors.white.withValues(alpha: 0.4), fontSize: 12)),
|
||||
style: TextStyle(color: SojornColors.basicWhite.withValues(alpha: 0.4), fontSize: 12)),
|
||||
const SizedBox(height: 20),
|
||||
|
||||
// Incident type — grid of preset buttons
|
||||
Text('What\'s happening?',
|
||||
style: TextStyle(color: Colors.white.withValues(alpha: 0.7), fontSize: 13, fontWeight: FontWeight.w600)),
|
||||
style: TextStyle(color: SojornColors.basicWhite.withValues(alpha: 0.7), fontSize: 13, fontWeight: FontWeight.w600)),
|
||||
const SizedBox(height: 10),
|
||||
Wrap(
|
||||
spacing: 8,
|
||||
|
|
@ -226,18 +227,18 @@ class _CreateBeaconSheetState extends ConsumerState<CreateBeaconSheet> {
|
|||
color: isSelected ? type.color.withValues(alpha: 0.25) : const Color(0xFF16213E),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
border: Border.all(
|
||||
color: isSelected ? type.color : Colors.white.withValues(alpha: 0.1),
|
||||
color: isSelected ? type.color : SojornColors.basicWhite.withValues(alpha: 0.1),
|
||||
width: isSelected ? 1.5 : 1,
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(type.icon, size: 16, color: isSelected ? type.color : Colors.white.withValues(alpha: 0.6)),
|
||||
Icon(type.icon, size: 16, color: isSelected ? type.color : SojornColors.basicWhite.withValues(alpha: 0.6)),
|
||||
const SizedBox(width: 6),
|
||||
Text(type.displayName,
|
||||
style: TextStyle(
|
||||
color: isSelected ? type.color : Colors.white.withValues(alpha: 0.7),
|
||||
color: isSelected ? type.color : SojornColors.basicWhite.withValues(alpha: 0.7),
|
||||
fontSize: 12, fontWeight: isSelected ? FontWeight.w600 : FontWeight.normal)),
|
||||
],
|
||||
),
|
||||
|
|
@ -249,7 +250,7 @@ class _CreateBeaconSheetState extends ConsumerState<CreateBeaconSheet> {
|
|||
|
||||
// Severity selector
|
||||
Text('Severity',
|
||||
style: TextStyle(color: Colors.white.withValues(alpha: 0.7), fontSize: 13, fontWeight: FontWeight.w600)),
|
||||
style: TextStyle(color: SojornColors.basicWhite.withValues(alpha: 0.7), fontSize: 13, fontWeight: FontWeight.w600)),
|
||||
const SizedBox(height: 10),
|
||||
Row(
|
||||
children: BeaconSeverity.values.map((sev) {
|
||||
|
|
@ -264,16 +265,16 @@ class _CreateBeaconSheetState extends ConsumerState<CreateBeaconSheet> {
|
|||
color: isSelected ? sev.color.withValues(alpha: 0.25) : const Color(0xFF16213E),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(
|
||||
color: isSelected ? sev.color : Colors.white.withValues(alpha: 0.1),
|
||||
color: isSelected ? sev.color : SojornColors.basicWhite.withValues(alpha: 0.1),
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Icon(sev.icon, size: 18, color: isSelected ? sev.color : Colors.white.withValues(alpha: 0.5)),
|
||||
Icon(sev.icon, size: 18, color: isSelected ? sev.color : SojornColors.basicWhite.withValues(alpha: 0.5)),
|
||||
const SizedBox(height: 4),
|
||||
Text(sev.label,
|
||||
style: TextStyle(
|
||||
color: isSelected ? sev.color : Colors.white.withValues(alpha: 0.5),
|
||||
color: isSelected ? sev.color : SojornColors.basicWhite.withValues(alpha: 0.5),
|
||||
fontSize: 10, fontWeight: FontWeight.w600)),
|
||||
],
|
||||
),
|
||||
|
|
@ -287,25 +288,25 @@ class _CreateBeaconSheetState extends ConsumerState<CreateBeaconSheet> {
|
|||
// Description
|
||||
TextFormField(
|
||||
controller: _descriptionController,
|
||||
style: const TextStyle(color: Colors.white, fontSize: 14),
|
||||
style: const TextStyle(color: SojornColors.basicWhite, fontSize: 14),
|
||||
decoration: InputDecoration(
|
||||
hintText: 'Describe what you see...',
|
||||
hintStyle: TextStyle(color: Colors.white.withValues(alpha: 0.3)),
|
||||
hintStyle: TextStyle(color: SojornColors.basicWhite.withValues(alpha: 0.3)),
|
||||
filled: true,
|
||||
fillColor: const Color(0xFF16213E),
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
borderSide: BorderSide(color: Colors.white.withValues(alpha: 0.1)),
|
||||
borderSide: BorderSide(color: SojornColors.basicWhite.withValues(alpha: 0.1)),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
borderSide: BorderSide(color: Colors.white.withValues(alpha: 0.1)),
|
||||
borderSide: BorderSide(color: SojornColors.basicWhite.withValues(alpha: 0.1)),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
borderSide: const BorderSide(color: Colors.red, width: 1),
|
||||
borderSide: const BorderSide(color: SojornColors.destructive, width: 1),
|
||||
),
|
||||
counterStyle: TextStyle(color: Colors.white.withValues(alpha: 0.3)),
|
||||
counterStyle: TextStyle(color: SojornColors.basicWhite.withValues(alpha: 0.3)),
|
||||
),
|
||||
maxLines: 3,
|
||||
maxLength: 300,
|
||||
|
|
@ -324,8 +325,8 @@ class _CreateBeaconSheetState extends ConsumerState<CreateBeaconSheet> {
|
|||
top: 6, right: 6,
|
||||
child: IconButton(
|
||||
onPressed: _removeImage,
|
||||
icon: const Icon(Icons.close, color: Colors.white, size: 18),
|
||||
style: IconButton.styleFrom(backgroundColor: Colors.black54, padding: const EdgeInsets.all(4)),
|
||||
icon: const Icon(Icons.close, color: SojornColors.basicWhite, size: 18),
|
||||
style: IconButton.styleFrom(backgroundColor: SojornColors.overlayDark, padding: const EdgeInsets.all(4)),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
|
@ -339,18 +340,18 @@ class _CreateBeaconSheetState extends ConsumerState<CreateBeaconSheet> {
|
|||
decoration: BoxDecoration(
|
||||
color: const Color(0xFF16213E),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
border: Border.all(color: Colors.white.withValues(alpha: 0.1)),
|
||||
border: Border.all(color: SojornColors.basicWhite.withValues(alpha: 0.1)),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
if (_isUploadingImage)
|
||||
const SizedBox(width: 16, height: 16, child: CircularProgressIndicator(strokeWidth: 2, color: Colors.white54))
|
||||
SizedBox(width: 16, height: 16, child: CircularProgressIndicator(strokeWidth: 2, color: SojornColors.basicWhite.withValues(alpha: 0.54)))
|
||||
else
|
||||
Icon(Icons.add_photo_alternate, size: 18, color: Colors.white.withValues(alpha: 0.5)),
|
||||
Icon(Icons.add_photo_alternate, size: 18, color: SojornColors.basicWhite.withValues(alpha: 0.5)),
|
||||
const SizedBox(width: 8),
|
||||
Text(_isUploadingImage ? 'Uploading...' : 'Add photo evidence',
|
||||
style: TextStyle(color: Colors.white.withValues(alpha: 0.5), fontSize: 13)),
|
||||
style: TextStyle(color: SojornColors.basicWhite.withValues(alpha: 0.5), fontSize: 13)),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
|
@ -365,13 +366,13 @@ class _CreateBeaconSheetState extends ConsumerState<CreateBeaconSheet> {
|
|||
child: ElevatedButton(
|
||||
onPressed: _isSubmitting ? null : _submit,
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Colors.red,
|
||||
foregroundColor: Colors.white,
|
||||
backgroundColor: SojornColors.destructive,
|
||||
foregroundColor: SojornColors.basicWhite,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
||||
disabledBackgroundColor: Colors.red.withValues(alpha: 0.3),
|
||||
disabledBackgroundColor: SojornColors.destructive.withValues(alpha: 0.3),
|
||||
),
|
||||
child: _isSubmitting
|
||||
? const SizedBox(width: 20, height: 20, child: CircularProgressIndicator(strokeWidth: 2, color: Colors.white))
|
||||
? const SizedBox(width: 20, height: 20, child: CircularProgressIndicator(strokeWidth: 2, color: SojornColors.basicWhite))
|
||||
: const Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
|
|
|
|||
Loading…
Reference in a new issue