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

79 lines
2.6 KiB
Dart
Raw Normal View History

2022-08-02 10:33:46 +02:00
import 'package:flutter/material.dart';
2022-08-07 01:37:12 +02:00
import 'package:flutter_i18n/flutter_i18n.dart';
2022-08-02 10:33:46 +02:00
import 'package:google_fonts/google_fonts.dart';
2022-08-09 03:30:12 +02:00
import 'package:revanced_manager/app/app.locator.dart';
2022-08-06 23:35:35 +02:00
import 'package:revanced_manager/constants.dart';
2022-08-09 03:30:12 +02:00
import 'package:revanced_manager/ui/views/app_selector/app_selector_viewmodel.dart';
import 'package:revanced_manager/ui/views/patches_selector/patches_selector_viewmodel.dart';
2022-08-02 10:33:46 +02:00
class PatchSelectorCard extends StatelessWidget {
final Function()? onPressed;
2022-08-11 22:17:10 +02:00
final Color? color;
2022-08-02 10:33:46 +02:00
const PatchSelectorCard({
Key? key,
this.onPressed,
2022-08-11 22:17:10 +02:00
this.color = const Color(0xff1B222B),
2022-08-02 10:33:46 +02:00
}) : super(key: key);
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: onPressed,
child: Container(
width: double.infinity,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
2022-08-11 22:17:10 +02:00
color: color,
2022-08-02 10:33:46 +02:00
),
padding: const EdgeInsets.symmetric(vertical: 18, horizontal: 20),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
2022-08-07 01:37:12 +02:00
I18nText(
'patchSelectorCard.widgetTitle',
child: Text(
'',
style: GoogleFonts.roboto(
fontSize: 18,
fontWeight: FontWeight.w500,
),
2022-08-02 10:33:46 +02:00
),
),
const SizedBox(height: 10),
2022-08-09 03:30:12 +02:00
locator<AppSelectorViewModel>().selectedApp == null
? I18nText(
'patchSelectorCard.widgetFirstSubtitle',
child: Text(
'',
style: robotoTextStyle,
),
)
: locator<PatchesSelectorViewModel>().selectedPatches.isEmpty
? I18nText(
'patchSelectorCard.widgetSecondSubtitle',
child: Text(
'',
style: robotoTextStyle,
),
)
: I18nText(
'patchSelectorCard.widgetThirdSubtitle',
translationParams: {
'selected': locator<PatchesSelectorViewModel>()
.selectedPatches
.length
.toString()
},
child: Text(
'',
style: robotoTextStyle,
),
),
2022-08-02 10:33:46 +02:00
],
),
),
);
}
}