【发布时间】:2020-10-26 23:53:01
【问题描述】:
我正在设计一个 ios 应用程序,并且是 Flutter 的新手。我无法弄清楚如何让 Flutter 许可证页面显示以使其可读。
当我在模拟器上进行测试时,Flutter 许可页面看起来不错。它有黑色背景和白色文字。
但是,当我在我的设备上测试该应用时,它不可读。背景切换到白色,一切都搞砸了。
我更新了我的主题数据以影响 Flutter 许可证的外观,使其可读。
我不确定我做错了什么。如果有人有任何处理此问题的经验或对我的建议,将不胜感激。
我控制应用颜色的 main.dart 文件
我在 main.dart 文件中编辑了主题数据的三个特定部分。它们是标题 5、bodyText2 和标题。当我这样做时,我可以在我的模拟器上正确读取 Flutter 许可证,但是当我在设备上测试时似乎仍然无法正常工作。
theme: ThemeData(
primaryColor: Color(0XFFeb1555),
accentColor: Color(0XFF5173A8),
scaffoldBackgroundColor: Color(0xff1D1E33),
canvasColor: Colors.black,
textTheme: TextTheme(
headline5: TextStyle(
color: Colors.white,
),
caption: TextStyle(
color: Colors.white,
),
bodyText2: TextStyle(
color: Colors.white, fontSize: 20.0, fontWeight: FontWeight.bold),
),
),
我的 settings.dart 页面,其中列出了 Flutter 许可证
import 'package:flutter/material.dart';
import 'package:tarotcards/screens/disclaimer.dart';
import 'package:url_launcher/url_launcher.dart';
_launchSupportURL() async {
const String url =
'mailto:terratarotapp@gmail.com?subject=Terra%20Tarot%20App%20Feedback';
if (await canLaunch(url)) {
await launch(url);
} else {
throw 'Could not launch $url';
}
}
_launchSocialURL() async {
const String url = 'http://instagram.com/terra_tarot';
if (await canLaunch(url)) {
await launch(url);
} else {
throw 'Could not launch $url';
}
}
class Settings extends StatefulWidget {
@override
_SettingsState createState() => _SettingsState();
}
class _SettingsState extends State<Settings> {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.black26,
body: SafeArea(
child: Column(
children: <Widget>[
Container(
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Image.asset(
'images/castle.png',
height: 65,
fit: BoxFit.fill,
),
],
),
),
Container(
padding: EdgeInsets.fromLTRB(0, 20.0, 0, 10.0),
child: Text(
'GREETINGS',
style: TextStyle(
fontSize: 40.0,
fontFamily: 'Pacifico',
fontWeight: FontWeight.bold,
color: Colors.white,
),
),
),
Text(
'TAROT READER',
style: TextStyle(
fontSize: 20.0,
fontFamily: 'San Source Pro',
color: Color(0XFFeb1555),
),
),
Container(
padding: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 0.0),
child: Text(
'Do you have feedback on how to improve the app?'
' I\'d love to hear from you!',
style: TextStyle(
color: Colors.white,
letterSpacing: 0.5,
height: 1.5,
fontFamily: 'Opensans',
fontSize: 16.0,
fontWeight: FontWeight.normal),
),
),
SizedBox(
height: 20.0,
),
ButtonTheme(
minWidth: 300.0,
child: RaisedButton(
child: Text('SEND FEEDBACK'),
padding: EdgeInsets.all(10.0),
textColor: Colors.white,
color: Color(0XFFeb1555),
onPressed: _launchSupportURL,
),
),
SizedBox(
height: 20.0,
),
ButtonTheme(
minWidth: 300.0,
child: RaisedButton(
child: Text('INSTAGRAM'),
padding: EdgeInsets.all(10.0),
textColor: Colors.black,
color: Colors.white,
onPressed: _launchSocialURL,
),
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
FlatButton(
child: Text(
'Disclaimer →',
style: TextStyle(
color: Color(0XFFeb1555),
),
),
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => Disclaimer(),
));
},
),
FlatButton(
child: Text(
'Licenses →',
style: TextStyle(
color: Color(0XFFeb1555),
),
),
onPressed: () {
showLicensePage(
context: context,
applicationName: 'Terra Tarot',
applicationVersion: '1.0.0',
);
},
),
],
),
],
),
),
);
}
}
【问题讨论】:
-
系统深色模式和浅色模式是否使用了不同的主题?
标签: ios flutter dart flutter-layout