From 6bf7411074a408aed862f42530d99f1e37801d21 Mon Sep 17 00:00:00 2001 From: Aunali321 Date: Mon, 1 Aug 2022 14:08:22 +0530 Subject: [PATCH] refactor: cleanup. --- lib/constants.dart | 4 ++ lib/main.dart | 19 ++++++++++ lib/ui/widgets/available_update.dart | 45 ++++++----------------- lib/ui/widgets/latest_commit.dart | 53 ++++++++++++++++++--------- lib/ui/widgets/patch_text_button.dart | 42 +++++++++++++++++++++ 5 files changed, 112 insertions(+), 51 deletions(-) create mode 100644 lib/ui/widgets/patch_text_button.dart diff --git a/lib/constants.dart b/lib/constants.dart index 90526a64..3f9ab2ff 100644 --- a/lib/constants.dart +++ b/lib/constants.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:google_fonts/google_fonts.dart'; const purple80 = Color(0xFFD0BCFF); const purpleGrey80 = Color(0xFFCCC2DC); @@ -6,3 +7,6 @@ const pink80 = Color(0xFFEFB8C8); const purple40 = Color(0xFF6650a4); const purpleGrey40 = Color(0xFF625b71); const pink40 = Color(0xFF7D5260); + +final interTextStyle = GoogleFonts.inter(); +final robotoTextStyle = GoogleFonts.roboto(); diff --git a/lib/main.dart b/lib/main.dart index a4379dad..86be8b0a 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -17,6 +17,13 @@ class MyApp extends StatelessWidget { debugShowCheckedModeBanner: false, title: 'ReVanced Manager', theme: ThemeData.light().copyWith( + navigationBarTheme: NavigationBarThemeData( + labelTextStyle: MaterialStateProperty.all( + GoogleFonts.roboto( + fontSize: 12, + ), + ), + ), backgroundColor: Colors.red, textTheme: GoogleFonts.interTextTheme( Theme.of(context).textTheme, @@ -30,6 +37,18 @@ class MyApp extends StatelessWidget { ), ), darkTheme: ThemeData.dark().copyWith( + navigationBarTheme: NavigationBarThemeData( + iconTheme: MaterialStateProperty.all(const IconThemeData( + color: Colors.white, + )), + indicatorColor: const Color(0xff223144), + backgroundColor: const Color(0x1b222b6b), + labelTextStyle: MaterialStateProperty.all( + GoogleFonts.roboto( + fontSize: 12, + ), + ), + ), backgroundColor: Colors.red, useMaterial3: true, scaffoldBackgroundColor: const Color(0xff0A0D11), diff --git a/lib/ui/widgets/available_update.dart b/lib/ui/widgets/available_update.dart index 4015bfcf..9c0f8847 100644 --- a/lib/ui/widgets/available_update.dart +++ b/lib/ui/widgets/available_update.dart @@ -1,6 +1,8 @@ import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:google_fonts/google_fonts.dart'; +import 'package:revanced_manager_flutter/constants.dart'; +import 'package:revanced_manager_flutter/ui/widgets/patch_text_button.dart'; class AvailableUpdatesWidget extends StatelessWidget { const AvailableUpdatesWidget({Key? key}) : super(key: key); @@ -58,24 +60,13 @@ class AvailableUpdatesWidget extends StatelessWidget { color: const Color(0xff7792BA), ), ), - subtitle: const Text("Released 2 days ago"), - trailing: TextButton( + subtitle: Text( + "Released 2 days ago", + style: robotoTextStyle, + ), + trailing: PatchTextButton( + text: "Patch", 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"), ), ), ListTile( @@ -91,24 +82,10 @@ class AvailableUpdatesWidget extends StatelessWidget { color: const Color(0xff7792BA), ), ), - subtitle: const Text("Released 1 month ago"), - trailing: TextButton( + subtitle: Text("Released 1 month ago", style: robotoTextStyle), + trailing: PatchTextButton( + text: "Patch", 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"), ), ), const SizedBox(height: 4), diff --git a/lib/ui/widgets/latest_commit.dart b/lib/ui/widgets/latest_commit.dart index f28a536b..70ae0a56 100644 --- a/lib/ui/widgets/latest_commit.dart +++ b/lib/ui/widgets/latest_commit.dart @@ -1,4 +1,7 @@ import 'package:flutter/material.dart'; +import 'package:google_fonts/google_fonts.dart'; +import 'package:revanced_manager_flutter/constants.dart'; +import 'package:revanced_manager_flutter/ui/widgets/patch_text_button.dart'; class LatestCommitWidget extends StatelessWidget { const LatestCommitWidget({Key? key}) : super(key: key); @@ -16,26 +19,42 @@ class LatestCommitWidget extends StatelessWidget { children: [ Column( crossAxisAlignment: CrossAxisAlignment.start, - children: const [ - Text("Patcher: 20 hours ago"), - Text("Manager: 3 days ago"), + children: [ + Row( + children: [ + Text( + "Patcher: ", + style: GoogleFonts.roboto( + fontWeight: FontWeight.w700, + ), + ), + Text( + "20 hours ago", + style: robotoTextStyle, + ) + ], + ), + Row( + children: [ + Text( + "Manager: ", + style: GoogleFonts.roboto( + fontWeight: FontWeight.w700, + ), + ), + Text( + "3 days ago", + style: robotoTextStyle, + ) + ], + ), ], ), - TextButton( + PatchTextButton( + text: "Update Manager", onPressed: () {}, - style: TextButton.styleFrom( - primary: Colors.white, - backgroundColor: const Color(0xff7792BA), - padding: const EdgeInsets.symmetric( - vertical: 10, - horizontal: 24, - ), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(24), - ), - ), - child: const Text("Update Manager"), - ) + backgroundColor: const Color(0xff7792BA), + ), ], ), ); diff --git a/lib/ui/widgets/patch_text_button.dart b/lib/ui/widgets/patch_text_button.dart new file mode 100644 index 00000000..979c1084 --- /dev/null +++ b/lib/ui/widgets/patch_text_button.dart @@ -0,0 +1,42 @@ +import 'package:flutter/material.dart'; +import 'package:revanced_manager_flutter/constants.dart'; + +class PatchTextButton extends StatelessWidget { + final String text; + final Function()? onPressed; + final Color borderColor; + final Color backgroundColor; + const PatchTextButton({ + Key? key, + required this.text, + this.onPressed, + this.borderColor = const Color(0xff7792BA), + this.backgroundColor = Colors.transparent, + }) : super(key: key); + + @override + Widget build(BuildContext context) { + return TextButton( + onPressed: onPressed, + style: TextButton.styleFrom( + side: BorderSide( + color: borderColor, + width: 1, + ), + primary: Colors.white, + backgroundColor: backgroundColor, + padding: const EdgeInsets.symmetric( + vertical: 10, + horizontal: 24, + ), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(24), + ), + ), + child: Text( + text, + style: interTextStyle, + ), + ); + } +}