Flutter: boxdecoration hide icon button's ripple , ¿el orden de renderizado es correcto?

Creado en 25 oct. 2017  ·  3Comentarios  ·  Fuente: flutter/flutter

Pasos para reproducir

Siga la página https://codelabs.developers.google.com/codelabs/flutter/index.html#5

mi código es:

```
Widget _setupBody() {
devolver nueva columna (
niños:[
nuevo ampliado (
niño: nuevo ListView.builder (
itemBuilder: (_nothing, índice int) => _messageList[índice],
reverso: verdadero,
itemCount: _messageList.longitud,
),
),
nuevo Divisor (altura: 1.0),
nuevo contenedor (
relleno: const EdgeInsets.simétrico (horizontal: 5.0),
//decoración: nueva BoxDecoration(color: Theme.of(context).cardColor,),
niño: nueva fila (
niños:[
nuevo Flexible(
niño: nuevo campo de texto (
líneas máximas: 1,
controlador: _miControlador,
onSubmitted: _handleSubmitt,
decoración: nueva InputDecoration.collapsed(hintText: "ingrese aquí"),
),
),
nuevo tema de iconos (
datos: nuevo 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

[✓] Flutter (en Mac OS X 10.12.4 16E195, configuración regional zh-Hans-CN, canal alfa)
• Flutter en /Users/cjz/ALL_IN_THIS/flutter
• Revisión del marco e8aa40eddd (hace 7 días), 2017-10-17 15:42:40 -0700
• Revisión del motor 7c4142808c
• Herramientas Dart versión 1.25.0-dev.11.0

[✓] Cadena de herramientas de Android: desarrollo para dispositivos Android (Android SDK 26.0.2)
• SDK de Android en /Users/cjz/ALL_IN_THIS/Android/sdk
• Plataforma android-26, herramientas de compilación 26.0.2
• ANDROID_HOME = /Users/cjz/ALL_IN_THIS/Android/sdk
• Binario Java en: /Aplicaciones/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Versión de Java OpenJDK Runtime Environment (compilación 1.8.0_152-release-915-b08)

[✓] Cadena de herramientas de iOS: desarrollo para dispositivos iOS (Xcode 8.3.2)
• Xcode en /Aplicaciones/Xcode.app/Contents/Developer
• Xcode 8.3.2, versión de compilación 8E2002
• ios-implementar 1.9.2
• CocoaPods versión 1.3.1

[✓] Android Studio (versión 3.0)
• Android Studio en /Aplicaciones/Android Studio.app/Contents
• Versión de Java OpenJDK Runtime Environment (compilación 1.8.0_152-release-915-b08)

[✓] Dispositivos conectados
• Android SDK construido para x86 • emulator-5554 • android-x86 • Android 5.1.1 (API 22) (emulador)
• iPhone SE • 795AA980-157D-455C-AC52-385CBDDC3BDE • ios • iOS 10.3 (simulador)
```

Comentario más útil

Soy novato, muchas gracias! ¡Buen trabajo! @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,
         //   ),
         // ),
        ),
      ],
    );
  }

Todos 3 comentarios

oye @cjztool , puedes envolverlo en una clase Material lugar de usar la clase Container si solo quieres colorearlo.

Soy novato, muchas gracias! ¡Buen trabajo! @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 es increíble jaja! Acabo de descubrir los caracteres chinos que se usan en su página de inicio...

¿Fue útil esta página
0 / 5 - 0 calificaciones