feat: Add Voicemail feature with playback functionality #32
@ -9,16 +9,6 @@ import 'package:dialer/features/settings/settings.dart';
|
|||||||
import '../../services/contact_service.dart';
|
import '../../services/contact_service.dart';
|
||||||
import 'package:dialer/features/voicemail/voicemail_page.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>
|
class _MyHomePageState extends State<MyHomePage>
|
||||||
with SingleTickerProviderStateMixin {
|
with SingleTickerProviderStateMixin {
|
||||||
@ -104,7 +94,7 @@ class _MyHomePageState extends State<MyHomePage>
|
|||||||
return SearchBar(
|
return SearchBar(
|
||||||
controller: controller,
|
controller: controller,
|
||||||
padding:
|
padding:
|
||||||
MaterialStateProperty.all<EdgeInsetsGeometry>(
|
WidgetStateProperty.all<EdgeInsetsGeometry>(
|
||||||
const EdgeInsets.only(
|
const EdgeInsets.only(
|
||||||
top: 6.0,
|
top: 6.0,
|
||||||
bottom: 6.0,
|
bottom: 6.0,
|
||||||
@ -116,10 +106,10 @@ class _MyHomePageState extends State<MyHomePage>
|
|||||||
controller.openView();
|
controller.openView();
|
||||||
_onSearchChanged('');
|
_onSearchChanged('');
|
||||||
},
|
},
|
||||||
backgroundColor: MaterialStateProperty.all(
|
backgroundColor: WidgetStateProperty.all(
|
||||||
const Color.fromARGB(255, 30, 30, 30)),
|
const Color.fromARGB(255, 30, 30, 30)),
|
||||||
hintText: 'Search contacts',
|
hintText: 'Search contacts',
|
||||||
hintStyle: MaterialStateProperty.all(
|
hintStyle: WidgetStateProperty.all(
|
||||||
const TextStyle(color: Colors.grey, fontSize: 16.0),
|
const TextStyle(color: Colors.grey, fontSize: 16.0),
|
||||||
),
|
),
|
||||||
leading: const Icon(
|
leading: const Icon(
|
||||||
@ -128,7 +118,7 @@ class _MyHomePageState extends State<MyHomePage>
|
|||||||
size: 24.0,
|
size: 24.0,
|
||||||
),
|
),
|
||||||
shape:
|
shape:
|
||||||
MaterialStateProperty.all<RoundedRectangleBorder>(
|
WidgetStateProperty.all<RoundedRectangleBorder>(
|
||||||
RoundedRectangleBorder(
|
RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.circular(12.0),
|
borderRadius: BorderRadius.circular(12.0),
|
||||||
),
|
),
|
||||||
@ -141,7 +131,14 @@ class _MyHomePageState extends State<MyHomePage>
|
|||||||
suggestionsBuilder:
|
suggestionsBuilder:
|
||||||
(BuildContext context, SearchController controller) {
|
(BuildContext context, SearchController controller) {
|
||||||
return _contactSuggestions.map((contact) {
|
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();
|
}).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 {
|
class MyHomePage extends StatefulWidget {
|
||||||
|
Loading…
Reference in New Issue
Block a user