divider_widget.dart 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. import 'package:flutter/material.dart';
  2. import 'package:photos/theme/ente_theme.dart';
  3. enum DividerType {
  4. solid,
  5. menu,
  6. menuNoIcon,
  7. bottomBar,
  8. }
  9. class DividerWidget extends StatelessWidget {
  10. final DividerType dividerType;
  11. final Color bgColor;
  12. const DividerWidget({
  13. required this.dividerType,
  14. this.bgColor = Colors.transparent,
  15. super.key,
  16. });
  17. @override
  18. Widget build(BuildContext context) {
  19. final dividerColor = getEnteColorScheme(context).blurStrokeFaint;
  20. if (dividerType == DividerType.solid) {
  21. return Container(
  22. color: getEnteColorScheme(context).strokeFaint,
  23. width: double.infinity,
  24. height: 1,
  25. );
  26. }
  27. if (dividerType == DividerType.bottomBar) {
  28. return Container(
  29. color: dividerColor,
  30. width: double.infinity,
  31. height: 1,
  32. );
  33. }
  34. return Container(
  35. color: bgColor,
  36. child: Row(
  37. children: [
  38. SizedBox(
  39. width: dividerType == DividerType.menu
  40. ? 48
  41. : dividerType == DividerType.menuNoIcon
  42. ? 16
  43. : 0,
  44. height: 1,
  45. ),
  46. Expanded(
  47. child: Container(
  48. color: dividerColor,
  49. height: 1,
  50. width: double.infinity,
  51. ),
  52. ),
  53. ],
  54. ),
  55. );
  56. }
  57. }