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

64 lines
1.9 KiB
Dart
Raw Normal View History

2022-08-02 14:03:46 +05:30
import 'package:flutter/material.dart';
2022-08-07 00:37:12 +01:00
import 'package:flutter_i18n/flutter_i18n.dart';
2022-08-02 14:03:46 +05:30
import 'package:google_fonts/google_fonts.dart';
2022-08-09 00:01:06 +01:00
import 'package:revanced_manager/app/app.locator.dart';
2022-08-06 22:35:35 +01:00
import 'package:revanced_manager/constants.dart';
2022-08-09 00:01:06 +01:00
import 'package:revanced_manager/services/patcher_api.dart';
import 'package:revanced_manager/ui/views/app_selector/app_selector_viewmodel.dart';
2022-08-02 14:03:46 +05:30
class AppSelectorCard extends StatelessWidget {
final Function()? onPressed;
2022-08-12 01:47:10 +05:30
final Color? color;
2022-08-09 00:01:06 +01:00
AppSelectorCard({
2022-08-02 14:03:46 +05:30
Key? key,
this.onPressed,
2022-08-12 01:47:10 +05:30
this.color = const Color(0xff1B222B),
2022-08-02 14:03:46 +05:30
}) : super(key: key);
final PatcherAPI patcherAPI = locator<PatcherAPI>();
2022-08-09 00:01:06 +01:00
2022-08-02 14:03:46 +05:30
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: onPressed,
child: Container(
width: double.infinity,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
2022-08-12 01:47:10 +05:30
color: color,
2022-08-02 14:03:46 +05:30
),
padding: const EdgeInsets.symmetric(vertical: 18, horizontal: 20),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
2022-08-07 00:37:12 +01:00
I18nText(
'appSelectorCard.widgetTitle',
child: Text(
'',
style: GoogleFonts.roboto(
fontSize: 18,
fontWeight: FontWeight.w500,
),
2022-08-02 14:03:46 +05:30
),
),
const SizedBox(height: 10),
locator<AppSelectorViewModel>().selectedApp != null
2022-08-09 00:01:06 +01:00
? Text(
locator<AppSelectorViewModel>().selectedApp!.name,
2022-08-09 00:01:06 +01:00
style: robotoTextStyle,
)
: I18nText(
'appSelectorCard.widgetSubtitle',
child: Text(
'',
style: robotoTextStyle,
),
),
2022-08-02 14:03:46 +05:30
],
),
),
);
}
}