我的应用程序显示一些文本。Component当字体大小通过设置 --> 辅助功能 --> 字体大小更改时,我需要重新渲染:
所以基本上这是se序列:
此时我需要重新加载应用程序,因为有些Components需要调整。
我正在使用react-native-device-info来获取字体大小,const fontScale = DeviceInfo.getFontScale();但在应用程序完全关闭和打开之前,它的值不会更新。
有任何想法吗?
accessibility font-scaling react-native react-native-device-info react-hooks
我有两个屏幕。在第一个中,有一个ListView. 在第一个元素中,我显示了变量的值selectedObject。
当ListTile按下 时,会打开第二个屏幕。我想selectedObject在从第二个屏幕返回后更新该值。
我需要分配的值result的selectedObject变量。
我想我必须调用该setState方法,但我不知道如何调用。
这是我的代码:
class _FilterTaskState extends State<FilterTask> {
List taskList;
String selectedObject = "initial value";
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: _buildAppBar(context, "AppBar Title"),
body: Center(
child: new ListView(
children: <Widget>[
new ListTile(
leading: new Icon(Icons.home, color: Colors.black),
title: new Text("Selected Object", style: styleTitle),
subtitle: new Text(selectedObject),
trailing: new Icon(Icons.play_arrow, color: Colors.black),
onTap: () => _navigateToFilterObject(context),
),
...
], …Run Code Online (Sandbox Code Playgroud) 我想得到这个结构:
-----------------------------------------------------------------------------------
item 1 item 2
item 3 item 4
-----------------------------------------------------------------------------------
Run Code Online (Sandbox Code Playgroud)
基本上我需要一个Table带2 columns的2 rows,每个2 column,但这是我得到的效果:
我的代码:
new Container(
decoration: new BoxDecoration(color: Colors.grey),
child: new Row(
children: <Widget>[
new Column(
children: <Widget>[
new Container(
decoration: new BoxDecoration(color: Colors.red),
child: new Text("item 1"),
),
new Container(
decoration: new BoxDecoration(color: Colors.amber),
child: new Text("item 3"),
),
],
),
new Column(
children: <Widget>[
new Container(
decoration: new BoxDecoration(color: Colors.green),
child: new Text("item 2"),
),
new Container(
decoration: new BoxDecoration(color: …Run Code Online (Sandbox Code Playgroud) 我已经Drawer在我的Flutter应用中实现了。
闭馆时间Drawer:
开业时间Drawer:
如您所见,Drawer在的上方Appbar。在上启动应用程序之前Flutter,我们有一个本机Android应用程序,该应用程序Drawer过去看起来像这样:
闭馆时间Drawer:
开业时间Drawer:
这是我的代码:
class MyDrawer extends StatelessWidget {
@override
Widget build(BuildContext context) {
return _buildDrawer(context);
}
}
Widget _buildDrawer(BuildContext context) {
return new Drawer(
child: new ListView(
children: <Widget>[
_buildDrawerItem(context, EnumDrawerItem.PROJECT_SELECTION, Icons.home, Colors.transparent),
new Divider(height: 20.0),
_buildDrawerItem(context, EnumDrawerItem.TASK_LIST, Icons.home, Colors.transparent),
new Divider(),
_buildDrawerItem(context, EnumDrawerItem.GUIDED_TASKS, Icons.home, Colors.transparent),
new Divider(),
_buildDrawerItem(context, EnumDrawerItem.PHOTOS, Icons.home, Colors.transparent),
new Divider(), …Run Code Online (Sandbox Code Playgroud) flutter ×3
appbar ×1
drawer ×1
font-scaling ×1
react-hooks ×1
react-native ×1
setstate ×1
tabular ×1