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/services.dart';
import 'package:traccar_client/main_screen.dart';
import 'package:traccar_client/permission_screen.dart';
import 'package:traccar_client/preferences.dart';

View file

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

View file

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

View file

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

View file

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