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
17 changes: 10 additions & 7 deletions task_manager_app/lib/home_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class HomePage extends StatelessWidget {
),
const SizedBox(height: 16),
Text(
'Welcome to Group 1',
'Welcome to Task Manager',
style: Theme.of(context).textTheme.headlineSmall,
),
const SizedBox(height: 8),
Expand All @@ -32,17 +32,20 @@ class HomePage extends StatelessWidget {
color: Theme.of(context).colorScheme.onSurfaceVariant,
),
),

const SizedBox(height: 30),

// Student Registration Button
const SizedBox(height: 20),
ElevatedButton(
onPressed: () {
Navigator.pushNamed(context, '/students_details');
},
child: const Text('Student Details'),
),
const SizedBox(height: 30),
ElevatedButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
const StudentRegistrationScreen(),
builder: (context) => const StudentRegistrationScreen(),
),
);
},
Expand Down
9 changes: 6 additions & 3 deletions task_manager_app/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:flutter/material.dart';
import 'student_registration_screen.dart';
import 'package:task_manager_app/screens/student_details_screen.dart';
import 'home_page.dart';

void main() {
Expand All @@ -17,8 +17,11 @@ class TaskManagerApp extends StatelessWidget {
colorScheme: ColorScheme.fromSeed(seedColor: Colors.blue),
useMaterial3: true,
),
home: const HomePage(),
// home: const StudentRegistrationScreen(),
initialRoute: '/',
routes: {
'/': (context) => const HomePage(),
'/students_details': (context) => const StudentDetailsScreen(),
},
);
}
}
50 changes: 50 additions & 0 deletions task_manager_app/lib/screens/student_details_screen.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import 'package:flutter/material.dart';

class Student {
final String name;
final String id;
final String course;

Student({
required this.name,
required this.id,
required this.course,
});
}

final students = [
Student(name: "John Doe", id: "S001", course: "CS"),
Student(name: "Jane Smith", id: "S002", course: "IT"),
];

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

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text("Students Details"),
),
body: Center(
child: Column(
children: [
const Text("Student Details Screen"),
Expanded(
child: ListView.builder(
itemCount: students.length,
itemBuilder: (context, index) {
return ListTile(
title: Text(students[index].name),
subtitle: Text(students[index].course),
trailing: Text(students[index].id),
);
},
),
),
],
),
),
);
}
}
3 changes: 1 addition & 2 deletions task_manager_app/test/widget_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,12 @@ void main() {
await tester.pumpWidget(const TaskManagerApp());

// AppBar title from HomePage.
expect(find.textContaining('Week 2'), findsOneWidget);
expect(find.text('Task Manager'), findsOneWidget);

// Body text from HomePage.
expect(find.text('Welcome to Task Manager'), findsOneWidget);

expect(find.textContaining('Week 2'), findsOneWidget);

expect(find.byIcon(Icons.check_circle_outline), findsOneWidget);

// Other useful matchers: findsNothing, findsWidgets, findsNWidgets(2)
Expand Down
Loading