4 почти
This commit is contained in:
parent
c406207bee
commit
33b107c04c
@ -3,7 +3,7 @@ part of 'home_page.dart';
|
||||
class _CardData {
|
||||
final String text;
|
||||
final String info;
|
||||
final String urlImage;
|
||||
final String? urlImage;
|
||||
|
||||
_CardData({required this.text, required this.info, required this.urlImage});
|
||||
}
|
||||
@ -11,7 +11,7 @@ class _CardData {
|
||||
class _Card extends StatefulWidget {
|
||||
final String text;
|
||||
final String info;
|
||||
final String urlImage;
|
||||
final String? urlImage;
|
||||
|
||||
const _Card({super.key, required this.text, required this.info, required this.urlImage});
|
||||
|
||||
@ -36,7 +36,7 @@ class _CardState extends State<_Card> {
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Image.network(
|
||||
widget.urlImage,
|
||||
widget.urlImage ?? 'https://hlebzavod3.ru/images/virtuemart/product/011_IMG_9657.jpg',
|
||||
fit: BoxFit.cover,
|
||||
height: 150.0,
|
||||
width: double.infinity,
|
||||
|
@ -46,7 +46,10 @@ class Body extends StatelessWidget {
|
||||
urlImage: "https://shokoladd.ru/wp-content/uploads/2019/02/Croissant_Chocolate_Plate_Two_547531_2048x1152.jpg"),
|
||||
_CardData(text: "Чиаба́тта",
|
||||
info: "Итальянский пшеничный хлеб, выпекаемый с использованием закваски, дрожжей и оливкового масла",
|
||||
urlImage: "https://avatars.mds.yandex.net/i?id=a9163f90a989a596b26b30ad39beaf47_l-10629685-images-thumbs&n=13")
|
||||
urlImage: "https://avatars.mds.yandex.net/i?id=a9163f90a989a596b26b30ad39beaf47_l-10629685-images-thumbs&n=13"),
|
||||
_CardData(text: "Булочка без картинки",
|
||||
info: "Очень кусьна",
|
||||
urlImage: null)
|
||||
];
|
||||
return Center(
|
||||
child: SingleChildScrollView(
|
||||
@ -57,4 +60,17 @@ class Body extends StatelessWidget {
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
void _showSnackBar(BuildContext context) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_){
|
||||
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
|
||||
content: Text(
|
||||
'Bread liked!',
|
||||
style: Theme.of(context).textTheme.bodyLarge,
|
||||
),
|
||||
backgroundColor: Colors.blueGrey,
|
||||
duration: const Duration(seconds: 1),
|
||||
));
|
||||
});
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user