chore: fix deprecated APIs and unused imports

This commit is contained in:
fiatcode 2026-04-30 16:26:56 +07:00
parent 6cbb7a2070
commit 93d5534755
No known key found for this signature in database
5 changed files with 23 additions and 22 deletions

View file

@ -1,5 +1,4 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:traccar_client/main_screen.dart'; import 'package:traccar_client/main_screen.dart';
import 'package:traccar_client/permission_screen.dart'; import 'package:traccar_client/permission_screen.dart';
import 'package:traccar_client/preferences.dart'; import 'package:traccar_client/preferences.dart';

View file

@ -188,7 +188,7 @@ class _MainScreenState extends State<MainScreen> with TickerProviderStateMixin {
boxShadow: _isTracking boxShadow: _isTracking
? [ ? [
BoxShadow( BoxShadow(
color: const Color(0xFF00e676).withOpacity(0.6), color: const Color(0xFF00e676).withValues(alpha: 0.6),
blurRadius: 8, blurRadius: 8,
spreadRadius: 2, spreadRadius: 2,
), ),
@ -248,7 +248,7 @@ class _MainScreenState extends State<MainScreen> with TickerProviderStateMixin {
fontSize: 11, fontSize: 11,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
letterSpacing: 2, letterSpacing: 2,
color: const Color(0xFF00bcd4).withOpacity(0.8), color: const Color(0xFF00bcd4).withValues(alpha: 0.8),
), ),
), ),
], ],
@ -330,7 +330,7 @@ class _MainScreenState extends State<MainScreen> with TickerProviderStateMixin {
BoxShadow( BoxShadow(
color: const Color( color: const Color(
0xFF00e676, 0xFF00e676,
).withOpacity(0.15 * _pulseAnimation.value), ).withValues(alpha: 0.15 * _pulseAnimation.value),
blurRadius: 12, blurRadius: 12,
spreadRadius: 0, spreadRadius: 0,
), ),

View file

@ -324,7 +324,7 @@ class _PermissionScreenState extends State<PermissionScreen> {
borderRadius: BorderRadius.circular(4), borderRadius: BorderRadius.circular(4),
border: Border.all( border: Border.all(
color: granted color: granted
? const Color(0xFF00e676).withOpacity(0.3) ? const Color(0xFF00e676).withValues(alpha: 0.3)
: const Color(0xFF2a2a2a), : const Color(0xFF2a2a2a),
width: 1, width: 1,
), ),
@ -336,7 +336,7 @@ class _PermissionScreenState extends State<PermissionScreen> {
height: 36, height: 36,
decoration: BoxDecoration( decoration: BoxDecoration(
color: granted color: granted
? const Color(0xFF00e676).withOpacity(0.15) ? const Color(0xFF00e676).withValues(alpha: 0.15)
: const Color(0xFF2a2a2a), : const Color(0xFF2a2a2a),
borderRadius: BorderRadius.circular(4), borderRadius: BorderRadius.circular(4),
), ),
@ -382,10 +382,10 @@ class _PermissionScreenState extends State<PermissionScreen> {
vertical: 4, vertical: 4,
), ),
decoration: BoxDecoration( decoration: BoxDecoration(
color: const Color(0xFF00e676).withOpacity(0.15), color: const Color(0xFF00e676).withValues(alpha: 0.15),
borderRadius: BorderRadius.circular(3), borderRadius: BorderRadius.circular(3),
border: Border.all( border: Border.all(
color: const Color(0xFF00e676).withOpacity(0.4), color: const Color(0xFF00e676).withValues(alpha: 0.4),
width: 1, width: 1,
), ),
), ),
@ -407,10 +407,10 @@ class _PermissionScreenState extends State<PermissionScreen> {
vertical: 4, vertical: 4,
), ),
decoration: BoxDecoration( decoration: BoxDecoration(
color: const Color(0xFF00bcd4).withOpacity(0.1), color: const Color(0xFF00bcd4).withValues(alpha: 0.1),
borderRadius: BorderRadius.circular(3), borderRadius: BorderRadius.circular(3),
border: Border.all( border: Border.all(
color: const Color(0xFF00bcd4).withOpacity(0.4), color: const Color(0xFF00bcd4).withValues(alpha: 0.4),
width: 1, width: 1,
), ),
), ),
@ -491,7 +491,7 @@ class _PermissionScreenState extends State<PermissionScreen> {
Widget _buildContinueButton() { Widget _buildContinueButton() {
return Material( return Material(
color: _allGranted color: _allGranted
? const Color(0xFF00e676).withOpacity(0.15) ? const Color(0xFF00e676).withValues(alpha: 0.15)
: const Color(0xFF2a2a2a), : const Color(0xFF2a2a2a),
borderRadius: BorderRadius.circular(4), borderRadius: BorderRadius.circular(4),
child: InkWell( child: InkWell(
@ -504,7 +504,7 @@ class _PermissionScreenState extends State<PermissionScreen> {
borderRadius: BorderRadius.circular(4), borderRadius: BorderRadius.circular(4),
border: Border.all( border: Border.all(
color: _allGranted color: _allGranted
? const Color(0xFF00e676).withOpacity(0.4) ? const Color(0xFF00e676).withValues(alpha: 0.4)
: const Color(0xFF2a2a2a), : const Color(0xFF2a2a2a),
width: 1, width: 1,
), ),

View file

@ -240,7 +240,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
border: Border.all(color: const Color(0xFF2a2a2a), width: 1), border: Border.all(color: const Color(0xFF2a2a2a), width: 1),
), ),
child: DropdownButtonFormField<int>( child: DropdownButtonFormField<int>(
value: _accuracy, initialValue: _accuracy,
dropdownColor: const Color(0xFF1a1a1a), dropdownColor: const Color(0xFF1a1a1a),
style: const TextStyle( style: const TextStyle(
fontFamily: 'monospace', fontFamily: 'monospace',
@ -359,8 +359,8 @@ class _SettingsScreenState extends State<SettingsScreen> {
Switch( Switch(
value: value, value: value,
onChanged: onChanged, onChanged: onChanged,
activeColor: const Color(0xFF00e676), activeThumbColor: const Color(0xFF00e676),
activeTrackColor: const Color(0xFF00e676).withOpacity(0.3), activeTrackColor: const Color(0xFF00e676).withValues(alpha: 0.3),
), ),
], ],
), ),
@ -369,7 +369,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
Widget _buildSaveButton() { Widget _buildSaveButton() {
return Material( return Material(
color: const Color(0xFF00bcd4).withOpacity(0.1), color: const Color(0xFF00bcd4).withValues(alpha: 0.1),
borderRadius: BorderRadius.circular(4), borderRadius: BorderRadius.circular(4),
child: InkWell( child: InkWell(
onTap: _saveSettings, onTap: _saveSettings,
@ -380,7 +380,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4), borderRadius: BorderRadius.circular(4),
border: Border.all( border: Border.all(
color: const Color(0xFF00bcd4).withOpacity(0.4), color: const Color(0xFF00bcd4).withValues(alpha: 0.4),
width: 1, width: 1,
), ),
), ),

View file

@ -189,7 +189,9 @@ class _StatusScreenState extends State<StatusScreen> {
style: TextStyle( style: TextStyle(
fontFamily: 'monospace', fontFamily: 'monospace',
fontSize: 11, fontSize: 11,
color: const Color(0xFF424242).withOpacity(0.6), color: const Color(
0xFF424242,
).withValues(alpha: 0.6),
), ),
), ),
], ],
@ -217,12 +219,12 @@ class _StatusScreenState extends State<StatusScreen> {
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 4), padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 4),
decoration: BoxDecoration( decoration: BoxDecoration(
color: isSelected color: isSelected
? const Color(0xFF00bcd4).withOpacity(0.15) ? const Color(0xFF00bcd4).withValues(alpha: 0.15)
: Colors.transparent, : Colors.transparent,
borderRadius: BorderRadius.circular(3), borderRadius: BorderRadius.circular(3),
border: Border.all( border: Border.all(
color: isSelected color: isSelected
? const Color(0xFF00bcd4).withOpacity(0.5) ? const Color(0xFF00bcd4).withValues(alpha: 0.5)
: const Color(0xFF2a2a2a), : const Color(0xFF2a2a2a),
width: 1, width: 1,
), ),
@ -276,7 +278,7 @@ class _StatusScreenState extends State<StatusScreen> {
width: 16, width: 16,
height: 16, height: 16,
decoration: BoxDecoration( decoration: BoxDecoration(
color: color.withOpacity(0.15), color: color.withValues(alpha: 0.15),
borderRadius: BorderRadius.circular(3), borderRadius: BorderRadius.circular(3),
), ),
child: Icon(icon, size: 10, color: color), child: Icon(icon, size: 10, color: color),
@ -285,7 +287,7 @@ class _StatusScreenState extends State<StatusScreen> {
Container( Container(
padding: const EdgeInsets.symmetric(horizontal: 5, vertical: 1), padding: const EdgeInsets.symmetric(horizontal: 5, vertical: 1),
decoration: BoxDecoration( decoration: BoxDecoration(
color: color.withOpacity(0.1), color: color.withValues(alpha: 0.1),
borderRadius: BorderRadius.circular(2), borderRadius: BorderRadius.circular(2),
), ),
child: Text( child: Text(