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

74 lines
2.1 KiB
Dart
Raw Normal View History

2022-08-07 02:13:27 +02:00
import 'dart:typed_data';
2022-08-02 11:19:14 +02:00
import 'package:flutter/material.dart';
2022-08-02 12:26:37 +02:00
import 'package:google_fonts/google_fonts.dart';
2022-08-06 23:35:35 +02:00
import 'package:revanced_manager/constants.dart';
2022-08-02 11:19:14 +02:00
2022-08-02 12:26:37 +02:00
class InstalledAppItem extends StatefulWidget {
2022-08-02 11:19:14 +02:00
final String name;
final String pkgName;
2022-08-07 02:13:27 +02:00
final Uint8List icon;
2022-08-02 11:19:14 +02:00
2022-08-07 02:13:27 +02:00
const InstalledAppItem({
2022-08-02 11:19:14 +02:00
Key? key,
required this.name,
required this.pkgName,
2022-08-07 02:13:27 +02:00
required this.icon,
2022-08-02 11:19:14 +02:00
}) : super(key: key);
2022-08-02 12:26:37 +02:00
@override
State<InstalledAppItem> createState() => _InstalledAppItemState();
}
class _InstalledAppItemState extends State<InstalledAppItem> {
2022-08-02 11:19:14 +02:00
@override
Widget build(BuildContext context) {
2022-08-09 01:01:06 +02:00
return Padding(
padding: const EdgeInsets.symmetric(vertical: 4.0),
child: Container(
padding: const EdgeInsets.all(12.0),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: Theme.of(context).colorScheme.primary,
2022-08-09 01:01:06 +02:00
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
width: 48,
height: 48,
padding: const EdgeInsets.symmetric(vertical: 4.0),
alignment: Alignment.center,
child: CircleAvatar(
backgroundColor: Colors.transparent,
2022-08-09 01:01:06 +02:00
child: Image.memory(widget.icon),
2022-08-07 02:13:27 +02:00
),
2022-08-09 01:01:06 +02:00
),
const SizedBox(width: 12),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
widget.name,
maxLines: 2,
overflow: TextOverflow.visible,
style: GoogleFonts.inter(
fontSize: 16,
fontWeight: FontWeight.w500,
2022-08-02 12:26:37 +02:00
),
2022-08-09 01:01:06 +02:00
),
const SizedBox(height: 4),
Text(
widget.pkgName,
style: robotoTextStyle,
),
],
2022-08-02 12:26:37 +02:00
),
2022-08-09 01:01:06 +02:00
),
],
2022-08-02 11:19:14 +02:00
),
),
);
}
}