feat(infobar): add infobar as 'unique' instance instead manual implementation of infobar via box, label, revealer and button;

This commit is contained in:
doryan 2024-07-27 22:22:51 +04:00
parent cb2a52cc7b
commit bd394b9bf4

View File

@ -1,14 +1,13 @@
use crate::model::builder_traits::*; use crate::model::builder_traits::*;
use builders::{BoxBuilder, RevealerBuilder};
use gtk4 as gtk; use gtk4 as gtk;
use gtk::{prelude::*, Revealer, StackTransitionType::SlideLeftRight, *}; use gtk::{prelude::*, Revealer, StackTransitionType::SlideLeftRight, *};
use info_bar::InfoBar;
use crate::view::components::pages::Pages;
#[allow(unused)] #[allow(unused)]
use crate::view::{ use crate::view::{
components::{wrapper::*, *}, components::{pages::Pages, wrapper::*, *},
pages::*, pages::*,
properties::*, properties::*,
}; };
@ -24,15 +23,12 @@ pub fn ui(application: &adw::Application) {
.spacing(10) .spacing(10)
.build(); .build();
let info_bar_label = Label::builder().label("test").build(); let info_bar = InfoBar::builder()
.set_text_label("Sample text")
let info_bar: Revealer = Revealer::builder() .set_button_icon("close")
.child(&info_bar_label)
.transition_type(RevealerTransitionType::SlideUp)
.transition_duration(200)
.build(); .build();
hamming_code::hamming_code_page(&hamming_code, info_bar.clone()); hamming_code::hamming_code_page(&hamming_code);
let signal_reducing = Wrapper::row_builder() let signal_reducing = Wrapper::row_builder()
.set_align(Alignment::new(Align::Fill, Align::Fill)) .set_align(Alignment::new(Align::Fill, Align::Fill))
@ -40,7 +36,7 @@ pub fn ui(application: &adw::Application) {
.spacing(10) .spacing(10)
.build(); .build();
signal_reducing::signal_reducing_page(&signal_reducing, info_bar.clone()); signal_reducing::signal_reducing_page(&signal_reducing);
let pages = Pages::builder() let pages = Pages::builder()
.set_transition(SlideLeftRight, 200) .set_transition(SlideLeftRight, 200)
@ -53,7 +49,7 @@ pub fn ui(application: &adw::Application) {
let application_box = Box::new(Orientation::Vertical, 0); let application_box = Box::new(Orientation::Vertical, 0);
application_box.append(&info_bar); application_box.append(info_bar.clone().get());
application_box.append(&pages); application_box.append(&pages);
let window = ApplicationWindow::builder() let window = ApplicationWindow::builder()