Flutter: boxdecoration cacher l'ondulation du bouton de l'icône, l'ordre de rendu est-il correct ?

Créé le 25 oct. 2017  ·  3Commentaires  ·  Source: flutter/flutter

Étapes pour reproduire

Suivez la page https://codelabs.developers.google.com/codelabs/flutter/index.html#5

mon code est :

```
Widget _setupBody() {
retourner une nouvelle colonne(
enfants:[
nouveau étendu(
enfant : nouveau ListView.builder(
itemBuilder : (_nothing, int index) => _messageList[index],
inverse : vrai,
itemCount : _messageList.length,
),
),
nouveau diviseur (hauteur : 1.0),
nouveau conteneur (
remplissage : const EdgeInsets.symmetric(horizontal : 5,0),
//décoration : new BoxDecoration(color : Theme.of(context).cardColor,),
enfant : nouvelle ligne(
enfants:[
nouveau Flexible(
enfant : nouveau TextField(
maxLignes : 1,
contrôleur : _monContrôleur,
onSubmitted : _handleSubmitt,
decoration: new InputDecoration.collapsed(hintText: "input here"),
),
),
nouveau IconTheme(
data: new IconThemeData(color: Theme.of(context).accentColor),
enfant : 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

[✓] Flutter (sur Mac OS X 10.12.4 16E195, locale zh-Hans-CN, canal alpha)
• Flutter à /Users/cjz/ALL_IN_THIS/flutter
• Révision du cadre e8aa40eddd (il y a 7 jours), 17-10-2017 15:42:40 -0700
• Révision du moteur 7c4142808c
• Outils Dart version 1.25.0-dev.11.0

[✓] Chaîne d'outils Android - développer pour les appareils Android (Android SDK 26.0.2)
• SDK Android sur /Users/cjz/ALL_IN_THIS/Android/sdk
• Plate-forme Android-26, outils de construction 26.0.2
• ANDROID_HOME = /Users/cjz/ALL_IN_THIS/Android/sdk
• Java binaire sur : /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b08)

[✓] Chaîne d'outils iOS - développer pour les appareils iOS (Xcode 8.3.2)
• Xcode sur /Applications/Xcode.app/Contents/Developer
• Xcode 8.3.2, Build version 8E2002
• ios-déployer 1.9.2
• CocoaPods version 1.3.1

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

[✓] Appareils connectés
• SDK Android conçu pour x86 • émulateur-5554 • android-x86 • Android 5.1.1 (API 22) (émulateur)
• iPhone SE • 795AA980-157D-455C-AC52-385CBDDC3BDE • ios • iOS 10.3 (simulateur)
```

Commentaire le plus utile

Je suis novice, merci beaucoup ! Bon travail! @mhome
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,
         //   ),
         // ),
        ),
      ],
    );
  }

Tous les 3 commentaires

hey @cjztool , vous pouvez l'envelopper dans une classe Material au lieu d'utiliser la classe Container si vous voulez juste le colorer.

Je suis novice, merci beaucoup ! Bon travail! @mhome
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 est incroyable haha ! Je viens de découvrir les caractères chinois utilisés sur votre page d'accueil..

Cette page vous a été utile?
0 / 5 - 0 notes