@@ -113,13 +113,14 @@ class _MovieDetailState extends State<MovieDetail> {
113113 mainAxisAlignment: MainAxisAlignment .spaceBetween,
114114 children: [
115115 LoginGuard (
116- widgetToGuard: OutlinedButton .icon (
117- onPressed: () {
118- _toggleFavorite ();
119- },
120- icon: Icon (_favorited ? Icons .favorite : Icons .favorite_border),
121- label: Text (_getFavoriteLabelText ()),
122- ))
116+ builder: (context) => OutlinedButton .icon (
117+ onPressed: () {
118+ _toggleFavorite ();
119+ },
120+ icon: Icon (_favorited ? Icons .favorite : Icons .favorite_border),
121+ label: Text (_getFavoriteLabelText ()),
122+ ),
123+ )
123124 ],
124125 )
125126 ];
@@ -224,28 +225,31 @@ class _MovieDetailState extends State<MovieDetail> {
224225 },
225226 ),
226227 LoginGuard (
227- widgetToGuard: TextField (
228- decoration: const InputDecoration (
229- hintText: "Write your review" ,
230- border: OutlineInputBorder (),
231- ),
232- controller: _reviewTextController,
228+ builder: (context) => TextField (
229+ decoration: const InputDecoration (
230+ hintText: "Write your review" ,
231+ border: OutlineInputBorder (),
233232 ),
234- message: "writing a review" ),
233+ controller: _reviewTextController,
234+ ),
235+ message: "writing a review" ,
236+ ),
235237 LoginGuard (
236- widgetToGuard : OutlinedButton .icon (
238+ builder : (context) => OutlinedButton .icon (
237239 onPressed: () {
238240 MoviesConnector .instance
239241 .addReview (
240242 movieId: widget.id,
241243 rating: _ratingValue.toInt (),
242244 reviewText: _reviewTextController.text)
243245 .execute ()
244- .then ((_) {
245- _refreshData ();
246- _reviewTextController.clear ();
247- MovieState .triggerUpdateFavorite ();
248- });
246+ .then (
247+ (_) {
248+ _refreshData ();
249+ _reviewTextController.clear ();
250+ MovieState .triggerUpdateFavorite ();
251+ },
252+ );
249253 },
250254 label: const Text ('Submit Review' ),
251255 ),
0 commit comments