Flutter: boxdecorationアイコンボタンの波紋を隠す、レンダリング順序は正しいですか?

作成日 2017年10月25日  ·  3コメント  ·  ソース: flutter/flutter

再現する手順

ページhttps://codelabs.developers.google.com/codelabs/flutter/index.html#5に従って

私のコードは:

`` `
ウィジェット_setupBody(){
新しい列を返す(
子供達:[[
new Expanded(
子:new ListView.builder(
itemBuilder:(_ nothing、int index)=> _messageList [index]、
逆:真、
itemCount:_messageList.length、
)、
)、
新しいディバイダー(高さ:1.0)、
新しいコンテナ(
パディング:const EdgeInsets.symmetric(horizo​​ntal:5.0)、
//装飾:new BoxDecoration(color:Theme.of(context).cardColor、)、
子:新しい行(
子供達:[[
新しいFlexible(
子:new TextField(
maxLines:1、
コントローラー:_myController、
onSubmitted:_handleSubmitt、
装飾:new InputDecoration.collapsed(hintText: "input here")、
)、
)、
新しいIconTheme(
データ:新しいIconThemeData(色:Theme.of(context).accentColor)、
子: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

[✓]フラッター(Mac OS X 10.12.4 16E​​195、ロケールzh-Hans-CN、チャネルアルファ)
•/ Users / cjz / ALL_IN_THIS / flutterでのフラッター
•フレームワークリビジョンe8aa40eddd(7日前)、2017-10-17 15:42:40 -0700
•エンジンリビジョン7c4142808c
•ToolsDartバージョン1.25.0-dev.11.0

[✓] Androidツールチェーン-Androidデバイス用に開発(Android SDK 26.0.2)
•/ Users / cjz / ALL_IN_THIS / Android / sdkにあるAndroidSDK
•プラットフォームandroid-26、build-tools 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ランタイム環境(ビルド1.8.0_152-release-915-b08)

[✓] iOSツールチェーン-iOSデバイス用に開発(Xcode 8.3.2)
•/ Applications / Xcode.app / Contents / DeveloperのXcode
•Xcode8.3.2、ビルドバージョン8E2002
•ios-deploy1.9.2
•CocoaPodsバージョン1.3.1

[✓] Android Studio(バージョン3.0)
•/ Applications / AndroidStudio.app/ContentsにあるAndroidStudio
•JavaバージョンのOpenJDKランタイム環境(ビルド1.8.0_152-release-915-b08)

[✓]接続されたデバイス
•x86用に構築されたAndroidSDK•エミュレーター-5554•android-x86•Android5.1.1(API 22)(エミュレーター)
•iPhoneSE•795AA980-157D-455C-AC52-385CBDDC3BDE•ios•iOS10.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さん、色を付けたいだけの場合は、 Containerクラスを使用する代わりに、 Materialクラスにラップできます。

私は初心者です、どうもありがとうございました! よくやった! @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 評価