Skip to content

Instantly share code, notes, and snippets.

@Eng-MFQ
Created August 4, 2019 10:59
Show Gist options
  • Save Eng-MFQ/04f63c77891851295dd236f79e97cced to your computer and use it in GitHub Desktop.
Save Eng-MFQ/04f63c77891851295dd236f79e97cced to your computer and use it in GitHub Desktop.
import 'package:flutter/material.dart';
import 'DessertList.dart';
Dessert dessert;
class DessertDetails extends StatelessWidget {
static final routeName = '/DessertDetails';
@override
Widget build(BuildContext context) {
/// you should call this in the main widget the one that has a Material App
/// to get the passed arguments
dessert = ModalRoute.of(context).settings.arguments;
print(dessert);
return MaterialApp(
home: MyApp(),
);
}
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(),
body: Container(
color: Colors.blue,
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Image.network(
'${dessert.imgUrl}',
fit: BoxFit.cover,
),
Padding(
padding: const EdgeInsets.all(16.0),
child: Text(
'${dessert?.name}',
style: TextStyle(fontSize: 50, fontWeight: FontWeight.w900),
),
),
],
),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment