PIbd-32_Shabunov_O.A._Mobil.../lib/presentation/home_page/home_page.dart
2024-10-03 00:24:49 +04:00

61 lines
1.5 KiB
Dart

import 'package:flutter/material.dart';
part 'card.dart';
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key, required this.title});
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Colors.deepPurple.shade200,
title: Text(widget.title),
),
body: const Body(),
);
}
}
class Body extends StatelessWidget {
const Body({super.key});
@override
Widget build(BuildContext context) {
final cardsData = [
_CardData(
title: 'Title 1',
description: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit',
imageUrl: 'https://i.imgur.com/a9WA68S.png',
),
_CardData(
title: 'Title 2',
description: 'Lorem ipsum dolor sit amet',
icon: Icons.add_chart_outlined,
imageUrl: 'https://i.imgur.com/dAUcs6I.png',
),
_CardData(
title: 'Title 3',
description: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor',
imageUrl: 'https://i.imgur.com/m2FhVAK.png',
),
];
return Center(
child: SingleChildScrollView(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: cardsData.map((e) => _Card.fromData(e)).toList(),
),
),
);
}
}