99 lines
3.0 KiB
Dart
99 lines
3.0 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_quill/flutter_quill.dart' as quill;
|
|
|
|
class CommentEditorCard extends StatelessWidget {
|
|
final quill.QuillController controller;
|
|
final VoidCallback onCancel;
|
|
final Future<void> Function(quill.QuillController controller) onSave;
|
|
|
|
const CommentEditorCard({
|
|
super.key,
|
|
required this.controller,
|
|
required this.onCancel,
|
|
required this.onSave,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
quill.QuillSimpleToolbar(
|
|
controller: controller,
|
|
configurations: const quill.QuillSimpleToolbarConfigurations(
|
|
showBoldButton: true,
|
|
showItalicButton: true,
|
|
showUnderLineButton: true,
|
|
showListBullets: false,
|
|
showListNumbers: false,
|
|
showAlignmentButtons: true,
|
|
showLink: true,
|
|
showFontSize: false,
|
|
showFontFamily: false,
|
|
showColorButton: false,
|
|
showBackgroundColorButton: false,
|
|
showUndo: false,
|
|
showRedo: false,
|
|
showCodeBlock: false,
|
|
showQuote: false,
|
|
showSuperscript: false,
|
|
showSubscript: false,
|
|
showInlineCode: false,
|
|
showDirection: false,
|
|
showListCheck: false,
|
|
showStrikeThrough: false,
|
|
showClearFormat: false,
|
|
showDividers: false,
|
|
showHeaderStyle: false,
|
|
multiRowsDisplay: false,
|
|
),
|
|
),
|
|
const SizedBox(height: 38),
|
|
Container(
|
|
height: 140,
|
|
padding: const EdgeInsets.all(8),
|
|
decoration: BoxDecoration(
|
|
border: Border.all(color: Colors.grey.shade300),
|
|
borderRadius: BorderRadius.circular(8),
|
|
color: const Color(0xFFFDFDFD),
|
|
),
|
|
child: quill.QuillEditor.basic(
|
|
controller: controller,
|
|
configurations: const quill.QuillEditorConfigurations(
|
|
autoFocus: true,
|
|
expands: false,
|
|
scrollable: true,
|
|
),
|
|
),
|
|
),
|
|
const SizedBox(height: 8),
|
|
Align(
|
|
alignment: Alignment.centerRight,
|
|
child: Wrap(
|
|
spacing: 8,
|
|
children: [
|
|
OutlinedButton.icon(
|
|
onPressed: onCancel,
|
|
icon: const Icon(Icons.close, size: 18),
|
|
label: const Text("Cancel"),
|
|
style: OutlinedButton.styleFrom(
|
|
foregroundColor: Colors.grey[700],
|
|
),
|
|
),
|
|
ElevatedButton.icon(
|
|
onPressed: () => onSave(controller),
|
|
icon: const Icon(Icons.save, size: 18),
|
|
label: const Text("Save"),
|
|
style: ElevatedButton.styleFrom(
|
|
backgroundColor: Colors.indigo,
|
|
foregroundColor: Colors.white,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
)
|
|
],
|
|
);
|
|
}
|
|
}
|