getPresentationWidgetsCustomPhonefieldTemplate function

String getPresentationWidgetsCustomPhonefieldTemplate(
  1. String projectName
)

Implementation

String getPresentationWidgetsCustomPhonefieldTemplate(String projectName) {
  return '''
import 'package:flutter/material.dart';
import 'package:${projectName}/core/utils/responsive_size.dart';
import 'package:${projectName}/presentation/widgets/text_input_widget.dart';
import 'package:${projectName}/presentation/widgets/text_widget.dart';

import '../../core/theme/app_colors.dart';

class CustomPhoneField extends StatefulWidget {
  final TextEditingController controller;
  final FormFieldValidator<String>? validator;

  const CustomPhoneField({super.key, required this.controller, this.validator});

  @override
  State<CustomPhoneField> createState() => _CustomPhoneFieldState();
}

class _CustomPhoneFieldState extends State<CustomPhoneField> {
  String selectedCode = "+61";

  final List<String> countryCodes = ["+1", "+44", "+61", "+91"];

  @override
  Widget build(BuildContext context) {
    return CommonTextFormField(
      controller: widget.controller,
      textInputType: TextInputType.phone,
      validator: widget.validator,
      hintText: "456 8456 4456",
      prefixWidget: Padding(
        padding: const EdgeInsets.only(left: 8),
        child: IntrinsicWidth(
          child: Row(
            mainAxisSize: MainAxisSize.min,
            children: [
              // DropdownButton<String>(
              //   value: selectedCode,
              //   underline: const SizedBox(),
              //   icon: const Icon(Icons.keyboard_arrow_down),
              //   items: countryCodes.map((code) {
              //     return DropdownMenuItem(value: code, child: Text(code));
              //   }).toList(),
              //   onChanged: (value) {
              //     setState(() {
              //       selectedCode = value!;
              //     });
              //   },
              // ),
              //
              TextWidget(
                text: "+44",
                textSize: 15.sp,
                fontWeight: FontWeight.w500,
              ),
              SizedBox(width: 8.sp),

              Container(
                margin: EdgeInsets.symmetric(vertical: 2.sp),
                width: 1,
                height: 32.sp,
                color: AppColors.phoneSideBorder,
              ),
            ],
          ),
        ),
      ),
    );
  }
}
''';
}