Skip to content

Conversation

@yaakovschectman
Copy link
Contributor

Previously, the platform_view example project was implemented only for iOS and Android. As part of issue #70027 , a Windows implementation was added in order to add a startup test for this project. This project utilizes platform-dependent views for iOS and Android that are displayed when a button is pressed. While the startup test for Windows passed as-is already, nothing would happen when the button is pressed on Windows. This PR implements a message box that displays when the button is pressed.

Addresses issue #109683

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I signed the CLA.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@yaakovschectman yaakovschectman added a: tests "flutter test", flutter_test, or one of our tests platform-windows Building on or for Windows specifically a: desktop Running on desktop labels Aug 17, 2022
@yaakovschectman yaakovschectman self-assigned this Aug 17, 2022
@flutter-dashboard flutter-dashboard bot added d: examples Sample code and demos c: contributor-productivity Team-specific productivity, code health, technical debt. labels Aug 17, 2022
@yaakovschectman yaakovschectman marked this pull request as ready for review August 17, 2022 20:43
return const Text('Continue in iOS view');
} else if (Platform.isWindows) {
return Text('Cotninue in Windows view');
return const Text('Cotninue in Windows view');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: typo in 'Continue'

result->Success(flutter::EncodableValue(counter));
}
);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Give clang-format a run over this file. Line 22 is getting pretty long :)

Copy link
Member

@cbracken cbracken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm modulo a couple nits :)

LGTM stamp from a Japanese personal seal

});
}

Text _getButtonText() {
Copy link
Contributor

@a-wallen a-wallen Aug 17, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: since this function has no parameter list, you could make it a static getter.

  static Widget get buttonText {
    // ... code here
  }

you can choose to ignore this :)

}

Text _getButtonText() {
if (Platform.isAndroid) {
Copy link
Contributor

@a-wallen a-wallen Aug 17, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: use TargetPlatform and a switch case so that we know what is unimplemented

import 'package:flutter/foundation.dart';

// your code here...

switch(defaultTargetPlatform) {
      case TargetPlatform.android:
        return const Text('Continue in Android view');
      case TargetPlatform.iOS:
        return const Text('Continue in iOS view');
      case TargetPlatform.windows:
        return const Text('Continue in Windows view');
      case TargetPlatform.fuchsia:
      case TargetPlatform.macOS:
      case TargetPlatform.linux:
        throw UnimplementedError();
}

You can choose to ignore this.

Copy link
Member

@cbracken cbracken Aug 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for spotting this! I was going to make the same comment then ended up going "I could have sworn this was an enum at some point, but apparently not!". There is a small difference between the two -- apps can fake out the platform they're running in via the enum, but not via these checks. In this case that's fine :)

Years ago we did a blast through as much of the code as we could to kill if-else blocks on enums and replace with switch since our linter enforces that all cases are covered but looks like we didn't check the examples!

#include <flutter/standard_method_codec.h>

#include <cstdint>
#include <iostream>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this used? Perhaps double-check that the other includes are also all used.

engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 18, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Aug 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: desktop Running on desktop a: tests "flutter test", flutter_test, or one of our tests c: contributor-productivity Team-specific productivity, code health, technical debt. d: examples Sample code and demos platform-windows Building on or for Windows specifically

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants