creek

The AI Image Editor of 2030

lib/ui/widgets/section_header.dart (1679B)


 1import 'package:flutter/material.dart';
 2import 'package:flutter_svg/flutter_svg.dart';
 3import 'package:creekui/ui/styles/variables.dart';
 4
 5class SectionHeader extends StatelessWidget {
 6  final String title;
 7  final VoidCallback? onTap;
 8  final Widget? trailing;
 9  final bool showArrow;
10
11  const SectionHeader({
12    super.key,
13    required this.title,
14    this.onTap,
15    this.trailing,
16    this.showArrow = true,
17  });
18
19  @override
20  Widget build(BuildContext context) {
21    Widget content = Padding(
22      padding: const EdgeInsets.only(bottom: 12),
23      child: Row(
24        mainAxisAlignment: MainAxisAlignment.spaceBetween,
25        children: [
26          Expanded(
27            child: Text(
28              title,
29              style: const TextStyle(
30                fontFamily: 'GeneralSans',
31                fontSize: 16,
32                fontWeight: FontWeight.w500,
33                height: 24 / 16,
34                color: Variables.textPrimary,
35              ),
36            ),
37          ),
38          if (trailing != null)
39            trailing!
40          else if (showArrow)
41            Transform.rotate(
42              angle: 3.14159,
43              child: SvgPicture.asset(
44                'assets/icons/arrow-left-s-line.svg',
45                width: 24,
46                height: 24,
47                colorFilter: const ColorFilter.mode(
48                  Variables.textPrimary,
49                  BlendMode.srcIn,
50                ),
51              ),
52            ),
53        ],
54      ),
55    );
56
57    if (onTap != null) {
58      return GestureDetector(
59        onTap: onTap,
60        behavior: HitTestBehavior.opaque,
61        child: content,
62      );
63    }
64
65    return content;
66  }
67}