Column, Padding, Container ,Sateless
class ContainerExample extends StatelessWidget {
const ContainerExample({[Link]});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text('Container Example'),backgroundColor: [Link],),
body:Padding(padding: [Link](10.0),
child: Column(
// mainAxisAlignment: [Link],
// crossAxisAlignment : [Link],
children: [
Container(height: 100,width: 100,color: [Link],),
SizedBox(height: 5,),
Container(height: 100,width: 100,color: [Link],),
SizedBox(height: 5,),
Container(height: 100,width: 100,
decoration: BoxDecoration(
color: [Link],
shape: [Link]
),
),
],
),
); } }
SINGLE SCROLL CHILD VIEW
Column(
crossAxisAlignment: [Link],
children: [
// getRowView()
SingleChildScrollView(
scrollDirection: [Link], // Row
// scrollDirection: [Link], // not working for column
child: Row(
children: [
Container(
height: 100,
width: 100,
color: [Link],
),
SizedBox(
width: 5,
),
Container(
height: 100,
width: 100,
color: [Link],
),
],
)
CheckBox
bool chkbx1State = false; // Global Variable
bool chkbx2State = false;
Approch 1 :
Checkbox(
value: chkbx1State,
onChanged: (bool? val) {
setState(() {
chkbx1State = val!;
});
}),
GestureDetector(
onTap: () {
setState(() {
chkbx1State = !chkbx1State;
});
},
child: Text('Checkbox 1'))
Approach 2 :
CheckboxListTile(
controlAffinity: [Link],
//controlAffinity: [Link],
title: Text('Check Box 2'),
value: chkbx2State,
onChanged: (bool? val) {
setState(() {
chkbx2State = val!;
});
})
Approch 3:
Row(
children: [
Checkbox(value: chkbxHock, onChanged: (val){
setState(() {
chkbxHock=val!;
});
}),
Text('Hockey')
],
ELEVATED BUTTON
ElevatedButton(onPressed: (){
int qty=[Link]([Link]);
int price=[Link]([Link]);
int bill=qty*price;
reciept='Amount\t{$bill}\nDiscount\t${discount}\nMembership\t${memberShipDiscount}\nPay
bale\t${payable}';
print(reciept);
setState(() {
[Link] = [Link]();
});
}, child:Text('Calculate')),
Text Foam Field
TextEditingController quantitycontroller=TextEditingController(); // Global
[Link]="0"; //Set Value ;
int qty=[Link]([Link]);//Get
Container(
width: 100,
height: 60,
child: TextFormField(
readOnly: true,
controller: quantitycontroller,
//keyboardType:[Link], // For Numaric Keyboard
decoration: InputDecoration(
border: OutlineInputBorder(),
hintText: 'Quantity',
labelText: 'Qunatity',
prefixIcon: Icon([Link])),
),//InputDecorator
),//TextFormField )//Container
Text
Text('Counter ${_counter}',style: TextStyle(fontSize: 20,fontWeight: [Link]),
Image
[Link](
'assets/[Link]',
width: 150.0,
height: 200.0,
fit: [Link],
),
Radio Button
String ?gender; // Same Variable is used For Grouping Multiple Radio button
Row(children: [
Radio(value: "Male",
groupValue: gender,
onChanged: (String? val){
setState(() {
gender=val;
});
}),
Text('Male')
],),
Row(children: [
Radio(value: "Female",
groupValue: gender,
onChanged: (String? val){
setState(() {
gender=val;
});
}),
Text('Female') ],),
DROPDOWN BUTTON
List<int> AgeList = [16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30 ];
String? _selectedage;
Row(
children: [
Text("Age"),
Container(
height: 60,
width: 150,
child: DropdownButton(
isExpanded: true,
value: _selectedage,
items: [Link]((e) {
return DropdownMenuItem<String>(
value: [Link](), child: Text([Link]()));
}).toList(),
onChanged: (selectedItem) {
setState(() {
_selectedage = selectedItem;
});
})),
],
List View Builder and DropDown
Text('City'),
Container(height: 60,width: 150,
decoration: BoxDecoration(
border: [Link](),
borderRadius: [Link](5)
),
child: DropdownButton(
isExpanded: true,
value: _city,
items:cities_list.map((e){
return DropdownMenuItem<String>(
value: e,
child: Text(e));
}).toList(),
onChanged: (String? _selectedItem){
setState(() {
_city=_selectedItem;
filterDoctors();
});
},
),
),
Expanded(child: Container(
child: [Link](
itemCount: [Link] ,
itemBuilder: (context,index){
Doctor doctor=doctorlist[index];
return Container(height: 70,
decoration: BoxDecoration(
border: [Link](),
borderRadius: [Link](4)
),
child: Card(
elevation: 3,// For Shadow
child: Column(
children: [
Text('Name ${[Link]}'),
Text('Experience ${[Link]}'),
Text('Specailization ${[Link]}')
],
),
),
);
}),
))
List View(Column Scroll)
body: ListView(
// scrollDirection: [Link],
children: [
Container(
margin: [Link](10),
height: 100,
width: 100,
color: [Link],
),
Container(
margin: [Link](10),
height: 100,
width: 100,
color: [Link],
),
Container(
margin: [Link](10),
height: 100,
width: 100,
color: [Link],
),
Container(
margin: [Link](10),
height: 100,
width: 100,
color: [Link],
),
List View Builder
body: [Link](
itemCount: 100,
itemBuilder: (BuildContext context ,int index){
return Text('S# ${index +1}',style: TextStyle(fontSize: 20),);
}),
LIST View Builder with Tile (Delete icon)
body: [Link](
itemCount: [Link],
itemBuilder: (context,index){
Student sobj=slist[index];
return ListTile(
onTap: (){
},
title: Text('Name ${[Link]}'),
subtitle: Text('Semester${[Link]}'),
trailing: IconButton(icon: Icon([Link]),onPressed: (){
setState(() {
[Link](index);
});
},),
);
}),
NAVIGATION on Button
ElevatedButton(onPressed: (){
[Link](context, MaterialPageRoute(builder: (context){
return SearchScreen(); // Screen To Call
);
}, child: Text('Search Doctor')),
ADD ON BUTTON
ElevatedButton(onPressed: (){
Doctor doctor=Doctor(city: _city!,
experience:[Link]([Link]),
name: [Link],
spec: _special!);
doctor_list.add(doctor);
}, child: Text('Add'))