Skip to content

Commit 55a5d51

Browse files
authored
Update document_viewer_screen.dart
1 parent 07b89a5 commit 55a5d51

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

lib/ui/screens/document_viewer_screen.dart

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,16 @@ class _DocumentViewerScreenState extends State<DocumentViewerScreen> {
4242
final String key = widget.fileName ?? _defaultDocName;
4343
final deltaData = jsonEncode(_controller!.document.toDelta());
4444
_box.put(key, deltaData);
45-
debugPrint("Dokument sačuvan: ${DateTime.now()}");
45+
debugPrint("Document saved at: ${DateTime.now()}");
4646
}
4747

4848
@override
4949
Widget build(BuildContext context) {
50-
final bool isKeyboardVisible = MediaQuery.of(context).viewInsets.bottom > 0;
50+
final bottomInset = MediaQuery.of(context).viewInsets.bottom;
51+
final bool isKeyboardVisible = bottomInset > 0;
5152

5253
return Scaffold(
54+
resizeToAvoidBottomInset: false,
5355
appBar: AppBar(
5456
title: Text(
5557
widget.fileName ?? 'f.Sentence',
@@ -58,22 +60,23 @@ class _DocumentViewerScreenState extends State<DocumentViewerScreen> {
5860
),
5961
body: Stack(
6062
children: [
61-
// Editor deo
6263
Positioned.fill(
6364
child: Padding(
6465
padding: const EdgeInsets.symmetric(horizontal: 16),
6566
child: FleatherEditor(
6667
controller: _controller!,
6768
focusNode: _focusNode,
68-
padding: const EdgeInsets.only(top: 16, bottom: 120),
69+
padding: EdgeInsets.only(
70+
top: 16,
71+
bottom: isKeyboardVisible ? bottomInset + 80 : 120
72+
),
6973
),
7074
),
7175
),
7276

73-
// Pilula toolbar koja lebdi iznad tastature
7477
if (isKeyboardVisible)
7578
Positioned(
76-
bottom: MediaQuery.of(context).viewInsets.bottom + 16,
79+
bottom: bottomInset + 16,
7780
left: 16,
7881
right: 16,
7982
child: Material(
@@ -87,15 +90,13 @@ class _DocumentViewerScreenState extends State<DocumentViewerScreen> {
8790
padding: const EdgeInsets.symmetric(horizontal: 8),
8891
child: Theme(
8992
data: Theme.of(context).copyWith(
90-
// Ovim čistimo toolbar od pozadina i viška linija
9193
dividerColor: Colors.transparent,
9294
),
9395
child: Center(
9496
child: SingleChildScrollView(
9597
scrollDirection: Axis.horizontal,
9698
child: FleatherToolbar.basic(
9799
controller: _controller!,
98-
99100
),
100101
),
101102
),

0 commit comments

Comments
 (0)