112 lines
3.3 KiB
Dart
112 lines
3.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:nestly_flash/cards/subject_card.dart';
|
|
import 'package:nestly_flash/cards/add_subject_card.dart';
|
|
|
|
class Subjects extends StatelessWidget {
|
|
const Subjects({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
leading: Builder(
|
|
builder: (context) {
|
|
return IconButton(
|
|
icon: Icon(
|
|
Icons.menu,
|
|
color: const Color.fromARGB(255, 228, 228, 228),
|
|
),
|
|
onPressed: () {
|
|
Scaffold.of(context).openDrawer();
|
|
},
|
|
);
|
|
},
|
|
),
|
|
actions: [
|
|
Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
|
child: Center(
|
|
child: Container(
|
|
padding: const EdgeInsets.symmetric(
|
|
horizontal: 8.0,
|
|
vertical: 4.0,
|
|
),
|
|
decoration: BoxDecoration(
|
|
color: Colors.orange.withOpacity(0.2),
|
|
borderRadius: BorderRadius.circular(20),
|
|
),
|
|
child: Row(
|
|
children: const [
|
|
Text(
|
|
"123",
|
|
style: TextStyle(
|
|
fontWeight: FontWeight.bold,
|
|
color: Color.fromARGB(255, 221, 221, 221),
|
|
),
|
|
),
|
|
SizedBox(width: 4),
|
|
Icon(Icons.monetization_on, color: Colors.orange, size: 20),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
backgroundColor: const Color.fromARGB(255, 24, 24, 24),
|
|
),
|
|
body: Padding(
|
|
padding: const EdgeInsets.all(0),
|
|
child: GridView.builder(
|
|
padding: const EdgeInsets.all(16.0),
|
|
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
|
|
crossAxisCount: 2,
|
|
crossAxisSpacing: 20.0,
|
|
mainAxisSpacing: 20.0,
|
|
childAspectRatio: 1.5,
|
|
),
|
|
itemCount: subjects.length + 1,
|
|
itemBuilder: (context, index) {
|
|
if (index == subjects.length) {
|
|
return AddSubjectCard(
|
|
onTap: () {
|
|
print("Addung new subject...");
|
|
},
|
|
);
|
|
}
|
|
return SubjectCard(
|
|
subject: subjects[index],
|
|
color: subjectColors[index],
|
|
onTap: () {
|
|
print("Opening subject: ${subjects[index]}");
|
|
},
|
|
);
|
|
},
|
|
),
|
|
),
|
|
backgroundColor: Color.fromARGB(255, 14, 14, 14),
|
|
floatingActionButton: FloatingActionButton(
|
|
onPressed: () {
|
|
// Logic to start a study session
|
|
print("Play button pressed!");
|
|
},
|
|
backgroundColor: Colors.blue,
|
|
child: const Icon(
|
|
Icons.play_arrow_rounded,
|
|
size: 40,
|
|
color: Colors.white,
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
List<String> subjects = ["LA", "RK", "VS", "OS", "TIS"];
|
|
|
|
List<Color> subjectColors = [
|
|
Color.fromARGB(255, 148, 34, 34),
|
|
Color.fromARGB(255, 29, 143, 29),
|
|
Color.fromARGB(255, 41, 75, 168),
|
|
Color.fromARGB(255, 184, 184, 60),
|
|
Color.fromARGB(255, 190, 70, 190),
|
|
];
|