1
0

w_cadre.dart 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. import 'package:flutter/material.dart';
  2. class WCadre extends StatelessWidget {
  3. const WCadre(
  4. {required this.child,
  5. this.title = "",
  6. this.titleleft,
  7. this.titleright,
  8. this.bottom,
  9. this.bottomright,
  10. this.bottomleft,
  11. this.color = Colors.grey,
  12. this.background = Colors.black,
  13. this.height,
  14. super.key});
  15. final dynamic title;
  16. final Widget? titleright;
  17. final Widget? titleleft;
  18. final Widget child;
  19. final dynamic bottom;
  20. final Widget? bottomright;
  21. final Widget? bottomleft;
  22. final Color color;
  23. final Color background;
  24. final double? height;
  25. @override
  26. Widget build(BuildContext context) {
  27. return Container(
  28. // width: 300,
  29. height: height,
  30. decoration: BoxDecoration(
  31. color: Colors.black,
  32. border: Border.all(
  33. width: 3,
  34. color: Colors.grey,
  35. ),
  36. ),
  37. child: Column(
  38. children: [
  39. if (titleleft != null || title != "" || titleright != null) ...[
  40. Row(
  41. mainAxisSize: MainAxisSize.max,
  42. children: [
  43. if (titleleft != null) titleleft!,
  44. Expanded(
  45. child: Container(
  46. alignment: Alignment.center,
  47. child: (title is Widget)
  48. ? title
  49. : Text(
  50. "$title",
  51. style: const TextStyle(
  52. fontSize: 22,
  53. fontWeight: FontWeight.w600,
  54. color: Colors.blue),
  55. ))),
  56. if (titleright != null) titleright!,
  57. ],
  58. ),
  59. Divider(
  60. height: 3,
  61. thickness: 2,
  62. color: color,
  63. )
  64. ],
  65. if (height == null)
  66. child
  67. else
  68. Expanded(
  69. child: SingleChildScrollView(
  70. child: child,
  71. ),
  72. ),
  73. if (bottomleft != null || bottom != null || bottomright != null) ...[
  74. Divider(
  75. height: 2,
  76. thickness: 1,
  77. color: color,
  78. ),
  79. Row(
  80. children: [
  81. if (bottomleft != null) bottomleft!,
  82. Expanded(
  83. child: Container(
  84. alignment: Alignment.center,
  85. child: (bottom is Widget)
  86. ? bottom
  87. : Text(
  88. "${bottom ?? ''}",
  89. style: const TextStyle(
  90. fontSize: 12, color: Colors.grey),
  91. )),
  92. ),
  93. if (bottomright != null) bottomright!,
  94. ],
  95. )
  96. ],
  97. ],
  98. ),
  99. );
  100. }
  101. }