flutter3.41接入deepseek快速构建window版智能ai系统
基于Flutter3.41.5+Dart3.11.3+DeepSeek+Window_manager+Dio构建桌面版AI流式对话系统解决方案。



技术栈
- 开发工具: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

https://b23.tv/DMArEnC
项目特性
- 新增深度思考✨
- 新增latex数学公式✨
- 新增mermaid图表渲染✨
- 支持代码块横向滚动、代码高亮/复制代码✨
- 支持图片预览、链接跳转、表格✨
- 支持多轮上下文会话、本地存储对话✨


项目结构目录
使用最新跨平台flutter3.41搭建项目,调用deepseek api大模型。

项目下载地址:https://b23.tv/FnTZLCD

项目运行
通过 flutter run -d windows 运行到windows桌面端。

flutter环境变量配置.env

在deepseek官网申请一个apikey,替换掉.env文件里的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,
),
),
],
),
),
],
),
),
);











项目路由配置
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import '../controller/app.dart';
/* 引入路由页面 */
import '../pages/auth/login.dart';
import '../pages/auth/register.dart';
import '../pages/index/index.dart';
import '../pages/aihub/index.dart';
import '../pages/setting/index.dart';
// 路由地址集合
final Map<String, Widget> routes = {
'/': Home(),
'/aihub': Aihub(),
'/setting': Setting(),
};
final List<GetPage> routeList = routes.entries.map((e) => GetPage(
name: e.key, // 路由名称
page: () => e.value, // 路由页面
transition: Transition.noTransition, // 跳转路由动画
middlewares: [RouteMiddleware()], // 路由中间件
)).toList();
final List<GetPage> routePages = [
GetPage(name: '/login', page: () => const Login(), transition: Transition.noTransition),
GetPage(name: '/register', page: () => const Register(), transition: Transition.noTransition),
...routeList,
];
// 路由中间件拦截验证
class RouteMiddleware extends GetMiddleware {
final appStore = AppStore.to;
@override
RouteSettings? redirect(String? route) {
return appStore.isLogin ? null : const RouteSettings(name: '/login');
}
}
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.41+DeepSeek+Dio+Get搭建APP版智能生成式AI助手
重磅自研Electron41+Vite8.0手搓DeepSeek电脑版AI智能系统
2026最新款Uniapp+DeepSeek+mphtml纯手撸跨三端ai流式输出模板
2026重磅爆肝tauri2.10+vite7.3+openai集成deepseek桌面客户端AI智能系统
首发vite8.0+vue3+deepseek+markdown手搓网页版ai流式生成模板
最新研发electron38+vite7.0+vue3客户端仿微信EXE聊天软件
Electron38.2实战客户端OS系统|vite7+vue3+electron仿mac/wins桌面
2025最新款Electron38+Vite7+Vue3+ElementPlus桌面客户端后台管理系统Exe
原创uniapp+vite5+vue3+uv-ui跨三端短视频+直播+聊天app应用
2025最新款Tauri2.9+Vite7+Vue3+ElementPlus电脑端后台管理系统Exe
最新版Vite7.1+Tauri2.8+Vue3电脑端仿QQ/微信聊天程序
Flutter3.32实战桌面端OS系统|flutter3仿macOS桌面
- 点赞
- 收藏
- 关注作者
评论(0)