Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion task_manager_app/lib/home_page.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'screens/student_list_screen.dart';

class HomePage extends StatelessWidget {
const HomePage({super.key});
Expand Down Expand Up @@ -26,11 +27,23 @@ class HomePage extends StatelessWidget {
),
const SizedBox(height: 8),
Text(
'Week 2 – Your first Flutter app',
'Manage your tasks efficiently and stay organized.',
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
color: Theme.of(context).colorScheme.onSurfaceVariant,
),
),
const SizedBox(height: 20),
ElevatedButton.icon(
onPressed: () {
Navigator.of(context).push(
MaterialPageRoute(
builder: (_) => const StudentListScreen(),
),
);
},
icon: const Icon(Icons.person_search),
label: const Text('View Students'),
),
],
),
),
Expand Down
7 changes: 7 additions & 0 deletions task_manager_app/lib/models/student.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class Student {
final String name;
final String id;
final String course;

const Student({required this.name, required this.id, required this.course});
}
41 changes: 41 additions & 0 deletions task_manager_app/lib/screens/student_list_screen.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import 'package:flutter/material.dart';
import '../models/student.dart';

class StudentListScreen extends StatelessWidget {
const StudentListScreen({super.key});

final List<Student> _students = const [
Student(name: 'Alice Johnson', id: 'S001', course: 'Biology'),
Student(name: 'Bob Smith', id: 'S002', course: 'Mathematics'),
Student(name: 'Carol Lee', id: 'S003', course: 'Computer Science'),
Student(name: 'David Kim', id: 'S004', course: 'Chemistry'),
Student(name: 'Eva Martínez', id: 'S005', course: 'Physics'),
Student(name: 'Frank Miller', id: 'S006', course: 'History'),
Student(name: 'Grace Wilson', id: 'S007', course: 'Economics'),
Student(name: 'Henry Clark', id: 'S008', course: 'English Literature'),
Student(name: 'Isabella Davis', id: 'S009', course: 'Psychology'),
Student(name: 'Jack Thompson', id: 'S010', course: 'Engineering'),
];

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Students'),
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
),
body: ListView.separated(
itemCount: _students.length,
separatorBuilder: (_, __) => const Divider(height: 1),
itemBuilder: (context, index) {
final s = _students[index];
return ListTile(
title: Text(s.name),
subtitle: Text('ID: ${s.id} • Course: ${s.course}'),
leading: CircleAvatar(child: Text(s.name.substring(0, 1))),
);
},
),
);
}
}
Loading