This commit is contained in:
parent
6b5fef4b93
commit
bf775d0f9b
@ -9,16 +9,6 @@ import 'package:dialer/features/settings/settings.dart';
|
||||
import '../../services/contact_service.dart';
|
||||
import 'package:dialer/features/voicemail/voicemail_page.dart';
|
||||
|
||||
const bool _privacyMode = bool.fromEnvironment('privacy-mode', defaultValue: false);
|
||||
|
||||
String _maskName(String name) {
|
||||
if (!_privacyMode) return name;
|
||||
final parts = name.split(' ');
|
||||
return parts.map((part) {
|
||||
if (part.length < 2) return part;
|
||||
return '${part[0]}${'*' * (part.length - 1)}';
|
||||
}).join(' ');
|
||||
}
|
||||
|
||||
class _MyHomePageState extends State<MyHomePage>
|
||||
with SingleTickerProviderStateMixin {
|
||||
@ -104,7 +94,7 @@ class _MyHomePageState extends State<MyHomePage>
|
||||
return SearchBar(
|
||||
controller: controller,
|
||||
padding:
|
||||
MaterialStateProperty.all<EdgeInsetsGeometry>(
|
||||
WidgetStateProperty.all<EdgeInsetsGeometry>(
|
||||
const EdgeInsets.only(
|
||||
top: 6.0,
|
||||
bottom: 6.0,
|
||||
@ -116,10 +106,10 @@ class _MyHomePageState extends State<MyHomePage>
|
||||
controller.openView();
|
||||
_onSearchChanged('');
|
||||
},
|
||||
backgroundColor: MaterialStateProperty.all(
|
||||
backgroundColor: WidgetStateProperty.all(
|
||||
const Color.fromARGB(255, 30, 30, 30)),
|
||||
hintText: 'Search contacts',
|
||||
hintStyle: MaterialStateProperty.all(
|
||||
hintStyle: WidgetStateProperty.all(
|
||||
const TextStyle(color: Colors.grey, fontSize: 16.0),
|
||||
),
|
||||
leading: const Icon(
|
||||
@ -128,7 +118,7 @@ class _MyHomePageState extends State<MyHomePage>
|
||||
size: 24.0,
|
||||
),
|
||||
shape:
|
||||
MaterialStateProperty.all<RoundedRectangleBorder>(
|
||||
WidgetStateProperty.all<RoundedRectangleBorder>(
|
||||
RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12.0),
|
||||
),
|
||||
@ -141,7 +131,14 @@ class _MyHomePageState extends State<MyHomePage>
|
||||
suggestionsBuilder:
|
||||
(BuildContext context, SearchController controller) {
|
||||
return _contactSuggestions.map((contact) {
|
||||
return _buildSuggestionTile(contact, controller);
|
||||
return ListTile(
|
||||
key: ValueKey(contact.id),
|
||||
title: Text(_obfuscateService.obfuscateData(contact.displayName),
|
||||
style: const TextStyle(color: Colors.white)),
|
||||
onTap: () {
|
||||
controller.closeView(contact.displayName);
|
||||
},
|
||||
);
|
||||
}).toList();
|
||||
},
|
||||
),
|
||||
@ -237,17 +234,6 @@ class _MyHomePageState extends State<MyHomePage>
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildSuggestionTile(Contact contact, SearchController controller) {
|
||||
final maskedName = _maskName(contact.displayName);
|
||||
return ListTile(
|
||||
key: ValueKey(contact.id),
|
||||
title: Text(maskedName, style: const TextStyle(color: Colors.white)),
|
||||
onTap: () {
|
||||
controller.closeView(maskedName);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class MyHomePage extends StatefulWidget {
|
||||
|
Loading…
Reference in New Issue
Block a user