PIbd-32_Stroev_V_M_PMD/lib/presentation/home_page/card.dart

36 lines
760 B
Dart
Raw Permalink Normal View History

2024-10-22 08:55:54 +04:00
part of 'home_page.dart';
typedef OnLikeCallBack = void Function(String title, bool isLiked)?;
class _Card extends StatefulWidget {
final String name;
final int age;
final List<String> courses;
final String? imageUrl;
final OnLikeCallBack onLike;
final VoidCallback? onTap;
const _Card(
this.name, {
required this.age,
required this.courses,
this.imageUrl,
this.onLike,
this.onTap,
});
factory _Card.fromData(Student data,
{OnLikeCallBack onLike, VoidCallback? onTap}) =>
_Card(
data.name,
age: data.age,
courses: data.courses,
imageUrl: data.image,
onLike: onLike,
onTap: onTap,
);
@override
State<_Card> createState() => _CardState();
}