Skip to content

Gallery video demo#13195

Merged
mravn-google merged 13 commits intoflutter:masterfrom
sigurdm:gallery_video_demo
Dec 1, 2017
Merged

Gallery video demo#13195
mravn-google merged 13 commits intoflutter:masterfrom
sigurdm:gallery_video_demo

Conversation

@sigurdm
Copy link
Contributor

@sigurdm sigurdm commented Nov 24, 2017

No description provided.

Copy link
Member

Choose a reason for hiding this comment

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

I think Flutter has a convention of pinning dependencies, i.e. video_player: 0.0.2

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Member

Choose a reason for hiding this comment

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

This is a very long build method, I suggest refactoring it a bit. For example, the onTap builds a whole screen, could that be a separate widget (i.e. FullScreenVideo)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea. I split it into a couple of helper methods. Hope it reads nicer.

@sigurdm sigurdm requested a review from mravn-google November 24, 2017 08:58
Copy link
Contributor

Choose a reason for hiding this comment

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

Can't controller by null here, too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

True!
Done

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not in version 0.0.3!

Copy link
Contributor

Choose a reason for hiding this comment

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

You can use the => short form here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Contributor

Choose a reason for hiding this comment

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

You can use the => short form here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Contributor

Choose a reason for hiding this comment

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

We should avoid abbreviations. imageFadeAnimation

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Contributor

Choose a reason for hiding this comment

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

We can avoid non-Flutterish formatting by inserting some trailing commas in the following lines.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Contributor

Choose a reason for hiding this comment

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

Can't we use an AnimatedWidget here? The code seems pretty low-level.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It would be nice.
Looked into AnimatedOpacity, but it transitions from the current value into the new. I want opacity to go from 1.0 to 0.0 each time. Not sure how it would work.
Also looked into ImplicitlyAnimatedWidget, it has the needed logic, but adds a lot of extra complications.

Leaving this for now

Copy link
Contributor

Choose a reason for hiding this comment

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

Avoid ugly indentation here with a trailing comma.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link
Contributor

Choose a reason for hiding this comment

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

final

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link
Contributor

Choose a reason for hiding this comment

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

Trailing comma.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Contributor Author

@sigurdm sigurdm left a comment

Choose a reason for hiding this comment

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

PTAL

Notice I changed the LoopingController to keep the future for being able to dispose correctly

Copy link
Contributor Author

Choose a reason for hiding this comment

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

True!
Done

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It would be nice.
Looked into AnimatedOpacity, but it transitions from the current value into the new. I want opacity to go from 1.0 to 0.0 each time. Not sure how it would work.
Also looked into ImplicitlyAnimatedWidget, it has the needed logic, but adds a lot of extra complications.

Leaving this for now

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@sethladd
Copy link
Contributor

thanks for this PR! :)

Copy link
Contributor

Choose a reason for hiding this comment

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

This phrase can be interpreted as antagonistic to an American audience. Is there another option we could use?

Copy link
Member

Choose a reason for hiding this comment

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

How about:

new VideoCard(
   title: 'Butterfly',
   subtitle: 'flutters by',
),
new VideoCard(
   title: 'Bee',
   subtitle: 'gently buzzing',
),

?

Copy link
Contributor

Choose a reason for hiding this comment

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

sure :)

bonus points if you can write a haiku!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@googlebot googlebot added cla: no and removed cla: yes labels Dec 1, 2017
@sigurdm sigurdm force-pushed the gallery_video_demo branch from d14cfaf to 21b206a Compare December 1, 2017 11:53
@flutter flutter deleted a comment from googlebot Dec 1, 2017
Copy link
Contributor

@mravn-google mravn-google left a comment

Choose a reason for hiding this comment

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

LGTM

final String subtitle;

const VideoCard({Key key, this.controller, this.title, this.subtitle})
: super(key: key);
Copy link
Contributor

Choose a reason for hiding this comment

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

Could be

const VideoCard({
  Key key,
  this.controller,
  this.title,
  this.subtitle,
}) : super(key: key);

though I don't know if dartfmt leaves it that way.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Dartfmt ruins this. Leaving as is.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

final TransitionRoute<Null> route = new PageRouteBuilder<Null>(
settings: new RouteSettings(name: title, isInitialRoute: false),
pageBuilder: (BuildContext context, Animation<double> animation,
Animation<double> secondaryAnimation) {
Copy link
Contributor

Choose a reason for hiding this comment

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

You could avoid this deep nesting by extracting the onTap handler and/or the pageBuilder as locals above.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

controller.pause();
} else {
imageFadeAnimation = new FadeAnimation(
child: new Icon(Icons.play_arrow, size: 100.0));
Copy link
Contributor

Choose a reason for hiding this comment

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

imageFadeAnimation = new FadeAnimation(
  child: new Icon(Icons.play_arrow, size: 100.0),
);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

final Duration duration;

const FadeAnimation(
{this.child, this.duration: const Duration(milliseconds: 500)});
Copy link
Contributor

Choose a reason for hiding this comment

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

const FadeAnimation({
  this.child,
  this.duration: const Duration(milliseconds: 500),
});

content: const ListTile(
title: const Text('No network'),
subtitle: const Text(
'To load the videos you must have an active network connection'),
Copy link
Contributor

Choose a reason for hiding this comment

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

Add trailing ,

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

super.initState();
connectivitySubscription =
connectivityStream().listen((ConnectivityResult connectivityResult) {
print(connectivityResult);
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

void initState() {
super.initState();
connectivitySubscription =
connectivityStream().listen((ConnectivityResult connectivityResult) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Dunno if this might help:

connectivitySubscription = connectivityStream().listen(
  (ConnectivityResult connectivityResult) {
    ...
  },
);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

class _VideoDemoState extends State<VideoDemo>
with SingleTickerProviderStateMixin {
final VideoPlayerController butterflyController =
new VideoPlayerController(butterflyUri);
Copy link
Contributor

Choose a reason for hiding this comment

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

Trailing comma. Though this one is a little annoying.

  final VideoPlayerController butterflyController = new VideoPlayerController(
    butterflyUri,
  );

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

void initState() {
super.initState();
animationController =
new AnimationController(duration: widget.duration, vsync: this);
Copy link
Contributor

Choose a reason for hiding this comment

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

Trailing ,

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link
Contributor

@mravn-google mravn-google left a comment

Choose a reason for hiding this comment

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

LGTM

final GlobalKey<ScaffoldState> scaffoldKey;

const ConnectivityOverlay(
{this.child, this.connectedCompleter, this.scaffoldKey});
Copy link
Contributor

Choose a reason for hiding this comment

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

Trailing comma

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

}
}

// Shows a
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove or finish.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed

@mravn-google mravn-google merged commit 3a39324 into flutter:master Dec 1, 2017
@Hixie
Copy link
Contributor

Hixie commented Dec 5, 2017

Looks like this PR did not include automatic changes to the gallery's android/ and ios/ directories, which is interfering with people testing with the gallery.

Hixie added a commit to Hixie/flutter that referenced this pull request Dec 5, 2017
@Hixie
Copy link
Contributor

Hixie commented Dec 5, 2017

Fix for Android in #13361

Hixie added a commit that referenced this pull request Dec 6, 2017
DaveShuckerow pushed a commit to DaveShuckerow/flutter that referenced this pull request May 14, 2018
DaveShuckerow pushed a commit to DaveShuckerow/flutter that referenced this pull request May 14, 2018
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants