diff --git a/example/lib/main.dart b/example/lib/main.dart
index e3c8a38..dad4868 100644
--- a/example/lib/main.dart
+++ b/example/lib/main.dart
@@ -17,6 +17,7 @@ class MyApp extends StatelessWidget {
return MaterialApp(
title: 'PowerLogger\nDemo',
home: MyHomePage(title: 'PowerLogger Demo'),
+ theme: ThemeData.dark(),
);
}
}
diff --git a/example/macos/Runner/DebugProfile.entitlements b/example/macos/Runner/DebugProfile.entitlements
index dddb8a3..08c3ab1 100644
--- a/example/macos/Runner/DebugProfile.entitlements
+++ b/example/macos/Runner/DebugProfile.entitlements
@@ -8,5 +8,7 @@
com.apple.security.network.server
+ com.apple.security.network.client
+
diff --git a/example/pubspec.lock b/example/pubspec.lock
index 50df4ff..e25dfdb 100644
--- a/example/pubspec.lock
+++ b/example/pubspec.lock
@@ -7,7 +7,7 @@ packages:
name: async
url: "https://pub.flutter-io.cn"
source: hosted
- version: "2.5.0"
+ version: "2.6.1"
auto_size_text:
dependency: transitive
description:
@@ -286,7 +286,7 @@ packages:
name: source_span
url: "https://pub.flutter-io.cn"
source: hosted
- version: "1.8.0"
+ version: "1.8.1"
stack_trace:
dependency: transitive
description:
@@ -321,7 +321,7 @@ packages:
name: test_api
url: "https://pub.flutter-io.cn"
source: hosted
- version: "0.2.19"
+ version: "0.3.0"
typed_data:
dependency: transitive
description:
diff --git a/lib/src/builders/dio_error_builder.dart b/lib/src/builders/dio_error_builder.dart
index 152332a..63ec106 100644
--- a/lib/src/builders/dio_error_builder.dart
+++ b/lib/src/builders/dio_error_builder.dart
@@ -21,24 +21,13 @@ class DioErrorBuilder extends StatelessWidget {
),
);
},
- title: Text(
- data.requestOptions.path,
- style: TextStyle(
- color: Colors.black87,
- ),
- ),
- subtitle: Text(
- '${data.message}\n$date',
- style: TextStyle(
- color: Colors.black45,
- fontWeight: FontWeight.w300,
- ),
- ),
+ title: Text(data.requestOptions.path),
+ subtitle: Text('${data.message}\n$date'),
trailing: Row(
mainAxisSize: MainAxisSize.min,
children: [
Chip(
- backgroundColor: Colors.blue.withOpacity(0.8),
+ backgroundColor: Colors.blue.withOpacity(0.4),
label: Text(data.requestOptions.method),
),
],
diff --git a/lib/src/builders/dio_responses_builder.dart b/lib/src/builders/dio_responses_builder.dart
index 1b591ac..e3988d2 100644
--- a/lib/src/builders/dio_responses_builder.dart
+++ b/lib/src/builders/dio_responses_builder.dart
@@ -18,12 +18,7 @@ class DioResponseBuilder extends StatelessWidget {
builder: (context) => DioResponseView(data: data),
),
),
- title: Text(
- data.requestOptions.path,
- style: TextStyle(
- color: Colors.black87,
- ),
- ),
+ title: Text(data.requestOptions.path),
subtitle: Text(date.toString()),
trailing: Row(
mainAxisSize: MainAxisSize.min,
diff --git a/lib/src/parser/unfocus_parser.dart b/lib/src/parser/unfocus_parser.dart
index e57892d..5c89233 100644
--- a/lib/src/parser/unfocus_parser.dart
+++ b/lib/src/parser/unfocus_parser.dart
@@ -10,7 +10,9 @@ class UnfocusParser extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Material(
- color: Colors.white,
+ color: Theme.of(context).brightness == Brightness.light
+ ? Colors.black12
+ : Colors.white10,
child: ListTile(
onTap: () => Navigator.push(
context,
diff --git a/lib/src/power_logger_view.dart b/lib/src/power_logger_view.dart
index eb76785..20c1540 100644
--- a/lib/src/power_logger_view.dart
+++ b/lib/src/power_logger_view.dart
@@ -18,59 +18,59 @@ class _PowerLoggerViewState extends State {
void Function(void Function())? _setState;
@override
Widget build(BuildContext context) {
- return Theme(
- data: ThemeData.light(),
- child: Scaffold(
- appBar: AppBar(
- title: Text('Logger View'),
- actions: [
- IconButton(
- icon: Icon(Icons.clear_all_rounded),
- onPressed: () {
- LoggerData.clear();
- setState(() {});
- },
- ),
- ],
- ),
- body: PageView(
- controller: _pageController,
- onPageChanged: (index) {
- _currentIndex = index;
- if (_setState != null) _setState!(() {});
- },
- children: [
- LoggerView(),
- InfoView(),
- SettingsView(),
- ],
- ),
- bottomNavigationBar: StatefulBuilder(
- builder: (context, kSetState) {
- _setState = kSetState;
- return BottomNavigationBar(
- currentIndex: _currentIndex,
- backgroundColor: Colors.white,
- onTap: (index) {
- _currentIndex = index;
- kSetState(() {});
- _pageController.animateToPage(
- index,
- duration: Duration(milliseconds: 300),
- curve: Curves.easeInOutCubic,
- );
- },
- items: [
- BottomNavigationBarItem(
- icon: Icon(Icons.assessment), label: '日志'),
- BottomNavigationBarItem(
- icon: Icon(Icons.perm_device_information), label: '信息'),
- BottomNavigationBarItem(
- icon: Icon(Icons.settings), label: '设置'),
- ],
- );
- },
- ),
+ return Scaffold(
+ appBar: AppBar(
+ title: Text('Logger View'),
+ actions: [
+ IconButton(
+ icon: Icon(Icons.clear_all_rounded),
+ onPressed: () {
+ LoggerData.clear();
+ setState(() {});
+ },
+ ),
+ ],
+ ),
+ body: PageView(
+ controller: _pageController,
+ onPageChanged: (index) {
+ _currentIndex = index;
+ if (_setState != null) _setState!(() {});
+ },
+ children: [
+ LoggerView(),
+ InfoView(),
+ SettingsView(),
+ ],
+ ),
+ bottomNavigationBar: StatefulBuilder(
+ builder: (context, kSetState) {
+ _setState = kSetState;
+ return BottomNavigationBar(
+ currentIndex: _currentIndex,
+ onTap: (index) {
+ _currentIndex = index;
+ kSetState(() {});
+ _pageController.animateToPage(
+ index,
+ duration: Duration(milliseconds: 300),
+ curve: Curves.easeInOutCubic,
+ );
+ },
+ items: [
+ BottomNavigationBarItem(
+ icon: Icon(Icons.assessment), label: 'Log'),
+ BottomNavigationBarItem(
+ icon: Icon(Icons.perm_device_information),
+ label: 'Info',
+ ),
+ BottomNavigationBarItem(
+ icon: Icon(Icons.settings),
+ label: 'Settings',
+ ),
+ ],
+ );
+ },
),
);
}
diff --git a/lib/src/view/box_view.dart b/lib/src/view/box_view.dart
index c47dc07..6e0b7d9 100644
--- a/lib/src/view/box_view.dart
+++ b/lib/src/view/box_view.dart
@@ -21,20 +21,12 @@ class BoxView extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
DefaultTextStyle(
- style: TextStyle(
- fontSize: 20,
- color: Colors.black87,
- fontWeight: FontWeight.w600,
- ),
+ style: Theme.of(context).textTheme.caption!,
child: title,
),
child == null ? SizedBox() : SizedBox(height: 10),
DefaultTextStyle(
- style: TextStyle(
- fontSize: 16,
- color: Colors.black87,
- fontWeight: FontWeight.w400,
- ),
+ style: Theme.of(context).textTheme.bodyText2!,
child: child ?? SizedBox(),
),
children == null ? SizedBox() : SizedBox(height: 10),
diff --git a/lib/src/view/dio_error_view.dart b/lib/src/view/dio_error_view.dart
index 0049d60..ae7caa1 100644
--- a/lib/src/view/dio_error_view.dart
+++ b/lib/src/view/dio_error_view.dart
@@ -1,4 +1,5 @@
import 'package:dio/dio.dart';
+import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:power_logger/src/view/box_view.dart';
import 'package:power_logger/src/view/table_view.dart';
@@ -67,12 +68,14 @@ class _DioErrorViewState extends State {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
- backgroundColor: Colors.red[600],
+ backgroundColor: Theme.of(context).brightness == Brightness.light
+ ? Colors.red[100]
+ : Colors.red[900],
title: Text(widget.data.requestOptions.path),
actions: [
Chip(
label: Text(widget.data.requestOptions.method),
- backgroundColor: Colors.lightGreen,
+ backgroundColor: Colors.lightGreen.withOpacity(0.5),
),
SizedBox(width: 8),
],
diff --git a/lib/src/view/dio_response_view.dart b/lib/src/view/dio_response_view.dart
index 0a530af..7235884 100644
--- a/lib/src/view/dio_response_view.dart
+++ b/lib/src/view/dio_response_view.dart
@@ -4,6 +4,7 @@ import 'dart:io';
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:flutter_highlight/flutter_highlight.dart';
+import 'package:flutter_highlight/themes/atom-one-dark.dart';
import 'package:flutter_highlight/themes/atom-one-light.dart';
import 'package:power_logger/external_lib/pretty_json.dart';
import 'package:power_logger/src/parser/dio_parser/dio_parser.dart';
@@ -79,7 +80,9 @@ class _DioResponseViewState extends State {
child: HighlightView(
widget.data!.data,
language: _dioParser.highlight,
- theme: atomOneLightTheme,
+ theme: Theme.of(context).brightness == Brightness.light
+ ? atomOneLightTheme
+ : atomOneDarkTheme,
),
);
case ContentType.JSON:
diff --git a/lib/src/view/title_view.dart b/lib/src/view/title_view.dart
index f70bc37..e57f591 100644
--- a/lib/src/view/title_view.dart
+++ b/lib/src/view/title_view.dart
@@ -9,11 +9,7 @@ class TitleView extends StatelessWidget {
return Padding(
padding: EdgeInsets.symmetric(horizontal: 5, vertical: 10),
child: DefaultTextStyle(
- style: TextStyle(
- fontSize: 24,
- color: Colors.black45,
- fontWeight: FontWeight.w600,
- ),
+ style: Theme.of(context).textTheme.headline4!,
child: title,
),
);
diff --git a/lib/src/views/info_view.dart b/lib/src/views/info_view.dart
index f916ce6..e6b2aff 100644
--- a/lib/src/views/info_view.dart
+++ b/lib/src/views/info_view.dart
@@ -1,10 +1,8 @@
import 'dart:io';
-import 'package:auto_size_text/auto_size_text.dart';
import 'package:device_info_plus/device_info_plus.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart' hide AndroidView;
-import 'package:flutter/services.dart';
import 'package:package_info_plus/package_info_plus.dart';
import 'package:power_logger/src/views/platform_specific/_android_view.dart';
import 'package:power_logger/src/views/platform_specific/_ios_view.dart';
@@ -74,7 +72,7 @@ class _InfoViewState extends State
delegate: SliverChildListDelegate([
ListTile(
title: Text('Package Info'),
- tileColor: Colors.lightBlueAccent[100],
+ tileColor: Theme.of(context).accentColor.withOpacity(0.2),
),
InfoTile(title: 'appName', subTitle: packageInfo!.appName),
InfoTile(
@@ -84,7 +82,7 @@ class _InfoViewState extends State
InfoTile(title: 'version', subTitle: packageInfo!.version),
ListTile(
title: Text('Device Info'),
- tileColor: Colors.lightBlueAccent[100],
+ tileColor: Theme.of(context).accentColor.withOpacity(0.1),
),
])),
_buildView(),
diff --git a/pubspec.lock b/pubspec.lock
index 287b992..ee37dea 100644
--- a/pubspec.lock
+++ b/pubspec.lock
@@ -7,7 +7,7 @@ packages:
name: async
url: "https://pub.flutter-io.cn"
source: hosted
- version: "2.5.0"
+ version: "2.6.1"
auto_size_text:
dependency: "direct main"
description:
@@ -265,7 +265,7 @@ packages:
name: source_span
url: "https://pub.flutter-io.cn"
source: hosted
- version: "1.8.0"
+ version: "1.8.1"
stack_trace:
dependency: transitive
description:
@@ -300,7 +300,7 @@ packages:
name: test_api
url: "https://pub.flutter-io.cn"
source: hosted
- version: "0.2.19"
+ version: "0.3.0"
typed_data:
dependency: transitive
description: