Zebra pattern in skills and project page and a little delay in init to show off the init view

This commit is contained in:
2025-05-16 00:04:23 +02:00
parent ebd5b994de
commit 6641254a5f
2 changed files with 30 additions and 18 deletions

View File

@@ -6,6 +6,7 @@ import 'package:flutter_dotenv/flutter_dotenv.dart';
Future<bool> initApp() async { Future<bool> initApp() async {
await dotenv.load(); await dotenv.load();
await Future.delayed(const Duration(seconds : 2));
return await checkToken(); return await checkToken();
} }
class InitScreen extends StatelessWidget { class InitScreen extends StatelessWidget {

View File

@@ -107,13 +107,19 @@ class ProfileScreen extends StatelessWidget {
itemCount: skills.length, itemCount: skills.length,
itemBuilder: (context, index) { itemBuilder: (context, index) {
final skill = skills[index] as Map<String, dynamic>; final skill = skills[index] as Map<String, dynamic>;
return ListTile( final isEven = index % 2 == 0;
title: Text(skill['name']),
trailing: Text( return Container(
skill['level'].toStringAsFixed(2), color: isEven ? Colors.white70 : Colors.grey[200], // alternate row colors
style: const TextStyle( child: ListTile(
fontWeight: FontWeight.bold, title: Text(skill['name']),
fontSize: 18,), trailing: Text(
skill['level'].toStringAsFixed(2),
style: const TextStyle(
fontWeight: FontWeight.bold,
fontSize: 18,
),
),
), ),
); );
}, },
@@ -122,31 +128,36 @@ class ProfileScreen extends StatelessWidget {
itemCount: projects.length, itemCount: projects.length,
itemBuilder: (context, index) { itemBuilder: (context, index) {
final project = projects[index] as Map<String, dynamic>; final project = projects[index] as Map<String, dynamic>;
final isEven = index % 2 == 0;
Text project_grade; Text project_grade;
if (project['final_mark'] == null) { if (project['final_mark'] == null) {
project_grade = const Text( project_grade = const Text(
'pending', 'pending',
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: Colors.black38, color: Colors.black38,
fontSize: 18 fontSize: 18,
), ),
); );
} } else {
else {
var color = (project['validated?']) ? Colors.green : Colors.red; var color = (project['validated?']) ? Colors.green : Colors.red;
project_grade = Text( project_grade = Text(
project['final_mark'].toStringAsFixed(2), project['final_mark'].toStringAsFixed(2),
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: color, color: color,
fontSize: 18 fontSize: 18,
), ),
); );
} }
return ListTile(
title: Text(project['project']['name']), return Container(
trailing: project_grade color: isEven ? Colors.white70 : Colors.grey[200],
child: ListTile(
title: Text(project['project']['name']),
trailing: project_grade,
),
); );
}, },
), ),