ente/mobile/lib/ui/components/divider_widget.dart

76 lines
1.7 KiB
Dart
Raw Normal View History

2022-11-02 07:39:36 +00:00
import 'package:flutter/material.dart';
import 'package:photos/theme/ente_theme.dart';
enum DividerType {
solid,
menu,
menuNoIcon,
bottomBar,
}
class DividerWidget extends StatelessWidget {
final DividerType dividerType;
final Color bgColor;
2023-03-13 06:34:52 +00:00
final bool divColorHasBlur;
final EdgeInsets? padding;
2022-11-02 07:39:36 +00:00
const DividerWidget({
required this.dividerType,
this.bgColor = Colors.transparent,
2023-03-13 06:34:52 +00:00
this.divColorHasBlur = true,
this.padding,
2022-11-02 07:39:36 +00:00
super.key,
});
@override
Widget build(BuildContext context) {
2023-03-13 06:34:52 +00:00
final dividerColor = divColorHasBlur
? getEnteColorScheme(context).blurStrokeFaint
: getEnteColorScheme(context).strokeFaint;
2022-11-08 09:20:30 +00:00
2022-11-02 07:39:36 +00:00
if (dividerType == DividerType.solid) {
2023-03-20 15:09:37 +00:00
return Padding(
padding: padding ?? EdgeInsets.zero,
child: Container(
color: getEnteColorScheme(context).strokeFaint,
width: double.infinity,
height: 1,
),
2022-11-02 07:39:36 +00:00
);
}
if (dividerType == DividerType.bottomBar) {
2023-03-20 15:09:37 +00:00
return Padding(
padding: padding ?? EdgeInsets.zero,
child: Container(
color: dividerColor,
width: double.infinity,
height: 1,
),
2022-11-02 07:39:36 +00:00
);
}
2022-11-08 10:01:47 +00:00
return Container(
color: bgColor,
padding: padding ?? EdgeInsets.zero,
2022-11-08 10:01:47 +00:00
child: Row(
children: [
SizedBox(
width: dividerType == DividerType.menu
? 48
: dividerType == DividerType.menuNoIcon
? 16
: 0,
2022-11-02 07:39:36 +00:00
height: 1,
),
2022-11-08 10:01:47 +00:00
Expanded(
child: Container(
color: dividerColor,
height: 1,
width: double.infinity,
),
),
],
),
2022-11-02 07:39:36 +00:00
);
}
}