36 lines
760 B
Dart
36 lines
760 B
Dart
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();
|
|
}
|