Widget build()

in release_dashboard/lib/widgets/cherrypicks_substeps.dart [92:185]


  Widget build(BuildContext context) {
    final StatusState statusState = context.watch<StatusState>();
    final StringBuffer cherrypicksInConflict = StringBuffer();
    final ConductorStatusEntry repositoryCherrypick = widget.repository == Repositories.engine
        ? ConductorStatusEntry.engineCherrypicks
        : ConductorStatusEntry.frameworkCherrypicks;

    if (statusState.releaseStatus![repositoryCherrypick] != null) {
      for (Map<Cherrypick, String> cherrypick
          in statusState.releaseStatus![repositoryCherrypick] as List<Map<Cherrypick, String>>) {
        if (cherrypick[Cherrypick.state] == pb.CherrypickState.PENDING_WITH_CONFLICT.string()) {
          cherrypicksInConflict.writeln('git cherry-pick ${cherrypick[Cherrypick.trunkRevision]!}');
        }
      }
    }

    return Column(
      children: <Widget>[
        if (widget.repository == Repositories.engine)
          CheckboxAsSubstep(
            substepName: CherrypicksSubsteps.substepTitles[CherrypicksSubstep.verifyRelease]!,
            subtitle: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                SelectableText(
                    'Verify if the release number: ${statusState.releaseStatus![ConductorStatusEntry.releaseVersion]}'
                    ' is correct based on existing published releases here: '),
                const UrlButton(
                  textToDisplay: kWebsiteReleasesUrl,
                  urlOrUri: kWebsiteReleasesUrl,
                ),
              ],
            ),
            isChecked: _isEachSubstepChecked[CherrypicksSubstep.verifyRelease]!,
            clickCallback: () {
              substepPressed(CherrypicksSubstep.verifyRelease);
            },
          ),
        CheckboxAsSubstep(
          substepName: CherrypicksSubsteps.substepTitles[CherrypicksSubstep.applyCherrypicks]!,
          subtitle: cherrypicksInConflict.isEmpty
              ? SelectableText('No ${repositoryName(widget.repository)} cherrypick conflicts, just check this substep.')
              : Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    SelectableText('Navigate to the ${repositoryName(widget.repository)} checkout directory '
                        'by pasting the code below to your terminal: '),
                    Padding(
                      padding: const EdgeInsets.fromLTRB(20, 5, 0, 10),
                      child: SelectableText(
                        'cd ${widget.repository == Repositories.engine ? statusState.conductor.engineCheckoutDirectory.path : statusState.conductor.frameworkCheckoutDirectory.path}',
                      ),
                    ),
                    SelectableText(
                        'At that location, apply the following ${repositoryName(widget.repository)} cherrypicks '
                        'that are in conflict by pasting the code below to your terminal and manually resolve any merge conflicts.'
                        ' Then commit the changes without pushing.'),
                    Padding(
                      padding: const EdgeInsets.fromLTRB(20, 5, 0, 10),
                      child: SelectableText(cherrypicksInConflict.toString()),
                    ),
                    const SelectableText('See more information about Flutter Cherrypick Process at: '),
                    const UrlButton(
                      textToDisplay: kReleaseDocumentationUrl,
                      urlOrUri: kReleaseDocumentationUrl,
                    ),
                  ],
                ),
          isChecked: _isEachSubstepChecked[CherrypicksSubstep.applyCherrypicks]!,
          clickCallback: () {
            substepPressed(CherrypicksSubstep.applyCherrypicks);
          },
        ),
        const SizedBox(height: 20.0),
        ContinueButton(
          elevatedButtonKey: Key('apply${repositoryName(widget.repository, true)}CherrypicksContinue'),
          enabled: !_isEachSubstepChecked.containsValue(false),
          error: _error,
          onPressedCallback: () async {
            setError(null);
            setIsLoading(true);
            try {
              await statusState.conductor.conductorNext(context);
            } catch (error, stacktrace) {
              setError(errorToString(error, stacktrace));
            } finally {
              setIsLoading(false);
            }
          },
          isLoading: _isLoading,
        ),
      ],
    );
  }