getFormUiTemplate function

String getFormUiTemplate({
  1. String? className,
  2. String? isLoading,
})

Implementation

String getFormUiTemplate({String? className, String? isLoading}) {
  final body = '''Padding(
      padding: const EdgeInsets.all(20.0),
      child: Form(
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            const TextWidget(
              text: "Welcome Back",
              textSize: 24,
              fontWeight: FontWeight.bold,
              isTitle: true,
            ),
            const SizedBox(height: 8),
            const TextWidget(
              text: "Please sign in to continue",
              color: Colors.grey,
            ),
            const SizedBox(height: 32),
            const CommonTextFormField(
              hintText: "Email Address",
              prefixWidget: Icon(Icons.email_outlined),
            ),
            const SizedBox(height: 20),
            const CommonTextFormField(
              isPassword: true,
              hintText: "Password",
              prefixWidget: Icon(Icons.lock_outline),
            ),
            const SizedBox(height: 32),
            SizedBox(
              width: double.infinity,
              height: 50,
              child: ElevatedButton(
                onPressed: () {},
                style: ElevatedButton.styleFrom(
                  backgroundColor: Colors.blue,
                  shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
                ),
                child: const TextWidget(text: "SUBMIT", color: Colors.white, fontWeight: FontWeight.bold),
              ),
            ),
          ],
        ),
      ),
    )''';

  if (className != null) {
    return '''CustomBody(
      title: "$className",
      isLoading: ${isLoading ?? 'false'},
      appBarLeading: const BackButton(),
      child: $body
    )''';
  }
  return body;
}