Skip to content

Add DartPad to flutter.dev#2938

Merged
legalcodes merged 17 commits into
flutter:masterfrom
legalcodes:dartpadHomepage
Sep 27, 2019
Merged

Add DartPad to flutter.dev#2938
legalcodes merged 17 commits into
flutter:masterfrom
legalcodes:dartpadHomepage

Conversation

@legalcodes

@legalcodes legalcodes commented Aug 27, 2019

Copy link
Copy Markdown
Contributor

Last staged 9/26/19:

https://jt-flutter-website-3.firebaseapp.com (Scroll all the way to the bottom)

@googlebot googlebot added the cla: yes Contributor has signed the Contributor License Agreement label Aug 27, 2019
@legalcodes
legalcodes requested a review from redbrogdon August 27, 2019 01:12
@legalcodes legalcodes added the st.WIP Issue in progress label Aug 27, 2019

@sfshaza2 sfshaza2 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@legalcodes, I think this looks good, but has it been reviewed by @maguinis, @timsneath, and the UX folk?

I wonder if we should include a "Try Flutter" link higher up in the front page. I'm not sure how many ppl scroll down to the bottom. It would be easy to miss that DartPad instance. I also like injecting it into the Install page, but I think it needs to be higher up in the page. It would be easy to miss in the TOC, and it would be equally easy to select a platform and proceed to the next steps without noticing DartPad. I'm wondering if we should add a new step 1: Try Flutter, and then step 2: Install. OR, another suggestion is we replace the big blue "Get started" button at the top right of every page with "Try Flutter". And then the Try Flutter page leads to install.

Just some ideas.

@maguinis

maguinis commented Aug 27, 2019 via email

Copy link
Copy Markdown
Contributor

@sfshaza2

sfshaza2 commented Aug 27, 2019

Copy link
Copy Markdown
Contributor

@maguinis, glad to hear. I was suggesting that we rename the "Get started" button to "Try Flutter", but we could also add a second button that says "Try Flutter" and rename "Get started" to "Install". Years ago @sethladd hammered out my preference for "Download" in favor of "Install" (you probably heard me kicking and screaming). Have we gone back to preferring "Download"?

When you say, A/B testing, how do you mean? Are you suggesting that we do actual A/B testing, or do you mean that it's kind of like an A/B test by having it on both pages?

I really think that "Try Flutter" should be a big blue button on every page. What do the UX folk say?

@johnpryan johnpryan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good overall - thanks Jon! My main concern is around including samples that are affected by dart-lang/dart-pad#1223 initially. Maybe we can leave those out for now.

// Snippet('Strings', strings),
// Snippet('Collection literals', collectionLiterals),
// Snippet('Classes', classes),
// Snippet('Compute Pi', piMonteCarlo),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: commented out code

Comment thread src/_assets/css/_base.scss Outdated
$dash-dartpad-border: #293542;
$dash-callout: #121a26;
$dash-off-white: #f8f9fa;
$dash-dartpad-border: #293542;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this variable is defined twice

Comment thread src/_assets/css/_base.scss Outdated
@@ -1,3 +1,55 @@

$dash-dartpad-border: #293542;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nitpick: Maybe this should be (0, 0, 0, 0.125); to match the card border?

var select = querySelector('#dartpad-select');

var snippets = [
Snippet('Counter', counter),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

My only concern with this and the todo examples is that they require Chrome 77 to work well ( dart-lang/dart-pad#1223).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I agree, I think that just before or after the first DartPad instance, there should be a warning about the version of Chrome that you need.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Cool, as discussed we'll:

  1. Wait until 77
  2. add a warning about the Chrome version

Widget build(BuildContext context) {
return Container(
height: 50,
width: 400,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nitpick: the width doesn't need to be set

border: OutlineInputBorder(),
labelText: labelText,
hintText: hintText),
));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: put a comma between these to and re-format

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Nice catch:

return Container(
        height: 50,
        margin: const EdgeInsets.all(20.0),
        child: TextField(
          obscureText: false,
          decoration: InputDecoration(
              icon: Icon(icon),
              border: OutlineInputBorder(),
              labelText: labelText,
              hintText: hintText),
      )
    );

(without adding a comma, right?)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

adding a comma will tell the formatter to format it like this:

  Widget build(BuildContext context) {
    return Container(
      height: 50,
      width: 400,
      margin: const EdgeInsets.all(20.0),
      child: TextField(
        obscureText: false,
        decoration: InputDecoration(
            icon: Icon(icon),
            border: OutlineInputBorder(),
            labelText: labelText,
            hintText: hintText),
      ),
    );

which I think is a best-practice for readability

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Interesting. Thanks for the tip

'''
.trim();

var strings = '''

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

let's take out the samples that aren't being used - they can be added back in if needed.

import 'package:dartpad_picker/dartpad_picker.dart';

void main() {
if (isMobile()) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This needs to be extended to detect Safari as well due to https://bugs.webkit.org/show_bug.cgi?id=199866.

This is the check we're doing in dart-pad:

if (window.navigator.vendor.contains('Apple') &&
    !window.navigator.userAgent.contains('CriOS') &&
    !window.navigator.userAgent.contains('FxiOS')) {
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this also needs to be changed on site-www dart-lang/site-www#1854


class SpinningSquare extends StatefulWidget {
@override
_SpinningSquareState createState() => new _SpinningSquareState();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nitpick: new isn't required anymore

width: 150.0,
height: 150.0,
color: const Color(0xFF00FF00),
));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

also need a comma here

@sfshaza2

sfshaza2 commented Aug 27, 2019

Copy link
Copy Markdown
Contributor

Some other suggestions, after a in-person discussion with Kathy and Jon:

  • The "Get started" CTA takes you to a page called "Install". This is disconcerting. Let's add a page actually called "Get started". At the top of that page, have the "Try Flutter" Dartpad. Either on that page, or a second page, provide the "install Flutter" option with the platform pre-selected. (Do we want to call it Install or Download? Currently, the platform is NOT pre-selected on flutter.dev, but it is on dart.dev.)
  • Jon is going to look into how much work it would be to do real A/B testing. If it's not an onerous amount of work, then we can test whether one page for try Flutter/install is better or two pages is better. Kathy gave Jon the name of an external Google service that implements A/B testing and works on Firebase, as well as AppEngine.
  • Jon also plans to talk to the UX folk to see if they have a preference for how this is implemented.

@galeyang

Copy link
Copy Markdown
Contributor

Talked to @legalcodes offline. Recommend to divide this into several PRs/issues

  • Landing page:
    We'd suggest to go ahead --- putting DartPad at the bottom of flutter.dev and monitor the usage. We can track the funnel of (1) page visit, (2) to seeing it, (3) and try it. For the "seeing it part", we need to add extra tracking code.

  • Get started and installation parts can be in different PRs.


Detailed feedback about Dartpad on the landing page

  • Heading "Try Flutter in your browser": text color should be #4A4A4A. Same as other headings.
  • iframe border color should be: #cccccc. Same as other use cases on flutter.dev
  • It'd good if the sample code (at least the first one) is visually compelling. In the past UX study, new users may raise concerns if UIs shown on the landing page and showcase page are not very polished.
  • Maybe add a little comments to explain the code since most users are very new to Flutter/Dart when they see the code on the landing page.
  • "Want more practice? Try a codelab." maybe link to the layout codelab since other codelabs require users to install Flutter SDK first.

- Reframe the installation page as the very first step of get started (aka try/install)
- Put the embedded Dartpad above the installation buttons and change the page title.
- Update title in left nav
@legalcodes legalcodes changed the title [WIP] Add DartPad to flutter.dev Add DartPad to flutter.dev Sep 23, 2019
@legalcodes legalcodes removed the st.WIP Issue in progress label Sep 23, 2019

@sfshaza2 sfshaza2 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM!

@maguinis

Copy link
Copy Markdown
Contributor

LGTM from Marketing. Let's ship!

var select = querySelector('#dartpad-select');

var snippets = [
Snippet('Spinning flutter', spinning_logo),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: "Flutter"?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks!

@sfshaza2

Copy link
Copy Markdown
Contributor

I think the last I saw about this PR, Jon was suggesting that we back out changes to the Install page and only update the home page, by adding DP, with no pointers, to the bottom of the page.

It doesn't feel like there's much point to the PR if that's all it does. We would track how many people find the DP instance at the bottom of the page, and that's it.

Thoughts?

@legalcodes

legalcodes commented Sep 26, 2019

Copy link
Copy Markdown
Contributor Author

@sfshaza2 Thank you for your thoughts!

The original goal of this PR was to do just that -- add DartPad to the homepage as a standalone PR. The proposal to add DartPad to the install page came as a later addition, and we have had extensive discussion about the benefits of modifying the install page in a separate PR from this one @galeyang @redbrogdon please feel free to chime in!

Of the ~550 lines of code in this PR, only ~30 pertain to modifying src/docs/get-started/install/index.md so IMHO this is PR is valid on its own, without modifying the install page, since it (1) adds necessary dartpad_picker code to flutter/website and (2) adds DartPad to the homepage, but I am open to hearing other thoughts.

@sfshaza2

Copy link
Copy Markdown
Contributor

LGTM! Ship it! (I'll let you merge it.)

@legalcodes
legalcodes merged commit 06189f3 into flutter:master Sep 27, 2019
Comment thread .gitignore
.flutter-plugins
.packages
.dart_tool
# pubspec.lock

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hi @legalcodes @johnpryan et all. Why was it decided that we'd start committing the pubspec.lock files contained in the repo?

@chalin chalin Oct 15, 2019

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hey all, I created a fresh issue to discuss this (#3107) rather than only having a comment in an old PR. (Sorry for the email notification noise.)

@chalin chalin Oct 16, 2019

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Oups, my bad, I wasn't looking at this edit carefully: you just deleted a commented out line! I'm the one who commented it out in #1237 last year. I didn't realize that it had been that long. I thought that it was a change that had been done in the last 6 months or so. Apologies!

FYI, I'll still go ahead a remove the pubspec.lock files.

Comment thread _config.yml
<i class="fas fa-exclamation-triangle"></i> **Warning:**
end: </aside>

custom:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We should probably drop this custom field/tag at some point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes Contributor has signed the Contributor License Agreement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants