part of '../neon_spreed.dart'; class SpreedCallButton extends StatelessWidget { const SpreedCallButton({ required this.type, required this.onPressed, super.key, }); final SpreedCallButtonType type; final VoidCallback? onPressed; @override Widget build(final BuildContext context) { late final String label; late final IconData icon; late final Color? backgroundColor; switch (type) { case SpreedCallButtonType.startCall: icon = Icons.videocam; label = SpreedLocalizations.of(context).callStart; backgroundColor = null; case SpreedCallButtonType.joinCall: icon = Icons.phone; label = SpreedLocalizations.of(context).callJoin; backgroundColor = Colors.green; case SpreedCallButtonType.leaveCall: icon = Icons.videocam_off; label = SpreedLocalizations.of(context).callLeave; backgroundColor = Colors.red; } return Container( margin: const EdgeInsets.all(5), child: ElevatedButton.icon( onPressed: onPressed, icon: Icon(icon), label: Text(label), style: backgroundColor != null ? ElevatedButton.styleFrom( backgroundColor: backgroundColor, foregroundColor: Theme.of(context).colorScheme.background, ) : null, ), ); } } enum SpreedCallButtonType { startCall, joinCall, leaveCall, }