Assignment
Assignment
Ǫues-1 wirte the flutter code app using container row column icon with listview.
Ans:-
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
@override
return MaterialApp(
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: MyHomePage(),
);
}
class MyHomePage extends StatelessWidget {
@override
return Scaffold(
appBar: AppBar(
),
body: ListView.builder(
itemCount: items.length, itemBuilder:
padding: EdgeInsets.all(12.0),
decoration: BoxDecoration(
color: Colors.blue.shade100,
borderRadius: BorderRadius.circular(10.0),
boxShadow: [
BoxShadow(
color: Colors.black26,
blurRadius: 4.0,
),
],
),
child: Row(
children: [
Icon(
Icons.star,
color: Colors.orange,
size: 30.0,
),
SizedBox(width: 16.0),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
items[index],
style: TextStyle(
fontSize: 18.0,
fontWeight: FontWeight.bold,
),
),
SizedBox(height: 4.0),
Text(
'Description of ${items[index]}',
style: TextStyle(
fontSize: 14.0,
color: Colors.grey,
),
),
],
),
),
Icon(
Icons.chevron_right,
color: Colors.blue,
),
],
),
);
},
),
);
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
@override
return MaterialApp(
home: TaskListScreen(),
);
@override
List<Task> tasks = [
];
@override
return Scaffold(
appBar: AppBar(
title: Text('Task List'),
),
body: Column(
children: [
// Header Section
Padding(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'Your Tasks',
),
IconButton(
icon: Icon(Icons.add),
onPressed: () {
setState(() {
});
},
),
],
),
),
Expanded(
child: ListView.builder(
itemCount: tasks.length,
return TaskItem(
task: tasks[index],
setState(() {
});
},
);
},
),
),
],
),
);
// Task model
class Task {
String title;
bool isCompleted;
return Padding(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
task.title,
style: TextStyle(
fontSize: 18,
decoration:
),
),
Checkbox(
value: task.isCompleted,
onChanged: onChanged,
),
],
),
);
}
}