Flutter: boxdecoration скрыть пульсацию кнопки значка, правильный ли порядок рендеринга?

Созданный на 25 окт. 2017  ·  3Комментарии  ·  Источник: flutter/flutter

Действия по воспроизведению

Следите за страницей https://codelabs.developers.google.com/codelabs/flutter/index.html#5.

мой код:

```
Виджет _setupBody() {
вернуть новый столбец (
дети:[
новый расширенный(
ребенок: новый ListView.builder(
itemBuilder: (_nothing, int index) => _messageList[index],
обратная сторона: правда,
itemCount: _messageList.length,
),
),
новый разделитель (высота: 1,0),
новый контейнер(
отступы: const EdgeInsets.симметричный (горизонтальный: 5.0),
//украшение: новое BoxDecoration(color: Theme.of(context).cardColor,),
ребенок: новая строка (
дети:[
новый гибкий(
дочерний элемент: новое текстовое поле (
максЛайнс: 1,
контроллер: _myController,
onSubmit: _handleSubmitt,
украшение: новый InputDecoration.collapsed(hintText: "введите здесь"),
),
),
новая IconTheme(
данные: новые IconThemeData(цвет: Theme.of(context).accentColor),
дочерний элемент: новый IconButton (значок: новый значок (Icons.send), onPressed: () => _handleSubmitt (_myController.text)))
],
))
],
);
}

then it shown like this: 
![screenflow](https://user-images.githubusercontent.com/3993323/31986228-425b9d68-b92d-11e7-8176-de3deab993c2.gif)

after add the decoration  (uncomment the line 14)

![screenflow2](https://user-images.githubusercontent.com/3993323/31986425-0dcfe8b4-b92e-11e7-90ae-52664835cd4b.gif)

as you see, the boxdecoration hide the ripple.

from the code , i think , the boxdexcoration should be rendered first. 

How to change the code makes the ripple at front of the boxdexcoration?



## Flutter Doctor

[✓] Flutter (в Mac OS X 10.12.4 16E195, локаль zh-Hans-CN, альфа-канал)
• Трепещите по адресу /Users/cjz/ALL_IN_THIS/flutter.
• Версия платформы e8aa40eddd (7 дней назад), 2017-10-17 15:42:40 -0700
• Версия двигателя 7c4142808c
• Инструменты Dart версии 1.25.0-dev.11.0

[✓] Набор инструментов Android — разработка для устройств Android (Android SDK 26.0.2)
• Android SDK в /Users/cjz/ALL_IN_THIS/Android/sdk.
• Платформа android-26, инструменты сборки 26.0.2
• ANDROID_HOME = /Users/cjz/ALL_IN_THIS/Android/sdk
• Двоичный файл Java по адресу: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java.
• Java-версия OpenJDK Runtime Environment (сборка 1.8.0_152-релиз-915-b08)

[✓] Набор инструментов iOS — разработка для устройств iOS (Xcode 8.3.2)
• Xcode в /Applications/Xcode.app/Contents/Developer.
• Xcode 8.3.2, версия сборки 8E2002.
• iOS-развертывание 1.9.2
• CocoaPods версии 1.3.1

[✓] Android Studio (версия 3.0)
• Android Studio по адресу /Applications/Android Studio.app/Contents.
• Java-версия OpenJDK Runtime Environment (сборка 1.8.0_152-релиз-915-b08)

[✓] Подключенные устройства
• Android SDK для x86 • emulator-5554 • android-x86 • Android 5.1.1 (API 22) (эмулятор)
• iPhone SE • 795AA980-157D-455C-AC52-385CBDDC3BDE • ios • iOS 10.3 (симулятор)
```

Самый полезный комментарий

Я новичок, спасибо большое! Хорошо сделано! @mchome
qq 20171101164118

Widget _setupBody() {
    return new Column(
      children: <Widget>[
        new Expanded(
          child: new ListView.builder(
            itemBuilder: (_nothing, int index) => _messageList[index],
            reverse: true,
            itemCount: _messageList.length,
          ),
        ),
        new Divider(height: 1.0),
        new Material(
          color: Theme.of(context).cardColor,
          //child: new Container(
          //  padding: const EdgeInsets.symmetric(horizontal: 5.0),
            child: new Row(
              children: <Widget>[
                new Flexible(
                  child: new TextField(
                    maxLines: 1,
                    controller: _myController,
                    onSubmitted: _handleSubmitt,
                    onChanged: (String text) {
                      setState(() {
                        _isComposing = text.length > 0;
                      });
                    },
                    decoration: new InputDecoration.collapsed(hintText: "input here"),
                  ),
                ),
                new IconTheme(
                    data: new IconThemeData(color: Theme.of(context).accentColor),
                    child: Theme.of(context).platform == TargetPlatform.iOS
                        ? new CupertinoButton(child: new Text("Send"), onPressed: _isComposing ? () => _handleSubmitt(_myController.text) : null)
                        : new IconButton(icon: new Icon(Icons.send), onPressed: _isComposing ? () => _handleSubmitt(_myController.text) : null))
              ],
            ),
         //   decoration: new BoxDecoration(
         //     color: Theme.of(context).cardColor,
         //   ),
         // ),
        ),
      ],
    );
  }

Все 3 Комментарий

эй @cjztool , вы можете обернуть его в класс Material вместо использования класса Container если вы просто хотите его раскрасить.

Я новичок, спасибо большое! Хорошо сделано! @mchome
qq 20171101164118

Widget _setupBody() {
    return new Column(
      children: <Widget>[
        new Expanded(
          child: new ListView.builder(
            itemBuilder: (_nothing, int index) => _messageList[index],
            reverse: true,
            itemCount: _messageList.length,
          ),
        ),
        new Divider(height: 1.0),
        new Material(
          color: Theme.of(context).cardColor,
          //child: new Container(
          //  padding: const EdgeInsets.symmetric(horizontal: 5.0),
            child: new Row(
              children: <Widget>[
                new Flexible(
                  child: new TextField(
                    maxLines: 1,
                    controller: _myController,
                    onSubmitted: _handleSubmitt,
                    onChanged: (String text) {
                      setState(() {
                        _isComposing = text.length > 0;
                      });
                    },
                    decoration: new InputDecoration.collapsed(hintText: "input here"),
                  ),
                ),
                new IconTheme(
                    data: new IconThemeData(color: Theme.of(context).accentColor),
                    child: Theme.of(context).platform == TargetPlatform.iOS
                        ? new CupertinoButton(child: new Text("Send"), onPressed: _isComposing ? () => _handleSubmitt(_myController.text) : null)
                        : new IconButton(icon: new Icon(Icons.send), onPressed: _isComposing ? () => _handleSubmitt(_myController.text) : null))
              ],
            ),
         //   decoration: new BoxDecoration(
         //     color: Theme.of(context).cardColor,
         //   ),
         // ),
        ),
      ],
    );
  }

@mchome потрясающий, ха-ха! Я только что обнаружил китайские иероглифы, используемые на вашей домашней странице..

Была ли эта страница полезной?
0 / 5 - 0 рейтинги