feat: add empty cards in app listings of the home view

This commit is contained in:
Alberto Ponces 2022-09-02 00:10:10 +01:00
parent 6487284dd2
commit 7723bb717c
3 changed files with 95 additions and 32 deletions

View File

@ -10,6 +10,8 @@
"updatesSubtitle": "Updates", "updatesSubtitle": "Updates",
"patchedSubtitle": "Patched Applications", "patchedSubtitle": "Patched Applications",
"updatesAvailable": "Updates Available", "updatesAvailable": "Updates Available",
"noUpdates": "No updates available",
"noInstallations": "No patched apps installed",
"installed": "Installed", "installed": "Installed",
"notificationTitle": "ReVanced Manager was updated!", "notificationTitle": "ReVanced Manager was updated!",
"notificationText": "Tap to open the app", "notificationText": "Tap to open the app",

View File

@ -1,4 +1,5 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_i18n/widgets/I18nText.dart';
import 'package:revanced_manager/app/app.locator.dart'; import 'package:revanced_manager/app/app.locator.dart';
import 'package:revanced_manager/models/patched_application.dart'; import 'package:revanced_manager/models/patched_application.dart';
import 'package:revanced_manager/ui/views/home/home_viewmodel.dart'; import 'package:revanced_manager/ui/views/home/home_viewmodel.dart';
@ -12,7 +13,36 @@ class AvailableUpdatesCard extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return ListView( return apps.isEmpty
? Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: Theme.of(context).colorScheme.primary,
),
padding: const EdgeInsets.symmetric(vertical: 18, horizontal: 20),
child: Center(
child: Column(
children: [
Icon(
Icons.update_disabled,
size: 40,
color: Theme.of(context).colorScheme.secondary,
),
const SizedBox(height: 16),
I18nText(
'homeView.noUpdates',
child: Text(
'',
textAlign: TextAlign.center,
style: Theme.of(context).textTheme.subtitle1!.copyWith(
color: Theme.of(context).colorScheme.secondary),
),
)
],
),
),
)
: ListView(
shrinkWrap: true, shrinkWrap: true,
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
physics: const NeverScrollableScrollPhysics(), physics: const NeverScrollableScrollPhysics(),
@ -23,7 +53,8 @@ class AvailableUpdatesCard extends StatelessWidget {
patchDate: app.patchDate, patchDate: app.patchDate,
changelog: app.changelog, changelog: app.changelog,
isUpdatableApp: true, isUpdatableApp: true,
onPressed: () => locator<HomeViewModel>().navigateToPatcher( onPressed: () =>
locator<HomeViewModel>().navigateToPatcher(
app, app,
), ),
)) ))

View File

@ -1,5 +1,6 @@
import 'package:device_apps/device_apps.dart'; import 'package:device_apps/device_apps.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_i18n/flutter_i18n.dart';
import 'package:revanced_manager/app/app.locator.dart'; import 'package:revanced_manager/app/app.locator.dart';
import 'package:revanced_manager/models/patched_application.dart'; import 'package:revanced_manager/models/patched_application.dart';
import 'package:revanced_manager/ui/views/home/home_viewmodel.dart'; import 'package:revanced_manager/ui/views/home/home_viewmodel.dart';
@ -13,7 +14,36 @@ class InstalledAppsCard extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return ListView( return apps.isEmpty
? Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: Theme.of(context).colorScheme.primary,
),
padding: const EdgeInsets.symmetric(vertical: 18, horizontal: 20),
child: Center(
child: Column(
children: [
Icon(
Icons.file_download_off,
size: 40,
color: Theme.of(context).colorScheme.secondary,
),
const SizedBox(height: 16),
I18nText(
'homeView.noInstallations',
child: Text(
'',
textAlign: TextAlign.center,
style: Theme.of(context).textTheme.subtitle1!.copyWith(
color: Theme.of(context).colorScheme.secondary),
),
)
],
),
),
)
: ListView(
shrinkWrap: true, shrinkWrap: true,
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
physics: const NeverScrollableScrollPhysics(), physics: const NeverScrollableScrollPhysics(),