wip notedeck

This commit is contained in:
2025-01-07 11:23:34 +00:00
parent c8c5485581
commit 0e19c1a8f3
31 changed files with 725 additions and 2173 deletions

View File

@ -1,7 +1,5 @@
use crate::route::{RouteAction, RouteServices};
use crate::theme::{MARGIN_DEFAULT, NEUTRAL_500, NEUTRAL_900, ROUNDING_DEFAULT};
use crate::widgets::NostrWidget;
use egui::{Frame, Response, TextEdit, Ui};
use egui::{Frame, Response, TextEdit, Ui, Widget};
/// Wrap the [TextEdit] widget to handle native keyboard
pub struct NativeTextInput<'a> {
@ -30,8 +28,8 @@ impl<'a> NativeTextInput<'a> {
}
}
impl<'a> NostrWidget for NativeTextInput<'a> {
fn render(&mut self, ui: &mut Ui, services: &mut RouteServices<'_>) -> Response {
impl Widget for NativeTextInput<'_> {
fn ui(self, ui: &mut Ui) -> Response {
let mut editor = TextEdit::multiline(self.text)
.frame(false)
.desired_rows(1)
@ -49,12 +47,6 @@ impl<'a> NostrWidget for NativeTextInput<'a> {
} else {
ui.add(editor)
};
if response.lost_focus() {
services.action(RouteAction::HideKeyboard);
}
if response.gained_focus() {
services.action(RouteAction::ShowKeyboard);
}
response
}
}