76 lines
2.1 KiB
Dart
76 lines
2.1 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
class ThinkingIndicator extends StatefulWidget {
|
|
const ThinkingIndicator({super.key});
|
|
|
|
@override
|
|
State<ThinkingIndicator> createState() => _ThinkingIndicatorState();
|
|
}
|
|
|
|
class _ThinkingIndicatorState extends State<ThinkingIndicator>
|
|
with SingleTickerProviderStateMixin {
|
|
late AnimationController _controller;
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
_controller = AnimationController(
|
|
vsync: this,
|
|
duration: const Duration(milliseconds: 1500),
|
|
)..repeat();
|
|
}
|
|
|
|
@override
|
|
void dispose() {
|
|
_controller.dispose();
|
|
super.dispose();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Container(
|
|
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
|
child: Row(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
AnimatedBuilder(
|
|
animation: _controller,
|
|
builder: (context, child) {
|
|
return Row(
|
|
children: List.generate(3, (index) {
|
|
final delay = index * 0.2;
|
|
final value = (_controller.value + delay) % 1.0;
|
|
final opacity = (value < 0.5 ? value * 2 : 2 - value * 2);
|
|
return Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 2),
|
|
child: Opacity(
|
|
opacity: 0.3 + opacity * 0.7,
|
|
child: Container(
|
|
width: 8,
|
|
height: 8,
|
|
decoration: BoxDecoration(
|
|
color: Colors.orange.shade400,
|
|
shape: BoxShape.circle,
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}),
|
|
);
|
|
},
|
|
),
|
|
const SizedBox(width: 8),
|
|
Text(
|
|
'Claude is thinking...',
|
|
style: TextStyle(
|
|
color: Colors.grey.shade400,
|
|
fontSize: 14,
|
|
fontStyle: FontStyle.italic,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|