monorepo/dialer/lib/widgets/encrypt_audio_button.dart
stcb 5975977a52
All checks were successful
/ mirror (push) Successful in 4s
Trying to get audio (DON'T COMPILE)
2025-01-17 14:40:02 +02:00

41 lines
1.0 KiB
Dart

// lib/widgets/encrypt_audio_button.dart
import 'package:flutter/material.dart';
import '../services/audio_handler.dart';
class EncryptAudioButton extends StatefulWidget {
final AudioHandler audioHandler;
const EncryptAudioButton({Key? key, required this.audioHandler}) : super(key: key);
@override
_EncryptAudioButtonState createState() => _EncryptAudioButtonState();
}
class _EncryptAudioButtonState extends State<EncryptAudioButton> {
bool _isEncrypted = false;
void _toggleEncryption() {
setState(() {
_isEncrypted = !_isEncrypted;
if (_isEncrypted) {
widget.audioHandler.enableEncryption();
} else {
widget.audioHandler.disableEncryption();
}
});
}
@override
Widget build(BuildContext context) {
return IconButton(
icon: Icon(
_isEncrypted ? Icons.lock : Icons.lock_open,
color: Colors.blueAccent,
),
onPressed: _toggleEncryption,
tooltip: _isEncrypted ? 'Disable Encryption' : 'Enable Encryption',
);
}
}