getDefaultConfig function

RegisterScreenConfig getDefaultConfig({
  1. String? title,
  2. String? subtitle,
  3. bool showTerms = false,
})

Implementation

RegisterScreenConfig getDefaultConfig({
  String? title,
  String? subtitle,
  bool showTerms = false,
}) {
  return RegisterScreenConfig(
    formConfig: FormConfig(
      showTerms: showTerms,
      title: title ?? "Create An Account",
      subtitle:
          subtitle ??
          "Join now for free and be part of United's global fan community to enjoy exclusive perks & rewards",
      logoPath:
          "https://download.logo.wine/logo/Manchester_United_F.C./Manchester_United_F.C.-Logo.wine.png",
      navigationType: NavigationType.otp,
      fields: [
        FieldConfig(key: 'title', label: 'Title', hint: 'Mr'),
        FieldConfig(
          key: 'name',
          label: 'Name',
          hint: 'John Jun De',
          validator: (value) {
            if (value != null && value.length < 2) {
              return 'Name is too short';
            }
            return null;
          },
        ),
        FieldConfig(key: 'surname', label: 'Surname', hint: 'Ng'),
        FieldConfig(
          key: 'email',
          label: 'Email Address',
          inputType: TextInputType.emailAddress,
          validationRegex: r'^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$',
          validationErrorMessage: 'Please enter a valid email address',
        ),
        FieldConfig(
          key: 'dob',
          label: 'Date of Birth',
          hint: 'DD/MM/YYYY',
          isDate: true,
          inputType: TextInputType.datetime,
          prefix: const Icon(Icons.calendar_today),
        ),
        FieldConfig(
          key: 'mobile',
          label: 'Mobile Number',
          inputType: TextInputType.phone,
          prefix: const Text('+'),
          validationRegex: r'^\d{7,15}$',
          validationErrorMessage: 'Enter 7-15 digits',
        ),
        FieldConfig(
          key: 'address1',
          label: 'Address Line One',
          hint: 'House/apartment number and street name',
        ),
        FieldConfig(key: 'town', label: 'Town/City'),
        FieldConfig(key: 'country', label: 'Country'),
        FieldConfig(
          key: 'password',
          label: 'Password',
          inputType: TextInputType.visiblePassword,
          validationRegex: r'^.{6,}$',
          validationErrorMessage: 'Password must be at least 6 characters',
        ),
        FieldConfig(
          key: 'confirmPassword',
          label: 'Confirm Password',
          inputType: TextInputType.visiblePassword,
          matchKey: 'password',
          matchKeyError: 'Passwords must match',
        ),
      ],
    ),
    uiConfig: UIConfig(
      scaffoldBackgroundColor: Colors.white,
      appBarBackgroundColor: Colors.white,
      titleStyle: const TextStyle(
        fontSize: 24,
        fontWeight: FontWeight.bold,
        color: Colors.black,
      ),
      subtitleStyle: TextStyle(fontSize: 14, color: Colors.grey[600]),

      inputDecorationTheme: InputDecorationTheme(
        border: OutlineInputBorder(
          borderRadius: BorderRadius.circular(8),
          borderSide: BorderSide(color: Colors.grey[300]!),
        ),
        enabledBorder: OutlineInputBorder(
          borderRadius: BorderRadius.circular(8),
          borderSide: BorderSide(color: Colors.grey[300]!),
        ),
        hintStyle: TextStyle(color: Colors.grey[400]),
      ),
    ),
  );
}