G-EIP-700-TLS-7-1-eip-steph.../lib/pages/settingsCall.dart
2024-10-25 12:29:44 +01:00

93 lines
2.6 KiB
Dart

import 'package:flutter/material.dart';
class SettingsCallPage extends StatefulWidget {
const SettingsCallPage({super.key});
@override
_SettingsCallPageState createState() => _SettingsCallPageState();
}
class _SettingsCallPageState extends State<SettingsCallPage> {
bool _enableVoicemail = true;
bool _enableCallRecording = false;
String _ringtone = 'Default';
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.black,
appBar: AppBar(
title: const Text('Calling Settings'),
),
body: ListView(
children: [
SwitchListTile(
title: const Text('Enable Voicemail', style: TextStyle(color: Colors.white)),
value: _enableVoicemail,
onChanged: (bool value) {
setState(() {
_enableVoicemail = value;
});
},
),
SwitchListTile(
title: const Text('Enable Call Recording', style: TextStyle(color: Colors.white)),
value: _enableCallRecording,
onChanged: (bool value) {
setState(() {
_enableCallRecording = value;
});
},
),
ListTile(
title: const Text('Ringtone', style: TextStyle(color: Colors.white)),
subtitle: Text(_ringtone, style: const TextStyle(color: Colors.grey)),
trailing: const Icon(Icons.arrow_forward_ios, color: Colors.white),
onTap: () {
_selectRingtone(context);
},
),
],
),
);
}
void _selectRingtone(BuildContext context) {
showDialog<String>(
context: context,
builder: (BuildContext context) {
return SimpleDialog(
title: const Text('Select Ringtone'),
children: <Widget>[
SimpleDialogOption(
onPressed: () {
Navigator.pop(context, 'Default');
},
child: const Text('Default'),
),
SimpleDialogOption(
onPressed: () {
Navigator.pop(context, 'Classic');
},
child: const Text('Classic'),
),
SimpleDialogOption(
onPressed: () {
Navigator.pop(context, 'Beep');
},
child: const Text('Beep'),
),
// Add more ringtone options
],
);
},
).then((value) {
if (value != null) {
setState(() {
_ringtone = value;
});
}
});
}
}