Skip to content

Commit f08890a

Browse files
authored
Merge pull request #50 from Update FAB Behavior, Add Bookmark Block Naming, and Improve Mobile UI for Note Management
Makjac/Update FAB Visibility and Theme, Add Bookmark Block Naming in Reorder Mode, and Improve Mobile UI
2 parents 173ce8a + 60eaa92 commit f08890a

File tree

8 files changed

+130
-86
lines changed

8 files changed

+130
-86
lines changed

installers/windows/innosetup/qicknote_innosetup.iss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
33

44
#define MyAppName "QuickNote"
5-
#define MyAppVersion "1.2.3+12"
5+
#define MyAppVersion "1.2.4+13"
66
#define MyAppPublisher "ecoala.eu sp. z.o.o"
77
#define MyAppURL "https://github.com/makjac/quick_note"
88
#define MyAppExeName "quick_note.exe"

lib/feature/home/presentation/page/home_page.dart

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import 'dart:async';
2+
13
import 'package:flutter/material.dart';
24
import 'package:flutter/rendering.dart';
35
import 'package:flutter_bloc/flutter_bloc.dart';
@@ -18,7 +20,7 @@ import 'package:quick_note/feature/home/presentation/widget/bottom_navigation_ba
1820
import 'package:quick_note/feature/home/presentation/widget/home_page_layout/home_page_menu/home_page_darwer.dart';
1921
import 'package:quick_note/feature/home/presentation/widget/home_page_layout/home_page_layout.dart';
2022
import 'package:quick_note/injection_container.dart';
21-
import 'package:quick_note/l10n/l10n.dart';
23+
import 'package:quick_note/preferences/theme/app_custom_colors.dart';
2224
import 'package:quick_note/router/app_routes.dart';
2325

2426
class HomePage extends StatefulWidget {
@@ -30,6 +32,17 @@ class HomePage extends StatefulWidget {
3032

3133
class _HomePageState extends State<HomePage> {
3234
bool _isFabVisible = true;
35+
Timer? _fabVisibilityTimer;
36+
37+
@override
38+
void initState() {
39+
_fabVisibilityTimer = Timer.periodic(const Duration(seconds: 1), (_) {
40+
if (mounted) {
41+
setState(() {});
42+
}
43+
});
44+
super.initState();
45+
}
3346

3447
@override
3548
Widget build(BuildContext context) {
@@ -49,6 +62,14 @@ class _HomePageState extends State<HomePage> {
4962
} else if (scrollNotification.direction ==
5063
ScrollDirection.reverse) {
5164
_isFabVisible = false;
65+
_fabVisibilityTimer?.cancel();
66+
_fabVisibilityTimer = Timer(const Duration(seconds: 1), () {
67+
if (mounted) {
68+
setState(() {
69+
_isFabVisible = true;
70+
});
71+
}
72+
});
5273
}
5374
});
5475
}
@@ -63,17 +84,18 @@ class _HomePageState extends State<HomePage> {
6384
),
6485
),
6586
floatingActionButton: width < AppConstans.mobileSize && _isFabVisible
66-
? FloatingActionButton.extended(
87+
? FloatingActionButton(
6788
onPressed: () {
6889
if (PlatformHelper.isMobile()) {
6990
locator<AnalyticsService>().logCreateNoteEvent();
7091
}
7192
BlocProvider.of<AppBloc>(context).add(AppCreateNote());
7293
},
73-
backgroundColor: Colors.grey[900],
74-
foregroundColor: Colors.white,
75-
icon: const Icon(Icons.add),
76-
label: Text(context.l10n.add_note),
94+
backgroundColor:
95+
Theme.of(context).floatingAcrionButtonBackgroundColor,
96+
foregroundColor:
97+
Theme.of(context).floatingAcrionButtonForegroundColor,
98+
child: const Icon(Icons.add),
7799
)
78100
: null,
79101
bottomNavigationBar: _buildBottomNavigationBar(),

lib/feature/notebook/presentation/page/notebook_edit_note_blocks_order.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,8 @@ class _NotebookNoteBlocksOrder extends StatelessWidget {
140140
return "${context.l10n.block_type_text} $blockIndex";
141141
case NoteBlockType.todo:
142142
return "${context.l10n.block_type_todo} $blockIndex";
143+
case NoteBlockType.bookmarks:
144+
return "${context.l10n.block_bookmark_todo} $blockIndex";
143145
default:
144146
return "Block $blockIndex";
145147
}

lib/feature/notebook/presentation/page/notebook_edit_notes_view.dart

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import 'package:quick_note/core/constans/app_constans.dart';
44
import 'package:quick_note/core/constans/insets.dart';
55
import 'package:quick_note/core/utils/platform_helper.dart';
66
import 'package:quick_note/feature/notebook/presentation/bloc/notebook_bloc.dart';
7+
import 'package:quick_note/feature/notebook/presentation/widget/notebook_leyout/notebook_add_note_block/notebook_mobile_add_note_block/show_add_note_block_bottom_sheet.dart';
78
import 'package:quick_note/feature/notebook/presentation/widget/notebook_leyout/notebook_header/Notebook_desktop_icons_menu/notebook_desktop_icons_menu.dart';
89
import 'package:quick_note/feature/notebook/presentation/widget/notebook_leyout/notebook_add_note_block/notebook_add_note_block_button/add_note_block_button.dart';
910
import 'package:quick_note/feature/notebook/presentation/widget/note_block/note_block_builder.dart';
@@ -28,6 +29,7 @@ class _NotebookEditNotesViewState extends State<NotebookEditNotesView> {
2829
late ScrollController _scrollController;
2930

3031
bool get _hasTitle => widget.note?.title.isNotEmpty ?? false;
32+
bool get _isNoteEmpty => widget.note?.content.isEmpty ?? false;
3133
bool get _setFocus => !_hasTitle && widget.note != null;
3234

3335
@override
@@ -41,8 +43,18 @@ class _NotebookEditNotesViewState extends State<NotebookEditNotesView> {
4143
void didUpdateWidget(covariant NotebookEditNotesView oldWidget) {
4244
super.didUpdateWidget(oldWidget);
4345

44-
if (oldWidget.note == null) {
45-
_setFocus ? _focusNode.requestFocus() : _focusNode.unfocus();
46+
if (oldWidget.note == null && widget.note != null) {
47+
if (_setFocus) {
48+
WidgetsBinding.instance.addPostFrameCallback((_) {
49+
_focusNode.requestFocus();
50+
51+
if (PlatformHelper.isMobile() && _isNoteEmpty) {
52+
ShowAddNoteBlockBottomSheet.show(context);
53+
}
54+
});
55+
} else {
56+
_focusNode.unfocus();
57+
}
4658
}
4759
}
4860

Original file line numberDiff line numberDiff line change
@@ -1,87 +1,14 @@
11
import 'package:flutter/material.dart';
2-
import 'package:flutter_bloc/flutter_bloc.dart';
3-
import 'package:quick_note/core/constans/insets.dart';
4-
import 'package:quick_note/core/service/analytics/service/analytics_service.dart';
5-
import 'package:quick_note/core/utils/platform_helper.dart';
6-
import 'package:quick_note/feature/notebook/presentation/bloc/notebook_bloc.dart';
7-
import 'package:quick_note/feature/shared/domain/entity/note/note_block_type.dart';
8-
import 'package:quick_note/injection_container.dart';
9-
import 'package:quick_note/l10n/l10n.dart';
2+
import 'package:quick_note/feature/notebook/presentation/widget/notebook_leyout/notebook_add_note_block/notebook_mobile_add_note_block/show_add_note_block_bottom_sheet.dart';
103

114
class NotebookAddNoteBlockModalBottomSheet extends StatelessWidget {
125
const NotebookAddNoteBlockModalBottomSheet({super.key});
136

147
@override
158
Widget build(BuildContext context) {
169
return IconButton(
17-
onPressed: () => _showAddNoteBlockModalBottomSheet(context),
10+
onPressed: () => ShowAddNoteBlockBottomSheet.show(context),
1811
icon: const Icon(Icons.add_box_outlined),
1912
);
2013
}
21-
22-
void logCreateNoteEvent(NoteBlockType blockType) {
23-
if (PlatformHelper.isMobile()) {
24-
locator<AnalyticsService>().logAddBlockEvent(blockType);
25-
}
26-
}
27-
28-
void _showAddNoteBlockModalBottomSheet(BuildContext context) {
29-
if (!context.mounted) return;
30-
31-
final notebookBloc = BlocProvider.of<NotebookBloc>(context);
32-
33-
showModalBottomSheet(
34-
context: context,
35-
builder: (context) {
36-
return Padding(
37-
padding: const EdgeInsets.all(Insets.s),
38-
child: Wrap(
39-
children: [
40-
Padding(
41-
padding:
42-
const EdgeInsets.only(left: Insets.s, bottom: Insets.xs),
43-
child: Text(
44-
"${context.l10n.add_note_block}:",
45-
style: Theme.of(context).textTheme.titleMedium,
46-
),
47-
),
48-
ListTile(
49-
leading: const Icon(Icons.text_fields),
50-
title: Text(context.l10n.block_type_text),
51-
onTap: () {
52-
notebookBloc.add(
53-
const NotebookAddNoteBlock(type: NoteBlockType.text),
54-
);
55-
logCreateNoteEvent(NoteBlockType.text);
56-
Navigator.pop(context);
57-
},
58-
),
59-
ListTile(
60-
leading: const Icon(Icons.check_box_outlined),
61-
title: Text(context.l10n.block_type_todo),
62-
onTap: () {
63-
notebookBloc.add(
64-
const NotebookAddNoteBlock(type: NoteBlockType.todo),
65-
);
66-
logCreateNoteEvent(NoteBlockType.todo);
67-
Navigator.pop(context);
68-
},
69-
),
70-
ListTile(
71-
leading: const Icon(Icons.bookmark_border),
72-
title: Text(context.l10n.block_bookmark_todo),
73-
onTap: () {
74-
notebookBloc.add(
75-
const NotebookAddNoteBlock(type: NoteBlockType.bookmarks),
76-
);
77-
logCreateNoteEvent(NoteBlockType.bookmarks);
78-
Navigator.pop(context);
79-
},
80-
),
81-
],
82-
),
83-
);
84-
},
85-
);
86-
}
8714
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
import 'package:flutter/material.dart';
2+
import 'package:flutter_bloc/flutter_bloc.dart';
3+
import 'package:quick_note/core/constans/insets.dart';
4+
import 'package:quick_note/core/service/analytics/service/analytics_service.dart';
5+
import 'package:quick_note/core/utils/platform_helper.dart';
6+
import 'package:quick_note/feature/notebook/presentation/bloc/notebook_bloc.dart';
7+
import 'package:quick_note/feature/shared/domain/entity/note/note_block_type.dart';
8+
import 'package:quick_note/injection_container.dart';
9+
import 'package:quick_note/l10n/l10n.dart';
10+
11+
class ShowAddNoteBlockBottomSheet {
12+
static void show(BuildContext context) {
13+
if (!context.mounted) return;
14+
15+
final notebookBloc = BlocProvider.of<NotebookBloc>(context);
16+
17+
showModalBottomSheet(
18+
context: context,
19+
builder: (context) {
20+
return Padding(
21+
padding: const EdgeInsets.all(Insets.s),
22+
child: Wrap(
23+
children: [
24+
Padding(
25+
padding:
26+
const EdgeInsets.only(left: Insets.s, bottom: Insets.xs),
27+
child: Text(
28+
"${context.l10n.add_note_block}:",
29+
style: Theme.of(context).textTheme.titleMedium,
30+
),
31+
),
32+
ListTile(
33+
leading: const Icon(Icons.text_fields),
34+
title: Text(context.l10n.block_type_text),
35+
onTap: () {
36+
notebookBloc.add(
37+
const NotebookAddNoteBlock(type: NoteBlockType.text),
38+
);
39+
_logCreateNoteEvent(NoteBlockType.text);
40+
Navigator.pop(context);
41+
},
42+
),
43+
ListTile(
44+
leading: const Icon(Icons.check_box_outlined),
45+
title: Text(context.l10n.block_type_todo),
46+
onTap: () {
47+
notebookBloc.add(
48+
const NotebookAddNoteBlock(type: NoteBlockType.todo),
49+
);
50+
_logCreateNoteEvent(NoteBlockType.todo);
51+
Navigator.pop(context);
52+
},
53+
),
54+
ListTile(
55+
leading: const Icon(Icons.bookmark_border),
56+
title: Text(context.l10n.block_bookmark_todo),
57+
onTap: () {
58+
notebookBloc.add(
59+
const NotebookAddNoteBlock(type: NoteBlockType.bookmarks),
60+
);
61+
_logCreateNoteEvent(NoteBlockType.bookmarks);
62+
Navigator.pop(context);
63+
},
64+
),
65+
],
66+
),
67+
);
68+
},
69+
);
70+
}
71+
72+
static void _logCreateNoteEvent(NoteBlockType blockType) {
73+
if (PlatformHelper.isMobile()) {
74+
locator<AnalyticsService>().logAddBlockEvent(blockType);
75+
}
76+
}
77+
}

lib/preferences/theme/app_custom_colors.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ import 'package:flutter/material.dart';
22

33
extension AppColors on ThemeData {
44
// HomePage
5+
Color get floatingAcrionButtonBackgroundColor =>
6+
brightness == Brightness.dark ? Colors.grey[900]! : Colors.white;
7+
Color get floatingAcrionButtonForegroundColor =>
8+
brightness == Brightness.dark ? Colors.white : Colors.grey[900]!;
59
//
610
// Side menu
711
Color? get sideMenuBackgroundColor =>

pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: quick_note
22
description: "A new Flutter project."
33
publish_to: "none"
44

5-
version: 1.2.3+12
5+
version: 1.2.4+13
66

77
environment:
88
sdk: ">=3.4.3 <4.0.0"
@@ -70,5 +70,5 @@ msix_config:
7070
publisher_display_name: makjac
7171
publisher: CN=PLACEHOLDER_PUBLISHER
7272
identity_name: PLACEHOLDER_IDENTITY_NAME
73-
msix_version: 1.1.1.1
73+
msix_version: 1.1.3.0
7474
logo_path: .\installers\windows\msix\quick_note.png

0 commit comments

Comments
 (0)