Files
Qlyra/lib/frontend/widgets/online_dot.dart
T

46 lines
1.2 KiB
Dart

import 'package:flutter/material.dart';
import '../../core/cache/info_cache.dart';
import '../../core/config/app_colors.dart';
class OnlineDot extends StatelessWidget {
final int userId;
final double size;
final Color color;
final Color borderColor;
final double borderWidth;
const OnlineDot({
super.key,
required this.userId,
required this.borderColor,
this.size = 12,
this.color = kSuccessGreen,
this.borderWidth = 2,
});
@override
Widget build(BuildContext context) {
return ValueListenableBuilder<int>(
valueListenable: PresenceFetch.revision,
builder: (context, _, _) {
final online = PresenceFetch.isOnline(userId);
return AnimatedScale(
scale: online ? 1 : 0,
duration: const Duration(milliseconds: 220),
curve: online ? Curves.easeOutBack : Curves.easeIn,
child: Container(
width: size,
height: size,
decoration: BoxDecoration(
color: color,
shape: BoxShape.circle,
border: Border.all(color: borderColor, width: borderWidth),
),
),
);
},
);
}
}