Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions tdesign-component/example/lib/page/td_popover_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,10 @@ class _TDPopoverPage extends State<TDPopoverPage> {
ExampleItem(
desc: '显示多行内容',
builder: _buildMultiLinePopover,
),
ExampleItem(
desc: '自定义圆角',
builder: _buildCustomRadiusPopover,
)
],
);
Expand Down Expand Up @@ -778,4 +782,31 @@ class _TDPopoverPage extends State<TDPopoverPage> {
),
);
}

@Demo(group: 'popover')
Widget _buildCustomRadiusPopover(BuildContext context) {
return Container(
padding: const EdgeInsets.only(top: 0),
margin: const EdgeInsets.all(8),
child: LayoutBuilder(
builder: (_, constraints) {
return TDButton(
size: TDButtonSize.medium,
text: '自定义圆角',
type: TDButtonType.outline,
theme: TDButtonTheme.primary,

onTap: () {
TDPopover.showPopover(
context: _,
width: 200,
radius: BorderRadius.circular(16),
content: '弹出气泡内容弹出气泡内容弹出气泡内容弹出气泡内容',
);
},
);
},
),
);
}
}
2 changes: 2 additions & 0 deletions tdesign-component/lib/src/components/popover/td_popover.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class TDPopover {
Color? overlayColor = Colors.transparent,
OnTap? onTap,
OnLongTap? onLongTap,
BorderRadius? radius,
}) {
return showDialog(
barrierDismissible: closeOnClickOutside,
Expand All @@ -40,6 +41,7 @@ class TDPopover {
height: height,
onTap: onTap,
onLongTap: onLongTap,
radius: radius,
),
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ class TDPopoverWidget extends StatefulWidget {
this.height,
this.onTap,
this.onLongTap,
this.radius
});

/// 上下文
Expand Down Expand Up @@ -119,6 +120,9 @@ class TDPopoverWidget extends StatefulWidget {
/// 长按事件
final OnLongTap? onLongTap;

/// 圆角
final BorderRadius? radius;

@override
State<TDPopoverWidget> createState() => _TDPopoverWidgetState();
}
Expand Down Expand Up @@ -350,7 +354,7 @@ class _TDPopoverWidgetState extends State<TDPopoverWidget> {
height: widget.height,
padding: widget.padding ?? const EdgeInsets.all(12),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(6),
borderRadius: widget.radius ?? BorderRadius.circular(6),
color: _backgroundColor,
boxShadow: const [
BoxShadow(color: Color(0x0d000000), offset: Offset(0, 6), blurRadius: 30, spreadRadius: 5),
Expand Down