现在我把自己逼到了墙角...
在Flutter中,我有以下代码片段:
SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
StreamBuilder(
stream: globals.mWorkDatabase.getPictureFiles().watch(),
builder: (context, snapshot) {
if(snapshot.hasError){
return Card(
color: Colors.red,
child: Padding(
padding: const EdgeInsets.all(4.0),
child: Text(
snapshot.error.toString(),
style: const TextStyle(color: Colors.yellow),),
),
);
}
if(snapshot.connectionState==ConnectionState.waiting){
return const CircularProgressIndicator();
}
if(snapshot.hasData){
var pictureFiles = snapshot.data as List<PictureFile?>?;
if(pictureFiles?.isNotEmpty==true){
return ListView.builder(
physics: const NeverScrollableScrollPhysics(),
shrinkWrap: true,
reverse: true,
controller: ScrollController(),
itemCount: pictureFiles?.length,
itemBuilder: (context, index){
return Row(
mainAxisAlignment: MainAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Theme(
data: Theme.of(context).copyWith(canvasColor: Colors.transparent),
child: RawChip( //<-- I want the text to wrap in RawChip !
backgroundColor: const Color(0x77FFFFFF),
label: Text("${pictureFiles?[index]?.filePath}"),
avatar: const Icon(Icons.image_outlined),
onDeleted: (){
},
onPressed: (){
},
),
),
],
);
}
);
}
}
return const Card(
child: Padding(
padding: EdgeInsets.all(4.0),
child: Text("No pictures available..."),
),
);
}
),
],
),
),
麻烦的是,芯片中的文本溢出,我需要显示芯片内的整个文本。有没有可能让芯片内的文字 Package ?
1条答案
按热度按时间c3frrgcw1#
看起来你只需要把
Theme
Package 在Expanded
里面。示例:
输出: