several toolbar UI tweaks
parent
b7ab6038ac
commit
240b039ae7
@ -0,0 +1,89 @@
|
|||||||
|
import 'package:fluffychat/pangea/widgets/common/bot_face_svg.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_gen/gen_l10n/l10n.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: 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),
|
||||||
|
SizedBox(
|
||||||
|
width: double.infinity,
|
||||||
|
child: 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),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,26 @@
|
|||||||
|
import 'package:fluffychat/pangea/utils/bot_style.dart';
|
||||||
|
import 'package:fluffychat/pangea/widgets/chat/message_toolbar.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||||
|
|
||||||
|
class SelectToDefine extends StatelessWidget {
|
||||||
|
const SelectToDefine({
|
||||||
|
super.key,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Center(
|
||||||
|
child: Container(
|
||||||
|
constraints: const BoxConstraints(minHeight: minCardHeight),
|
||||||
|
padding: const EdgeInsets.all(8),
|
||||||
|
child: Center(
|
||||||
|
child: Text(
|
||||||
|
L10n.of(context)!.selectToDefine,
|
||||||
|
style: BotStyle.text(context),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue