import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import '../models/agent_status.dart'; import '../providers/agent_provider.dart'; class AgentStatusToggle extends StatelessWidget { const AgentStatusToggle({super.key}); @override Widget build(BuildContext context) { final agent = context.watch(); final current = agent.status?.status ?? AgentStatusValue.offline; return Card( child: Padding( padding: const EdgeInsets.all(16), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text('Agent Status', style: Theme.of(context).textTheme.titleSmall), const SizedBox(height: 12), SegmentedButton( segments: const [ ButtonSegment( value: AgentStatusValue.available, label: Text('Available'), icon: Icon(Icons.circle, color: Colors.green, size: 12), ), ButtonSegment( value: AgentStatusValue.busy, label: Text('Busy'), icon: Icon(Icons.circle, color: Colors.orange, size: 12), ), ButtonSegment( value: AgentStatusValue.offline, label: Text('Offline'), icon: Icon(Icons.circle, color: Colors.red, size: 12), ), ], selected: {current}, onSelectionChanged: (selection) { agent.updateStatus(selection.first); }, ), ], ), ), ); } }