Application propre sans erreurs. Bonne base sur laquelle repartir de zero en cas de soucis majeurs.
This commit is contained in:
6
lib/core/constants/urls.dart
Normal file
6
lib/core/constants/urls.dart
Normal file
@@ -0,0 +1,6 @@
|
||||
class Urls {
|
||||
static const String baseUrl = 'http://localhost:8085';
|
||||
// static const String login = baseUrl + 'auth/login';
|
||||
// static const String events = baseUrl + 'events';
|
||||
// Ajoute d'autres URLs ici
|
||||
}
|
||||
3
lib/core/errors/exceptions.dart
Normal file
3
lib/core/errors/exceptions.dart
Normal file
@@ -0,0 +1,3 @@
|
||||
class ServerException implements Exception {}
|
||||
|
||||
class CacheException implements Exception {}
|
||||
9
lib/core/errors/failures.dart
Normal file
9
lib/core/errors/failures.dart
Normal file
@@ -0,0 +1,9 @@
|
||||
import 'package:equatable/equatable.dart';
|
||||
|
||||
abstract class Failure extends Equatable {
|
||||
@override
|
||||
List<Object> get props => [];
|
||||
}
|
||||
|
||||
class ServerFailure extends Failure {}
|
||||
class CacheFailure extends Failure {}
|
||||
20
lib/core/theme/app_theme.dart
Normal file
20
lib/core/theme/app_theme.dart
Normal file
@@ -0,0 +1,20 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class AppTheme {
|
||||
static final ThemeData lightTheme = ThemeData(
|
||||
primaryColor: Colors.blue,
|
||||
colorScheme: const ColorScheme.light(
|
||||
secondary: Colors.orange,
|
||||
),
|
||||
brightness: Brightness.light,
|
||||
buttonTheme: const ButtonThemeData(buttonColor: Colors.blue),
|
||||
);
|
||||
|
||||
static final ThemeData darkTheme = ThemeData(
|
||||
primaryColor: Colors.black,
|
||||
colorScheme: const ColorScheme.dark(
|
||||
secondary: Colors.red,
|
||||
),
|
||||
brightness: Brightness.dark,
|
||||
);
|
||||
}
|
||||
16
lib/core/utils/input_converter.dart
Normal file
16
lib/core/utils/input_converter.dart
Normal file
@@ -0,0 +1,16 @@
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:afterwork/core/errors/failures.dart';
|
||||
|
||||
class InputConverter {
|
||||
Either<Failure, int> stringToUnsignedInteger(String str) {
|
||||
try {
|
||||
final integer = int.parse(str);
|
||||
if (integer < 0) throw const FormatException();
|
||||
return Right(integer);
|
||||
} catch (e) {
|
||||
return Left(InvalidInputFailure());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class InvalidInputFailure extends Failure {}
|
||||
Reference in New Issue
Block a user