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';
|
||||
|
||||
// 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 String notificationSound = 'MeetTheSniper.mp3';
|
||||
@@ -124,11 +126,13 @@ class MainPage extends StatefulWidget {
|
||||
|
||||
class _MainPageState extends State<MainPage> with WindowListener {
|
||||
final SystemTray _systemTray = SystemTray();
|
||||
final Menu _menu = Menu();
|
||||
final AudioPlayer _audioPlayer = AudioPlayer();
|
||||
|
||||
final TextEditingController _previousEntryController =
|
||||
TextEditingController();
|
||||
final TextEditingController _currentEntryController = TextEditingController();
|
||||
final FocusNode _currentEntryFocusNode = FocusNode();
|
||||
final TextEditingController _todoController = TextEditingController();
|
||||
|
||||
Note? previousNote;
|
||||
@@ -154,6 +158,7 @@ class _MainPageState extends State<MainPage> with WindowListener {
|
||||
_debounceTimer?.cancel();
|
||||
_previousEntryController.dispose();
|
||||
_currentEntryController.dispose();
|
||||
_currentEntryFocusNode.dispose();
|
||||
_todoController.dispose();
|
||||
_audioPlayer.dispose();
|
||||
super.dispose();
|
||||
@@ -208,9 +213,11 @@ class _MainPageState extends State<MainPage> with WindowListener {
|
||||
await windowManager.center();
|
||||
await windowManager.show();
|
||||
await windowManager.focus();
|
||||
_currentEntryFocusNode.requestFocus();
|
||||
await _playSound();
|
||||
} else {
|
||||
await windowManager.focus();
|
||||
_currentEntryFocusNode.requestFocus();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -290,6 +297,7 @@ class _MainPageState extends State<MainPage> with WindowListener {
|
||||
Expanded(
|
||||
child: TextField(
|
||||
controller: _currentEntryController,
|
||||
focusNode: _currentEntryFocusNode,
|
||||
maxLines: null,
|
||||
expands: true,
|
||||
autofocus: true,
|
||||
|
Reference in New Issue
Block a user