diff --git a/lib/pangea/utils/inline_tooltip.dart b/lib/pangea/utils/inline_tooltip.dart new file mode 100644 index 000000000..253288a84 --- /dev/null +++ b/lib/pangea/utils/inline_tooltip.dart @@ -0,0 +1,62 @@ +import 'package:flutter/material.dart'; + +class InlineTooltip extends StatelessWidget { + final String body; + final VoidCallback onClose; + + const InlineTooltip({ + super.key, + required this.body, + required this.onClose, + }); + + @override + Widget build(BuildContext context) { + return Badge( + offset: const Offset(0, -7), + backgroundColor: Colors.transparent, + label: CircleAvatar( + radius: 10, + child: IconButton( + padding: EdgeInsets.zero, + icon: const Icon( + Icons.close_outlined, + size: 15, + ), + onPressed: onClose, + ), + ), + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: Theme.of(context).colorScheme.primary.withAlpha(20), + ), + child: Padding( + padding: const EdgeInsets.all(10), + child: RichText( + textAlign: TextAlign.justify, + text: TextSpan( + children: [ + const WidgetSpan( + child: Icon( + Icons.lightbulb, + size: 16, + ), + ), + const WidgetSpan( + child: SizedBox(width: 5), + ), + TextSpan( + text: body, + style: TextStyle( + color: Theme.of(context).colorScheme.onSurface, + ), + ), + ], + ), + ), + ), + ), + ); + } +}