英文:
how to make side color on dialog
问题
你们知道如何在对话框上添加类似下图的侧边颜色吗?
如果你想知道我的代码,我在这里附上它:
Future<T?> showCustomDialog<T>(BuildContext context) {
return showDialog<T>(
context: context,
builder: (context) => Dialog(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16),
),
child: this,
),
);
}
只需假设这个小部件位于子组件中。
英文:
Do you guys know how to give side color on dialog like picture below.
If you want to know my code, here I attach it:
Future<T?> showCustomDialog<T>(BuildContext context) {
return showDialog<T>(
context: context,
builder: (context) => Dialog(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16),
),
child: this,
),
);
}
Just assume the widget is in the child.
答案1
得分: 1
你可以尝试这样做:
showDialog(
context: context,
builder: (BuildContext context) {
return Dialog(
clipBehavior: Clip.antiAlias,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16),
),
child: Column(
children: [
Container(
color: Colors.green,
width: double.infinity,
height: 10,
),
],
),
);
}
);
英文:
You can try this:
showDialog(
context: context,
builder: (BuildContext context) {
return Dialog(
clipBehavior: Clip.antiAlias,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16),
),
child: Column(
children: [
Container(
color: Colors.green,
width: double.infinity,
height: 10,
),
],
),
);
});
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论