refactor: 重构 Agent 模块为 AgentScope,删除旧版 CrewAI/LiteLLM 实现
This commit is contained in:
@@ -2,8 +2,13 @@ import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import '../../../../core/di/injection.dart';
|
||||
import '../../../../core/theme/design_tokens.dart';
|
||||
import '../../../../shared/widgets/app_button.dart';
|
||||
import '../../../../shared/widgets/toast/toast.dart';
|
||||
import '../../../../shared/widgets/toast/toast_type.dart';
|
||||
import '../../../calendar/data/calendar_api.dart';
|
||||
import '../../../calendar/ui/calendar_state_manager.dart';
|
||||
import '../../../calendar/ui/widgets/bottom_dock.dart';
|
||||
import '../../data/todo_api.dart';
|
||||
|
||||
class TodoQuadrantsScreen extends StatefulWidget {
|
||||
const TodoQuadrantsScreen({super.key});
|
||||
@@ -13,38 +18,103 @@ class TodoQuadrantsScreen extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _TodoQuadrantsScreenState extends State<TodoQuadrantsScreen> {
|
||||
late List<_TodoItem> _importantUrgent;
|
||||
late List<_TodoItem> _urgentNotImportant;
|
||||
late List<_TodoItem> _importantNotUrgent;
|
||||
final TodoApi _todoApi = sl<TodoApi>();
|
||||
|
||||
List<TodoResponse> _todos = [];
|
||||
bool _isLoading = true;
|
||||
String? _error;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_importantUrgent = [
|
||||
_TodoItem(title: '18:00 前提交活动方案'),
|
||||
_TodoItem(title: '回复客户邀约确认'),
|
||||
];
|
||||
_urgentNotImportant = [
|
||||
_TodoItem(title: '确认会场停车信息'),
|
||||
_TodoItem(title: '代订明早高铁票'),
|
||||
];
|
||||
_importantNotUrgent = [
|
||||
_TodoItem(title: '本周复盘与下周规划'),
|
||||
_TodoItem(title: '整理个人知识库结构'),
|
||||
_TodoItem(title: '优化三月目标里程碑'),
|
||||
];
|
||||
_loadTodos();
|
||||
}
|
||||
|
||||
void _removeItem(String id, List<_TodoItem> list) {
|
||||
Future<void> _loadTodos() async {
|
||||
setState(() {
|
||||
list.removeWhere((item) => item.id == id);
|
||||
_isLoading = true;
|
||||
_error = null;
|
||||
});
|
||||
|
||||
try {
|
||||
final todos = await _todoApi.getTodos(status: 'pending');
|
||||
setState(() {
|
||||
_todos = todos;
|
||||
_isLoading = false;
|
||||
});
|
||||
} catch (e) {
|
||||
setState(() {
|
||||
_error = e.toString();
|
||||
_isLoading = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
List<TodoResponse> get _importantUrgent =>
|
||||
_todos.where((t) => t.priority == 1).toList();
|
||||
|
||||
List<TodoResponse> get _urgentNotImportant =>
|
||||
_todos.where((t) => t.priority == 3).toList();
|
||||
|
||||
List<TodoResponse> get _importantNotUrgent =>
|
||||
_todos.where((t) => t.priority == 2).toList();
|
||||
|
||||
Future<void> _completeTodo(TodoResponse todo) async {
|
||||
try {
|
||||
await _todoApi.completeTodo(todo.id);
|
||||
if (mounted) {
|
||||
Toast.show(context, '已完成', type: ToastType.success);
|
||||
}
|
||||
try {
|
||||
await _loadTodos();
|
||||
} catch (_) {
|
||||
// ignore reload error
|
||||
}
|
||||
} catch (e) {
|
||||
if (mounted) {
|
||||
Toast.show(context, '完成失败: $e', type: ToastType.error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void _navigateToDetail(TodoResponse todo) {
|
||||
context.push('/todo/${todo.id}');
|
||||
}
|
||||
|
||||
Future<void> _addTodo() async {
|
||||
final result = await showModalBottomSheet<Map<String, dynamic>>(
|
||||
context: context,
|
||||
isScrollControlled: true,
|
||||
backgroundColor: Colors.transparent,
|
||||
builder: (context) => const _AddTodoSheet(),
|
||||
);
|
||||
|
||||
if (result != null) {
|
||||
try {
|
||||
await _todoApi.createTodo(
|
||||
title: result['title'] as String,
|
||||
description: result['description'] as String?,
|
||||
priority: result['priority'] as int,
|
||||
scheduleItemIds: (result['schedule_item_ids'] as List<String>?) ?? [],
|
||||
);
|
||||
await _loadTodos();
|
||||
} catch (e) {
|
||||
if (mounted) {
|
||||
Toast.show(context, '创建失败: $e', type: ToastType.error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.todoBg,
|
||||
floatingActionButton: FloatingActionButton(
|
||||
onPressed: _addTodo,
|
||||
backgroundColor: AppColors.blue600,
|
||||
child: const Icon(Icons.add, color: Colors.white),
|
||||
),
|
||||
body: PopScope(
|
||||
canPop: false,
|
||||
onPopInvokedWithResult: (didPop, result) {
|
||||
@@ -70,54 +140,83 @@ class _TodoQuadrantsScreenState extends State<TodoQuadrantsScreen> {
|
||||
height: 72,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 16, right: 16, top: 14, bottom: 8),
|
||||
child: Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: const Text(
|
||||
'待办事项',
|
||||
style: TextStyle(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: 22,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: AppColors.slate900,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
const Text(
|
||||
'待办事项',
|
||||
style: TextStyle(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: 22,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: AppColors.slate900,
|
||||
),
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
onPressed: _loadTodos,
|
||||
icon: const Icon(Icons.refresh, color: AppColors.slate600),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildContent() {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(left: 16, right: 16, top: 4, bottom: 96),
|
||||
child: ListView(
|
||||
children: [
|
||||
_buildQuadrant(
|
||||
title: '重要紧急',
|
||||
textColor: AppColors.g1Text,
|
||||
dividerColor: AppColors.g1Divider,
|
||||
borderColor: AppColors.g1Border,
|
||||
items: _importantUrgent,
|
||||
onRemove: (id) => _removeItem(id, _importantUrgent),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
_buildQuadrant(
|
||||
title: '紧急不重要',
|
||||
textColor: AppColors.g2Text,
|
||||
dividerColor: AppColors.g2Divider,
|
||||
borderColor: AppColors.g2Border,
|
||||
items: _urgentNotImportant,
|
||||
onRemove: (id) => _removeItem(id, _urgentNotImportant),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
_buildQuadrant(
|
||||
title: '重要不紧急',
|
||||
textColor: AppColors.g3Text,
|
||||
dividerColor: AppColors.g3Divider,
|
||||
borderColor: AppColors.g3Border,
|
||||
items: _importantNotUrgent,
|
||||
onRemove: (id) => _removeItem(id, _importantNotUrgent),
|
||||
),
|
||||
],
|
||||
if (_isLoading) {
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
}
|
||||
|
||||
if (_error != null) {
|
||||
return Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text('加载失败: $_error', style: const TextStyle(color: Colors.red)),
|
||||
const SizedBox(height: 16),
|
||||
AppButton(text: '重试', onPressed: _loadTodos),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return RefreshIndicator(
|
||||
onRefresh: _loadTodos,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 16, right: 16, top: 4, bottom: 96),
|
||||
child: ListView(
|
||||
children: [
|
||||
_buildQuadrant(
|
||||
title: '重要紧急',
|
||||
textColor: AppColors.g1Text,
|
||||
dividerColor: AppColors.g1Divider,
|
||||
borderColor: AppColors.g1Border,
|
||||
items: _importantUrgent,
|
||||
onComplete: _completeTodo,
|
||||
onTap: _navigateToDetail,
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
_buildQuadrant(
|
||||
title: '紧急不重要',
|
||||
textColor: AppColors.g2Text,
|
||||
dividerColor: AppColors.g2Divider,
|
||||
borderColor: AppColors.g2Border,
|
||||
items: _urgentNotImportant,
|
||||
onComplete: _completeTodo,
|
||||
onTap: _navigateToDetail,
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
_buildQuadrant(
|
||||
title: '重要不紧急',
|
||||
textColor: AppColors.g3Text,
|
||||
dividerColor: AppColors.g3Divider,
|
||||
borderColor: AppColors.g3Border,
|
||||
items: _importantNotUrgent,
|
||||
onComplete: _completeTodo,
|
||||
onTap: _navigateToDetail,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -127,8 +226,9 @@ class _TodoQuadrantsScreenState extends State<TodoQuadrantsScreen> {
|
||||
required Color textColor,
|
||||
required Color dividerColor,
|
||||
required Color borderColor,
|
||||
required List<_TodoItem> items,
|
||||
required void Function(String) onRemove,
|
||||
required List<TodoResponse> items,
|
||||
required Future<void> Function(TodoResponse) onComplete,
|
||||
required void Function(TodoResponse) onTap,
|
||||
}) {
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
@@ -167,20 +267,33 @@ class _TodoQuadrantsScreenState extends State<TodoQuadrantsScreen> {
|
||||
const SizedBox(height: 8),
|
||||
Container(height: 1, color: dividerColor),
|
||||
const SizedBox(height: 8),
|
||||
...items.map((item) => _buildTodoItem(item, onRemove)),
|
||||
if (items.isEmpty)
|
||||
const Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 16),
|
||||
child: Center(
|
||||
child: Text(
|
||||
'暂无待办',
|
||||
style: TextStyle(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: 13,
|
||||
color: AppColors.slate400,
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
else
|
||||
...items.map(
|
||||
(item) => _TodoItemWidget(
|
||||
item: item,
|
||||
onComplete: () => onComplete(item),
|
||||
onTap: () => onTap(item),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildTodoItem(_TodoItem item, void Function(String) onRemove) {
|
||||
return _TodoItemWidget(
|
||||
key: ValueKey(item.id),
|
||||
item: item,
|
||||
onRemove: onRemove,
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildBottomDock() {
|
||||
return BottomDock(
|
||||
activeTab: DockTab.todo,
|
||||
@@ -202,22 +315,15 @@ class _TodoQuadrantsScreenState extends State<TodoQuadrantsScreen> {
|
||||
}
|
||||
}
|
||||
|
||||
class _TodoItem {
|
||||
final String id;
|
||||
final String title;
|
||||
|
||||
_TodoItem({required this.title})
|
||||
: id = DateTime.now().microsecondsSinceEpoch.toString();
|
||||
}
|
||||
|
||||
class _TodoItemWidget extends StatefulWidget {
|
||||
final _TodoItem item;
|
||||
final void Function(String) onRemove;
|
||||
final TodoResponse item;
|
||||
final VoidCallback onComplete;
|
||||
final VoidCallback onTap;
|
||||
|
||||
const _TodoItemWidget({
|
||||
super.key,
|
||||
required this.item,
|
||||
required this.onRemove,
|
||||
required this.onComplete,
|
||||
required this.onTap,
|
||||
});
|
||||
|
||||
@override
|
||||
@@ -249,70 +355,326 @@ class _TodoItemWidgetState extends State<_TodoItemWidget>
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
void _handleTap() {
|
||||
void _handleCheckTap() async {
|
||||
if (_isChecked) return;
|
||||
|
||||
setState(() {
|
||||
_isChecked = true;
|
||||
});
|
||||
_controller.forward().then((_) {
|
||||
widget.onRemove(widget.item.id);
|
||||
widget.onComplete();
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SizedBox(
|
||||
height: 42,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
widget.item.title,
|
||||
style: const TextStyle(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColors.slate700,
|
||||
return GestureDetector(
|
||||
onTap: widget.onTap,
|
||||
child: SizedBox(
|
||||
height: 42,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
widget.item.title,
|
||||
style: const TextStyle(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColors.slate700,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: _handleTap,
|
||||
child: AnimatedBuilder(
|
||||
animation: _controller,
|
||||
builder: (context, child) {
|
||||
return Container(
|
||||
width: 20,
|
||||
height: 20,
|
||||
decoration: BoxDecoration(
|
||||
color: _isChecked ? AppColors.blue600 : Colors.white,
|
||||
border: Border.all(
|
||||
color: _isChecked
|
||||
? AppColors.blue600
|
||||
: AppColors.slate300,
|
||||
width: 1.5,
|
||||
GestureDetector(
|
||||
onTap: _handleCheckTap,
|
||||
child: AnimatedBuilder(
|
||||
animation: _controller,
|
||||
builder: (context, child) {
|
||||
return Container(
|
||||
width: 20,
|
||||
height: 20,
|
||||
decoration: BoxDecoration(
|
||||
color: _isChecked ? AppColors.blue600 : Colors.white,
|
||||
border: Border.all(
|
||||
color: _isChecked
|
||||
? AppColors.blue600
|
||||
: AppColors.slate300,
|
||||
width: 1.5,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
),
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
child: _isChecked
|
||||
? Transform.scale(
|
||||
scale: _scaleAnimation.value,
|
||||
child: const Icon(
|
||||
Icons.check,
|
||||
size: 14,
|
||||
color: Colors.white,
|
||||
),
|
||||
)
|
||||
: null,
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _AddTodoSheet extends StatefulWidget {
|
||||
const _AddTodoSheet();
|
||||
|
||||
@override
|
||||
State<_AddTodoSheet> createState() => _AddTodoSheetState();
|
||||
}
|
||||
|
||||
class _AddTodoSheetState extends State<_AddTodoSheet> {
|
||||
final _titleController = TextEditingController();
|
||||
final _descriptionController = TextEditingController();
|
||||
int _priority = 1;
|
||||
final Set<String> _selectedScheduleItems = {};
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_titleController.dispose();
|
||||
_descriptionController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
height: MediaQuery.of(context).size.height * 0.85,
|
||||
decoration: const BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.vertical(top: Radius.circular(20)),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(24),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Text(
|
||||
'添加待办',
|
||||
style: TextStyle(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
child: _isChecked
|
||||
? Transform.scale(
|
||||
scale: _scaleAnimation.value,
|
||||
child: const Icon(
|
||||
Icons.check,
|
||||
size: 14,
|
||||
color: Colors.white,
|
||||
),
|
||||
)
|
||||
: null,
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
TextField(
|
||||
controller: _titleController,
|
||||
decoration: const InputDecoration(
|
||||
labelText: '标题',
|
||||
border: OutlineInputBorder(),
|
||||
),
|
||||
autofocus: true,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
TextField(
|
||||
controller: _descriptionController,
|
||||
decoration: const InputDecoration(
|
||||
labelText: '描述(可选)',
|
||||
border: OutlineInputBorder(),
|
||||
),
|
||||
maxLines: 2,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
const Text(
|
||||
'优先级',
|
||||
style: TextStyle(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Row(
|
||||
children: [
|
||||
_PriorityChip(
|
||||
label: '重要紧急',
|
||||
selected: _priority == 1,
|
||||
color: AppColors.g1Border,
|
||||
onTap: () => setState(() => _priority = 1),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
_PriorityChip(
|
||||
label: '紧急不重要',
|
||||
selected: _priority == 3,
|
||||
color: AppColors.g2Border,
|
||||
onTap: () => setState(() => _priority = 3),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
_PriorityChip(
|
||||
label: '重要不紧急',
|
||||
selected: _priority == 2,
|
||||
color: AppColors.g3Border,
|
||||
onTap: () => setState(() => _priority = 2),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 24),
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
'关联日历事件',
|
||||
style: TextStyle(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Expanded(
|
||||
child: FutureBuilder(
|
||||
future: _loadScheduleItems(),
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.connectionState == ConnectionState.waiting) {
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
}
|
||||
if (snapshot.hasError) {
|
||||
return Center(child: Text('加载失败: ${snapshot.error}'));
|
||||
}
|
||||
final items = snapshot.data ?? [];
|
||||
if (items.isEmpty) {
|
||||
return const Center(child: Text('暂无日历事件'));
|
||||
}
|
||||
return ListView.builder(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
itemCount: items.length,
|
||||
itemBuilder: (context, index) {
|
||||
final item = items[index];
|
||||
final isSelected = _selectedScheduleItems.contains(item.id);
|
||||
return CheckboxListTile(
|
||||
title: Text(item.title),
|
||||
subtitle: Text(_formatDate(item.startAt)),
|
||||
value: isSelected,
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
if (value == true) {
|
||||
_selectedScheduleItems.add(item.id);
|
||||
} else {
|
||||
_selectedScheduleItems.remove(item.id);
|
||||
}
|
||||
});
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: SizedBox(
|
||||
width: double.infinity,
|
||||
child: AppButton(
|
||||
text: '添加',
|
||||
onPressed: () {
|
||||
if (_titleController.text.trim().isEmpty) {
|
||||
Toast.show(context, '请输入标题', type: ToastType.warning);
|
||||
return;
|
||||
}
|
||||
Navigator.of(context).pop({
|
||||
'title': _titleController.text.trim(),
|
||||
'description': _descriptionController.text.trim().isEmpty
|
||||
? null
|
||||
: _descriptionController.text.trim(),
|
||||
'priority': _priority,
|
||||
'schedule_item_ids': _selectedScheduleItems.toList(),
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Future<List<_ScheduleItemSimple>> _loadScheduleItems() async {
|
||||
final calendarApi = sl<CalendarApi>();
|
||||
final now = DateTime.now();
|
||||
final start = now.subtract(const Duration(days: 30));
|
||||
final end = now.add(const Duration(days: 90));
|
||||
final items = await calendarApi.listByRange(startAt: start, endAt: end);
|
||||
return items
|
||||
.map(
|
||||
(e) =>
|
||||
_ScheduleItemSimple(id: e.id, title: e.title, startAt: e.startAt),
|
||||
)
|
||||
.toList();
|
||||
}
|
||||
|
||||
String _formatDate(DateTime dt) {
|
||||
return '${dt.year}年${dt.month}月${dt.day}日 ${dt.hour.toString().padLeft(2, '0')}:${dt.minute.toString().padLeft(2, '0')}';
|
||||
}
|
||||
}
|
||||
|
||||
class _ScheduleItemSimple {
|
||||
final String id;
|
||||
final String title;
|
||||
final DateTime startAt;
|
||||
|
||||
_ScheduleItemSimple({
|
||||
required this.id,
|
||||
required this.title,
|
||||
required this.startAt,
|
||||
});
|
||||
}
|
||||
|
||||
class _PriorityChip extends StatelessWidget {
|
||||
final String label;
|
||||
final bool selected;
|
||||
final Color color;
|
||||
final VoidCallback onTap;
|
||||
|
||||
const _PriorityChip({
|
||||
required this.label,
|
||||
required this.selected,
|
||||
required this.color,
|
||||
required this.onTap,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GestureDetector(
|
||||
onTap: onTap,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
||||
decoration: BoxDecoration(
|
||||
color: selected ? color.withValues(alpha: 0.2) : Colors.transparent,
|
||||
border: Border.all(
|
||||
color: selected ? color : AppColors.slate300,
|
||||
width: selected ? 2 : 1,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
),
|
||||
child: Text(
|
||||
label,
|
||||
style: TextStyle(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: 12,
|
||||
fontWeight: selected ? FontWeight.w600 : FontWeight.normal,
|
||||
color: selected ? color : AppColors.slate600,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user