Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 
 
 
 

106 rindas
3.4 KiB

  1. import 'package:flutter/material.dart';
  2. import 'package:qadirneyriz/config/config.dart';
  3. class ExpansionTileCustom extends StatefulWidget {
  4. final String title;
  5. final String? subTitile;
  6. final List<Widget> widgets;
  7. final bool isForm;
  8. const ExpansionTileCustom({
  9. Key? key,
  10. required this.title,
  11. this.subTitile,
  12. required this.widgets,
  13. this.isForm = false,
  14. }) : super(key: key);
  15. @override
  16. State<ExpansionTileCustom> createState() => _ExpansionTileCustomState();
  17. }
  18. class _ExpansionTileCustomState extends State<ExpansionTileCustom> {
  19. @override
  20. Widget build(BuildContext context) {
  21. return Container(
  22. decoration: widget.isForm
  23. ? BoxDecoration(
  24. border: Border(
  25. bottom: BorderSide(
  26. color:
  27. config.ui.mainGreen, // Set the color of the bottom border
  28. width: 2.0, // Set the width of the bottom border
  29. ),
  30. ),
  31. )
  32. : null,
  33. child: Column(
  34. crossAxisAlignment: CrossAxisAlignment.start,
  35. children: [
  36. if (widget.isForm)
  37. Text(
  38. widget.subTitile ?? '',
  39. style: TextStyle(
  40. fontWeight: FontWeight.normal,
  41. fontSize: 13,
  42. color: Colors.black.withOpacity(.8),
  43. ),
  44. ),
  45. if (widget.isForm)
  46. const SizedBox(
  47. height: 5,
  48. ),
  49. ExpansionTile(
  50. shape: const Border(), // No shape (no shadow)
  51. collapsedShape:
  52. const Border(), // No shape (no shadow when collapsed)
  53. tilePadding: widget.isForm
  54. ? const EdgeInsets.symmetric(horizontal: 5)
  55. : null, // Adjust padding if needed
  56. iconColor: config.ui.secendGreen,
  57. collapsedIconColor: config.ui.secendGreen,
  58. title: Text(
  59. widget.title,
  60. style: TextStyle(
  61. fontSize: 12,
  62. color: Colors.black.withOpacity(.5),
  63. ),
  64. ),
  65. children: [
  66. Padding(
  67. padding: const EdgeInsets.all(8.0),
  68. child: Container(
  69. decoration: (widget.isForm)
  70. ? BoxDecoration(
  71. color: Colors.white,
  72. borderRadius:
  73. BorderRadius.circular(12.0), // Rounded corners
  74. boxShadow: [
  75. BoxShadow(
  76. color:
  77. Colors.black.withOpacity(0.1), // Shadow color
  78. spreadRadius: 1, // Spread of the shadow
  79. blurRadius: 8, // Softening of the shadow
  80. offset: const Offset(
  81. 0, 4), // Positioning of the shadow
  82. ),
  83. ],
  84. )
  85. : null,
  86. child: Padding(
  87. padding: const EdgeInsets.symmetric(vertical: 10),
  88. child: Column(
  89. children:
  90. widget.widgets, // Widgets inside the shadow container
  91. ),
  92. ),
  93. ),
  94. ),
  95. ],
  96. ),
  97. ],
  98. ),
  99. );
  100. }
  101. }