235 lines
6.7 KiB
Dart
235 lines
6.7 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
void main() {
|
|
runApp(const GBCMApp());
|
|
}
|
|
|
|
class GBCMApp extends StatelessWidget {
|
|
const GBCMApp({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return MaterialApp(
|
|
title: 'GBCM Mobile',
|
|
theme: ThemeData(
|
|
colorScheme: ColorScheme.fromSeed(
|
|
seedColor: const Color(0xFF1976D2), // Bleu professionnel GBCM
|
|
brightness: Brightness.light,
|
|
),
|
|
useMaterial3: true,
|
|
appBarTheme: const AppBarTheme(
|
|
backgroundColor: Color(0xFF1976D2),
|
|
foregroundColor: Colors.white,
|
|
elevation: 2,
|
|
),
|
|
),
|
|
home: const GBCMHomePage(),
|
|
debugShowCheckedModeBanner: false,
|
|
);
|
|
}
|
|
}
|
|
|
|
class GBCMHomePage extends StatefulWidget {
|
|
const GBCMHomePage({super.key});
|
|
|
|
@override
|
|
State<GBCMHomePage> createState() => _GBCMHomePageState();
|
|
}
|
|
|
|
class _GBCMHomePageState extends State<GBCMHomePage> {
|
|
bool _isConnectedToServer = false;
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
_checkServerConnection();
|
|
}
|
|
|
|
void _checkServerConnection() {
|
|
// Simulation de vérification de connexion au serveur
|
|
setState(() {
|
|
_isConnectedToServer = true; // Simulé pour la démo
|
|
});
|
|
}
|
|
|
|
Widget _buildActionCard({
|
|
required IconData icon,
|
|
required String title,
|
|
required String subtitle,
|
|
required VoidCallback onTap,
|
|
}) {
|
|
return Card(
|
|
elevation: 4,
|
|
child: InkWell(
|
|
onTap: onTap,
|
|
borderRadius: BorderRadius.circular(12),
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(16.0),
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
Icon(icon, size: 48, color: const Color(0xFF1976D2)),
|
|
const SizedBox(height: 8),
|
|
Text(
|
|
title,
|
|
style: const TextStyle(
|
|
fontSize: 16,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
textAlign: TextAlign.center,
|
|
),
|
|
Text(
|
|
subtitle,
|
|
style: const TextStyle(
|
|
fontSize: 12,
|
|
color: Colors.grey,
|
|
),
|
|
textAlign: TextAlign.center,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
void _showLoginDialog(BuildContext context) {
|
|
showDialog(
|
|
context: context,
|
|
builder: (context) => AlertDialog(
|
|
title: const Text('Authentification'),
|
|
content: const Text('Connexion au backend GBCM\nhttp://localhost:8080'),
|
|
actions: [
|
|
TextButton(
|
|
onPressed: () => Navigator.pop(context),
|
|
child: const Text('Fermer'),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
void _showFeatureDialog(BuildContext context, String feature) {
|
|
showDialog(
|
|
context: context,
|
|
builder: (context) => AlertDialog(
|
|
title: Text(feature),
|
|
content: Text('Module $feature\nConnexion au backend requise'),
|
|
actions: [
|
|
TextButton(
|
|
onPressed: () => Navigator.pop(context),
|
|
child: const Text('Fermer'),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
title: const Text('GBCM Mobile'),
|
|
centerTitle: true,
|
|
),
|
|
body: Padding(
|
|
padding: const EdgeInsets.all(16.0),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
children: [
|
|
// En-tête de bienvenue
|
|
Card(
|
|
elevation: 4,
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(20.0),
|
|
child: Column(
|
|
children: [
|
|
const Icon(
|
|
Icons.business_center,
|
|
size: 64,
|
|
color: Color(0xFF1976D2),
|
|
),
|
|
const SizedBox(height: 16),
|
|
const Text(
|
|
'GBCM',
|
|
style: TextStyle(
|
|
fontSize: 28,
|
|
fontWeight: FontWeight.bold,
|
|
color: Color(0xFF1976D2),
|
|
),
|
|
),
|
|
const Text(
|
|
'Global Business Consulting and Management',
|
|
style: TextStyle(
|
|
fontSize: 16,
|
|
color: Colors.grey,
|
|
),
|
|
textAlign: TextAlign.center,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
const SizedBox(height: 24),
|
|
|
|
// Statut de connexion
|
|
Card(
|
|
elevation: 2,
|
|
child: ListTile(
|
|
leading: Icon(
|
|
_isConnectedToServer ? Icons.cloud_done : Icons.cloud_off,
|
|
color: _isConnectedToServer ? Colors.green : Colors.red,
|
|
),
|
|
title: Text(
|
|
_isConnectedToServer ? 'Connecté au serveur' : 'Déconnecté',
|
|
),
|
|
subtitle: const Text('Backend API: http://localhost:8080'),
|
|
trailing: IconButton(
|
|
icon: const Icon(Icons.refresh),
|
|
onPressed: _checkServerConnection,
|
|
),
|
|
),
|
|
),
|
|
const SizedBox(height: 24),
|
|
|
|
// Boutons d'action
|
|
Expanded(
|
|
child: GridView.count(
|
|
crossAxisCount: 2,
|
|
crossAxisSpacing: 16,
|
|
mainAxisSpacing: 16,
|
|
children: [
|
|
_buildActionCard(
|
|
icon: Icons.login,
|
|
title: 'Se connecter',
|
|
subtitle: 'Authentification',
|
|
onTap: () => _showLoginDialog(context),
|
|
),
|
|
_buildActionCard(
|
|
icon: Icons.people,
|
|
title: 'Clients',
|
|
subtitle: 'Gestion clients',
|
|
onTap: () => _showFeatureDialog(context, 'Clients'),
|
|
),
|
|
_buildActionCard(
|
|
icon: Icons.school,
|
|
title: 'Coaches',
|
|
subtitle: 'Nos experts',
|
|
onTap: () => _showFeatureDialog(context, 'Coaches'),
|
|
),
|
|
_buildActionCard(
|
|
icon: Icons.event,
|
|
title: 'Ateliers',
|
|
subtitle: 'Formations',
|
|
onTap: () => _showFeatureDialog(context, 'Ateliers'),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|