@@ -2,6 +2,7 @@ use ratatui::{
22 Frame ,
33 layout:: { Alignment , Constraint , Direction , Layout } ,
44 style:: { Color , Style , Stylize } ,
5+ text:: Text ,
56 widgets:: { Block , BorderType , Borders , Clear , Padding , Paragraph } ,
67} ;
78use tui_input:: Input ;
@@ -30,7 +31,7 @@ impl Auth {
3031 . flex ( ratatui:: layout:: Flex :: SpaceBetween )
3132 . split ( popup_layout[ 1 ] ) [ 1 ] ;
3233
33- let ( text_area, passkey_area) = {
34+ let ( text_area, passkey_area, show_password_area ) = {
3435 let chunks = Layout :: default ( )
3536 . direction ( Direction :: Vertical )
3637 . constraints ( [
@@ -55,11 +56,12 @@ impl Auth {
5556 . constraints ( [
5657 Constraint :: Percentage ( 20 ) ,
5758 Constraint :: Fill ( 1 ) ,
59+ Constraint :: Length ( 5 ) ,
5860 Constraint :: Percentage ( 20 ) ,
5961 ] )
6062 . split ( chunks[ 2 ] ) ;
6163
62- ( area1[ 1 ] , area2[ 1 ] )
64+ ( area1[ 1 ] , area2[ 1 ] , area2 [ 2 ] )
6365 } ;
6466
6567 let text = Paragraph :: new ( "Enter the password" )
@@ -78,6 +80,12 @@ impl Auth {
7880 . style ( Style :: default ( ) . fg ( Color :: White ) )
7981 . block ( Block :: new ( ) . style ( Style :: default ( ) . bg ( Color :: DarkGray ) ) ) ;
8082
83+ let show_password_icon = if show_password {
84+ Text :: from ( " " ) . centered ( )
85+ } else {
86+ Text :: from ( " " ) . centered ( )
87+ } ;
88+
8189 frame. render_widget ( Clear , area) ;
8290
8391 frame. render_widget (
@@ -90,5 +98,6 @@ impl Auth {
9098 ) ;
9199 frame. render_widget ( text, text_area) ;
92100 frame. render_widget ( passkey, passkey_area) ;
101+ frame. render_widget ( show_password_icon, show_password_area) ;
93102 }
94103}
0 commit comments