小编esu*_*esu的帖子

如何改变小吃店的不透明度?

我希望改变SnackBar的不透明度.它只有背景属性.可以自定义还是我必须为小吃店创建自定义小部件?

flutter

12
推荐指数
3
解决办法
8439
查看次数

没有为Flutter中的类MyApp错误定义方法'setState'

我正在错误The method 'setState' isn't defined for the class MyApp error in FlutteronSubmittedTextField

码:

  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)

flutter

11
推荐指数
5
解决办法
9686
查看次数

如何在没有app bar的情况下创建标签栏?

我希望在主屏幕上添加标签应用而不是应用栏.如何创建它.目前,我的标签栏添加在应用栏的底部,我已删除标题和标高.同时,我不能说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)

flutter

8
推荐指数
2
解决办法
5042
查看次数

什么是Kotlin中的Java Scanner?

什么是ScannerKotlin中的Java ?

我用过readLine()但我想知道它的类型是否安全?

java input java.util.scanner kotlin

7
推荐指数
2
解决办法
3137
查看次数

我的颤振项目的 android studio 中缺少 Gradle 窗口

我的 Flutter 项目的 android studio 中缺少 gradle 窗口,但它可用于我的 Kotlin 项目。

在此处输入图片说明

我必须生成signing certificate SHA-1以在 Firebase 中注册我的应用程序。

intellij-idea gradle android-studio flutter

4
推荐指数
2
解决办法
4339
查看次数

如何在flutter中的列中添加滚动

我创建了一个在一个列中包含多个小部件的屏幕。我得到了错误。然后我更新了列中容器的高度,然后屏幕没有滚动,因为它有一些固定的大小。

然后,我从列移动到,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)

flutter flutter-layout

4
推荐指数
1
解决办法
5317
查看次数

如何动态地将小部件添加到Flutter中的列?

我在里面添加了一些小部件 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)

flutter flutter-layout

4
推荐指数
4
解决办法
8441
查看次数

Kotlin Map中plus()和put()方法之间的区别是什么?

Kotlin Map中plus()和put()方法之间的区别是什么?

我已经创建了地图,并使用plus()方法添加了键值对,但是在打印地图时,找不到添加的值。然后我转到了put()。plus()方法的行为是什么?

kotlin

2
推荐指数
2
解决办法
1950
查看次数

Flutter中如何减少AppBar的标题空间

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)

在此处输入图片说明

我希望减少应用栏标题的顶部空间。

flutter flutter-layout

2
推荐指数
1
解决办法
5997
查看次数

如何在文本字段的onclick而不是flutter的键盘上显示日期选择器?

希望在单击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)

flutter

1
推荐指数
3
解决办法
4020
查看次数