mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2025-11-17 19:07:30 +00:00
feat: implement afdivider (#7803)
This commit is contained in:
parent
6bdaee3a00
commit
f9f151e89e
@ -1,3 +1,4 @@
|
|||||||
export 'button/button.dart';
|
export 'button/button.dart';
|
||||||
|
export 'separator/divider.dart';
|
||||||
export 'modal/modal.dart';
|
export 'modal/modal.dart';
|
||||||
export 'textfield/textfield.dart';
|
export 'textfield/textfield.dart';
|
||||||
|
|||||||
@ -0,0 +1,53 @@
|
|||||||
|
import 'package:appflowy_ui/appflowy_ui.dart';
|
||||||
|
import 'package:flutter/widgets.dart';
|
||||||
|
|
||||||
|
class AFDivider extends StatelessWidget {
|
||||||
|
const AFDivider({
|
||||||
|
super.key,
|
||||||
|
this.axis = Axis.horizontal,
|
||||||
|
this.color,
|
||||||
|
this.thickness = 1.0,
|
||||||
|
this.spacing = 0.0,
|
||||||
|
this.startIndent = 0.0,
|
||||||
|
this.endIndent = 0.0,
|
||||||
|
}) : assert(thickness > 0.0),
|
||||||
|
assert(spacing >= 0.0),
|
||||||
|
assert(startIndent >= 0.0),
|
||||||
|
assert(endIndent >= 0.0);
|
||||||
|
|
||||||
|
final Axis axis;
|
||||||
|
final double thickness;
|
||||||
|
final double spacing;
|
||||||
|
final double startIndent;
|
||||||
|
final double endIndent;
|
||||||
|
final Color? color;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final theme = AppFlowyTheme.of(context);
|
||||||
|
final color = this.color ?? theme.borderColorScheme.greyTertiary;
|
||||||
|
|
||||||
|
return switch (axis) {
|
||||||
|
Axis.horizontal => Container(
|
||||||
|
height: thickness,
|
||||||
|
color: color,
|
||||||
|
margin: EdgeInsetsDirectional.only(
|
||||||
|
start: startIndent,
|
||||||
|
end: endIndent,
|
||||||
|
top: spacing,
|
||||||
|
bottom: spacing,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Axis.vertical => Container(
|
||||||
|
width: thickness,
|
||||||
|
color: color,
|
||||||
|
margin: EdgeInsets.only(
|
||||||
|
left: spacing,
|
||||||
|
right: spacing,
|
||||||
|
top: startIndent,
|
||||||
|
bottom: endIndent,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user