From d4dc845e009a8108b1428382c4d24797585bf05a Mon Sep 17 00:00:00 2001 From: Aunali321 Date: Mon, 1 Aug 2022 17:54:05 +0530 Subject: [PATCH] refactor: MOARR CLEANUP. --- lib/ui/screens/home_screen.dart | 34 ++++++++++--------------- lib/ui/widgets/app_details.dart | 8 +++--- lib/ui/widgets/available_update.dart | 6 +++-- lib/ui/widgets/installed_apps.dart | 38 +++++----------------------- 4 files changed, 28 insertions(+), 58 deletions(-) diff --git a/lib/ui/screens/home_screen.dart b/lib/ui/screens/home_screen.dart index 735c257b..8965ae5d 100644 --- a/lib/ui/screens/home_screen.dart +++ b/lib/ui/screens/home_screen.dart @@ -18,6 +18,7 @@ class HomeScreen extends StatelessWidget { horizontal: 20.0, ), child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ Align( alignment: Alignment.topRight, @@ -29,35 +30,26 @@ class HomeScreen extends StatelessWidget { ), ), const SizedBox(height: 60), - Align( - alignment: Alignment.topLeft, - child: Text( - "Dashboard", - style: GoogleFonts.inter( - fontSize: 28, - ), + Text( + "Dashboard", + style: GoogleFonts.inter( + fontSize: 28, ), ), const SizedBox(height: 23), - Align( - alignment: Alignment.topLeft, - child: Text( - "ReVanced Updates", - style: GoogleFonts.inter( - fontSize: 18, - ), + Text( + "ReVanced Updates", + style: GoogleFonts.inter( + fontSize: 18, ), ), const SizedBox(height: 10), const LatestCommitWidget(), const SizedBox(height: 14), - Align( - alignment: Alignment.topLeft, - child: Text( - "Patched Applications", - style: GoogleFonts.inter( - fontSize: 18, - ), + Text( + "Patched Applications", + style: GoogleFonts.inter( + fontSize: 18, ), ), const SizedBox(height: 14), diff --git a/lib/ui/widgets/app_details.dart b/lib/ui/widgets/app_details.dart index bb1e957c..e8f4dba1 100644 --- a/lib/ui/widgets/app_details.dart +++ b/lib/ui/widgets/app_details.dart @@ -8,12 +8,14 @@ class AppDetails extends StatelessWidget { final String asset; final String name; final String releaseDate; + final Function()? onPressed; const AppDetails({ Key? key, required this.asset, required this.name, required this.releaseDate, + required this.onPressed, }) : super(key: key); @override @@ -24,8 +26,8 @@ class AppDetails extends StatelessWidget { leading: isSVG ? SvgPicture.asset( asset, - height: 24, - width: 24, + height: 26, + width: 26, ) : Image.asset( asset, @@ -44,7 +46,7 @@ class AppDetails extends StatelessWidget { ), trailing: PatchTextButton( text: "Patch", - onPressed: () {}, + onPressed: onPressed, ), ); } diff --git a/lib/ui/widgets/available_update.dart b/lib/ui/widgets/available_update.dart index e7757c3f..b65688c6 100644 --- a/lib/ui/widgets/available_update.dart +++ b/lib/ui/widgets/available_update.dart @@ -36,15 +36,17 @@ class AvailableUpdatesWidget extends StatelessWidget { ), ], ), - const AppDetails( + AppDetails( asset: "lib/assets/images/revanced.svg", name: "ReVanced", releaseDate: "2 days ago", + onPressed: () {}, ), - const AppDetails( + AppDetails( asset: "lib/assets/images/reddit.png", name: "ReReddit", releaseDate: "Released 1 month ago", + onPressed: () {}, ), const SizedBox(height: 4), Text( diff --git a/lib/ui/widgets/installed_apps.dart b/lib/ui/widgets/installed_apps.dart index 7ecefd59..c2466aa2 100644 --- a/lib/ui/widgets/installed_apps.dart +++ b/lib/ui/widgets/installed_apps.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; +import 'package:revanced_manager_flutter/ui/widgets/app_details.dart'; class InstalledAppsWidget extends StatelessWidget { const InstalledAppsWidget({Key? key}) : super(key: key); @@ -24,38 +25,11 @@ class InstalledAppsWidget extends StatelessWidget { fontWeight: FontWeight.w500, ), ), - ListTile( - horizontalTitleGap: 12.0, - leading: const Image( - image: AssetImage("lib/assets/images/reddit.png"), - height: 39, - width: 39, - ), - title: Text( - "ReVanced", - style: GoogleFonts.roboto( - color: const Color(0xff7792BA), - ), - ), - subtitle: const Text("Released 2 days ago"), - trailing: TextButton( - onPressed: () {}, - style: TextButton.styleFrom( - side: const BorderSide( - color: Color(0xff7792BA), - width: 1, - ), - primary: Colors.white, - padding: const EdgeInsets.symmetric( - vertical: 10, - horizontal: 24, - ), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(24), - ), - ), - child: const Text("Patch"), - ), + AppDetails( + asset: "lib/assets/images/revanced.svg", + name: "ReVanced", + releaseDate: "2 days ago", + onPressed: () {}, ), Text( "Changelog",