flutter3.41+deepseek+dio+getx纯手搓桌面客户端ai流式智能对话系统
最新实战Flutter3.41+Dart3.11+Window_Manager跨平台桌面电脑端AI流式问答助手。
flutter3-deepseek-winai:原创flutter3+dart3+deepseek api+flutter_markdown构建高颜值桌面版ai智能系统。集成深度思考、各种代码高亮/复制代码、latex数学公式、mermaid图表渲染、图片预览/链接/表格、本地存储会话等功能。

技术栈
- 编辑器:VScode
- 跨平台技术框架:flutter3.41.5+dart3.11.3
- 大模型框架:deepseek-v3.2
- 流式请求:dio^5.9.2
- 路由/状态管理:get^4.7.3
- 存储服务:get_storage^2.1.1
- markdown解析:flutter_markdown_plus^1.0.7
- latex公式:flutter_markdown_plus_latex^1.0.5
- 高亮组件:flutter_highlight^0.7.0
- 环境变量配置:flutter_dotenv^6.0.0
- 窗口管理:window_manager^0.5.1
- 托盘管理:system_tray^2.0.3



项目特性
- 基于Flutter3.41接入DeepSeek-V3,对话丝滑流畅
- 新增深度思考✨
- 新增latex数学公式✨
- 新增mermaid图表渲染✨
- 支持代码块横向滚动、代码高亮/复制代码✨
- 支持图片预览、链接跳转、表格✨
- 支持多轮上下文会话、本地存储对话✨

项目框架结构
flutter3-win-ai使用最新跨平台框架 flutter3.41 构建项目,对接 deepseek 智能大模型。

Flutter3-Deepseek-WinAI桌面端ai项目已经正式发布到我的原创作品集。

flutter create flutter_winseek 快速构建一个flutter3初始化项目。
flutter run -d windows 命令快速运行到桌面端。

flutter3环境变量.env
项目通过 flutter_dotenv 插件配置环境变量。

申请一个deepseek apikey,替换如下文件里的key字段,即可畅快体验流式对话功能。
# 项目名称 APP_NAME = 'Flutter3-WinSeek' # DeepSeek API配置 DEEPSEEK_API_KEY = apikey DEEPSEEK_BASE_URL = https://api.deepseek.com
在页面中通过如下方式获取环境变量。
// 获取.env环境变量baseUrl和apiKey String baseURL = dotenv.get('DEEPSEEK_BASE_URL'); String apiKEY = dotenv.get('DEEPSEEK_API_KEY');








项目通用模板

项目整体布局结构如上图所示:

return Scaffold( backgroundColor: Colors.grey[50], body: DragToResizeArea( child: Row( children: [ // 侧边栏 AnimatedSize( duration: const Duration(milliseconds: 300), curve: Curves.easeInOut, child: Container( width: collapsed ? 0 : 260, decoration: BoxDecoration( border: Border(right: BorderSide(color: Colors.grey.withAlpha(50))) ), child: Material( color: Color(0xFFF3F3F3), child: Sidebar(), ), ), ), // 主体容器 Expanded( child: Column( children: [ // 自定义导航栏 SizedBox( height: 30.0, child: Row( children: [ IconButton( onPressed: () { setState(() { collapsed = !collapsed; }); }, icon: Icon(collapsed ? Icons.format_indent_increase : Icons.format_indent_decrease, size: 16.0,), tooltip: collapsed ? '展开' : '收缩', ), Expanded( child: DragToMoveArea( child: SizedBox( height: double.infinity, ), ), ), // 右上角操作按钮 WinBtns( leading: Row( children: [ ... ], ), ), ], ), ), // 右侧主面板 Expanded( child: Container( child: widget.child, ), ), ], ), ), ], ), ), );









flutter3自定义ai编辑框



return Container( width: double.infinity, padding: EdgeInsets.symmetric(vertical: 10.0), child: Column( spacing: 6.0, children: [ // 技能栏 if (widget.skillbar) ScrollConfiguration( behavior: CustomScrollBehavior(), child: SingleChildScrollView( scrollDirection: Axis.horizontal, padding: EdgeInsets.symmetric(horizontal: 15.0), child: Row( spacing: 4.0, children: [ ... ] ), ), ), // 编辑框 Container( margin: EdgeInsets.symmetric(horizontal: 15.0), padding: EdgeInsets.all(10.0), decoration: BoxDecoration( color: Colors.white, border: Border.all(color: Colors.grey.withAlpha(100), width: .5), borderRadius: BorderRadius.circular(15.0), boxShadow: [ BoxShadow( color: Colors.black.withAlpha(20), offset: Offset(0.0, 3.0), blurRadius: 6.0, spreadRadius: 0.0, ), ] ), child: Column( spacing: 10.0, children: [ // 输入框 ConstrainedBox( constraints: BoxConstraints(minHeight: 48.0, maxHeight: 150.0), child: TextField( ... ), ), // 操作栏 Row( spacing: 10.0, children: [ SizedBox( height: 30.0, child: TextButton( onPressed: () { // ... }, style: ButtonStyle( backgroundColor: WidgetStateProperty.all(isDeep ? Color(0xFF4F6BFE).withAlpha(30) : Colors.grey[200]), padding: WidgetStateProperty.all(EdgeInsets.symmetric(horizontal: 10.0)), ), child: Row( spacing: 4.0, children: [ Icon(Icons.stream, color: isDeep ? Color(0xFF4F6BFE) : Colors.black, size: 18.0,), Text('深度思考(R1)', style: TextStyle(color: isDeep ? Color(0xFF4F6BFE) : Colors.black, fontSize: 13.0),), ], ), ), ), SizedBox( height: 30.0, child: TextButton( onPressed: () { // ... }, style: ButtonStyle( backgroundColor: WidgetStateProperty.all(isNetwork ? Color(0xFF4F6BFE).withAlpha(30) : Colors.grey[200]), padding: WidgetStateProperty.all(EdgeInsets.symmetric(horizontal: 10.0)), ), child: Row( spacing: 4.0, children: [ Icon(Icons.travel_explore, color: isNetwork ? Color(0xFF4F6BFE) : Colors.black, size: 18.0,), Text('联网', style: TextStyle(color: isNetwork ? Color(0xFF4F6BFE) : Colors.black, fontSize: 13.0),), ], ), ), ), Spacer(), SizedBox( height: 30.0, width: 30.0, child: IconButton( ... ), ), SizedBox( height: 30.0, width: 30.0, child: IconButton( ... ), ) ], ), ], ), ), ], ) );
flutter3+dio接入deepseek流式对话
// 调用deepseek接口 final response = await dio.post( '$baseURL/v1/chat/completions', options: Options( // 响应超时 receiveTimeout: const Duration(seconds: 60), headers: { "Content-Type": "application/json", "Authorization": "Bearer $apiKEY", }, // 设置响应类型为流式响应 responseType: ResponseType.stream, ), data: { // 多轮会话 'messages': widget.multiConversation ? chatStore.historySession : [{'role': 'user', 'content': editorValue}], // deepseek-chat对话模型 deepseek-reasoner推理模型 'model': chatStore.getSetting('thinkingEnabled') ? 'deepseek-reasoner' : 'deepseek-chat', 'stream': true, // 流式输出 'max_tokens': 8192, // 限制一次请求中模型生成 completion 的最大 token 数(默认使用 4096) 'temperature': 0.4, // 严谨采样 越低越严谨(默认1) } );

flutter3自定义系统托盘

使用 system_tray 插件管理系统托盘图标。
// 初始化系统托盘 Future<void> initSystemTray() async { String trayIco = 'assets/images/tray.ico'; SystemTray systemTray = SystemTray(); // 初始化系统托盘 await systemTray.initSystemTray( title: 'system-tray', iconPath: trayIco, ); // 右键菜单 final Menu menu = Menu(); await menu.buildFrom([ MenuItemLabel(label: '打开主界面', image: 'assets/images/tray.ico', onClicked: (menuItem) async => await windowManager.show()), MenuItemLabel(label: '隐藏窗口', image: 'assets/images/tray.ico', onClicked: (menuItem) async => await windowManager.hide()), MenuItemLabel(label: '设置中心', image: 'assets/images/tray.ico', onClicked: (menuItem) => Get.toNamed('/setting')), MenuItemLabel(label: '锁屏', image: 'assets/images/tray.ico', onClicked: (menuItem) => {}), MenuItemLabel(label: '关闭程序并退出', image: 'assets/images/tray.ico', onClicked: (menuItem) async => await windowManager.destroy()), ]); await systemTray.setContextMenu(menu); // 右键事件 systemTray.registerSystemTrayEventHandler((eventName) async { debugPrint('eventName: $eventName'); if (eventName == kSystemTrayEventClick) { Platform.isWindows ? await windowManager.show() : systemTray.popUpContextMenu(); } else if (eventName == kSystemTrayEventRightClick) { Platform.isWindows ? systemTray.popUpContextMenu() : await windowManager.show(); } }); }
综上就是Flutter3.41接入DeepSeek搭建桌面版AI对话系统的一些项目分享,希望对大家有所帮助哈~
附上一些最新原创项目作品案例
Flutter3.41+DeepSeek智能AI应用|flutter3+getx+dio流式ai对话app模板
Vite8+DeepSeek网页版AI助手|vue3+arco本地web版ai流式打字问答系统
uniapp+deepseek流式ai助理|uniapp+vue3对接deepseek三端Ai问答模板
Electron41+Vite8.0+DeepSeek桌面端AI助手|electron+vue3流式ai系统
vite8.0+deepseek流式ai模板|vue3.5+vant4+markdown打字输出ai助手
tauri2.10+deepseek+vite7客户端ai系统|Tauri2+Vue3.5桌面AI程序Exe
最新版Flutter3.38+Dart3.10仿写抖音APP直播+短视频+聊天应用程序
Tauri2.9+Vue3桌面版OS系统|vite7+tauri2+arcoDesign电脑端os后台模板
electron38-admin桌面端后台|Electron38+Vue3+ElementPlus管理系统
Electron38-Wechat电脑端聊天|vite7+electron38仿微信桌面端聊天系统


浙公网安备 33010602011771号