Base Coding

황규빈·2022년 3월 6일

More Point

목록 보기
2/8

Tab 

Selected State와 Unselected State 스타일 결정 
> labelStyle & unselectedLabelStyle 속성으로 결정  

Button 

Bottom에 위치한 버튼 생성  
> 
Align(   
	alignment: Alignment.bottomCenter,   
		child: RaisedButton(  
	)  
)  

TextField 

Hint text no underline  
>
TextField(    
	decoration: new InputDecoration(  
	border: InputBorder.none,    
  		hintText: 'Username'  ),  
),  
Input 값 제한
>
TextFormField(        
//validator: ,        
controller: controllerValor,        
inputFormatters: 
[WhitelistingTextInputFormatter.digitsOnly,  
        // Fit the validating format.  
        //fazer o formater para dinheiro  
        CurrencyInputFormatter()    ],  
   keyboardType: TextInputType.number,
최대 길이 설정 maxLength
Hide letter count  
>
TextField(    
decoration: InputDecoration(      
hintText: "Email",    counterText: "",),  maxLength: 40,),  
Hint text sytle 설정
>
TextField(        
	style: TextStyle(fontSize: 20),        
    decoration: InputDecoration(
    				hintText: "Password",         
                    hintStyle: TextStyle(
                    				fontSize: 20.0, 
                                    color: Colors.redAccent),
                    border: OutlineInputBorder(borderSide: BorderSide(color: Colors.teal)),          
                    prefixIcon: const Icon(            
                    				Icons.security,            
                                    color: Colors.white,          
                                    ),        
                            ),
                    ),  

Text 

softWrap 동작 안함  
Flexible로 감싸주기  
문자와 숫자의 높이 맞추기  
Row나 Column으로 묶고, textbaseline.alphatic, crossAlignment.baseline 값 주기  
Decoration  
둥큰 코너 넣기  
BoxDecoration(   
borderRadius: BorderRadius.all( Radius.circular(5.0) // POINT   
),   
);  
Padding 
padding: const EdgeInsets.only(left:15.0,right: 15.0,top:0,bottom: 0), 
        padding: EdgeInsets.symmetric(horizontal: 15), 
> 이 두개는 같은 의미 

UI exception  

text filed focus node exception  
>  
WidgetsBinding.instance.addPostFrameCallback((_){      FocusScope.of(context).requestFocus(myFocusNode);    });  

Q.버튼 활성화 조건에 따라 활성화되도록 해두었는데, 이를 받아온 컨트롤러가 추가적으로 null체크를 해주지 않아도 괜찮을까요
; 추가적으로 같은 동작, 버튼이 활성화되는 조건을 다시한번 컨트롤러에서 검사하는 해야하나요?
A. null safety 는 이미 dart 언어에서 지원하니까, 애초에 arg 를 null이 아닌 값으로만 받아오도록 하면 굳이 필요 없지 않을까요??
; 말씀해주신 것이, 컨트롤러가 받아오는 인자 형식을 null이 아닌 값을 지정해두면 굳이 안해도 된다는 것 맞을까요??

시간을 표현하는 타입   
> DateTime   
시간타입의 객체 생성 
> DateTime.now()  
문자열이나 기타 자료형으로 변환  
> DateFormat  
switch case
여러 케이스에서 같은 동작할때  
>
switch (mark) {         
	case0:  
		return "mark is 0";         
	case 1:         
	case 2:         
	case 3: 
		return "mark is either 1, 2 or 3" ;         
	default :             
		return "mark is not 0, 1, 2 or 3" ;     
}  

parse handling 

String to int  
int.TryParse, since I most often don't care why the parsing fails, if it fails. However, int.Parse can (according to the documentation) throw three different exceptions:  
the input is null  
the input is not in a valid format  
the input contains a number that produces an overflow  
If you care about why it fails, then int.Parse is clearly the better choice. 
profile
어제보다 더 나음을 위해.

0개의 댓글