getLoginUiTemplate function

String getLoginUiTemplate({
  1. required String className,
  2. required String isLoading,
  3. bool addApiCalling = false,
})

Implementation

String getLoginUiTemplate(
    {required String className,
    required String isLoading,
    bool addApiCalling = false}) {
  return '''
CustomBody(
      title: "",
      isLoading: $isLoading,
      padding: EdgeInsets.zero,
      backgroundColor: AppColors.white,
      child: SingleChildScrollView(
        child: Column(
          children: [
            // Top Section (Logo)
            Container(
              width: 100.sw,
              height: 280.sp,
              decoration: const BoxDecoration(
                gradient: LinearGradient(
                  begin: Alignment.topCenter,
                  end: Alignment.bottomCenter,
                  colors: [AppColors.primary, AppColors.secondary],
                ),
              ),
              child: Column(
                mainAxisAlignment: MainAxisAlignment.center,
                children: [
                  Container(
                    width: 110.sp,
                    height: 110.sp,
                    decoration: BoxDecoration(
                      color: AppColors.white.withOpacity(0.24),
                      shape: BoxShape.circle,
                    ),
                    child: Center(
                      child: Container(
                        width: 80.sp,
                        height: 80.sp,
                        decoration: const BoxDecoration(
                          color: AppColors.white,
                          shape: BoxShape.circle,
                        ),
                        child: Icon(
                          Icons.security_outlined,
                          size: 45.sp,
                          color: AppColors.primary,
                        ),
                      ),
                    ),
                  ),
                  SizedBox(height: 20.sp),
                  TextWidget(
                    text: "Enterprise App",
                    textSize: 24.sp,
                    fontWeight: FontWeight.bold,
                    color: AppColors.white,
                  ),
                  TextWidget(
                    text: "Secure & Professional Access",
                    textSize: 14.sp,
                    color: AppColors.white.withOpacity(0.8),
                  ),
                ],
              ),
            ),

            // Bottom Section (Form Sheet)
            Transform.translate(
              offset: Offset(0, -30.sp),
              child: Container(
                width: 100.sw,
                padding: EdgeInsets.all(30.sp),
                decoration: BoxDecoration(
                  color: AppColors.white,
                  borderRadius: BorderRadius.only(
                    topLeft: Radius.circular(40.sp),
                    topRight: Radius.circular(40.sp),
                  ),
                  boxShadow: [
                    BoxShadow(
                      color: AppColors.black.withOpacity(0.05),
                      blurRadius: 10,
                      offset: const Offset(0, -5),
                    ),
                  ],
                ),
                child: Column(
                  children: [
                    TextWidget(
                      text: "Sign In",
                      textSize: 26.sp,
                      fontWeight: FontWeight.bold,
                      color: AppColors.primary,
                    ),
                    SizedBox(height: 40.sp),

                    CommonTextFormField(
                      hintText: "Email Address",
                      prefixWidget: Icon(Icons.alternate_email, size: 20.sp, color: AppColors.grey),
                    ),

                    SizedBox(height: 25.sp),

                    CommonTextFormField(
                      hintText: "Password",
                      isPassword: true,
                      prefixWidget: Icon(Icons.lock_open_rounded, size: 20.sp, color: AppColors.grey),
                    ),

                    SizedBox(height: 15.sp),
                    Align(
                      alignment: Alignment.centerRight,
                      child: TextButton(
                        onPressed: () {},
                        child: TextWidget(
                          text: "Recovery Password?",
                          color: AppColors.primary,
                          fontWeight: FontWeight.w600,
                          textSize: 14.sp,
                        ),
                      ),
                    ),

                    SizedBox(height: 40.sp),
                    GestureDetector(
                      onTap: () {
                         ${addApiCalling ? "context.read<${className}Bloc>().add(${className}Submit());" : ""}
                      },
                      child: Container(
                        width: 100.sw,
                        height: 55.sp,
                        decoration: BoxDecoration(
                          color: AppColors.primary,
                          borderRadius: BorderRadius.circular(100.sp), // Pill shape
                          boxShadow: [
                            BoxShadow(
                              color: AppColors.primary.withOpacity(0.35),
                              blurRadius: 10,
                              offset: const Offset(0, 5),
                            ),
                          ],
                        ),
                        child: Center(
                          child: TextWidget(
                            text: "Log In",
                            textSize: 18.sp,
                            fontWeight: FontWeight.bold,
                            color: AppColors.white,
                          ),
                        ),
                      ),
                    ),

                    SizedBox(height: 40.sp),
                    Row(
                      mainAxisAlignment: MainAxisAlignment.center,
                      children: [
                        TextWidget(
                          text: "New here? ",
                          textSize: 14.sp,
                          color: AppColors.grey,
                        ),
                        GestureDetector(
                          onTap: () {},
                          child: TextWidget(
                            text: "Create Account",
                            textSize: 14.sp,
                            color: AppColors.primary,
                            fontWeight: FontWeight.bold,
                          ),
                        ),
                      ],
                    ),
                    SizedBox(height: 50.sp),
                  ],
                ),
              ),
            ),
          ],
        ),
      ),
    )''';
}