Ikuti laman https://codelabs.developers.google.com/codelabs/flutter/index.html#5
kode saya adalah:
```
Widget _setupBody() {
kembalikan Kolom baru (
anak-anak:
baru Diperluas (
anak: ListView.builder baru (
itemBuilder: (_nothing, int index) => _messageList[index],
terbalik: benar,
itemCount: _messageList.length,
),
),
Pembagi baru (tinggi: 1.0),
wadah baru (
padding: const EdgeInsets.symmetric(horizontal: 5.0),
//decoration: baru BoxDecoration(warna: Theme.of(context).cardColor,),
anak: Baris baru (
anak-anak:
baru Fleksibel (
anak: TextField baru (
garis maks: 1,
pengontrol: _myController,
onSubmitted: _handleSubmitt,
dekorasi: InputDecoration.collapsed baru (hintText: "masukkan di sini"),
),
),
Tema Ikon baru (
data: IconThemeData baru(warna: Theme.of(context).accentColor),
anak: IconButton baru(ikon: Ikon baru(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 (pada Mac OS X 10.12.4 16E195, lokal zh-Hans-CN, saluran alfa)
• Berkibar di /Users/cjz/ALL_IN_THIS/flutter
• Revisi framework e8aa40eddd (7 hari yang lalu), 17-10-2017 15:42:40 -0700
• Revisi mesin 7c4142808c
• Alat Dart versi 1.25.0-dev.11.0
[✓] Rantai alat Android - kembangkan untuk perangkat Android (Android SDK 26.0.2)
• Android SDK di /Users/cjz/ALL_IN_THIS/Android/sdk
• Platform android-26, build-tools 26.0.2
• ANDROID_HOME = /Users/cjz/ALL_IN_THIS/Android/sdk
• Biner Java di: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Lingkungan Runtime OpenJDK versi Java (build 1.8.0_152-release-915-b08)
[✓] Rantai alat iOS - kembangkan untuk perangkat iOS (Xcode 8.3.2)
• Xcode di /Applications/Xcode.app/Contents/Developer
• Xcode 8.3.2, Bangun versi 8E2002
• ios-deploy 1.9.2
• CocoaPods versi 1.3.1
[✓] Android Studio (versi 3.0)
• Android Studio di /Applications/Android Studio.app/Contents
• Lingkungan Runtime OpenJDK versi Java (build 1.8.0_152-release-915-b08)
[✓] Perangkat yang terhubung
• Android SDK dibuat untuk x86 • emulator-5554 • android-x86 • Android 5.1.1 (API 22) (emulator)
• iPhone SE • 795AA980-157D-455C-AC52-385CBDDC3BDE • ios • iOS 10.3 (simulator)
```
hey @cjztool , Anda dapat membungkusnya menjadi kelas Material
alih-alih menggunakan kelas Container
jika Anda hanya ingin mewarnainya.
Saya seorang pemula, terima kasih banyak! Kerja bagus! @mchome
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 luar biasa haha! Saya baru saja menemukan karakter Cina yang digunakan di beranda Anda..
Komentar yang paling membantu
Saya seorang pemula, terima kasih banyak! Kerja bagus! @mchome