我正在错误The method 'setState' isn't defined for the class MyApp error in Flutter的onSubmitted的TextField
码:
Widget build(BuildContext context) {
String phoneNo;
return new MaterialApp(
title: 'SchoolTrack',
theme: new ThemeData(
primaryColor: Colors.grey[50],
),
home: new Scaffold(
appBar: null,
backgroundColor: Colors.cyan[100],
body: new Container(
padding: const EdgeInsets.all(32.0),
child: new Center(
child: new TextField(
autofocus: true,
autocorrect: false,
decoration: new InputDecoration(
hintText: 'Type the phone no',
suffixIcon: new Icon(Icons.send),
suffixStyle: new TextStyle(
color: Colors.cyan[300],
)
),
onSubmitted: (String input) { …Run Code Online (Sandbox Code Playgroud) 我希望在主屏幕上添加标签应用而不是应用栏.如何创建它.目前,我的标签栏添加在应用栏的底部,我已删除标题和标高.同时,我不能说appBar: null因为我需要在标签栏的顶部有一些空间.
Widget HomeTap = new Scaffold(
appBar: new AppBar(
bottom: new TabBar(
indicatorColor: Colors.pinkAccent[100],
labelColor: Colors.pinkAccent[100],
indicatorWeight: 0.5,
unselectedLabelColor: Colors.grey[400],
tabs: [
new Tab(text: 'Album',),
new Tab(text: 'Artist'),
new Tab(text: 'Playlist'),
new Tab(text: 'Songs'),
new Tab(icon: new Icon(Icons.search))
]),
title: null,
elevation: 0.0,
),
body: new TabBarView(
children: [
new Center(
child: new AlbumWidget(),
),
new Container(),
new Container(),
new Container(),
new Container(),
],
),
);
Run Code Online (Sandbox Code Playgroud) 什么是ScannerKotlin中的Java ?
我用过readLine()但我想知道它的类型是否安全?
我的 Flutter 项目的 android studio 中缺少 gradle 窗口,但它可用于我的 Kotlin 项目。
我必须生成signing certificate SHA-1以在 Firebase 中注册我的应用程序。
我创建了一个在一个列中包含多个小部件的屏幕。我得到了错误。然后我更新了列中容器的高度,然后屏幕没有滚动,因为它有一些固定的大小。
然后,我从列移动到,ListView但仍然不滚动。
new ListView(
shrinkWrap: true,
children: <Widget>[
// Author information
new Container(
height: MediaQuery
.of(context)
.size
.height * .075,
width: double.infinity,
padding: const EdgeInsets.only(
top: 10.00, right: 10.00),
child: new Row(
children: <Widget>[
new CircleAvatar(
backgroundColor: new Color(0xFF535386),
foregroundColor: new Color(0xFFF4F4F4),
backgroundImage: new NetworkImage(
_feed.authorImageUrl),
radius: 30.00,
child: new Text(
_feed.authorName.substring(0, 1)
.toUpperCase()),
),
new Padding(padding: EdgeInsets.only(
bottom: 5.00, top: 2.00, left: 5.00),
child: new Column(
crossAxisAlignment: CrossAxisAlignment
.start,
children: <Widget>[
new Text(
_feed.authorName,
textAlign: TextAlign.start,
softWrap: …Run Code Online (Sandbox Code Playgroud) 我在里面添加了一些小部件 ListView.这样我就可以滚动所有小部件.现在我需要再添加一个小部件ListView来加载注释列表.我无法添加ListView内部ListView.此外,我不需要单独的滚动条来表达我的意见.它应该与内部的小部件一起滚动ListView.所以我计划添加Column而不是ListView.可以帮助我动态添加我的评论Columns吗?
new Expanded(
child:
new ListView(
shrinkWrap: true,
children: <Widget>[
// Title
new Padding(padding: const EdgeInsets.only(
top: 10.00, left: 10.00),
child: new Text(
_feed.title, textAlign: TextAlign.start,),
),
// content
new Container(
child: new Text(
_feed.content, textAlign: TextAlign.start,),
),
// Comments List will go here
],
),
),
Run Code Online (Sandbox Code Playgroud) Kotlin Map中plus()和put()方法之间的区别是什么?
我已经创建了地图,并使用plus()方法添加了键值对,但是在打印地图时,找不到添加的值。然后我转到了put()。plus()方法的行为是什么?
我titleSpacing在 AppBar 的构造函数中覆盖了。但标题空间没有区别。
new AppBar(
backgroundColor: Colors.amber,
title: new Text("Flying Dutchman",
style: new TextStyle(
color: const Color(0xFF444444),
fontSize: 30.0,
fontWeight: FontWeight.w900,
),
),
titleSpacing: 0.00,
centerTitle: true,
elevation: 0.0,
)
Run Code Online (Sandbox Code Playgroud)
我希望减少应用栏标题的顶部空间。
希望在单击TextFormField而不是键盘时显示日期选择器。我已尝试使用GestureDetector但未按预期工作。
DateTime _date = new DateTime.now();
TimeOfDay _time = new TimeOfDay.now();
Future<Null> _selectedDate(BuildContext context) async {
final DateTime picked = await showDatePicker(
context: context,
initialDate: _date,
firstDate: new DateTime(2016),
lastDate: new DateTime(2019));
if (picked != null && picked != _date) {
print("Date selected ${_date.toString()}");
setState(() {
_date = picked;
});
}
}
......
new GestureDetector(
onTap: (){
_selectedTime(context);
},
child:
new TextFormField(
initialValue: convertToDate(_date),
decoration: const InputDecoration(
icon: const Icon(Icons.calendar_today),
hintText: 'Enter your date of event', …Run Code Online (Sandbox Code Playgroud)