buildForm method

  1. @override
JobBody buildForm(
  1. BuildContext context
)
override

Implementation

@override
j.JobBody buildForm(BuildContext context) {
  return j.JobBody(
      onRemoveJob: () =>
          Provider.of<GlobalJobStack>(context, listen: false).removeJob(this),
      children: <Widget>[
        j.JobTitle(
          title: Provider.of<InternationalizationNotifier>(context)
              .i18n
              .singleImgJob
              .canonical_name,
          subtitle: timestamp.canonicalizedTimeString,
        ),
        const Padding(
          padding: EdgeInsets.symmetric(vertical: 4),
          child: Divider(thickness: 1, color: kThemePrimaryFg3),
        ),
        j.JobSinglePathPickerActionable(
            validator: (String? value) async {
              String? validFile = await FilePathValidators.validateFilePath(value);
              if (validFile != null) {
                return validFile;
              }
              String ext = paths.extension(value!).substring(
                  1); // since paths.extension will return the ".", we need to remove it
              if (!ImageMedium.I.isSupportedOutput(ext)) {
                // we use bang on value because the previous validateFilePath call has a null check that returns a value to validFile
                return (context.mounted
                        ? Provider.of<InternationalizationNotifier>(context,
                            listen: false)
                        : InternationalizationNotifier())
                    .i18n
                    .appGenerics
                    .MIX_is_not_supported(ext);
              }
              return null;
            },
            onChanged: (String str) {},
            allowedExtensions: List<String>.empty(),
            canonicalLabel: "Input file path",
            filePickerLabel:
                Provider.of<InternationalizationNotifier>(context, listen: false)
                    .i18n
                    .appGenerics
                    .browse),
        const SizedBox(height: 6),
      ]);
}