diff --git a/dialer/lib/core/utils/color_utils.dart b/dialer/lib/core/utils/color_utils.dart deleted file mode 100644 index 6677b1f..0000000 --- a/dialer/lib/core/utils/color_utils.dart +++ /dev/null @@ -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(); -} diff --git a/dialer/lib/presentation/features/call/call_page.dart b/dialer/lib/presentation/features/call/call_page.dart index 137e7cf..46f04b5 100644 --- a/dialer/lib/presentation/features/call/call_page.dart +++ b/dialer/lib/presentation/features/call/call_page.dart @@ -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 { diff --git a/dialer/lib/presentation/features/call/incoming_call_page.dart b/dialer/lib/presentation/features/call/incoming_call_page.dart index 1abe72d..e1eae95 100644 --- a/dialer/lib/presentation/features/call/incoming_call_page.dart +++ b/dialer/lib/presentation/features/call/incoming_call_page.dart @@ -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 { diff --git a/dialer/lib/presentation/features/contacts/widgets/alphabet_scroll_page.dart b/dialer/lib/presentation/features/contacts/widgets/alphabet_scroll_page.dart index c0af877..ff723fe 100644 --- a/dialer/lib/presentation/features/contacts/widgets/alphabet_scroll_page.dart +++ b/dialer/lib/presentation/features/contacts/widgets/alphabet_scroll_page.dart @@ -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';