1.
Design Flutter UI for college ID Card:-
import 'package:flutter/[Link]';
void main() => runApp(MaterialApp(
home: IdCard(),
));
class IdCard extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: [Link][900],
appBar: AppBar(
title: Text('TE-IT ID Card'),
centerTitle: true,
backgroundColor: [Link][850],
elevation: 0.0,
),
body: Padding(
padding: const [Link](30.0, 40.0, 30.0,
0),
child: Column(
crossAxisAlignment: [Link],
children: <Widget>[
Center(
child: CircleAvatar(
radius: 40.0,
backgroundImage: AssetImage('[Link]'),
),
),
Divider(
color: [Link][800],
height: 60.0,
),
Text(
'NAME',
style: TextStyle(
color: [Link],
letterSpacing: 2.0,
),
),
SizedBox(height: 10.0),
Text(
'Shrihan',
style: TextStyle(
color: [Link][200],
fontWeight: [Link],
fontSize: 28.0,
letterSpacing: 2.0,
),
),
SizedBox(height: 30.0),
Text(
'HOMETOWN',
style: TextStyle(
color: [Link],
letterSpacing: 2.0,
),
),
SizedBox(height: 10.0),
Text(
'Thane- India',
style: TextStyle(
color: [Link][200],
fontWeight: [Link],
fontSize: 28.0,
letterSpacing: 2.0,
),
),
SizedBox(height: 30.0),
Text(
'Current Academic Year',
style: TextStyle(
color: [Link],
letterSpacing: 2.0,
),
),
SizedBox(height: 10.0),
Text(
'2021-2022',
style: TextStyle(
color: [Link][200],
fontWeight: [Link],
fontSize: 28.0,
letterSpacing: 2.0,
),
),
SizedBox(height: 30.0),
Row(
children: <Widget>[
Icon(
[Link],
color: [Link][400],
),
SizedBox(width: 10.0),
Text(
'shrihan@[Link]',
style: TextStyle(
color: [Link][400],
fontSize: 18.0,
letterSpacing: 1.0,
),
)
],
),
],
),
),
);
}
}
2. Design Student Registration Form in Flutter.
import 'package:flutter/[Link]';
void main() {
runApp(const MaterialApp(
home: MyForm(),
));
}
class MyForm extends StatefulWidget {
const MyForm({Key? key}) : super(key: key);
@override
State<StatefulWidget> createState() {
return MyFormState();
}
}
class MyFormState extends State<MyForm> {
final _myFormKey = GlobalKey<FormState>();
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text("Student Registration Form"),
),
body: Container(
padding: const [Link](vertical: 25.0,
horizontal: 25.0),
child: Form(
key: _myFormKey,
child: Column(
children: <Widget>[
Padding(
padding: const [Link](10.0),
child: TextFormField(
validator: (msg) {
if (msg!.isEmpty) {
return "Please enter name";
}
return null;
},
decoration: InputDecoration(labelText:
"Name", hintText: "Enter Your Name", border:
OutlineInputBorder(borderRadius:
[Link](10.0))),
),
),
Padding(
padding: const [Link](10.0),
child: TextFormField(
validator: (msg) {
if (msg!.isEmpty) {
return "Please enter email";
}
return null;
},
decoration: InputDecoration(labelText:
"Email", hintText: "Enter Your Email", border:
OutlineInputBorder(borderRadius:
[Link](10.0))),
),
),
Padding(
padding: const [Link](10.0),
child: TextFormField(
keyboardType: [Link],
validator: (msg) {
if (msg!.isEmpty) {
return "Please enter Mobile Number";
}
if (msg!.length != 10) {
return "Please Enter Correct Digits";
}
return null;
},
decoration: InputDecoration(labelText:
"Mobile", hintText: "Enter Your Mobile No.", border:
OutlineInputBorder(borderRadius:
[Link](10.0))),
),
),
Padding(
padding: const [Link](10.0),
child: TextFormField(
keyboardType: [Link],
validator: (msg) {
if (msg!.isEmpty) {
return "Please enter Roll Number";
}
return null;
},
decoration: InputDecoration(labelText:
"Roll No.", hintText: "Enter Your Roll No.", border:
OutlineInputBorder(borderRadius:
[Link](10.0))),
),
),
Padding(
padding: const [Link](10.0),
child: TextFormField(
validator: (msg) {
if (msg!.isEmpty) {
return "Please enter Password";
}
if (msg!.length < 8) {
return "Please Enter Correct
Password";
}
return null;
},
obscureText: true,
decoration: InputDecoration(labelText:
"Password", hintText: "Enter Your Password.", border:
OutlineInputBorder(borderRadius:
[Link](10.0))),
),
),
Container(
padding: const [Link](left:
150.0, top: 40.0),
child: ElevatedButton(
child: const Text('Submit'),
onPressed: () {
// It returns true if the form is
valid, otherwise returns false
if
(_myFormKey.currentState!.validate()) {
// If the form is valid, display a
Snackbar.
[Link](context)
.showSnackBar(const
SnackBar(content: Text('Data is in processing.')));
}
},
)),
],
)),
),
);
}
}
3. Design Listview Layout in Flutter.
import 'package:flutter/[Link]';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
// It is the root widget of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo Application',
theme: ThemeData(
primarySwatch: [Link],
),
home: MyHomePage(title: 'Complex layout example'),
);
class MyHomePage extends StatelessWidget {
MyHomePage({Key? key, required [Link]}) : super(key: key);
final String title;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text("Product List")),
body: ListView(
padding: const [Link](3.0, 12.0, 3.0, 12.0),
children: <Widget>[
ProductBox(
name: "iPhone",
description: "iPhone is the top branded phone ever",
price: 55000,
image: "[Link]"),
ProductBox(
name: "Android",
description: "Android is a very stylish phone",
price: 10000,
image: "[Link]"),
ProductBox(
name: "Tablet",
description: "Tablet is a popular device for official meetings",
price: 25000,
image: "[Link]"),
ProductBox(
name: "Laptop",
description: "Laptop is most famous electronic device",
price: 35000,
image: "[Link]"),
ProductBox(
name: "Desktop",
description: "Desktop is most popular for regular use",
price: 10000,
image: "[Link]"),
],
));
}
}
class ProductBox extends StatelessWidget {
ProductBox(
{Key? key,
required [Link],
required [Link],
required [Link],
required [Link]})
: super(key: key);
final String name;
final String description;
final int price;
final String image;
Widget build(BuildContext context) {
return Container(
padding: [Link](2),
height: 110,
child: Card(
child: Row(
mainAxisAlignment: [Link],
children: <Widget>[
[Link]("assets/" + image),
Expanded(
child: Container(
padding: [Link](5),
child: Column(
mainAxisAlignment: [Link],
children: <Widget>[
Text([Link],
style: TextStyle(fontWeight: [Link])),
Text([Link]),
Text("Price: " + [Link]()),
],
)))
])));
}
4. Design Gridview Layout in Flutter.
import 'package:flutter/[Link]';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
List<String> images = [
"[Link]
"[Link]
"[Link]
"[Link]
];
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: Text("Flutter GridView Demo"),
backgroundColor: [Link],
),
body: Container(
padding: [Link](12.0),
child: [Link](
itemCount: [Link],
gridDelegate:
SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2,
crossAxisSpacing: 4.0, mainAxisSpacing: 4.0),
itemBuilder: (BuildContext context, int index) {
return [Link](images[index]);
},
)),
),
);
}
}
5. Design Flutter Ul to navigate between two screens.
[Link]
import 'package:flutter/[Link]';
import 'mynavapp/[Link]';
void main() {
runApp(MaterialApp(
home: MyNavigation(),
));
class MyNavigation extends StatefulWidget {
const MyNavigation({Key? key}) : super(key: key);
@override
State<StatefulWidget> createState() {
return _MyNavigation();
class _MyNavigation extends State<MyNavigation> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Navigation Tutorail"),
),
body: Center(
child: RaisedButton(
child: Text("Click Here"),
onPressed: () {
[Link](context, MaterialPageRoute(builder:
(context) => MyPageDetail()));
},
),
),
);
[Link]
import 'package:flutter/[Link]';
class MyPageDetail extends StatelessWidget {
const MyPageDetail({Key? key}): super(key:key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Navigation Result"),
),
body: Center(
child: Column(
children: <Widget>[
Text("Navigation Page")
],
),
),
);
}
}
6. Design Product Description Layout. ( same as list view )
7. Design Employee Registration Form in Flutter.
import 'package:flutter/[Link]';
void main() {
runApp(const MaterialApp(
home: MyForm(),
));
}
class MyForm extends StatefulWidget {
const MyForm({Key? key}) : super(key: key);
@override
State<StatefulWidget> createState() {
return MyFormState();
}
}
class MyFormState extends State<MyForm> {
final _myFormKey = GlobalKey<FormState>();
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text("Employee Registration Form"),
),
body: Container(
padding: const [Link](vertical: 25.0,
horizontal: 25.0),
child: Form(
key: _myFormKey,
child: Column(
children: <Widget>[
Padding(
padding: const [Link](10.0),
child: TextFormField(
validator: (msg) {
if (msg!.isEmpty) {
return "Please enter name";
}
return null;
},
decoration: InputDecoration(labelText:
"Name", hintText: "Enter Your Name", border:
OutlineInputBorder(borderRadius:
[Link](10.0))),
),
),
Padding(
padding: const [Link](10.0),
child: TextFormField(
validator: (msg) {
if (msg!.isEmpty) {
return "Please enter email";
}
return null;
},
decoration: InputDecoration(labelText:
"Email", hintText: "Enter Your Email", border:
OutlineInputBorder(borderRadius:
[Link](10.0))),
),
),
Padding(
padding: const [Link](10.0),
child: TextFormField(
keyboardType: [Link],
validator: (msg) {
if (msg!.isEmpty) {
return "Please enter Mobile Number";
}
if (msg!.length != 10) {
return "Please Enter Correct Digits";
}
return null;
},
decoration: InputDecoration(labelText:
"Mobile", hintText: "Enter Your Mobile No.", border:
OutlineInputBorder(borderRadius:
[Link](10.0))),
),
),
Padding(
padding: const [Link](10.0),
child: TextFormField(
validator: (msg) {
if (msg!.isEmpty) {
return "Please enter Password";
}
if (msg!.length < 8) {
return "Please Enter Correct
Password";
}
return null;
},
obscureText: true,
decoration: InputDecoration(labelText:
"Password", hintText: "Enter Your Password.", border:
OutlineInputBorder(borderRadius:
[Link](10.0))),
),
),
Container(
padding: const [Link](left:
150.0, top: 40.0),
child: ElevatedButton(
child: const Text('Submit'),
onPressed: () {
// It returns true if the form is
valid, otherwise returns false
if
(_myFormKey.currentState!.validate()) {
// If the form is valid, display a
Snackbar.
[Link](context).showSnackBar(const SnackBar(content:
Text('Data is in processing.')));
}
},
)),
],
)),
),
);
}
}
8. Create flutter layout using any 7-8 widgets of flutter ( same as ID card )
9. Create Calculator using flutter.
10. a. Create Stateless Widget.
import 'package:flutter/[Link]';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: Text("Stateless Widget"),
),
body: Center(
child: Column(
children: [
TextButton(
onPressed: () {},
child: Text("Login"),
),
TextButton(
onPressed: () {},
child: Text("Register"),
)
],
),
),
),
);
}
}
b. Create Stateful Widget.
import 'package:flutter/[Link]';
void main() => runApp(MyApp());
class MyApp extends StatefulWidget {
@override
_MyState createState() => _MyState();
}
class _MyState extends State<MyApp> {
Color _containerColor = [Link];
void changeColor() {
setState(() {
if (_containerColor == [Link]) {
_containerColor = [Link];
return;
}
_containerColor = [Link];
});
}
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: [Link],
),
home: Scaffold(
appBar: AppBar(title: Text("A Simple App
Stateful Widget")),
body: Container(decoration:
BoxDecoration(color: _containerColor)),
floatingActionButton: FloatingActionButton(
onPressed: changeColor,
child: Icon([Link]),
tooltip: "Book Here",
),
));
}
}
11. Design Product Registration Form in Flutter.
import 'package:flutter/[Link]';
void main() {
runApp(const MaterialApp(
home: MyForm(),
));
}
class MyForm extends StatefulWidget {
const MyForm({Key? key}) : super(key: key);
@override
State<StatefulWidget> createState() {
return MyFormState();
}
}
class MyFormState extends State<MyForm> {
final _myFormKey = GlobalKey<FormState>();
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text("Product Registration Form"),
),
body: Container(
padding: const [Link](vertical: 25.0,
horizontal: 25.0),
child: Form(
key: _myFormKey,
child: Column(
children: <Widget>[
Padding(
padding: const [Link](10.0),
child: TextFormField(
validator: (msg) {
if (msg!.isEmpty) {
return "Please enter name";
}
return null;
},
decoration: InputDecoration(labelText:
"Product Name", hintText: "Enter Product Name", border:
OutlineInputBorder(borderRadius:
[Link](10.0))),
),
),
Padding(
padding: const [Link](10.0),
child: TextFormField(
validator: (msg) {
if (msg!.isEmpty) {
return "Please enter Price";
}
return null;
},
decoration: InputDecoration(labelText:
"Price", hintText: "Enter Product Price", border:
OutlineInputBorder(borderRadius:
[Link](10.0))),
),
),
Padding(
padding: const [Link](10.0),
child: TextFormField(
validator: (msg) {
if (msg!.isEmpty) {
return "Please enter Description";
}
return null;
},
decoration: InputDecoration(labelText:
"Description", hintText: "Enter Product Price", border:
OutlineInputBorder(borderRadius:
[Link](10.0))),
),
),
Container(
padding: const [Link](left:
150.0, top: 40.0),
child: ElevatedButton(
child: const Text('Submit'),
onPressed: () {
// It returns true if the form is
valid, otherwise returns false
if
(_myFormKey.currentState!.validate()) {
// If the form is valid, display a
Snackbar.
[Link](context).showSnackBar(const SnackBar(content:
Text('Data is in processing.')));
}
},
)),
],
)),
),
);
}
}