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