fluffychat/lib/pangea/widgets/content_issue_button.dart
ggurdin 9ecf4e3bd2
fix: fix dart formatting for CI (#1368)
* fix: fix dart formatting for CI

* fix: sorted imports, updated deprecated flutter functions

* fix: format files

* fix: format files

* feat: replace syncfusion flutter package with excel flutter package

* fix: don't run enable google services patch in CI

* fix: update iOS supported platforms for enable ios build script

* fix: commented out linux build in integrate CI
2025-01-07 08:32:42 -05:00

90 lines
3 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:fluffychat/pangea/widgets/common/bot_face_svg.dart';
class ContentIssueButton extends StatelessWidget {
final bool isActive;
final void Function(String) submitFeedback;
const ContentIssueButton({
super.key,
required this.isActive,
required this.submitFeedback,
});
@override
Widget build(BuildContext context) {
return Opacity(
opacity: 0.8, // Slight opacity
child: Tooltip(
message: L10n.of(context).reportContentIssueTitle,
child: IconButton(
icon: const Icon(Icons.flag),
iconSize: 16,
onPressed: () {
if (!isActive) {
return;
}
final TextEditingController feedbackController =
TextEditingController();
showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: Text(
L10n.of(context).reportContentIssueTitle,
textAlign: TextAlign.center,
),
content: SingleChildScrollView(
child: Container(
constraints: const BoxConstraints(maxWidth: 300),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
const BotFace(
width: 60,
expression: BotExpression.addled,
),
const SizedBox(height: 10),
Text(L10n.of(context).reportContentIssueDescription),
const SizedBox(height: 10),
TextField(
controller: feedbackController,
decoration: InputDecoration(
labelText: L10n.of(context).feedback,
border: const OutlineInputBorder(),
),
maxLines: 4,
),
],
),
),
),
actions: [
TextButton(
onPressed: () {
Navigator.of(context).pop(); // Close the dialog
},
child: Text(L10n.of(context).cancel),
),
ElevatedButton(
onPressed: () {
// Call the additional callback function
submitFeedback(feedbackController.text);
Navigator.of(context).pop(); // Close the dialog
},
child: Text(L10n.of(context).submit),
),
],
);
},
);
},
),
),
);
}
}