diff --git a/task_manager_app/lib/home_page.dart b/task_manager_app/lib/home_page.dart index ddbfd2a..55c106d 100644 --- a/task_manager_app/lib/home_page.dart +++ b/task_manager_app/lib/home_page.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'screens/student_list_screen.dart'; class HomePage extends StatelessWidget { const HomePage({super.key}); @@ -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'), + ), ], ), ), diff --git a/task_manager_app/lib/models/student.dart b/task_manager_app/lib/models/student.dart new file mode 100644 index 0000000..3cc324e --- /dev/null +++ b/task_manager_app/lib/models/student.dart @@ -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}); +} diff --git a/task_manager_app/lib/screens/student_list_screen.dart b/task_manager_app/lib/screens/student_list_screen.dart new file mode 100644 index 0000000..94f61f4 --- /dev/null +++ b/task_manager_app/lib/screens/student_list_screen.dart @@ -0,0 +1,41 @@ +import 'package:flutter/material.dart'; +import '../models/student.dart'; + +class StudentListScreen extends StatelessWidget { + const StudentListScreen({super.key}); + + final List _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))), + ); + }, + ), + ); + } +}