3 готово
This commit is contained in:
parent
8978b5624d
commit
ee88c0e202
@ -59,19 +59,24 @@ class GrandWidget extends StatelessWidget {
|
||||
final data = [
|
||||
_CardData(text: "Батон",
|
||||
info: "Белый хлеб, испечённый в виде продолговатой булки",
|
||||
urlImage: "https://ru.freepik.com/free-photo/baton-bread-and-flour-on-table_8136565.htm#query=%D0%B1%D0%B0%D0%B3%D0%B5%D1%82&position=46&from_view=keyword&track=ais_hybrid&uuid=a7873756-425e-4011-bf7c-4cca79471eef"),
|
||||
urlImage: "https://hlebzavod3.ru/images/virtuemart/product/011_IMG_9657.jpg"),
|
||||
_CardData(text: "Багет",
|
||||
info: "Длинный тонкий вид хлеба французского происхождения",
|
||||
urlImage: "https://ru.freepik.com/free-photo/loaf-of-white-bread_7105195.htm#query=%D0%B1%D0%B0%D0%B3%D0%B5%D1%82&position=33&from_view=keyword&track=ais_hybrid&uuid=a7873756-425e-4011-bf7c-4cca79471eef"),
|
||||
urlImage: "https://main-cdn.sbermegamarket.ru/big1/hlr-system/13/14/29/23/31/01/100027310078b0.jpg"),
|
||||
_CardData(text: "Круассан",
|
||||
info: "Небольшое мучное кондитерское изделие, булочка в форме полумесяца из слоёного теста",
|
||||
urlImage: "https://ru.freepik.com/free-photo/top-view-vegan-baked-products-arrangement_39543140.htm#query=%D0%B1%D0%B0%D0%B3%D0%B5%D1%82&position=21&from_view=keyword&track=ais_hybrid&uuid=a7873756-425e-4011-bf7c-4cca79471eef")
|
||||
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")
|
||||
];
|
||||
return Center(
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Text("Текст",
|
||||
)),
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: data.map((e) => _Card.fromData(e)).toList(),
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -82,4 +87,59 @@ class _CardData {
|
||||
final String urlImage;
|
||||
|
||||
_CardData({required this.text, required this.info, required this.urlImage});
|
||||
}
|
||||
}
|
||||
|
||||
class _Card extends StatelessWidget {
|
||||
final String text;
|
||||
final String info;
|
||||
final String urlImage;
|
||||
|
||||
const _Card({super.key, required this.text, required this.info, required this.urlImage});
|
||||
|
||||
factory _Card.fromData(_CardData data) => _Card(
|
||||
text: data.text,
|
||||
info: data.info,
|
||||
urlImage: data.urlImage);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Card(
|
||||
elevation: 4.0,
|
||||
margin: const EdgeInsets.all(10.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Image.network(
|
||||
urlImage,
|
||||
fit: BoxFit.cover,
|
||||
height: 150.0,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(10.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
text,
|
||||
style: const TextStyle(
|
||||
fontSize: 18.0,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 5.0),
|
||||
Text(
|
||||
info,
|
||||
style: const TextStyle(
|
||||
fontSize: 14.0,
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user