mirror of
https://github.com/ReVanced/revanced-manager.git
synced 2025-05-11 13:05:37 +02:00
refactor: split widgets folder by screen usage.
This commit is contained in:
parent
e2c99d6340
commit
2c243b75dd
21 changed files with 17 additions and 17 deletions
96
lib/ui/widgets/patchesSelectorView/patch_item.dart
Normal file
96
lib/ui/widgets/patchesSelectorView/patch_item.dart
Normal file
|
@ -0,0 +1,96 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
|
||||
// ignore: must_be_immutable
|
||||
class PatchItem extends StatefulWidget {
|
||||
final String name;
|
||||
final String simpleName;
|
||||
final String description;
|
||||
final String version;
|
||||
bool isSelected;
|
||||
final Function(bool) onChanged;
|
||||
|
||||
PatchItem({
|
||||
Key? key,
|
||||
required this.name,
|
||||
required this.simpleName,
|
||||
required this.description,
|
||||
required this.version,
|
||||
required this.isSelected,
|
||||
required this.onChanged,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<PatchItem> createState() => _PatchItemState();
|
||||
}
|
||||
|
||||
class _PatchItemState extends State<PatchItem> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
setState(() => widget.isSelected = !widget.isSelected);
|
||||
widget.onChanged(widget.isSelected);
|
||||
},
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
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(
|
||||
widget.simpleName,
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
Text(widget.version)
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
widget.description,
|
||||
softWrap: true,
|
||||
maxLines: 3,
|
||||
overflow: TextOverflow.visible,
|
||||
style: GoogleFonts.roboto(
|
||||
fontSize: 14,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Transform.scale(
|
||||
scale: 1.2,
|
||||
child: Checkbox(
|
||||
value: widget.isSelected,
|
||||
activeColor: Colors.blueGrey[500],
|
||||
onChanged: (newValue) {
|
||||
setState(() => widget.isSelected = newValue!);
|
||||
widget.onChanged(widget.isSelected);
|
||||
},
|
||||
),
|
||||
)
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue