flutter.widget

FractionallySizedBox

paulaner80 2021. 4. 6. 11:24
반응형

 

withFactor

 

return Container(
  width:
200,
 
height: 150,
 
color: Colors.amber,
 
child: FractionallySizedBox(
    widthFactor:
0.5,
   
child: ElevatedButton(
      child:
Text("click"),
     
onPressed: (){
        print(
"click");
     
},
   
),
 
),
);

 

hieghtFactor

return Container(
  width:
200,
 
height: 150,
 
color: Colors.amber,
 
child: FractionallySizedBox(
    widthFactor:
0.5,
   
heightFactor: 0.5,
   
child: ElevatedButton(
      child:
Text("click"),
     
onPressed: (){
        print(
"click");
     
},
   
),
 
),
);

 

 

 

 

alignment

return Container(
    width:
200,
   
height: 150,
   
color: Colors.amber,
   
child: FractionallySizedBox(
      widthFactor:
0.5,
     
heightFactor: 0.5,
     
alignment: Alignment.topCenter,
     
child: ElevatedButton(
        child:
Text("click"),
       
onPressed: () {
          print(
"click");
        
},
     
),
   
),
 
);
}

'flutter.widget' 카테고리의 다른 글

AlertDialog  (0) 2021.04.13
RefreshIndicator  (0) 2021.04.08
image  (0) 2020.11.30
WebView  (0) 2020.11.17
DropdownButton  (0) 2020.11.13