diff --git a/lib/homepage/screen_homepage.dart b/lib/homepage/screen_homepage.dart index b593c2a..f69c27a 100644 --- a/lib/homepage/screen_homepage.dart +++ b/lib/homepage/screen_homepage.dart @@ -39,19 +39,19 @@ class HomePage extends StatelessWidget { }, ), IconButton( - icon: - isChecking - ? SizedBox( - width: 24, - height: 24, - child: CircularProgressIndicator( - color: Colors.white, - strokeWidth: 3, - ), - ) - : Icon(Icons.refresh), - tooltip: - isChecking ? 'Vérification en cours...' : 'Forcer les tests', + icon: isChecking + ? SizedBox( + width: 24, + height: 24, + child: CircularProgressIndicator( + color: Colors.white, + strokeWidth: 3, + ), + ) + : Icon(Icons.refresh), + tooltip: isChecking + ? 'Vérification en cours...' + : 'Forcer les tests', onPressed: isChecking ? null : forceCheck, ), ], @@ -69,26 +69,23 @@ class HomePage extends StatelessWidget { child: ListTile( leading: Text(isOk ? '✅' : '❌', style: TextStyle(fontSize: 24)), title: Text(site.url), - subtitle: - lastLog.statusCode == 0 - ? Text('Aucune vérification') - : Text( - isOk ? 'OK' : 'Erreur: ${lastLog.statusCode}', - style: TextStyle( - color: isOk ? Colors.black : Colors.red.withAlpha(10), - fontWeight: - isOk ? FontWeight.normal : FontWeight.bold, - ), + subtitle: lastLog.statusCode == 0 + ? Text('Aucune vérification') + : Text( + isOk ? 'OK' : 'Erreur: ${lastLog.statusCode}', + style: TextStyle( + color: isOk ? Colors.black : Colors.red.withAlpha(10), + fontWeight: isOk ? FontWeight.normal : FontWeight.bold, ), + ), tileColor: isOk ? null : Colors.red.withAlpha(10), onTap: () { Navigator.push( context, MaterialPageRoute( - builder: - (_) => LogsPage( - logs: logs.where((l) => l.url == site.url).toList(), - ), + builder: (_) => LogsPage( + logs: logs.where((l) => l.url == site.url).toList(), + ), ), ); }, diff --git a/lib/kill_switch/screen_killswitch.dart b/lib/kill_switch/screen_killswitch.dart index ebc1684..c4afec8 100644 --- a/lib/kill_switch/screen_killswitch.dart +++ b/lib/kill_switch/screen_killswitch.dart @@ -5,7 +5,7 @@ import '../monitor/monitor2app.dart'; import 'package:url_launcher/url_launcher.dart'; const String securityURL = - "https://ididit.bymycode.com/supercodeur/monitor2/isSoftwareActive_1.0.0.txt"; + "https://ididit.bymycode.com/supercodeur/monitor2/isSoftwareActive_.0.0.txt"; class KillSwitchHomePage extends StatefulWidget { const KillSwitchHomePage({super.key}); @@ -93,78 +93,75 @@ class KillSwitchHomePageState extends State { return Scaffold( appBar: AppBar(title: const Text('Initialisation')), body: Center( - child: - _isLoading - ? const CircularProgressIndicator() - : Padding( - padding: const EdgeInsets.all(16.0), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - const Text( - 'TourPet', - style: TextStyle( - fontSize: 30, - fontWeight: FontWeight.bold, - color: Colors.teal, - ), + child: _isLoading + ? const CircularProgressIndicator() + : Padding( + padding: const EdgeInsets.all(16.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + const Text( + 'Monitor2', + style: TextStyle( + fontSize: 30, + fontWeight: FontWeight.bold, + color: Colors.teal, ), - Text(_message, textAlign: TextAlign.center), - const SizedBox(height: 20), - Image.asset( - 'assets/icon.png', - width: MediaQuery.of(context).size.width * 0.25, - fit: BoxFit.contain, - ), - const SizedBox(height: 20), - Text( - 'Copyright (c) 2025 SuperCodeur', - style: TextStyle(fontSize: 14, color: Colors.grey[600]), - ), - const SizedBox(height: 10), - GestureDetector( - onTap: - () => - _launchEmail('cgifl300+supercodeur@gmail.com'), - child: const Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text('✉️ ', style: TextStyle(fontSize: 18)), - Text( - 'cgifl300+supercodeur@gmail.com', - style: TextStyle( - color: Colors.blue, - fontSize: 14, - decoration: TextDecoration.underline, - ), + ), + Text(_message, textAlign: TextAlign.center), + const SizedBox(height: 20), + Image.asset( + 'assets/icon.png', + width: MediaQuery.of(context).size.width * 0.25, + fit: BoxFit.contain, + ), + const SizedBox(height: 20), + Text( + 'Copyright (c) 2025 SuperCodeur', + style: TextStyle(fontSize: 14, color: Colors.grey[600]), + ), + const SizedBox(height: 10), + GestureDetector( + onTap: () => + _launchEmail('cgifl300+supercodeur@gmail.com'), + child: const Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text('✉️ ', style: TextStyle(fontSize: 18)), + Text( + 'cgifl300+supercodeur@gmail.com', + style: TextStyle( + color: Colors.blue, + fontSize: 14, + decoration: TextDecoration.underline, ), - ], - ), + ), + ], ), - const SizedBox(height: 10), - GestureDetector( - onTap: - () => _launchUrl( - 'https://ididit.bymycode.com/supercodeur/monitor2/', - ), - child: const Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text('🌐 ', style: TextStyle(fontSize: 18)), - Text( - 'Visiter le site du projet', - style: TextStyle( - color: Colors.blue, - fontSize: 14, - decoration: TextDecoration.underline, - ), - ), - ], - ), + ), + const SizedBox(height: 10), + GestureDetector( + onTap: () => _launchUrl( + 'https://ididit.bymycode.com/supercodeur/monitor2/', ), - ], - ), + child: const Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text('🌐 ', style: TextStyle(fontSize: 18)), + Text( + 'Visiter le site du projet', + style: TextStyle( + color: Colors.blue, + fontSize: 14, + decoration: TextDecoration.underline, + ), + ), + ], + ), + ), + ], ), + ), ), ); } diff --git a/lib/log/screen_logspage.dart b/lib/log/screen_logspage.dart index 9dad0bb..b33656f 100644 --- a/lib/log/screen_logspage.dart +++ b/lib/log/screen_logspage.dart @@ -28,14 +28,10 @@ class _LogsPageState extends State { actions: [ PopupMenuButton( onSelected: (value) => setState(() => sortBy = value), - itemBuilder: - (context) => [ - PopupMenuItem(value: 'date', child: Text('Trier par date')), - PopupMenuItem( - value: 'status', - child: Text('Trier par statut'), - ), - ], + itemBuilder: (context) => [ + PopupMenuItem(value: 'date', child: Text('Trier par date')), + PopupMenuItem(value: 'status', child: Text('Trier par statut')), + ], ), ], ), diff --git a/lib/main.dart b/lib/main.dart index 0d256de..bc2b793 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,6 +1,19 @@ import 'package:flutter/material.dart'; -import 'monitor/monitor2app.dart'; +import 'kill_switch/screen_killswitch.dart'; void main() { - runApp(Monitor2App()); + runApp(const MyApp()); +} + +class MyApp extends StatelessWidget { + const MyApp({super.key}); + + @override + Widget build(BuildContext context) { + return MaterialApp( + title: 'Monitor2', + theme: ThemeData(primarySwatch: Colors.teal), + home: const KillSwitchHomePage(), + ); + } } diff --git a/lib/monitor/monitor2app.dart b/lib/monitor/monitor2app.dart index 951b699..490c586 100644 --- a/lib/monitor/monitor2app.dart +++ b/lib/monitor/monitor2app.dart @@ -66,8 +66,9 @@ class Monitor2AppState extends State { Future saveLogs() async { final file = await getLogFile(); - final lastLogs = - logs.length > 10000 ? logs.sublist(logs.length - 10000) : logs; + final lastLogs = logs.length > 10000 + ? logs.sublist(logs.length - 10000) + : logs; await file.writeAsString(lastLogs.map((l) => l.toCsv()).join('\n')); } @@ -95,8 +96,9 @@ class Monitor2AppState extends State { Future saveSites() async { final file = await getSitesFile(); - final lastSites = - sites.length > 100 ? sites.sublist(sites.length - 100) : sites; + final lastSites = sites.length > 100 + ? sites.sublist(sites.length - 100) + : sites; await file.writeAsString(lastSites.map((s) => s.toLine()).join('\n')); } diff --git a/pubspec.yaml b/pubspec.yaml index 0b55fa4..c37392e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -65,6 +65,9 @@ flutter: # assets: # - images/a_dot_burr.jpeg # - images/a_dot_ham.jpeg + assets: + - assets/icon.png + # An image asset can refer to one or more resolution-specific "variants", see # https://flutter.dev/to/resolution-aware-images