form_section.dart 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. import 'package:flutter/material.dart';
  2. import '../../core/theme/app_colors.dart';
  3. class FormSection extends StatelessWidget {
  4. final String? title;
  5. final Widget? trailing;
  6. final List<Widget> children;
  7. const FormSection({
  8. super.key,
  9. this.title,
  10. this.trailing,
  11. required this.children,
  12. });
  13. @override
  14. Widget build(BuildContext context) {
  15. return Container(
  16. margin: const EdgeInsets.symmetric(horizontal: 12, vertical: 5),
  17. decoration: BoxDecoration(
  18. color: AppColors.cardWhite,
  19. borderRadius: BorderRadius.circular(10),
  20. boxShadow: [
  21. BoxShadow(
  22. color: Colors.black.withValues(alpha: 0.04),
  23. blurRadius: 4,
  24. offset: const Offset(0, 1),
  25. ),
  26. ],
  27. ),
  28. child: Column(
  29. crossAxisAlignment: CrossAxisAlignment.start,
  30. children: [
  31. if (title != null)
  32. Padding(
  33. padding: const EdgeInsets.fromLTRB(14, 12, 14, 10),
  34. child: Row(
  35. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  36. children: [
  37. Text(
  38. title!,
  39. style: const TextStyle(
  40. fontSize: 13,
  41. fontWeight: FontWeight.w600,
  42. color: AppColors.textPrimary,
  43. ),
  44. ),
  45. ?trailing,
  46. ],
  47. ),
  48. ),
  49. ...children,
  50. ],
  51. ),
  52. );
  53. }
  54. }