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

71 lines
2.0 KiB
Dart
Raw Normal View History

2022-08-02 14:49:14 +05:30
import 'package:flutter/material.dart';
2022-08-02 15:56:37 +05:30
import 'package:google_fonts/google_fonts.dart';
import 'package:revanced_manager_flutter/constants.dart';
2022-08-02 14:49:14 +05:30
2022-08-02 15:56:37 +05:30
class InstalledAppItem extends StatefulWidget {
2022-08-02 14:49:14 +05:30
final String name;
final String pkgName;
2022-08-02 15:56:37 +05:30
bool isSelected = false;
2022-08-02 14:49:14 +05:30
2022-08-02 15:56:37 +05:30
InstalledAppItem({
2022-08-02 14:49:14 +05:30
Key? key,
required this.name,
required this.pkgName,
2022-08-02 15:56:37 +05:30
required this.isSelected,
2022-08-02 14:49:14 +05:30
}) : super(key: key);
2022-08-02 15:56:37 +05:30
@override
State<InstalledAppItem> createState() => _InstalledAppItemState();
}
class _InstalledAppItemState extends State<InstalledAppItem> {
2022-08-02 14:49:14 +05:30
@override
Widget build(BuildContext context) {
return Padding(
2022-08-02 15:56:37 +05:30
padding: const EdgeInsets.symmetric(vertical: 4.0),
2022-08-02 14:49:14 +05:30
child: Container(
padding: const EdgeInsets.symmetric(vertical: 12.0, horizontal: 12.0),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: const Color(0xff1B222B),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
2022-08-02 15:56:37 +05:30
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
widget.name,
maxLines: 2,
overflow: TextOverflow.visible,
style: GoogleFonts.inter(
fontSize: 16,
fontWeight: FontWeight.w500,
),
),
const SizedBox(height: 4),
Text(
widget.pkgName,
style: robotoTextStyle,
),
],
),
2022-08-02 14:49:14 +05:30
),
Checkbox(
2022-08-02 15:56:37 +05:30
value: widget.isSelected,
onChanged: (val) {
setState(() {
widget.isSelected = val!;
Navigator.pop(context);
});
},
2022-08-02 14:49:14 +05:30
),
],
),
),
);
}
}