You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
79 lines
2.4 KiB
Dart
79 lines
2.4 KiB
Dart
import 'package:fluffychat/config/app_config.dart';
|
|
import 'package:fluffychat/pangea/enum/instructions_enum.dart';
|
|
import 'package:fluffychat/widgets/matrix.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
|
|
|
class InlineTooltip extends StatelessWidget {
|
|
final InstructionsEnum instructionsEnum;
|
|
final VoidCallback onClose;
|
|
|
|
const InlineTooltip({
|
|
super.key,
|
|
required this.instructionsEnum,
|
|
required this.onClose,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
if (instructionsEnum.toggledOff()) {
|
|
return const SizedBox();
|
|
}
|
|
|
|
return Padding(
|
|
padding: const EdgeInsets.all(8.0),
|
|
child: DecoratedBox(
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(AppConfig.borderRadius),
|
|
color: Theme.of(context).colorScheme.primary.withAlpha(20),
|
|
),
|
|
child: Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 8),
|
|
child: Row(
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
// Lightbulb icon on the left
|
|
Icon(
|
|
Icons.lightbulb,
|
|
size: 20,
|
|
color: Theme.of(context).colorScheme.onSurface,
|
|
),
|
|
const SizedBox(width: 8),
|
|
// Text in the middle
|
|
Flexible(
|
|
child: Center(
|
|
child: Text(
|
|
instructionsEnum.body(L10n.of(context)!),
|
|
style: TextStyle(
|
|
color: Theme.of(context).colorScheme.onSurface,
|
|
height: 1.5,
|
|
),
|
|
textAlign: TextAlign.left,
|
|
),
|
|
),
|
|
),
|
|
// Close button on the right
|
|
IconButton(
|
|
constraints: const BoxConstraints(),
|
|
icon: Icon(
|
|
Icons.close_outlined,
|
|
size: 20,
|
|
color: Theme.of(context).colorScheme.onSurface,
|
|
),
|
|
onPressed: () {
|
|
MatrixState.pangeaController.instructions.setToggledOff(
|
|
instructionsEnum,
|
|
true,
|
|
);
|
|
onClose();
|
|
},
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|