update theme

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

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

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

@ -7,7 +7,7 @@ packages:
name: async name: async
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.5.0" version: "2.6.1"
auto_size_text: auto_size_text:
dependency: transitive dependency: transitive
description: description:
@ -286,7 +286,7 @@ packages:
name: source_span name: source_span
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.8.0" version: "1.8.1"
stack_trace: stack_trace:
dependency: transitive dependency: transitive
description: description:
@ -321,7 +321,7 @@ packages:
name: test_api name: test_api
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.2.19" version: "0.3.0"
typed_data: typed_data:
dependency: transitive dependency: transitive
description: description:

@ -21,24 +21,13 @@ class DioErrorBuilder extends StatelessWidget {
), ),
); );
}, },
title: Text( title: Text(data.requestOptions.path),
data.requestOptions.path, subtitle: Text('${data.message}\n$date'),
style: TextStyle(
color: Colors.black87,
),
),
subtitle: Text(
'${data.message}\n$date',
style: TextStyle(
color: Colors.black45,
fontWeight: FontWeight.w300,
),
),
trailing: Row( trailing: Row(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
Chip( Chip(
backgroundColor: Colors.blue.withOpacity(0.8), backgroundColor: Colors.blue.withOpacity(0.4),
label: Text(data.requestOptions.method), label: Text(data.requestOptions.method),
), ),
], ],

@ -18,12 +18,7 @@ class DioResponseBuilder extends StatelessWidget {
builder: (context) => DioResponseView(data: data), builder: (context) => DioResponseView(data: data),
), ),
), ),
title: Text( title: Text(data.requestOptions.path),
data.requestOptions.path,
style: TextStyle(
color: Colors.black87,
),
),
subtitle: Text(date.toString()), subtitle: Text(date.toString()),
trailing: Row( trailing: Row(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,

@ -10,7 +10,9 @@ class UnfocusParser extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Material( return Material(
color: Colors.white, color: Theme.of(context).brightness == Brightness.light
? Colors.black12
: Colors.white10,
child: ListTile( child: ListTile(
onTap: () => Navigator.push( onTap: () => Navigator.push(
context, context,

@ -18,59 +18,59 @@ class _PowerLoggerViewState extends State<PowerLoggerView> {
void Function(void Function())? _setState; void Function(void Function())? _setState;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Theme( return Scaffold(
data: ThemeData.light(), appBar: AppBar(
child: Scaffold( title: Text('Logger View'),
appBar: AppBar( actions: [
title: Text('Logger View'), IconButton(
actions: [ icon: Icon(Icons.clear_all_rounded),
IconButton( onPressed: () {
icon: Icon(Icons.clear_all_rounded), LoggerData.clear();
onPressed: () { setState(() {});
LoggerData.clear(); },
setState(() {}); ),
}, ],
), ),
], body: PageView(
), controller: _pageController,
body: PageView( onPageChanged: (index) {
controller: _pageController, _currentIndex = index;
onPageChanged: (index) { if (_setState != null) _setState!(() {});
_currentIndex = index; },
if (_setState != null) _setState!(() {}); children: [
}, LoggerView(),
children: [ InfoView(),
LoggerView(), SettingsView(),
InfoView(), ],
SettingsView(), ),
], bottomNavigationBar: StatefulBuilder(
), builder: (context, kSetState) {
bottomNavigationBar: StatefulBuilder( _setState = kSetState;
builder: (context, kSetState) { return BottomNavigationBar(
_setState = kSetState; currentIndex: _currentIndex,
return BottomNavigationBar( onTap: (index) {
currentIndex: _currentIndex, _currentIndex = index;
backgroundColor: Colors.white, kSetState(() {});
onTap: (index) { _pageController.animateToPage(
_currentIndex = index; index,
kSetState(() {}); duration: Duration(milliseconds: 300),
_pageController.animateToPage( curve: Curves.easeInOutCubic,
index, );
duration: Duration(milliseconds: 300), },
curve: Curves.easeInOutCubic, items: [
); BottomNavigationBarItem(
}, icon: Icon(Icons.assessment), label: 'Log'),
items: [ BottomNavigationBarItem(
BottomNavigationBarItem( icon: Icon(Icons.perm_device_information),
icon: Icon(Icons.assessment), label: '日志'), label: 'Info',
BottomNavigationBarItem( ),
icon: Icon(Icons.perm_device_information), label: '信息'), BottomNavigationBarItem(
BottomNavigationBarItem( icon: Icon(Icons.settings),
icon: Icon(Icons.settings), label: '设置'), label: 'Settings',
], ),
); ],
}, );
), },
), ),
); );
} }

@ -21,20 +21,12 @@ class BoxView extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
DefaultTextStyle( DefaultTextStyle(
style: TextStyle( style: Theme.of(context).textTheme.caption!,
fontSize: 20,
color: Colors.black87,
fontWeight: FontWeight.w600,
),
child: title, child: title,
), ),
child == null ? SizedBox() : SizedBox(height: 10), child == null ? SizedBox() : SizedBox(height: 10),
DefaultTextStyle( DefaultTextStyle(
style: TextStyle( style: Theme.of(context).textTheme.bodyText2!,
fontSize: 16,
color: Colors.black87,
fontWeight: FontWeight.w400,
),
child: child ?? SizedBox(), child: child ?? SizedBox(),
), ),
children == null ? SizedBox() : SizedBox(height: 10), children == null ? SizedBox() : SizedBox(height: 10),

@ -1,4 +1,5 @@
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:power_logger/src/view/box_view.dart'; import 'package:power_logger/src/view/box_view.dart';
import 'package:power_logger/src/view/table_view.dart'; import 'package:power_logger/src/view/table_view.dart';
@ -67,12 +68,14 @@ class _DioErrorViewState extends State<DioErrorView> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar( 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), title: Text(widget.data.requestOptions.path),
actions: [ actions: [
Chip( Chip(
label: Text(widget.data.requestOptions.method), label: Text(widget.data.requestOptions.method),
backgroundColor: Colors.lightGreen, backgroundColor: Colors.lightGreen.withOpacity(0.5),
), ),
SizedBox(width: 8), SizedBox(width: 8),
], ],

@ -4,6 +4,7 @@ import 'dart:io';
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_highlight/flutter_highlight.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:flutter_highlight/themes/atom-one-light.dart';
import 'package:power_logger/external_lib/pretty_json.dart'; import 'package:power_logger/external_lib/pretty_json.dart';
import 'package:power_logger/src/parser/dio_parser/dio_parser.dart'; import 'package:power_logger/src/parser/dio_parser/dio_parser.dart';
@ -79,7 +80,9 @@ class _DioResponseViewState extends State<DioResponseView> {
child: HighlightView( child: HighlightView(
widget.data!.data, widget.data!.data,
language: _dioParser.highlight, language: _dioParser.highlight,
theme: atomOneLightTheme, theme: Theme.of(context).brightness == Brightness.light
? atomOneLightTheme
: atomOneDarkTheme,
), ),
); );
case ContentType.JSON: case ContentType.JSON:

@ -9,11 +9,7 @@ class TitleView extends StatelessWidget {
return Padding( return Padding(
padding: EdgeInsets.symmetric(horizontal: 5, vertical: 10), padding: EdgeInsets.symmetric(horizontal: 5, vertical: 10),
child: DefaultTextStyle( child: DefaultTextStyle(
style: TextStyle( style: Theme.of(context).textTheme.headline4!,
fontSize: 24,
color: Colors.black45,
fontWeight: FontWeight.w600,
),
child: title, child: title,
), ),
); );

@ -1,10 +1,8 @@
import 'dart:io'; import 'dart:io';
import 'package:auto_size_text/auto_size_text.dart';
import 'package:device_info_plus/device_info_plus.dart'; import 'package:device_info_plus/device_info_plus.dart';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart' hide AndroidView; import 'package:flutter/material.dart' hide AndroidView;
import 'package:flutter/services.dart';
import 'package:package_info_plus/package_info_plus.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/_android_view.dart';
import 'package:power_logger/src/views/platform_specific/_ios_view.dart'; import 'package:power_logger/src/views/platform_specific/_ios_view.dart';
@ -74,7 +72,7 @@ class _InfoViewState extends State<InfoView>
delegate: SliverChildListDelegate([ delegate: SliverChildListDelegate([
ListTile( ListTile(
title: Text('Package Info'), title: Text('Package Info'),
tileColor: Colors.lightBlueAccent[100], tileColor: Theme.of(context).accentColor.withOpacity(0.2),
), ),
InfoTile(title: 'appName', subTitle: packageInfo!.appName), InfoTile(title: 'appName', subTitle: packageInfo!.appName),
InfoTile( InfoTile(
@ -84,7 +82,7 @@ class _InfoViewState extends State<InfoView>
InfoTile(title: 'version', subTitle: packageInfo!.version), InfoTile(title: 'version', subTitle: packageInfo!.version),
ListTile( ListTile(
title: Text('Device Info'), title: Text('Device Info'),
tileColor: Colors.lightBlueAccent[100], tileColor: Theme.of(context).accentColor.withOpacity(0.1),
), ),
])), ])),
_buildView(), _buildView(),

@ -7,7 +7,7 @@ packages:
name: async name: async
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.5.0" version: "2.6.1"
auto_size_text: auto_size_text:
dependency: "direct main" dependency: "direct main"
description: description:
@ -265,7 +265,7 @@ packages:
name: source_span name: source_span
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.8.0" version: "1.8.1"
stack_trace: stack_trace:
dependency: transitive dependency: transitive
description: description:
@ -300,7 +300,7 @@ packages:
name: test_api name: test_api
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.2.19" version: "0.3.0"
typed_data: typed_data:
dependency: transitive dependency: transitive
description: description:

Loading…
Cancel
Save