From 0c774366594d944e2250fd35ae3585fd1a04ec29 Mon Sep 17 00:00:00 2001 From: Felix Kirchner Date: Wed, 9 Jul 2025 15:20:05 +0200 Subject: [PATCH] Implemented CustomRowForm Widget --- lib/presentation/widgets/custom_form_row.dart | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 lib/presentation/widgets/custom_form_row.dart diff --git a/lib/presentation/widgets/custom_form_row.dart b/lib/presentation/widgets/custom_form_row.dart new file mode 100644 index 0000000..61d0fdb --- /dev/null +++ b/lib/presentation/widgets/custom_form_row.dart @@ -0,0 +1,49 @@ +import 'package:cabo_counter/utility/custom_theme.dart'; +import 'package:flutter/cupertino.dart'; + +class CustomFormRow extends StatefulWidget { + final String prefixText; + final IconData prefixIcon; + final Widget? suffixWidget; + final void Function()? onTap; + const CustomFormRow({ + super.key, + required this.prefixText, + required this.prefixIcon, + required this.onTap, + this.suffixWidget, + }); + + @override + State createState() => _CustomFormRowState(); +} + +class _CustomFormRowState extends State { + late Widget suffixWidget; + @override + void initState() { + super.initState(); + suffixWidget = widget.suffixWidget ?? const SizedBox.shrink(); + } + + @override + Widget build(BuildContext context) { + return GestureDetector( + onTap: widget.onTap, + child: CupertinoFormRow( + prefix: Row( + children: [ + Icon( + widget.prefixIcon, + color: CustomTheme.primaryColor, + ), + const SizedBox(width: 10), + Text(widget.prefixText), + ], + ), + padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 15), + child: suffixWidget, + ), + ); + } +}