thinking image
This commit is contained in:
BIN
assets/images/thinking_circle.png
Normal file
BIN
assets/images/thinking_circle.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.5 KiB |
@@ -1,4 +1,5 @@
|
|||||||
import 'package:ai_chat_assistant/utils/common_util.dart';
|
import 'package:ai_chat_assistant/utils/common_util.dart';
|
||||||
|
import 'package:ai_chat_assistant/widgets/rotating_image.dart';
|
||||||
import 'package:basic_intl/intl.dart';
|
import 'package:basic_intl/intl.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_markdown/flutter_markdown.dart';
|
import 'package:flutter_markdown/flutter_markdown.dart';
|
||||||
@@ -127,6 +128,11 @@ class _ChatBubbleState extends State<ChatBubble> {
|
|||||||
case MessageStatus.listening:
|
case MessageStatus.listening:
|
||||||
case MessageStatus.recognizing:
|
case MessageStatus.recognizing:
|
||||||
case MessageStatus.thinking:
|
case MessageStatus.thinking:
|
||||||
|
icon = RotatingImage(
|
||||||
|
imagePath: 'assets/images/thinking_circle.png'
|
||||||
|
);
|
||||||
|
color = Colors.white;
|
||||||
|
break;
|
||||||
case MessageStatus.executing:
|
case MessageStatus.executing:
|
||||||
icon = const SizedBox(
|
icon = const SizedBox(
|
||||||
width: 16,
|
width: 16,
|
||||||
@@ -349,13 +355,12 @@ class _ChatBubbleState extends State<ChatBubble> {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.only(left: 12),
|
padding: const EdgeInsets.only(left: 12),
|
||||||
child: _disliked
|
child: _disliked
|
||||||
? Image.asset('assets/images/disliked2.png',
|
? Image.asset('assets/images/disliked2.png',
|
||||||
width: 20, height: 20)
|
width: 20, height: 20)
|
||||||
: Image.asset('assets/images/disliked1.png',
|
: Image.asset('assets/images/disliked1.png',
|
||||||
width: 20, height: 20)
|
width: 20, height: 20)),
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
49
lib/widgets/rotating_image.dart
Normal file
49
lib/widgets/rotating_image.dart
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class RotatingImage extends StatefulWidget {
|
||||||
|
final String imagePath;
|
||||||
|
final double size;
|
||||||
|
final Duration duration;
|
||||||
|
|
||||||
|
const RotatingImage({
|
||||||
|
Key? key,
|
||||||
|
required this.imagePath,
|
||||||
|
this.size = 20,
|
||||||
|
this.duration = const Duration(seconds: 3)
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<RotatingImage> createState() => _RotatingImageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _RotatingImageState extends State<RotatingImage>
|
||||||
|
with SingleTickerProviderStateMixin {
|
||||||
|
late AnimationController _controller;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
_controller = AnimationController(
|
||||||
|
duration: widget.duration,
|
||||||
|
vsync: this,
|
||||||
|
)..repeat();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
_controller.dispose();
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return RotationTransition(
|
||||||
|
turns: _controller,
|
||||||
|
child: Image.asset(
|
||||||
|
widget.imagePath,
|
||||||
|
width: widget.size,
|
||||||
|
height: widget.size
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user