init
This commit is contained in:
commit
8e54cfffc5
91 changed files with 2686 additions and 0 deletions
0
lib/features/core/services/connection_service.dart
Normal file
0
lib/features/core/services/connection_service.dart
Normal file
66
lib/features/core/services/logging_service.dart
Normal file
66
lib/features/core/services/logging_service.dart
Normal file
|
@ -0,0 +1,66 @@
|
|||
import 'dart:io';
|
||||
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:talker/talker.dart';
|
||||
import 'package:talker_dio_logger/talker_dio_logger_interceptor.dart';
|
||||
import 'package:talker_dio_logger/talker_dio_logger_settings.dart';
|
||||
|
||||
import '/locator.dart';
|
||||
|
||||
class LoggingService {
|
||||
final Talker _talker = Talker(
|
||||
settings: TalkerSettings(
|
||||
useHistory: false,
|
||||
),
|
||||
logger: TalkerLogger(formater: const ColoredLoggerFormatter()),
|
||||
loggerSettings: TalkerLoggerSettings(
|
||||
enableColors: !Platform.isIOS,
|
||||
),
|
||||
loggerOutput: debugPrint,
|
||||
);
|
||||
|
||||
void Function(dynamic msg, [Object? exception, StackTrace? stackTrace]) get fine => _talker.fine;
|
||||
void Function(dynamic msg, [Object? exception, StackTrace? stackTrace]) get good => _talker.good;
|
||||
|
||||
void Function(dynamic msg, [Object? exception, StackTrace? stackTrace]) get info => _talker.info;
|
||||
void Function(dynamic msg, [Object exception, StackTrace stackTrace]) get warning =>
|
||||
_talker.warning;
|
||||
|
||||
void Function(dynamic msg, [Object? exception, StackTrace? stackTrace]) get error =>
|
||||
_talker.error;
|
||||
void Function(Object exception, [StackTrace stackTrace, dynamic msg]) get handle =>
|
||||
_talker.handle;
|
||||
void Function(Error error, [StackTrace stackTrace, dynamic msg]) get handleError =>
|
||||
_talker.handleError;
|
||||
void Function(Exception exception, [StackTrace? stackTrace, dynamic msg]) get handleException =>
|
||||
_talker.handleException;
|
||||
|
||||
void successfulInit({required String location}) => _talker.good('[$location] I am initialized');
|
||||
void successfulDispose({required String location}) => _talker.good('[$location] I am disposed');
|
||||
|
||||
/// Adds logging to dio calls
|
||||
void addLoggingInterceptor({required Dio dio}) {
|
||||
dio.interceptors.add(
|
||||
TalkerDioLogger(
|
||||
talker: Talker(
|
||||
logger: TalkerLogger(formater: const ColoredLoggerFormatter()),
|
||||
settings: TalkerSettings(
|
||||
useConsoleLogs: true,
|
||||
useHistory: false,
|
||||
),
|
||||
loggerSettings: TalkerLoggerSettings(
|
||||
enableColors: !Platform.isIOS,
|
||||
),
|
||||
),
|
||||
settings: const TalkerDioLoggerSettings(
|
||||
printRequestHeaders: true,
|
||||
printResponseHeaders: true,
|
||||
printResponseMessage: true,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
static LoggingService get locate => Locator.locate();
|
||||
}
|
21
lib/features/core/services/navigation_service.dart
Normal file
21
lib/features/core/services/navigation_service.dart
Normal file
|
@ -0,0 +1,21 @@
|
|||
import 'package:flutter/widgets.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
|
||||
import '../abstracts/router/app_router.dart';
|
||||
import '../abstracts/router/routes.dart';
|
||||
|
||||
class NavigationService {
|
||||
const NavigationService({
|
||||
required McgRouter mcgRouter,
|
||||
}) : _mcgRouter = mcgRouter;
|
||||
|
||||
final McgRouter _mcgRouter;
|
||||
|
||||
void pushImageCarouselView(BuildContext context) =>
|
||||
context.pushNamed(Routes.imageCarousel.routeName);
|
||||
|
||||
void backToGallery(BuildContext context) => context.pop();
|
||||
|
||||
void previous() {}
|
||||
void next() {}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue