Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 
 
 
 

109 rader
3.5 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: Padding(
  59. padding: const EdgeInsets.symmetric(horizontal: 10),
  60. child: Text(
  61. widget.title,
  62. style: TextStyle(
  63. fontSize: 12,
  64. color: Colors.black.withOpacity(.5),
  65. ),
  66. ),
  67. ),
  68. children: [
  69. Padding(
  70. padding: const EdgeInsets.all(8.0),
  71. child: Container(
  72. decoration: (widget.isForm)
  73. ? BoxDecoration(
  74. color: Colors.white,
  75. borderRadius:
  76. BorderRadius.circular(12.0), // Rounded corners
  77. boxShadow: [
  78. BoxShadow(
  79. color:
  80. Colors.black.withOpacity(0.1), // Shadow color
  81. spreadRadius: 1, // Spread of the shadow
  82. blurRadius: 8, // Softening of the shadow
  83. offset: const Offset(
  84. 0, 4), // Positioning of the shadow
  85. ),
  86. ],
  87. )
  88. : null,
  89. child: Padding(
  90. padding: const EdgeInsets.symmetric(vertical: 10),
  91. child: Column(
  92. children:
  93. widget.widgets, // Widgets inside the shadow container
  94. ),
  95. ),
  96. ),
  97. ),
  98. ],
  99. ),
  100. ],
  101. ),
  102. );
  103. }
  104. }