2022-08-12 20:07:16 +02:00
|
|
|
import 'package:flutter/material.dart';
|
2022-09-12 10:12:34 +02:00
|
|
|
import 'package:flutter_cache_manager/file.dart';
|
|
|
|
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
|
2022-09-12 18:30:44 +02:00
|
|
|
import 'package:flutter_i18n/flutter_i18n.dart';
|
2022-09-05 04:32:36 +02:00
|
|
|
import 'package:revanced_manager/ui/widgets/shared/custom_card.dart';
|
2022-08-12 20:07:16 +02:00
|
|
|
import 'package:url_launcher/url_launcher.dart';
|
|
|
|
|
|
|
|
class ContributorsCard extends StatefulWidget {
|
|
|
|
const ContributorsCard({
|
|
|
|
Key? key,
|
|
|
|
required this.title,
|
|
|
|
required this.contributors,
|
|
|
|
}) : super(key: key);
|
2023-01-30 13:35:06 +01:00
|
|
|
final String title;
|
|
|
|
final List<dynamic> contributors;
|
2022-08-12 20:07:16 +02:00
|
|
|
|
|
|
|
@override
|
|
|
|
State<ContributorsCard> createState() => _ContributorsCardState();
|
|
|
|
}
|
|
|
|
|
|
|
|
class _ContributorsCardState extends State<ContributorsCard> {
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2022-09-12 18:30:44 +02:00
|
|
|
return Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: <Widget>[
|
|
|
|
Padding(
|
|
|
|
padding: const EdgeInsets.only(bottom: 8.0),
|
|
|
|
child: I18nText(
|
|
|
|
widget.title,
|
|
|
|
child: const Text(
|
|
|
|
'',
|
|
|
|
style: TextStyle(
|
2022-09-05 04:32:36 +02:00
|
|
|
fontSize: 20,
|
2022-09-25 14:43:37 +02:00
|
|
|
fontWeight: FontWeight.w500,
|
2022-09-05 04:32:36 +02:00
|
|
|
),
|
2022-08-12 20:07:16 +02:00
|
|
|
),
|
|
|
|
),
|
2022-09-12 18:30:44 +02:00
|
|
|
),
|
|
|
|
CustomCard(
|
|
|
|
child: GridView.builder(
|
|
|
|
shrinkWrap: true,
|
|
|
|
padding: EdgeInsets.zero,
|
|
|
|
physics: const NeverScrollableScrollPhysics(),
|
|
|
|
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
|
|
|
|
crossAxisCount: 6,
|
|
|
|
mainAxisSpacing: 8,
|
|
|
|
crossAxisSpacing: 8,
|
|
|
|
),
|
|
|
|
itemCount: widget.contributors.length,
|
|
|
|
itemBuilder: (context, index) => ClipRRect(
|
|
|
|
borderRadius: BorderRadius.circular(100),
|
|
|
|
child: GestureDetector(
|
|
|
|
onTap: () => launchUrl(
|
|
|
|
Uri.parse(
|
|
|
|
widget.contributors[index]['html_url'],
|
2022-08-12 20:07:16 +02:00
|
|
|
),
|
2023-04-18 16:16:16 +02:00
|
|
|
mode: LaunchMode.externalApplication,
|
2022-09-12 18:30:44 +02:00
|
|
|
),
|
|
|
|
child: FutureBuilder<File?>(
|
|
|
|
future: DefaultCacheManager().getSingleFile(
|
|
|
|
widget.contributors[index]['avatar_url'],
|
|
|
|
),
|
|
|
|
builder: (context, snapshot) => snapshot.hasData
|
|
|
|
? Image.file(snapshot.data!)
|
|
|
|
: Image.network(
|
|
|
|
widget.contributors[index]['avatar_url'],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
2022-09-05 04:32:36 +02:00
|
|
|
),
|
2022-08-12 20:07:16 +02:00
|
|
|
),
|
2022-09-12 18:30:44 +02:00
|
|
|
),
|
|
|
|
],
|
2022-08-12 20:07:16 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|