update theme

master
小赖 4 years ago
parent 9d8d804290
commit 25f97cb04b

@ -17,6 +17,7 @@ class MyApp extends StatelessWidget {
return MaterialApp(
title: 'PowerLogger\nDemo',
home: MyHomePage(title: 'PowerLogger Demo'),
theme: ThemeData.dark(),
);
}
}

@ -8,5 +8,7 @@
<true/>
<key>com.apple.security.network.server</key>
<true/>
<key>com.apple.security.network.client</key>
<true/>
</dict>
</plist>

@ -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:

@ -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),
),
],

@ -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,

@ -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,

@ -18,59 +18,59 @@ class _PowerLoggerViewState extends State<PowerLoggerView> {
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',
),
],
);
},
),
);
}

@ -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),

@ -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<DioErrorView> {
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),
],

@ -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<DioResponseView> {
child: HighlightView(
widget.data!.data,
language: _dioParser.highlight,
theme: atomOneLightTheme,
theme: Theme.of(context).brightness == Brightness.light
? atomOneLightTheme
: atomOneDarkTheme,
),
);
case ContentType.JSON:

@ -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,
),
);

@ -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<InfoView>
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<InfoView>
InfoTile(title: 'version', subTitle: packageInfo!.version),
ListTile(
title: Text('Device Info'),
tileColor: Colors.lightBlueAccent[100],
tileColor: Theme.of(context).accentColor.withOpacity(0.1),
),
])),
_buildView(),

@ -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:

Loading…
Cancel
Save