revanced-manager/lib/ui/widgets/contributorsView/contributors_card.dart

70 lines
2.1 KiB
Dart

import 'package:flutter/material.dart';
import 'package:github/github.dart';
import 'package:revanced_manager/ui/widgets/shared/custom_card.dart';
import 'package:url_launcher/url_launcher.dart';
class ContributorsCard extends StatefulWidget {
final String title;
final List<Contributor> contributors;
final double height;
const ContributorsCard({
Key? key,
required this.title,
required this.contributors,
this.height = 200,
}) : super(key: key);
@override
State<ContributorsCard> createState() => _ContributorsCardState();
}
class _ContributorsCardState extends State<ContributorsCard> {
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 20),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Padding(
padding: const EdgeInsets.only(bottom: 8.0),
child: Text(
widget.title,
style: const TextStyle(
fontSize: 20,
fontWeight: FontWeight.w600,
),
),
),
CustomCard(
child: GridView.builder(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 7,
mainAxisSpacing: 8,
crossAxisSpacing: 8,
),
itemCount: widget.contributors.length,
itemBuilder: (context, index) {
return ClipRRect(
borderRadius: BorderRadius.circular(100),
child: GestureDetector(
onTap: () => launchUrl(
Uri.parse(widget.contributors[index].htmlUrl!)),
child: Image.network(
widget.contributors[index].avatarUrl!,
height: 40,
width: 40,
),
),
);
},
),
),
],
),
);
}
}