fix color issue

master
小赖 4 years ago
parent e11550a706
commit e403b62ec0

@ -8,6 +8,13 @@ packages:
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.5.0-nullsafety.1" version: "2.5.0-nullsafety.1"
auto_size_text:
dependency: transitive
description:
name: auto_size_text
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.0"
boolean_selector: boolean_selector:
dependency: transitive dependency: transitive
description: description:

@ -18,55 +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 Scaffold( return Theme(
appBar: AppBar( data: ThemeData.light(),
title: Text('Logger View'), child: Scaffold(
actions: [ appBar: AppBar(
IconButton( title: Text('Logger View'),
icon: Icon(Icons.clear_all_rounded), actions: [
onPressed: () { IconButton(
LoggerData.clear(); icon: Icon(Icons.clear_all_rounded),
setState(() {}); onPressed: () {
}, LoggerData.clear();
), setState(() {});
], },
), ),
body: PageView( ],
controller: _pageController, ),
onPageChanged: (index) { body: PageView(
_currentIndex = index; controller: _pageController,
if (_setState != null) _setState(() {}); onPageChanged: (index) {
}, _currentIndex = index;
children: [ if (_setState != null) _setState(() {});
LoggerView(), },
InfoView(), children: [
SettingsView(), LoggerView(),
], InfoView(),
), SettingsView(),
bottomNavigationBar: StatefulBuilder( ],
builder: (context, kSetState) { ),
_setState = kSetState; bottomNavigationBar: StatefulBuilder(
return BottomNavigationBar( builder: (context, kSetState) {
currentIndex: _currentIndex, _setState = kSetState;
backgroundColor: Colors.white, 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: '日志'), items: [
BottomNavigationBarItem( BottomNavigationBarItem(
icon: Icon(Icons.perm_device_information), label: '信息'), icon: Icon(Icons.assessment), label: '日志'),
BottomNavigationBarItem(icon: Icon(Icons.settings), label: '设置'), BottomNavigationBarItem(
], icon: Icon(Icons.perm_device_information), label: '信息'),
); BottomNavigationBarItem(
}, icon: Icon(Icons.settings), label: '设置'),
],
);
},
),
), ),
); );
} }

@ -1,6 +1,5 @@
import 'dart:convert'; import 'dart:convert';
import 'dart:io'; import 'dart:io';
import 'dart:typed_data';
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';

@ -1,5 +1,6 @@
import 'dart:io'; import 'dart:io';
import 'package:auto_size_text/auto_size_text.dart';
import 'package:device_info/device_info.dart'; import 'package:device_info/device_info.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -30,57 +31,39 @@ class _InfoViewState extends State<InfoView>
packageInfo != null && (androidInfo != null || iosInfo != null); packageInfo != null && (androidInfo != null || iosInfo != null);
_buildGridItem(String title, String subTitle) { _buildGridItem(String title, String subTitle) {
return CupertinoContextMenu( return MaterialButton(
actions: [ elevation: 2,
CupertinoContextMenuAction( onPressed: () {},
child: Text('复制'), onLongPress: () {
onPressed: () { Scaffold.of(context).hideCurrentSnackBar();
Clipboard.setData(ClipboardData(text: subTitle)); Clipboard.setData(ClipboardData(text: subTitle));
Navigator.pop(context); Scaffold.of(context).showSnackBar(SnackBar(
}, content: Text('已复制'),
), action: SnackBarAction(
], label: '确定',
previewBuilder: (context, animation, child) { onPressed: () {
return Material( Scaffold.of(context).hideCurrentSnackBar();
borderRadius: BorderRadius.circular(8), },
child: Container(
width: MediaQuery.of(context).size.width - 100,
constraints: BoxConstraints(minHeight: 300),
padding: const EdgeInsets.all(8.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Text(title),
Text(
subTitle,
style: TextStyle(fontSize: 22),
),
],
),
), ),
); ));
}, },
child: Material( shape: RoundedRectangleBorder(
color: Colors.white,
borderRadius: BorderRadius.circular(5), borderRadius: BorderRadius.circular(5),
elevation: 3, ),
child: Padding( color: Theme.of(context).scaffoldBackgroundColor,
padding: const EdgeInsets.all(8.0), child: Padding(
child: Column( padding: const EdgeInsets.all(8.0),
mainAxisAlignment: MainAxisAlignment.center, child: Column(
crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.center,
children: [ crossAxisAlignment: CrossAxisAlignment.start,
Text(title), children: [
Text( Text(title),
subTitle ?? '', AutoSizeText(
style: TextStyle(fontSize: 22), subTitle ?? '',
maxLines: 2, style: TextStyle(fontSize: 26),
overflow: TextOverflow.ellipsis, maxLines: 2,
), ),
], ],
),
), ),
), ),
); );
@ -93,8 +76,17 @@ class _InfoViewState extends State<InfoView>
title: Text(title), title: Text(title),
subtitle: Text(subTitle ?? ''), subtitle: Text(subTitle ?? ''),
onLongPress: () { onLongPress: () {
Scaffold.of(context).hideCurrentSnackBar();
Clipboard.setData(ClipboardData(text: subTitle)); Clipboard.setData(ClipboardData(text: subTitle));
Scaffold.of(context).showSnackBar(SnackBar(content: Text('已复制'))); Scaffold.of(context).showSnackBar(SnackBar(
content: Text('已复制'),
action: SnackBarAction(
label: '确定',
onPressed: () {
Scaffold.of(context).hideCurrentSnackBar();
},
),
));
}, },
), ),
); );

@ -8,6 +8,13 @@ packages:
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.5.0-nullsafety.1" version: "2.5.0-nullsafety.1"
auto_size_text:
dependency: "direct main"
description:
name: auto_size_text
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.0"
boolean_selector: boolean_selector:
dependency: transitive dependency: transitive
description: description:

@ -15,6 +15,7 @@ dependencies:
flutter_highlight: ^0.6.0 flutter_highlight: ^0.6.0
device_info: ^1.0.0 device_info: ^1.0.0
package_info: ^0.4.3+4 package_info: ^0.4.3+4
auto_size_text: ^2.1.0
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:

Loading…
Cancel
Save