Skip to content

Commit 0545fc1

Browse files
authored
Update document_viewer_screen.dart [build]
1 parent 6d4526d commit 0545fc1

File tree

1 file changed

+27
-42
lines changed

1 file changed

+27
-42
lines changed
Lines changed: 27 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,45 @@
11
import 'package:flutter/material.dart';
2-
import 'package:flutter_quill/flutter_quill.dart';
2+
import 'package:fleather/fleather.dart';
3+
import 'package:parchment/parchment.dart';
34

4-
class FSentenceEditor extends StatefulWidget {
5-
const FSentenceEditor({super.key});
5+
class DocumentViewerScreen extends StatefulWidget {
6+
final String? fileName;
7+
const DocumentViewerScreen({super.key, this.fileName});
68

79
@override
8-
State<FSentenceEditor> createState() => _FSentenceEditorState();
10+
State<DocumentViewerScreen> createState() => _DocumentViewerScreenState();
911
}
1012

11-
class _FSentenceEditorState extends State<FSentenceEditor> {
12-
// Kontroler koji drži sav tekst i stilove
13-
final QuillController _controller = QuillController.basic();
13+
class _DocumentViewerScreenState extends State<DocumentViewerScreen> {
14+
FleatherController? _controller;
15+
final FocusNode _focusNode = FocusNode();
16+
17+
@override
18+
void initState() {
19+
super.initState();
20+
// Inicijalizujemo prazan dokument
21+
final doc = ParchmentDocument();
22+
_controller = FleatherController(document: doc);
23+
}
1424

1525
@override
1626
Widget build(BuildContext context) {
1727
return Scaffold(
1828
appBar: AppBar(
19-
title: const Text('f.Sentence'),
20-
actions: [
21-
IconButton(
22-
icon: const Icon(Icons.save),
23-
onPressed: () {
24-
},
25-
),
26-
],
29+
title: Text(widget.fileName ?? 'f.Sentence Editor'),
2730
),
2831
body: Column(
2932
children: [
30-
// TOOLBAR: Ovde su tvoja dugmad (Bold, Italic, Liste...)
31-
QuillSimpleToolbar(
32-
controller: _controller,
33-
QuillSimpleToolbarConfigurations(
34-
showFontSize: false,
35-
showFontFamily: false,
36-
showSearchButton: false,
37-
showSubscript: false,
38-
showSuperscript: false,
39-
showSmallButton: false,
40-
showInlineCode: false,
41-
showLink: true,
42-
showUndo: true,
43-
showRedo: true,
44-
multiRowsDisplay: false,
45-
),
46-
),
33+
// Toolbar koji korisnik vidi - samo klikne Bold/Italic
34+
FleatherToolbar.basic(controller: _controller!),
35+
4736
Expanded(
4837
child: Container(
4938
padding: const EdgeInsets.all(16),
50-
child: QuillEditor.basic(
51-
controller: _controller,
52-
configurations: const QuillEditorConfigurations(
53-
placeholder: 'Počni da pišeš...',
54-
readOnly: false,
55-
autoFocus: true,
56-
expands: true,
57-
padding: EdgeInsets.zero,
58-
),
39+
child: FleatherEditor(
40+
controller: _controller!,
41+
focusNode: _focusNode,
42+
padding: EdgeInsets.zero,
5943
),
6044
),
6145
),
@@ -66,7 +50,8 @@ class _FSentenceEditorState extends State<FSentenceEditor> {
6650

6751
@override
6852
void dispose() {
69-
_controller.dispose();
53+
_controller?.dispose();
54+
_focusNode.dispose();
7055
super.dispose();
7156
}
7257
}

0 commit comments

Comments
 (0)