fix: 修复assets在example app中不能使用的问题 & 加入maven local的链接,修复flutter无法打包 aar的问题

This commit is contained in:
2025-09-10 17:33:26 +08:00
parent 4176116bb3
commit 62924296b2
13 changed files with 66 additions and 71 deletions

View File

@@ -18,6 +18,7 @@ class AssistantAvatar extends StatelessWidget {
child: Image.asset(
'assets/images/avatar.png',
fit: BoxFit.contain,
package: 'ai_chat_assistant',
),
);
}

View File

@@ -123,7 +123,7 @@ class _ChatBubbleState extends State<ChatBubble> {
break;
case MessageStatus.completed:
case MessageStatus.success:
icon = Image.asset('assets/images/checked.png', width: 20, height: 20);
icon = Image.asset('assets/images/checked.png', width: 20, height: 20, package: 'ai_chat_assistant',);
color = Colors.white;
break;
case MessageStatus.failure:
@@ -301,7 +301,7 @@ class _ChatBubbleState extends State<ChatBubble> {
},
child: Padding(
padding: const EdgeInsets.only(left: 12),
child: Image.asset('assets/images/copy.png',
child: Image.asset('assets/images/copy.png',package: 'ai_chat_assistant',
width: 22, height: 22),
),
),
@@ -315,9 +315,9 @@ class _ChatBubbleState extends State<ChatBubble> {
child: Padding(
padding: const EdgeInsets.only(left: 12),
child: _liked
? Image.asset('assets/images/liked2.png',
? Image.asset('assets/images/liked2.png',package: 'ai_chat_assistant',
width: 22, height: 22)
: Image.asset('assets/images/liked1.png',
: Image.asset('assets/images/liked1.png',package: 'ai_chat_assistant',
width: 22, height: 22),
),
),
@@ -331,9 +331,9 @@ class _ChatBubbleState extends State<ChatBubble> {
child: Padding(
padding: const EdgeInsets.only(left: 12),
child: _disliked
? Image.asset('assets/images/disliked2.png',
? Image.asset('assets/images/disliked2.png',package: 'ai_chat_assistant',
width: 22, height: 22)
: Image.asset('assets/images/disliked1.png',
: Image.asset('assets/images/disliked1.png',package: 'ai_chat_assistant',
width: 22, height: 22)),
),
],

View File

@@ -49,7 +49,7 @@ class _ChatFooterState extends State<ChatFooter>
child: GestureDetector(
onTap: widget.onClear,
child: Image.asset(
'assets/images/delete.png',
'assets/images/delete.png',package: 'ai_chat_assistant',
width: 24,
height: 24,
),
@@ -137,7 +137,7 @@ class _ChatFooterState extends State<ChatFooter>
child: GestureDetector(
onTap: () {},
child: Image.asset(
'assets/images/keyboard_mini.png',
'assets/images/keyboard_mini.png',package: 'ai_chat_assistant',
width: 24,
height: 24,
),

View File

@@ -140,7 +140,7 @@ class _FloatingIconState extends State<FloatingIcon>
Intl.getCurrentLocale().startsWith('zh')
? _iconImages[_imageIndex]:_iconImagesEn[_imageIndex],
width: iconSize,
height: iconSize,
height: iconSize,package: 'ai_chat_assistant',
),
);
},

View File

@@ -1,3 +1,4 @@
import 'package:ai_chat_assistant/utils/assets_util.dart';
import 'package:flutter/material.dart';
import 'mini_audio_wave.dart';
@@ -36,6 +37,7 @@ class FloatingIconWithWave extends StatelessWidget {
width: iconSize,
height: iconSize,
fit: BoxFit.contain,
package: AssetsUtil.packageName
),
// 声波动画距离底部13px的位置
Positioned(

View File

@@ -5,11 +5,14 @@ class RotatingImage extends StatefulWidget {
final double size;
final Duration duration;
final String? package; // 添加这个参数
const RotatingImage({
Key? key,
required this.imagePath,
this.size = 20,
this.duration = const Duration(seconds: 3)
this.duration = const Duration(seconds: 3),
this.package = 'ai_chat_assistant', // 默认值
}) : super(key: key);
@override
@@ -42,7 +45,8 @@ class _RotatingImageState extends State<RotatingImage>
child: Image.asset(
widget.imagePath,
width: widget.size,
height: widget.size
height: widget.size,
package: widget.package, // 使用传入的package参数
),
);
}