shadcn_ui-sheet
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseShadcn UI — Sheet
Shadcn UI — Sheet
Instructions
使用说明
Sheets extend the dialog pattern to display content from an edge of the screen. Use . can be , , , or . Return a with optional , , (body), and . Use (e.g. for left/right) to limit width or height.
showShadSheet(context: context, side: ShadSheetSide.*, builder: (context) => ShadSheet(...))sideShadSheetSide.topShadSheetSide.rightShadSheetSide.bottomShadSheetSide.leftShadSheettitledescriptionchildactionsconstraintsBoxConstraints(maxWidth: 512)Sheet组件扩展了对话框模式,可从屏幕边缘展示内容。使用调用。参数可选值为、、或。返回的可配置可选的、、(主体内容)和参数。使用(例如左右侧边面板设置)来限制宽度或高度。
showShadSheet(context: context, side: ShadSheetSide.*, builder: (context) => ShadSheet(...))sideShadSheetSide.topShadSheetSide.rightShadSheetSide.bottomShadSheetSide.leftShadSheettitledescriptionchildactionsconstraintsBoxConstraints(maxWidth: 512)Basic (right side)
基础示例(右侧面板)
dart
showShadSheet(
side: ShadSheetSide.right,
context: context,
builder: (context) => ShadSheet(
constraints: const BoxConstraints(maxWidth: 512),
title: const Text('Edit Profile'),
description: const Text(
"Make changes to your profile here. Click save when you're done",
),
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 20),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch,
spacing: 16,
children: profile
.map(
(p) => Row(
children: [
Expanded(
child: Text(
p.title,
textAlign: TextAlign.end,
style: theme.textTheme.small,
),
),
const SizedBox(width: 16),
Expanded(
flex: 5,
child: ShadInput(initialValue: p.value),
),
],
),
)
.toList(),
),
),
actions: const [
ShadButton(child: Text('Save changes')),
],
),
);dart
showShadSheet(
side: ShadSheetSide.right,
context: context,
builder: (context) => ShadSheet(
constraints: const BoxConstraints(maxWidth: 512),
title: const Text('Edit Profile'),
description: const Text(
"Make changes to your profile here. Click save when you're done",
),
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 20),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch,
spacing: 16,
children: profile
.map(
(p) => Row(
children: [
Expanded(
child: Text(
p.title,
textAlign: TextAlign.end,
style: theme.textTheme.small,
),
),
const SizedBox(width: 16),
Expanded(
flex: 5,
child: ShadInput(initialValue: p.value),
),
],
),
)
.toList(),
),
),
actions: const [
ShadButton(child: Text('Save changes')),
],
),
);All sides
全侧边支持
Use , , , or in . For left/right sheets pass to the so content doesn’t stretch full width.
side: ShadSheetSide.topShadSheetSide.bottomShadSheetSide.leftShadSheetSide.rightshowShadSheetconstraints: const BoxConstraints(maxWidth: 512)ShadSheet在中使用、、或来指定面板位置。对于左侧/右侧面板,需为传入,避免内容拉伸至全屏宽度。
showShadSheetside: ShadSheetSide.topShadSheetSide.bottomShadSheetSide.leftShadSheetSide.rightShadSheetconstraints: const BoxConstraints(maxWidth: 512)