refactor: remove unused color_utils import and replace with username_color_generator in call and contact pages
All checks were successful
/ mirror (push) Successful in 14s
/ build (push) Successful in 10m38s
/ build-stealth (push) Successful in 10m43s

This commit is contained in:
AlexisDanlos 2025-05-16 22:33:48 +02:00
parent 6fc2991d1e
commit 960ddd8e8f
4 changed files with 3 additions and 40 deletions

View File

@ -1,37 +0,0 @@
import 'package:flutter/material.dart';
/// Generates a color based on a string input (typically a name)
Color generateColorFromName(String name) {
if (name.isEmpty) return Colors.grey;
// Use the hashCode of the name to generate a consistent color
int hash = name.hashCode;
// Use the hash to generate RGB values
final r = (hash & 0xFF0000) >> 16;
final g = (hash & 0x00FF00) >> 8;
final b = hash & 0x0000FF;
// Create a color with these RGB values
return Color.fromARGB(255, r, g, b);
}
/// Darkens a color by a percentage (0.0 to 1.0)
Color darken(Color color, [double amount = 0.3]) {
assert(amount >= 0 && amount <= 1);
final hsl = HSLColor.fromColor(color);
final darkened = hsl.withLightness((hsl.lightness - amount).clamp(0.0, 1.0));
return darkened.toColor();
}
/// Lightens a color by a percentage (0.0 to 1.0)
Color lighten(Color color, [double amount = 0.3]) {
assert(amount >= 0 && amount <= 1);
final hsl = HSLColor.fromColor(color);
final lightened = hsl.withLightness((hsl.lightness + amount).clamp(0.0, 1.0));
return lightened.toColor();
}

View File

@ -3,7 +3,7 @@ import 'package:flutter/services.dart';
import 'dart:typed_data';
import '../../../domain/services/call_service.dart';
import '../../../domain/services/obfuscate_service.dart';
import '../../../core/utils/color_utils.dart';
import 'package:dialer/presentation/common/widgets/username_color_generator.dart';
// import '../../../presentation/common/widgets/obfuscated_avatar.dart';
class CallPage extends StatefulWidget {

View File

@ -3,7 +3,7 @@ import 'package:flutter/services.dart';
import 'dart:typed_data';
import '../../../domain/services/call_service.dart';
import '../../../domain/services/obfuscate_service.dart';
import '../../../core/utils/color_utils.dart';
import 'package:dialer/presentation/common/widgets/username_color_generator.dart';
import 'call_page.dart';
class IncomingCallPage extends StatefulWidget {

View File

@ -1,7 +1,7 @@
import 'package:flutter/material.dart';
import 'package:flutter_contacts/flutter_contacts.dart';
import '../../../../domain/services/obfuscate_service.dart';
import '../../../../core/utils/color_utils.dart';
import 'package:dialer/presentation/common/widgets/username_color_generator.dart';
import '../contact_state.dart';
import 'add_contact_button.dart';
import 'contact_modal.dart';