当我选择一个项目时,对话框中的初始值不会改变。这是下拉列表的代码:
void _buildStatusDialog(String documentID) {
String _selectedText = "SDD";
showDialog<void>(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: Text("Status Update"),
content: new DropdownButton<String>(
hint: Text("Status"),
value: _selectedText,
items: <String>['SDD', 'Meeting', 'Home', 'Space']
.map((String value) {
return new DropdownMenuItem<String>(
value: value,
child: new Text(value),
);
}).toList(),
onChanged: (String val) {
_selectedText = val;
setState(() {
_selectedText = val;
});
},
),
actions: <Widget>[
FlatButton(
child: Text("UPDATE"),
onPressed: () {
.....
},
),
],
);
});
Run Code Online (Sandbox Code Playgroud)
}
如何更新“提示”或显示所选项目?
例如 :
String desc = "<bold>Hello<bold> World";
new Text(desc);
Run Code Online (Sandbox Code Playgroud) 我正在尝试在 Flutter 中制作自定义步进器。我复制了 stepper.dart 的实现,将我的文件保存到我自己的 lib 文件夹并修复了导入以消除错误。
import 'package:flutter/src/material/button_theme.dart';
import 'package:flutter/src/material/colors.dart';
import 'package:flutter/src/material/debug.dart';
import 'package:flutter/src/material/flat_button.dart';
import 'package:flutter/src/material/icons.dart';
import 'package:flutter/src/material/ink_well.dart';
import 'package:flutter/src/material/material.dart';
import 'package:flutter/src/material/material_localizations.dart';
import 'package:flutter/src/material/theme.dart';
import 'package:flutter/src/material/typography.dart';
Run Code Online (Sandbox Code Playgroud)
错误被删除,但 dart 说“不要从另一个包导入实现文件。”
我可以知道继续操作是否安全吗?或者还有另一种实现自定义小部件的方法吗?还是应该转移自定义步进器文件的位置?谢谢。
使用flutter_markdown时是否可以更改文本的字体大小?类似于将TextStyle提供给Text小部件。谢谢!
是否可以改变颤振的膨胀瓦?具体来说,我想删除它扩展时创建的分隔符.我也想调整它的填充.那可能吗?谢谢!
是否可以在Scaffold的AppBar中添加背景图像?我知道条子但是当你向下滚动时,图像会被隐藏,而AppBar会改变颜色吗?所以我想知道这是否可能,如果没有,是否有任何现有的解决方法?谢谢!
I have an app that has a listview of images(places) then when tapped, returns a new page displaying certain details about the place. My concern is about the details page, my layout is I have an image on top, some text below it and an expanded list view. What I want is that I can scroll thru whole page. What I came up with is that only the expanded list view is scrollable.
Here is the code for the details …
我有一个StatefulWidget。然后,当我单击一个按钮时,它将显示一个警报对话框。当我实现时:
onTap: () {
showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: Text("Hello"),
);
}
}
Run Code Online (Sandbox Code Playgroud)
一切正常。但是,当我将构建器中的内容转移到另一个StatefulWidget时,就会发生此错误:
A build function returned null.
I/flutter ( 3647): The offending widget is: Builder
I/flutter ( 3647): Build functions must never return null. To return an empty space that causes the building widget to
I/flutter ( 3647): fill available room, return "new Container()". To return an empty space that takes as little room as
I/flutter ( 3647): possible, return "new Container(width: 0.0, …Run Code Online (Sandbox Code Playgroud) 基本上我的文字是这样的:
该文本是使用以下代码编写的:
child: Text(
"1) Persons with burns, skin infections\n2) Primary or secondary immunodeficiencies (HIV)\n3) Previous tuberculosis infection\n4) Untreated active tuberculosis\n5) History of close contact with tuberculosis patient\n6) Immunosupressed individuals (i.e. HIV infected, leukemia, lymphoma, malignancy)\n7) People receiving immunosuppressive medications (including high-dose steroids\n8) Pregnancy",
),
Run Code Online (Sandbox Code Playgroud)
我希望6)和7)中的第二行与文本的开头对齐,而不与数字对齐。有什么办法可以扑扑吗?
我不想添加其他空格,因为它可能会随着不同的移动屏幕而改变。在其他情况下,它涉及多于2行。感谢您的回答!
flutter ×11
dart ×7
indentation ×2
appbar ×1
bulletedlist ×1
dropdown ×1
markdown ×1
newline ×1
stepper ×1
string ×1