Auto focus new entry
This commit is contained in:
@@ -8,7 +8,9 @@ import 'package:window_manager/window_manager.dart';
|
|||||||
import 'package:audioplayers/audioplayers.dart';
|
import 'package:audioplayers/audioplayers.dart';
|
||||||
|
|
||||||
// TODO: Add an icon to the executable, simply use the existing tray icon
|
// TODO: Add an icon to the executable, simply use the existing tray icon
|
||||||
// TODO: Auto focus new entry field
|
// TODO: Add an entry field for the duration ie. the interval of apperance
|
||||||
|
// TODO: Also the sound file, if possible...
|
||||||
|
// TODO: Cram the above into the database
|
||||||
|
|
||||||
const Duration popupInterval = Duration(minutes: 20);
|
const Duration popupInterval = Duration(minutes: 20);
|
||||||
const String notificationSound = 'MeetTheSniper.mp3';
|
const String notificationSound = 'MeetTheSniper.mp3';
|
||||||
@@ -124,11 +126,13 @@ class MainPage extends StatefulWidget {
|
|||||||
|
|
||||||
class _MainPageState extends State<MainPage> with WindowListener {
|
class _MainPageState extends State<MainPage> with WindowListener {
|
||||||
final SystemTray _systemTray = SystemTray();
|
final SystemTray _systemTray = SystemTray();
|
||||||
|
final Menu _menu = Menu();
|
||||||
final AudioPlayer _audioPlayer = AudioPlayer();
|
final AudioPlayer _audioPlayer = AudioPlayer();
|
||||||
|
|
||||||
final TextEditingController _previousEntryController =
|
final TextEditingController _previousEntryController =
|
||||||
TextEditingController();
|
TextEditingController();
|
||||||
final TextEditingController _currentEntryController = TextEditingController();
|
final TextEditingController _currentEntryController = TextEditingController();
|
||||||
|
final FocusNode _currentEntryFocusNode = FocusNode();
|
||||||
final TextEditingController _todoController = TextEditingController();
|
final TextEditingController _todoController = TextEditingController();
|
||||||
|
|
||||||
Note? previousNote;
|
Note? previousNote;
|
||||||
@@ -154,6 +158,7 @@ class _MainPageState extends State<MainPage> with WindowListener {
|
|||||||
_debounceTimer?.cancel();
|
_debounceTimer?.cancel();
|
||||||
_previousEntryController.dispose();
|
_previousEntryController.dispose();
|
||||||
_currentEntryController.dispose();
|
_currentEntryController.dispose();
|
||||||
|
_currentEntryFocusNode.dispose();
|
||||||
_todoController.dispose();
|
_todoController.dispose();
|
||||||
_audioPlayer.dispose();
|
_audioPlayer.dispose();
|
||||||
super.dispose();
|
super.dispose();
|
||||||
@@ -208,9 +213,11 @@ class _MainPageState extends State<MainPage> with WindowListener {
|
|||||||
await windowManager.center();
|
await windowManager.center();
|
||||||
await windowManager.show();
|
await windowManager.show();
|
||||||
await windowManager.focus();
|
await windowManager.focus();
|
||||||
|
_currentEntryFocusNode.requestFocus();
|
||||||
await _playSound();
|
await _playSound();
|
||||||
} else {
|
} else {
|
||||||
await windowManager.focus();
|
await windowManager.focus();
|
||||||
|
_currentEntryFocusNode.requestFocus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -290,6 +297,7 @@ class _MainPageState extends State<MainPage> with WindowListener {
|
|||||||
Expanded(
|
Expanded(
|
||||||
child: TextField(
|
child: TextField(
|
||||||
controller: _currentEntryController,
|
controller: _currentEntryController,
|
||||||
|
focusNode: _currentEntryFocusNode,
|
||||||
maxLines: null,
|
maxLines: null,
|
||||||
expands: true,
|
expands: true,
|
||||||
autofocus: true,
|
autofocus: true,
|
||||||
|
Reference in New Issue
Block a user