revanced-manager/lib/ui/widgets/patch_item.dart

90 lines
2.6 KiB
Dart
Raw Normal View History

2022-08-07 20:05:44 +02:00
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
2022-08-09 01:01:06 +02:00
// ignore: must_be_immutable
2022-08-07 21:15:52 +02:00
class PatchItem extends StatefulWidget {
2022-08-07 20:05:44 +02:00
final String name;
2022-08-09 03:30:12 +02:00
final String simpleName;
2022-08-07 20:05:44 +02:00
final String description;
final String version;
2022-08-07 21:15:52 +02:00
bool isSelected;
2022-08-07 20:05:44 +02:00
PatchItem({
Key? key,
required this.name,
2022-08-09 03:30:12 +02:00
required this.simpleName,
2022-08-07 20:05:44 +02:00
required this.description,
required this.version,
required this.isSelected,
}) : super(key: key);
2022-08-07 21:15:52 +02:00
@override
State<PatchItem> createState() => _PatchItemState();
}
class _PatchItemState extends State<PatchItem> {
2022-08-07 20:05:44 +02:00
@override
Widget build(BuildContext context) {
return Container(
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.primary,
borderRadius: BorderRadius.circular(12),
2022-08-07 20:05:44 +02:00
),
padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 12),
margin: const EdgeInsets.symmetric(vertical: 4, horizontal: 8),
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Flexible(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(
2022-08-09 03:30:12 +02:00
widget.simpleName,
2022-08-07 20:05:44 +02:00
style: GoogleFonts.inter(
fontSize: 16,
fontWeight: FontWeight.w600,
),
),
const SizedBox(width: 4),
2022-08-07 21:15:52 +02:00
Text(widget.version)
2022-08-07 20:05:44 +02:00
],
),
const SizedBox(height: 4),
Text(
2022-08-07 21:15:52 +02:00
widget.description,
2022-08-07 20:05:44 +02:00
softWrap: true,
maxLines: 3,
overflow: TextOverflow.visible,
style: GoogleFonts.roboto(
fontSize: 14,
),
),
],
),
),
Transform.scale(
scale: 1.2,
child: Checkbox(
2022-08-07 21:15:52 +02:00
value: widget.isSelected,
activeColor: Colors.blueGrey[500],
onChanged: (newValue) {
setState(() {
widget.isSelected = newValue!;
});
},
2022-08-07 20:05:44 +02:00
),
)
],
)
],
),
);
}
}