Flutter: boxdecoration Symbolschaltfläche ausblenden, stimmt die Renderreihenfolge?

Erstellt am 25. Okt. 2017  ·  3Kommentare  ·  Quelle: flutter/flutter

Schritte zum Reproduzieren

Folgen Sie der Seite https://codelabs.developers.google.com/codelabs/flutter/index.html#5

mein Code ist:

```
Widget _setupBody() {
neue Spalte zurückgeben(
Kinder:[
neu Erweitert (
Kind: neuer ListView.builder(
itemBuilder: (_nothing, int index) => _messageList[index],
umgekehrt: wahr,-
itemCount: _messageList.length,
),
),
neuer Teiler (Höhe: 1.0),
neuer Container (
Polsterung: const EdgeInsets.symmetric(horizontal: 5.0),
//decoration: neue BoxDecoration(color: Theme.of(context).cardColor,),
Kind: neue Zeile(
Kinder:[
neu Flexibel (
Kind: neues TextField(
maxLinien: 1,
Controller: _myController,
onSubmitted: _handleSubmitt,
Dekoration: new InputDecoration.collapsed(hintText: "hier eingeben"),
),
),
neues IconTheme(
Daten: neues IconThemeData(color: Theme.of(context).accentColor),
child: new IconButton(icon: new Icon(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

[✓] Flattern (unter Mac OS X 10.12.4 16E195, Gebietsschema zh-Hans-CN, Kanal Alpha)
• Flattern bei /Users/cjz/ALL_IN_THIS/flatter
• Framework-Revision e8aa40eddd (vor 7 Tagen), 2017-10-17 15:42:40 -0700
• Motorrevision 7c4142808c
• Tools Dart-Version 1.25.0-dev.11.0

[✓] Android-Toolchain – Entwicklung für Android-Geräte (Android SDK 26.0.2)
• Android-SDK unter /Users/cjz/ALL_IN_THIS/Android/sdk
• Plattform Android-26, Build-Tools 26.0.2
• ANDROID_HOME = /Users/cjz/ALL_IN_THIS/Android/sdk
• Java-Binärdatei unter: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java-Version OpenJDK Runtime Environment (Build 1.8.0_152-release-915-b08)

[✓] iOS-Toolchain - für iOS-Geräte entwickeln (Xcode 8.3.2)
• Xcode unter /Applications/Xcode.app/Contents/Developer
• Xcode 8.3.2, Build-Version 8E2002
• iOS-Bereitstellung 1.9.2
• CocoaPods-Version 1.3.1

[✓] Android Studio (Version 3.0)
• Android Studio unter /Applications/Android Studio.app/Contents
• Java-Version OpenJDK Runtime Environment (Build 1.8.0_152-release-915-b08)

[✓] Verbundene Geräte
• Android SDK für x86 gebaut • Emulator-5554 • android-x86 • Android 5.1.1 (API 22) (Emulator)
• iPhone SE • 795AA980-157D-455C-AC52-385CBDDC3BDE • ios • iOS 10.3 (Simulator)
```

Hilfreichster Kommentar

Ich bin ein Neuling, vielen Dank! Gute Arbeit! @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,
         //   ),
         // ),
        ),
      ],
    );
  }

Alle 3 Kommentare

hey @cjztool , du kannst es in eine Material Klasse packen , anstatt die Container Klasse zu verwenden, wenn du es nur einfärben möchtest.

Ich bin ein Neuling, vielen Dank! Gute Arbeit! @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 ist unglaublich, haha! Ich habe gerade die chinesischen Schriftzeichen entdeckt, die auf deiner Homepage verwendet werden.

War diese Seite hilfreich?
0 / 5 - 0 Bewertungen