feat: add scheduled tasks behind a 全部功能 button
- the sidebar footer gains 全部功能 left of 设置; its page lists the features the server offers, planned tasks for now - 计划任务 follows the web client: a project (or the chats scope) picked at the top, then its tasks with schedule, last result, next run, model and error; the switch pauses, the menu runs now, edits or deletes - the editor covers name, prompt, daily/weekly/once/cron schedules (Chinese date and time pickers), several times a day, weekdays, cron examples, enabled, and either the session defaults or a fixed model and agent - the same /api/projects/:id/scheduled-tasks endpoints the web uses; a server without them says so instead of failing silently - the app now pins zh_CN localizations, so the built-in pickers and menus are Chinese too - bump to 0.5.1
This commit is contained in:
1 parent
2f5ce61692
commit
da4bfb6826
13 files changed
+1612
-3
No files matched your search
@@ -0,0 +1,101 @@
|
||||
// 全部功能: the tools the sidebar keeps behind one button, each opening its
|
||||
// own page. Scheduled tasks so far; more entries go into the grid.
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../state.dart';
|
||||
import 'scheduled_tasks_screen.dart';
|
||||
|
||||
class FeaturesScreen extends StatelessWidget {
|
||||
final AppState app;
|
||||
const FeaturesScreen({super.key, required this.app});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: const Text('全部功能')),
|
||||
body: ListView(
|
||||
padding: const EdgeInsets.fromLTRB(16, 12, 16, 32),
|
||||
children: [
|
||||
Text('服务器与智能体的工具都收在这里。',
|
||||
style: TextStyle(fontSize: 12.5, color: theme.hintColor)),
|
||||
const SizedBox(height: 14),
|
||||
GridView.count(
|
||||
crossAxisCount: 2,
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
mainAxisSpacing: 12,
|
||||
crossAxisSpacing: 12,
|
||||
childAspectRatio: 1.25,
|
||||
children: [
|
||||
_FeatureTile(
|
||||
icon: Icons.schedule,
|
||||
title: '计划任务',
|
||||
caption: '按时间向会话发送提示词',
|
||||
onTap: () => Navigator.of(context).push(MaterialPageRoute(
|
||||
builder: (_) => ScheduledTasksScreen(app: app),
|
||||
)),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _FeatureTile extends StatelessWidget {
|
||||
final IconData icon;
|
||||
final String title;
|
||||
final String caption;
|
||||
final VoidCallback onTap;
|
||||
|
||||
const _FeatureTile({
|
||||
required this.icon,
|
||||
required this.title,
|
||||
required this.caption,
|
||||
required this.onTap,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
return Material(
|
||||
color: theme.colorScheme.surfaceContainerHighest.withValues(alpha: 0.5),
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
clipBehavior: Clip.antiAlias,
|
||||
child: InkWell(
|
||||
onTap: onTap,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(14),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
width: 38,
|
||||
height: 38,
|
||||
decoration: BoxDecoration(
|
||||
color: theme.colorScheme.primaryContainer,
|
||||
borderRadius: BorderRadius.circular(11),
|
||||
),
|
||||
child: Icon(icon,
|
||||
size: 21, color: theme.colorScheme.onPrimaryContainer),
|
||||
),
|
||||
const Spacer(),
|
||||
Text(title,
|
||||
style: const TextStyle(
|
||||
fontSize: 14.5, fontWeight: FontWeight.w600)),
|
||||
const SizedBox(height: 2),
|
||||
Text(
|
||||
caption,
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(fontSize: 11.5, color: theme.hintColor),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user