Replace inline Colors.* with SojornColors tokens in beacon_screen.dart (46 replacements)

This commit is contained in:
Patrick Britton 2026-02-10 14:16:46 -06:00
parent 9093c17e55
commit 54fac1eafa

View file

@ -8,6 +8,7 @@ import '../../providers/api_provider.dart';
import '../../models/post.dart';
import 'beacon_detail_screen.dart';
import 'create_beacon_sheet.dart';
import '../../theme/tokens.dart';
class BeaconScreen extends ConsumerStatefulWidget {
final LatLng? initialMapCenter;
@ -157,10 +158,10 @@ class _BeaconScreenState extends ConsumerState<BeaconScreen> {
}
Color get _safetyStatusColor {
if (_criticalCount > 0) return Colors.red;
if (_highCount > 0) return Colors.deepOrange;
if (_mediumCount > 0) return Colors.amber;
return Colors.green;
if (_criticalCount > 0) return SojornColors.destructive;
if (_highCount > 0) return const Color(0xFFFF5722);
if (_mediumCount > 0) return SojornColors.nsfwWarningIcon;
return const Color(0xFF4CAF50);
}
@override
@ -193,7 +194,7 @@ class _BeaconScreenState extends ConsumerState<BeaconScreen> {
borderRadius: const BorderRadius.vertical(top: Radius.circular(20)),
boxShadow: [
BoxShadow(
color: Colors.black.withValues(alpha: 0.4),
color: SojornColors.overlayDark,
blurRadius: 20,
offset: const Offset(0, -4),
),
@ -213,10 +214,10 @@ class _BeaconScreenState extends ConsumerState<BeaconScreen> {
child: Center(
child: Column(
children: [
Icon(Icons.shield, color: Colors.green.withValues(alpha: 0.5), size: 48),
Icon(Icons.shield, color: const Color(0xFF4CAF50).withValues(alpha: 0.5), size: 48),
const SizedBox(height: 12),
Text('All clear in your area',
style: TextStyle(color: Colors.white.withValues(alpha: 0.6), fontSize: 14)),
style: TextStyle(color: SojornColors.basicWhite.withValues(alpha: 0.6), fontSize: 14)),
],
),
),
@ -267,7 +268,7 @@ class _BeaconScreenState extends ConsumerState<BeaconScreen> {
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),
),
),
@ -286,13 +287,13 @@ class _BeaconScreenState extends ConsumerState<BeaconScreen> {
const SizedBox(width: 10),
Expanded(
child: Text(_safetyStatusText,
style: const TextStyle(color: Colors.white, fontSize: 15, fontWeight: FontWeight.w600)),
style: const TextStyle(color: SojornColors.basicWhite, fontSize: 15, fontWeight: FontWeight.w600)),
),
if (_isLoading)
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))),
const SizedBox(width: 8),
Text('${_beacons.length}', style: TextStyle(color: Colors.white.withValues(alpha: 0.5), fontSize: 13)),
Icon(Icons.keyboard_arrow_up, color: Colors.white.withValues(alpha: 0.4), size: 20),
Text('${_beacons.length}', style: TextStyle(color: SojornColors.basicWhite.withValues(alpha: 0.5), fontSize: 13)),
Icon(Icons.keyboard_arrow_up, color: SojornColors.basicWhite.withValues(alpha: 0.4), size: 20),
],
),
],
@ -315,7 +316,7 @@ class _BeaconScreenState extends ConsumerState<BeaconScreen> {
color: const Color(0xFF16213E),
borderRadius: BorderRadius.circular(12),
border: Border.all(
color: isRecent ? severityColor.withValues(alpha: 0.6) : Colors.white.withValues(alpha: 0.08),
color: isRecent ? severityColor.withValues(alpha: 0.6) : SojornColors.basicWhite.withValues(alpha: 0.08),
),
),
child: Row(
@ -338,37 +339,37 @@ class _BeaconScreenState extends ConsumerState<BeaconScreen> {
children: [
Expanded(
child: Text(beacon.beaconType.displayName,
style: const TextStyle(color: Colors.white, fontSize: 14, fontWeight: FontWeight.w600),
style: const TextStyle(color: SojornColors.basicWhite, fontSize: 14, fontWeight: FontWeight.w600),
overflow: TextOverflow.ellipsis),
),
if (isRecent)
Container(
padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 2),
decoration: BoxDecoration(
color: Colors.red.withValues(alpha: 0.2),
color: SojornColors.destructive.withValues(alpha: 0.2),
borderRadius: BorderRadius.circular(4),
),
child: const Text('LIVE', style: TextStyle(color: Colors.red, fontSize: 9, fontWeight: FontWeight.bold)),
child: const Text('LIVE', style: TextStyle(color: SojornColors.destructive, fontSize: 9, fontWeight: FontWeight.bold)),
),
],
),
const SizedBox(height: 3),
Text(beacon.body, maxLines: 1, overflow: TextOverflow.ellipsis,
style: TextStyle(color: Colors.white.withValues(alpha: 0.6), fontSize: 12)),
style: TextStyle(color: SojornColors.basicWhite.withValues(alpha: 0.6), fontSize: 12)),
const SizedBox(height: 4),
Row(
children: [
Icon(Icons.schedule, size: 11, color: Colors.white.withValues(alpha: 0.4)),
Icon(Icons.schedule, size: 11, 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: 10),
Icon(Icons.location_on, size: 11, color: Colors.white.withValues(alpha: 0.4)),
Icon(Icons.location_on, size: 11, 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 Spacer(),
Icon(Icons.visibility, size: 11, color: Colors.white.withValues(alpha: 0.4)),
Icon(Icons.visibility, size: 11, color: SojornColors.basicWhite.withValues(alpha: 0.4)),
const SizedBox(width: 3),
Text('${beacon.verificationCount}', style: TextStyle(color: Colors.white.withValues(alpha: 0.4), fontSize: 11)),
Text('${beacon.verificationCount}', style: TextStyle(color: SojornColors.basicWhite.withValues(alpha: 0.4), fontSize: 11)),
],
),
],
@ -419,15 +420,15 @@ class _BeaconScreenState extends ConsumerState<BeaconScreen> {
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [Colors.black.withValues(alpha: 0.8), Colors.transparent],
colors: [const Color(0xCC000000), SojornColors.transparent],
),
),
child: Row(
children: [
IconButton(
onPressed: () => Navigator.of(context).pop(),
icon: const Icon(Icons.arrow_back, color: Colors.white),
style: IconButton.styleFrom(backgroundColor: Colors.black26),
icon: const Icon(Icons.arrow_back, color: SojornColors.basicWhite),
style: IconButton.styleFrom(backgroundColor: const Color(0x42000000)),
),
const SizedBox(width: 8),
Expanded(
@ -435,26 +436,26 @@ class _BeaconScreenState extends ConsumerState<BeaconScreen> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('Beacon Network',
style: Theme.of(context).textTheme.titleMedium?.copyWith(color: Colors.white, fontWeight: FontWeight.bold)),
style: Theme.of(context).textTheme.titleMedium?.copyWith(color: SojornColors.basicWhite, fontWeight: FontWeight.bold)),
Text('${_beacons.length} incident${_beacons.length != 1 ? 's' : ''} nearby',
style: Theme.of(context).textTheme.bodySmall?.copyWith(color: Colors.white70)),
style: Theme.of(context).textTheme.bodySmall?.copyWith(color: SojornColors.basicWhite.withValues(alpha: 0.7))),
],
),
),
if (_isLoading || _isLoadingLocation)
const Padding(
padding: EdgeInsets.only(right: 8),
child: SizedBox(width: 18, height: 18, child: CircularProgressIndicator(strokeWidth: 2, valueColor: AlwaysStoppedAnimation<Color>(Colors.white))),
child: SizedBox(width: 18, height: 18, child: CircularProgressIndicator(strokeWidth: 2, valueColor: AlwaysStoppedAnimation<Color>(SojornColors.basicWhite))),
),
IconButton(
onPressed: _isLoadingLocation ? null : () => _getCurrentLocation(forceCenter: true),
icon: const Icon(Icons.my_location, color: Colors.white),
style: IconButton.styleFrom(backgroundColor: Colors.black26),
icon: const Icon(Icons.my_location, color: SojornColors.basicWhite),
style: IconButton.styleFrom(backgroundColor: const Color(0x42000000)),
),
IconButton(
onPressed: () => _loadBeacons(),
icon: const Icon(Icons.refresh, color: Colors.white),
style: IconButton.styleFrom(backgroundColor: Colors.black26),
icon: const Icon(Icons.refresh, color: SojornColors.basicWhite),
style: IconButton.styleFrom(backgroundColor: const Color(0x42000000)),
),
],
),
@ -467,8 +468,8 @@ class _BeaconScreenState extends ConsumerState<BeaconScreen> {
return FloatingActionButton(
heroTag: 'safety_report',
onPressed: _onCreateBeacon,
backgroundColor: Colors.red,
foregroundColor: Colors.white,
backgroundColor: SojornColors.destructive,
foregroundColor: SojornColors.basicWhite,
elevation: 8,
child: const Icon(Icons.warning_rounded, size: 28),
);
@ -488,14 +489,14 @@ class _BeaconScreenState extends ConsumerState<BeaconScreen> {
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
const Icon(Icons.shield, size: 64, color: Colors.red),
const Icon(Icons.shield, size: 64, color: SojornColors.destructive),
const SizedBox(height: 24),
Text('Enable Location',
style: Theme.of(context).textTheme.headlineSmall?.copyWith(fontWeight: FontWeight.bold, color: Colors.white),
style: Theme.of(context).textTheme.headlineSmall?.copyWith(fontWeight: FontWeight.bold, color: SojornColors.basicWhite),
textAlign: TextAlign.center),
const SizedBox(height: 16),
Text('Location access is required to show safety alerts in your area.',
style: Theme.of(context).textTheme.bodyMedium?.copyWith(color: Colors.white70),
style: Theme.of(context).textTheme.bodyMedium?.copyWith(color: SojornColors.basicWhite.withValues(alpha: 0.7)),
textAlign: TextAlign.center),
const SizedBox(height: 24),
ElevatedButton.icon(
@ -504,7 +505,7 @@ class _BeaconScreenState extends ConsumerState<BeaconScreen> {
? const SizedBox(width: 20, height: 20, child: CircularProgressIndicator(strokeWidth: 2))
: const Icon(Icons.location_on),
label: const Text('Allow Location'),
style: ElevatedButton.styleFrom(backgroundColor: Colors.red, foregroundColor: Colors.white),
style: ElevatedButton.styleFrom(backgroundColor: SojornColors.destructive, foregroundColor: SojornColors.basicWhite),
),
],
),