divider_widget.dart 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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 Row(
  35. children: [
  36. Container(
  37. color: bgColor,
  38. width: dividerType == DividerType.menu
  39. ? 48
  40. : dividerType == DividerType.menuNoIcon
  41. ? 16
  42. : 0,
  43. height: 1,
  44. ),
  45. Expanded(
  46. child: Container(
  47. color: dividerColor,
  48. height: 1,
  49. width: double.infinity,
  50. ),
  51. ),
  52. ],
  53. );
  54. // return SizedBox(
  55. // width: double.infinity,
  56. // child: Row(
  57. // children: [
  58. // Container(
  59. // color: bgColor,
  60. // height: 1,
  61. // width: dividerType == DividerType.menu
  62. // ? 48
  63. // : dividerType == DividerType.menuNoIcon
  64. // ? 16
  65. // : 0,
  66. // ),
  67. // Container(
  68. // height: 1,
  69. // width: 100,
  70. // color: dividerColor,
  71. // ),
  72. // ],
  73. // ),
  74. // );
  75. // else if (dividerType == DividerType.menu) {
  76. // return Padding(
  77. // padding: const EdgeInsets.only(left: 48),
  78. // child: divider,
  79. // );
  80. // } else if (dividerType == DividerType.menuNoIcon) {
  81. // return Padding(
  82. // padding: const EdgeInsets.only(left: 16),
  83. // child: divider,
  84. // );
  85. // } else if (dividerType == DividerType.bottomBar) {
  86. // return divider;
  87. // } else {
  88. // return const SizedBox.shrink();
  89. // }
  90. }
  91. }