|
|
@ -1,7 +1,6 @@
|
|
|
|
import 'dart:ui';
|
|
|
|
import 'dart:ui';
|
|
|
|
|
|
|
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:power_logger/power_logger.dart';
|
|
|
|
|
|
|
|
import 'package:power_logger/src/widgets/logger_fab.dart';
|
|
|
|
import 'package:power_logger/src/widgets/logger_fab.dart';
|
|
|
|
|
|
|
|
|
|
|
|
class PowerLogger {
|
|
|
|
class PowerLogger {
|
|
|
@ -15,13 +14,31 @@ class PowerLogger {
|
|
|
|
///```dart
|
|
|
|
///```dart
|
|
|
|
///PowerLogger.init(context,debug:true);
|
|
|
|
///PowerLogger.init(context,debug:true);
|
|
|
|
///```
|
|
|
|
///```
|
|
|
|
|
|
|
|
@Deprecated("use PowerLogger.start")
|
|
|
|
static init(BuildContext context, {bool debug = true}) {
|
|
|
|
static init(BuildContext context, {bool debug = true}) {
|
|
|
|
PowerLogger.debug = debug;
|
|
|
|
PowerLogger.debug = debug;
|
|
|
|
if (debug)
|
|
|
|
if (debug) if (debug) _insertToOverlay(context);
|
|
|
|
Overlay.of(context).insert(OverlayEntry(
|
|
|
|
}
|
|
|
|
builder: (context) {
|
|
|
|
|
|
|
|
return LoggerFab();
|
|
|
|
///初始化
|
|
|
|
},
|
|
|
|
///
|
|
|
|
));
|
|
|
|
///默认开启debug
|
|
|
|
|
|
|
|
///
|
|
|
|
|
|
|
|
///```dart
|
|
|
|
|
|
|
|
///PowerLogger.start(context,debug:true);
|
|
|
|
|
|
|
|
///```
|
|
|
|
|
|
|
|
static start(BuildContext context, {bool debug = true}) {
|
|
|
|
|
|
|
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
|
|
|
|
|
|
PowerLogger.debug = debug;
|
|
|
|
|
|
|
|
if (debug) _insertToOverlay(context);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static _insertToOverlay(BuildContext context) {
|
|
|
|
|
|
|
|
Overlay.of(context).insert(OverlayEntry(
|
|
|
|
|
|
|
|
builder: (context) {
|
|
|
|
|
|
|
|
return LoggerFab();
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|