feat: improve app theming code and add Material You (#58)

This commit is contained in:
Alberto Ponces
2022-09-05 03:32:36 +01:00
committed by GitHub
parent 35d334ea1f
commit 5404208562
44 changed files with 627 additions and 854 deletions

View File

@ -0,0 +1,58 @@
import 'package:dynamic_color/dynamic_color.dart';
import 'package:dynamic_themes/dynamic_themes.dart';
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:revanced_manager/app/app.router.dart';
import 'package:revanced_manager/theme.dart';
import 'package:stacked_services/stacked_services.dart';
class DynamicThemeBuilder extends StatelessWidget {
final String title;
final Widget home;
final Iterable<LocalizationsDelegate> localizationsDelegates;
const DynamicThemeBuilder({
Key? key,
required this.title,
required this.home,
required this.localizationsDelegates,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return DynamicColorBuilder(
builder: (lightColorScheme, darkColorScheme) {
ThemeData lightDynamicTheme = ThemeData(
useMaterial3: true,
colorScheme: lightColorScheme?.harmonized(),
textTheme: GoogleFonts.robotoTextTheme(ThemeData.light().textTheme),
);
ThemeData darkDynamicTheme = ThemeData(
useMaterial3: true,
colorScheme: darkColorScheme?.harmonized(),
textTheme: GoogleFonts.robotoTextTheme(ThemeData.dark().textTheme),
);
return DynamicTheme(
themeCollection: ThemeCollection(
themes: {
0: lightCustomTheme,
1: darkCustomTheme,
2: lightDynamicTheme,
3: darkDynamicTheme,
},
fallbackTheme: lightCustomTheme,
),
builder: (context, theme) => MaterialApp(
debugShowCheckedModeBanner: false,
title: title,
navigatorKey: StackedService.navigatorKey,
onGenerateRoute: StackedRouter().onGenerateRoute,
theme: theme,
home: home,
localizationsDelegates: localizationsDelegates,
),
);
},
);
}
}

View File

@ -1,6 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter_i18n/flutter_i18n.dart';
import 'package:revanced_manager/theme.dart';
import 'package:revanced_manager/ui/widgets/appSelectorView/installed_app_item.dart';
import 'package:revanced_manager/ui/widgets/shared/search_bar.dart';
import 'package:revanced_manager/ui/widgets/appSelectorView/app_skeleton_loader.dart';
@ -30,11 +29,6 @@ class _AppSelectorViewState extends State<AppSelectorView> {
model.selectAppFromStorage(context);
Navigator.of(context).pop();
},
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
),
backgroundColor: Theme.of(context).colorScheme.secondary,
foregroundColor: Theme.of(context).colorScheme.surface,
),
body: SafeArea(
child: Padding(
@ -50,15 +44,10 @@ class _AppSelectorViewState extends State<AppSelectorView> {
children: <Widget>[
SearchBar(
showSelectIcon: false,
fillColor: isDark
? const Color(0xff1B222B)
: Colors.grey[200],
hintText: FlutterI18n.translate(
context,
'appSelectorView.searchBarHint',
),
hintTextColor:
Theme.of(context).colorScheme.tertiary,
onQueryChanged: (searchQuery) {
setState(() {
_query = searchQuery;

View File

@ -6,12 +6,13 @@ import 'package:flutter_i18n/flutter_i18n.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:revanced_manager/app/app.locator.dart';
import 'package:revanced_manager/models/patched_application.dart';
import 'package:revanced_manager/services/manager_api.dart';
import 'package:revanced_manager/services/patcher_api.dart';
import 'package:revanced_manager/ui/views/patcher/patcher_viewmodel.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:stacked/stacked.dart';
class AppSelectorViewModel extends BaseViewModel {
final ManagerAPI _managerAPI = locator<ManagerAPI>();
final PatcherAPI _patcherAPI = locator<PatcherAPI>();
final List<ApplicationWithIcon> apps = [];
bool noApps = false;
@ -21,8 +22,7 @@ class AppSelectorViewModel extends BaseViewModel {
apps.addAll(await _patcherAPI.getFilteredInstalledApps());
apps.sort((a, b) => a.appName.compareTo(b.appName));
noApps = apps.isEmpty;
SharedPreferences prefs = await SharedPreferences.getInstance();
_isRooted = prefs.getBool('isRooted') ?? false;
_isRooted = _managerAPI.isRooted() ?? false;
notifyListeners();
}

View File

@ -2,10 +2,9 @@ import 'package:flutter/material.dart';
import 'package:flutter_i18n/flutter_i18n.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:revanced_manager/app/app.locator.dart';
import 'package:revanced_manager/theme.dart';
import 'package:revanced_manager/ui/views/home/home_viewmodel.dart';
import 'package:revanced_manager/ui/widgets/homeView/available_updates_card.dart';
import 'package:revanced_manager/ui/widgets/homeView/dashboard_raw_chip.dart';
import 'package:revanced_manager/ui/widgets/homeView/dashboard_chip.dart';
import 'package:revanced_manager/ui/widgets/homeView/installed_apps_card.dart';
import 'package:revanced_manager/ui/widgets/homeView/latest_commit_card.dart';
import 'package:revanced_manager/ui/widgets/shared/custom_sliver_app_bar.dart';
@ -29,8 +28,7 @@ class HomeView extends StatelessWidget {
child: Text(
'',
style: GoogleFonts.inter(
color: Theme.of(context).textTheme.headline5!.color,
fontWeight: FontWeight.w500,
color: Theme.of(context).textTheme.headline6!.color,
),
),
),
@ -44,13 +42,7 @@ class HomeView extends StatelessWidget {
'homeView.updatesSubtitle',
child: Text(
'',
style: GoogleFonts.inter(
fontSize: 20,
fontWeight: FontWeight.w500,
color: isDark
? const Color(0xffD1E1FA)
: const Color(0xff384E6E),
),
style: Theme.of(context).textTheme.headline6!,
),
),
const SizedBox(height: 10),
@ -62,12 +54,7 @@ class HomeView extends StatelessWidget {
'homeView.patchedSubtitle',
child: Text(
'',
style: GoogleFonts.inter(
fontSize: 20,
color: isDark
? const Color(0xffD1E1FA)
: const Color(0xff384E6E),
),
style: Theme.of(context).textTheme.headline6!,
),
),
const SizedBox(height: 8),

View File

@ -3,6 +3,7 @@ import 'package:flutter_i18n/flutter_i18n.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:revanced_manager/ui/views/installer/installer_viewmodel.dart';
import 'package:revanced_manager/ui/widgets/installerView/custom_material_button.dart';
import 'package:revanced_manager/ui/widgets/shared/custom_card.dart';
import 'package:revanced_manager/ui/widgets/shared/custom_sliver_app_bar.dart';
import 'package:stacked/stacked.dart';
@ -23,14 +24,13 @@ class InstallerView extends StatelessWidget {
title: Text(
model.headerLogs,
style: GoogleFonts.inter(
color: Theme.of(context).textTheme.headline5!.color,
fontWeight: FontWeight.w500,
color: Theme.of(context).textTheme.headline6!.color,
),
),
bottom: PreferredSize(
preferredSize: const Size(double.infinity, 1.0),
child: LinearProgressIndicator(
color: Theme.of(context).colorScheme.secondary,
color: Theme.of(context).colorScheme.primary,
backgroundColor: Colors.white,
value: model.progress,
),
@ -41,13 +41,7 @@ class InstallerView extends StatelessWidget {
sliver: SliverList(
delegate: SliverChildListDelegate.fixed(
<Widget>[
Container(
padding: const EdgeInsets.all(12.0),
width: double.infinity,
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.primary,
borderRadius: BorderRadius.circular(12),
),
CustomCard(
child: Text(
model.logs,
style: GoogleFonts.jetBrainsMono(

View File

@ -2,7 +2,6 @@ import 'package:flutter/material.dart';
import 'package:flutter_i18n/flutter_i18n.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:revanced_manager/app/app.locator.dart';
import 'package:revanced_manager/theme.dart';
import 'package:revanced_manager/ui/views/app_selector/app_selector_view.dart';
import 'package:revanced_manager/ui/views/installer/installer_view.dart';
import 'package:revanced_manager/ui/views/patcher/patcher_viewmodel.dart';
@ -30,11 +29,6 @@ class PatcherView extends StatelessWidget {
label: I18nText('patcherView.patchButton'),
icon: const Icon(Icons.build),
onPressed: openContainer,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
),
backgroundColor: Theme.of(context).colorScheme.secondary,
foregroundColor: Theme.of(context).colorScheme.surface,
),
),
),
@ -46,8 +40,7 @@ class PatcherView extends StatelessWidget {
child: Text(
'',
style: GoogleFonts.inter(
color: Theme.of(context).textTheme.headline5!.color,
fontWeight: FontWeight.w500,
color: Theme.of(context).textTheme.headline6!.color,
),
),
),
@ -65,9 +58,7 @@ class PatcherView extends StatelessWidget {
),
const SizedBox(height: 16),
Opacity(
opacity: isDark
? (model.dimPatchesCard() ? 0.5 : 1)
: (model.dimPatchesCard() ? 0.75 : 1),
opacity: model.dimPatchesCard() ? 0.5 : 1,
child: OpenContainerWrapper(
openBuilder: (_, __) => const PatchesSelectorView(),
closedBuilder: (_, openContainer) => PatchSelectorCard(

View File

@ -2,7 +2,6 @@ import 'package:expandable/expandable.dart';
import 'package:flutter/material.dart';
import 'package:flutter_i18n/flutter_i18n.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:revanced_manager/theme.dart';
import 'package:revanced_manager/ui/views/patches_selector/patches_selector_viewmodel.dart';
import 'package:revanced_manager/ui/widgets/patchesSelectorView/patch_item.dart';
import 'package:revanced_manager/ui/widgets/patchesSelectorView/patch_options_fields.dart';
@ -35,11 +34,6 @@ class _PatchesSelectorViewState extends State<PatchesSelectorView> {
model.selectPatches();
Navigator.of(context).pop();
},
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
),
backgroundColor: Theme.of(context).colorScheme.secondary,
foregroundColor: Theme.of(context).colorScheme.surface,
),
),
body: SafeArea(
@ -49,20 +43,17 @@ class _PatchesSelectorViewState extends State<PatchesSelectorView> {
child: model.patches.isEmpty
? Center(
child: CircularProgressIndicator(
color: Theme.of(context).colorScheme.secondary,
color: Theme.of(context).colorScheme.primary,
),
)
: Column(
children: <Widget>[
SearchBar(
showSelectIcon: true,
fillColor:
isDark ? const Color(0xff1B222B) : Colors.grey[200],
hintText: FlutterI18n.translate(
context,
'patchesSelectorView.searchBarHint',
),
hintTextColor: Theme.of(context).colorScheme.tertiary,
onQueryChanged: (searchQuery) {
setState(() {
_query = searchQuery;

View File

@ -17,11 +17,6 @@ class RootCheckerView extends StatelessWidget {
label: I18nText('rootCheckerView.nonRootButton'),
icon: const Icon(Icons.keyboard_arrow_right),
onPressed: () => model.navigateAsNonRoot(),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
),
backgroundColor: Theme.of(context).colorScheme.secondary,
foregroundColor: Theme.of(context).colorScheme.surface,
),
body: Container(
height: double.infinity,
@ -41,10 +36,10 @@ class RootCheckerView extends StatelessWidget {
const SizedBox(height: 24),
I18nText(
'rootCheckerView.widgetDescription',
child: Text(
child: const Text(
'',
textAlign: TextAlign.center,
style: GoogleFonts.roboto(
style: TextStyle(
fontSize: 17,
letterSpacing: 1.1,
),
@ -62,10 +57,6 @@ class RootCheckerView extends StatelessWidget {
translationParams: {
'isRooted': model.isRooted.toString(),
},
child: Text(
'',
style: GoogleFonts.poppins(),
),
),
],
),

View File

@ -1,12 +1,13 @@
import 'package:revanced_manager/app/app.locator.dart';
import 'package:revanced_manager/app/app.router.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:revanced_manager/services/manager_api.dart';
import 'package:stacked/stacked.dart';
import 'package:root/root.dart';
import 'package:stacked_services/stacked_services.dart';
class RootCheckerViewModel extends BaseViewModel {
final NavigationService _navigationService = locator<NavigationService>();
final ManagerAPI _managerAPI = locator<ManagerAPI>();
bool isRooted = false;
Future<void> navigateAsRoot() async {
@ -25,8 +26,7 @@ class RootCheckerViewModel extends BaseViewModel {
}
Future<void> navigateToHome() async {
final prefs = await SharedPreferences.getInstance();
await prefs.setBool('isRooted', isRooted);
_managerAPI.setIsRooted(isRooted);
_navigationService.navigateTo(Routes.navigation);
}
}

View File

@ -1,8 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter_i18n/flutter_i18n.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:revanced_manager/constants.dart';
import 'package:revanced_manager/theme.dart';
import 'package:revanced_manager/ui/views/contributors/contributors_view.dart';
import 'package:revanced_manager/ui/views/settings/settings_viewmodel.dart';
import 'package:revanced_manager/ui/widgets/settingsView/about_widget.dart';
@ -14,7 +12,6 @@ import 'package:revanced_manager/ui/widgets/settingsView/sources_widget.dart';
import 'package:revanced_manager/ui/widgets/shared/custom_sliver_app_bar.dart';
import 'package:revanced_manager/ui/widgets/shared/open_container_wrapper.dart';
import 'package:stacked/stacked.dart';
import 'package:stacked_themes/stacked_themes.dart';
class SettingsView extends StatelessWidget {
final TextEditingController organizationController = TextEditingController();
@ -37,8 +34,7 @@ class SettingsView extends StatelessWidget {
child: Text(
'',
style: GoogleFonts.inter(
color: Theme.of(context).textTheme.headline5!.color,
fontWeight: FontWeight.w500,
color: Theme.of(context).textTheme.headline6!.color,
),
),
),
@ -56,18 +52,39 @@ class SettingsView extends StatelessWidget {
children: <Widget>[
CustomSwitchTile(
title: I18nText(
'settingsView.themeLabel',
child: Text(
'settingsView.darkThemeLabel',
child: const Text(
'',
style: kSettingItemTextStyle,
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.w500,
),
),
),
subtitle: I18nText('settingsView.themeHint'),
value: isDark,
onTap: (value) {
isDark = value;
getThemeManager(context).toggleDarkLightTheme();
},
subtitle: I18nText('settingsView.darkThemeHint'),
value: model.getDarkThemeStatus(),
onTap: (value) => model.setUseDarkTheme(
context,
value,
),
),
CustomSwitchTile(
title: I18nText(
'settingsView.dynamicThemeLabel',
child: const Text(
'',
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.w500,
),
),
),
subtitle: I18nText('settingsView.dynamicThemeHint'),
value: model.getDynamicThemeStatus(),
onTap: (value) => model.setUseDynamicTheme(
context,
value,
),
),
],
),
@ -102,9 +119,12 @@ class SettingsView extends StatelessWidget {
contentPadding: EdgeInsets.zero,
title: I18nText(
'settingsView.rootModeLabel',
child: Text(
child: const Text(
'',
style: kSettingItemTextStyle,
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.w500,
),
),
),
subtitle: I18nText('settingsView.rootModeHint'),
@ -129,7 +149,13 @@ class SettingsView extends StatelessWidget {
contentPadding: EdgeInsets.zero,
title: I18nText(
'settingsView.contributorsLabel',
child: Text('', style: kSettingItemTextStyle),
child: const Text(
'',
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.w500,
),
),
),
subtitle: I18nText('settingsView.contributorsHint'),
onTap: openContainer,

View File

@ -1,13 +1,18 @@
// ignore_for_file: use_build_context_synchronously
import 'package:dynamic_themes/dynamic_themes.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.router.dart';
import 'package:revanced_manager/services/manager_api.dart';
import 'package:stacked/stacked.dart';
import 'package:stacked_services/stacked_services.dart';
import 'package:timeago/timeago.dart';
class SettingsViewModel extends BaseViewModel {
final NavigationService _navigationService = locator<NavigationService>();
final ManagerAPI _managerAPI = locator<ManagerAPI>();
void setLanguage(String language) {
notifyListeners();
@ -23,4 +28,34 @@ class SettingsViewModel extends BaseViewModel {
setLocaleMessages(value, EnMessages());
}
}
bool getDynamicThemeStatus() {
return _managerAPI.getUseDynamicTheme();
}
void setUseDynamicTheme(BuildContext context, bool value) async {
await _managerAPI.setUseDynamicTheme(value);
int currentTheme = DynamicTheme.of(context)!.themeId;
if (currentTheme.isEven) {
DynamicTheme.of(context)!.setTheme(value ? 2 : 0);
} else {
DynamicTheme.of(context)!.setTheme(value ? 3 : 1);
}
notifyListeners();
}
bool getDarkThemeStatus() {
return _managerAPI.getUseDarkTheme();
}
void setUseDarkTheme(BuildContext context, bool value) async {
await _managerAPI.setUseDarkTheme(value);
int currentTheme = DynamicTheme.of(context)!.themeId;
if (currentTheme < 2) {
DynamicTheme.of(context)!.setTheme(value ? 1 : 0);
} else {
DynamicTheme.of(context)!.setTheme(value ? 3 : 2);
}
notifyListeners();
}
}

View File

@ -1,7 +1,6 @@
import 'dart:typed_data';
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:revanced_manager/constants.dart';
import 'package:revanced_manager/ui/widgets/shared/custom_card.dart';
class InstalledAppItem extends StatefulWidget {
final String name;
@ -24,12 +23,7 @@ class _InstalledAppItemState extends State<InstalledAppItem> {
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.symmetric(vertical: 4.0),
child: Container(
padding: const EdgeInsets.all(12.0),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: Theme.of(context).colorScheme.primary,
),
child: CustomCard(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
@ -52,16 +46,13 @@ class _InstalledAppItemState extends State<InstalledAppItem> {
widget.name,
maxLines: 2,
overflow: TextOverflow.visible,
style: GoogleFonts.inter(
style: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.w500,
),
),
const SizedBox(height: 4),
Text(
widget.pkgName,
style: kRobotoTextStyle,
),
Text(widget.pkgName),
],
),
),

View File

@ -1,7 +1,6 @@
import 'package:flutter/material.dart';
import 'package:github/github.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:revanced_manager/theme.dart';
import 'package:revanced_manager/ui/widgets/shared/custom_card.dart';
import 'package:url_launcher/url_launcher.dart';
class ContributorsCard extends StatefulWidget {
@ -23,54 +22,49 @@ class ContributorsCard extends StatefulWidget {
class _ContributorsCardState extends State<ContributorsCard> {
@override
Widget build(BuildContext context) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Padding(
padding: const EdgeInsets.symmetric(vertical: 4.0, horizontal: 4.0),
child: Text(
widget.title,
style: GoogleFonts.poppins(
fontSize: 20,
fontWeight: FontWeight.w600,
return Padding(
padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 20),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Padding(
padding: const EdgeInsets.only(bottom: 8.0),
child: Text(
widget.title,
style: const TextStyle(
fontSize: 20,
fontWeight: FontWeight.w600,
),
),
),
),
Container(
margin: const EdgeInsets.all(8.0),
padding: const EdgeInsets.all(4.0),
decoration: BoxDecoration(
color: isDark
? Theme.of(context).colorScheme.primary
: Theme.of(context).navigationBarTheme.backgroundColor!,
borderRadius: BorderRadius.circular(12),
),
height: widget.height,
child: GridView.builder(
physics: const NeverScrollableScrollPhysics(),
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 7,
mainAxisSpacing: 8,
crossAxisSpacing: 8,
),
itemCount: widget.contributors.length,
itemBuilder: (context, index) {
return ClipRRect(
borderRadius: BorderRadius.circular(100),
child: GestureDetector(
onTap: () =>
launchUrl(Uri.parse(widget.contributors[index].htmlUrl!)),
child: Image.network(
widget.contributors[index].avatarUrl!,
height: 40,
width: 40,
CustomCard(
child: GridView.builder(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 7,
mainAxisSpacing: 8,
crossAxisSpacing: 8,
),
itemCount: widget.contributors.length,
itemBuilder: (context, index) {
return ClipRRect(
borderRadius: BorderRadius.circular(100),
child: GestureDetector(
onTap: () => launchUrl(
Uri.parse(widget.contributors[index].htmlUrl!)),
child: Image.network(
widget.contributors[index].avatarUrl!,
height: 40,
width: 40,
),
),
),
);
},
);
},
),
),
),
],
],
),
);
}
}

View File

@ -4,6 +4,7 @@ import 'package:revanced_manager/app/app.locator.dart';
import 'package:revanced_manager/models/patched_application.dart';
import 'package:revanced_manager/ui/views/home/home_viewmodel.dart';
import 'package:revanced_manager/ui/widgets/shared/application_item.dart';
import 'package:revanced_manager/ui/widgets/shared/custom_card.dart';
class AvailableUpdatesCard extends StatelessWidget {
AvailableUpdatesCard({Key? key}) : super(key: key);
@ -14,28 +15,18 @@ class AvailableUpdatesCard extends StatelessWidget {
@override
Widget build(BuildContext context) {
return apps.isEmpty
? Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: Theme.of(context).colorScheme.primary,
),
padding: const EdgeInsets.symmetric(vertical: 18, horizontal: 20),
? CustomCard(
child: Center(
child: Column(
children: <Widget>[
Icon(
Icons.update_disabled,
size: 40,
color: Theme.of(context).colorScheme.secondary,
),
const Icon(Icons.update_disabled, size: 40),
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),
style: Theme.of(context).textTheme.subtitle1!,
),
)
],

View File

@ -0,0 +1,31 @@
import 'package:flutter/material.dart';
class DashboardChip extends StatelessWidget {
final Widget label;
final bool isSelected;
final Function(bool)? onSelected;
const DashboardChip({
Key? key,
required this.label,
required this.isSelected,
this.onSelected,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return RawChip(
showCheckmark: false,
label: label,
selected: isSelected,
labelStyle: Theme.of(context).textTheme.subtitle2!.copyWith(
color: Theme.of(context).colorScheme.primary,
fontWeight: FontWeight.bold,
),
backgroundColor: Colors.transparent,
selectedColor: Theme.of(context).colorScheme.secondaryContainer,
padding: const EdgeInsets.all(10),
onSelected: onSelected,
);
}
}

View File

@ -1,52 +0,0 @@
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:revanced_manager/theme.dart';
class DashboardChip extends StatelessWidget {
final Widget label;
final bool isSelected;
final Function(bool)? onSelected;
const DashboardChip({
Key? key,
required this.label,
required this.isSelected,
this.onSelected,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return RawChip(
showCheckmark: false,
label: label,
selected: isSelected,
labelStyle: GoogleFonts.inter(
color: isSelected
? isDark
? const Color(0xff95C0FE)
: Theme.of(context).colorScheme.secondary
: isDark
? Colors.grey
: Colors.grey[700],
fontWeight: FontWeight.w500,
),
backgroundColor:
isDark ? Theme.of(context).colorScheme.background : Colors.white,
selectedColor: const Color.fromRGBO(118, 155, 209, 0.42),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
side: BorderSide(
width: 1,
color: isDark
? isSelected
? const Color.fromRGBO(118, 155, 209, 0.42)
: Colors.grey
: isSelected
? const Color.fromRGBO(118, 155, 209, 0.42)
: Colors.grey,
),
),
onSelected: onSelected,
);
}
}

View File

@ -5,6 +5,7 @@ import 'package:revanced_manager/app/app.locator.dart';
import 'package:revanced_manager/models/patched_application.dart';
import 'package:revanced_manager/ui/views/home/home_viewmodel.dart';
import 'package:revanced_manager/ui/widgets/shared/application_item.dart';
import 'package:revanced_manager/ui/widgets/shared/custom_card.dart';
class InstalledAppsCard extends StatelessWidget {
InstalledAppsCard({Key? key}) : super(key: key);
@ -15,28 +16,18 @@ class InstalledAppsCard extends StatelessWidget {
@override
Widget build(BuildContext context) {
return apps.isEmpty
? Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: Theme.of(context).colorScheme.primary,
),
padding: const EdgeInsets.symmetric(vertical: 18, horizontal: 20),
? CustomCard(
child: Center(
child: Column(
children: <Widget>[
Icon(
Icons.file_download_off,
size: 40,
color: Theme.of(context).colorScheme.secondary,
),
const Icon(Icons.file_download_off, size: 40),
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),
style: Theme.of(context).textTheme.subtitle1!,
),
)
],

View File

@ -1,11 +1,11 @@
import 'package:flutter/material.dart';
import 'package:flutter_i18n/flutter_i18n.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:revanced_manager/app/app.locator.dart';
import 'package:revanced_manager/services/github_api.dart';
import 'package:revanced_manager/constants.dart';
import 'package:revanced_manager/ui/views/home/home_viewmodel.dart';
import 'package:revanced_manager/ui/widgets/shared/patch_text_button.dart';
import 'package:revanced_manager/ui/widgets/installerView/custom_material_button.dart';
import 'package:revanced_manager/ui/widgets/shared/custom_card.dart';
class LatestCommitCard extends StatefulWidget {
final Function() onPressed;
@ -24,12 +24,7 @@ class _LatestCommitCardState extends State<LatestCommitCard> {
@override
Widget build(BuildContext context) {
return Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: Theme.of(context).colorScheme.primary,
),
padding: const EdgeInsets.symmetric(vertical: 18, horizontal: 20),
return CustomCard(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
@ -40,11 +35,9 @@ class _LatestCommitCardState extends State<LatestCommitCard> {
children: <Widget>[
I18nText(
'latestCommitCard.patcherLabel',
child: Text(
child: const Text(
'',
style: GoogleFonts.roboto(
fontWeight: FontWeight.w700,
),
style: TextStyle(fontWeight: FontWeight.bold),
),
),
FutureBuilder<String>(
@ -60,7 +53,6 @@ class _LatestCommitCardState extends State<LatestCommitCard> {
context,
'latestCommitCard.loadingLabel',
),
style: kRobotoTextStyle,
),
),
],
@ -70,28 +62,20 @@ class _LatestCommitCardState extends State<LatestCommitCard> {
children: <Widget>[
I18nText(
'latestCommitCard.managerLabel',
child: Text(
child: const Text(
'',
style: GoogleFonts.roboto(
fontWeight: FontWeight.w700,
),
style: TextStyle(fontWeight: FontWeight.bold),
),
),
FutureBuilder<String>(
future: _githubAPI.latestCommitTime(ghOrg, managerRepo),
builder: (context, snapshot) => Text(
snapshot.hasData && snapshot.data!.isNotEmpty
? FlutterI18n.translate(
context,
'latestCommitCard.timeagoLabel',
translationParams: {'time': snapshot.data!},
)
: FlutterI18n.translate(
context,
'latestCommitCard.loadingLabel',
),
style: kRobotoTextStyle,
),
builder: (context, snapshot) =>
snapshot.hasData && snapshot.data!.isNotEmpty
? I18nText(
'latestCommitCard.timeagoLabel',
translationParams: {'time': snapshot.data!},
)
: I18nText('latestCommitCard.loadingLabel'),
),
],
),
@ -101,17 +85,13 @@ class _LatestCommitCardState extends State<LatestCommitCard> {
future: locator<HomeViewModel>().hasManagerUpdates(),
initialData: false,
builder: (context, snapshot) => Opacity(
opacity: snapshot.hasData && snapshot.data! ? 1.0 : 0.5,
child: PatchTextButton(
text: FlutterI18n.translate(
context,
'latestCommitCard.updateButton',
),
opacity: snapshot.hasData && snapshot.data! ? 1.0 : 1.0,
child: CustomMaterialButton(
isExpanded: false,
label: I18nText('latestCommitCard.updateButton'),
onPressed: snapshot.hasData && snapshot.data!
? widget.onPressed
: () => {},
backgroundColor: Theme.of(context).colorScheme.secondary,
borderColor: Theme.of(context).colorScheme.secondary,
),
),
),

View File

@ -1,5 +1,4 @@
import 'package:flutter/material.dart';
import 'package:revanced_manager/theme.dart';
class CustomMaterialButton extends StatelessWidget {
final Widget label;
@ -21,43 +20,17 @@ class CustomMaterialButton extends StatelessWidget {
style: ButtonStyle(
padding: MaterialStateProperty.all(
isExpanded
? const EdgeInsets.symmetric(
horizontal: 24,
vertical: 12,
)
: const EdgeInsets.symmetric(
horizontal: 20,
vertical: 12,
),
),
shape: MaterialStateProperty.all(
RoundedRectangleBorder(
borderRadius: BorderRadius.circular(100),
side: BorderSide(
width: 1,
color: Theme.of(context).colorScheme.secondary,
),
),
),
side: MaterialStateProperty.all(
BorderSide(
color: isFilled
? Colors.transparent
: Theme.of(context).iconTheme.color!.withOpacity(0.4),
width: 1,
),
? const EdgeInsets.symmetric(horizontal: 24, vertical: 12)
: const EdgeInsets.symmetric(horizontal: 20, vertical: 12),
),
shape: MaterialStateProperty.all(const StadiumBorder()),
backgroundColor: MaterialStateProperty.all(
isFilled
? Theme.of(context).colorScheme.secondary
: isDark
? Theme.of(context).colorScheme.background
: Colors.white,
isFilled ? Theme.of(context).colorScheme.primary : Colors.transparent,
),
foregroundColor: MaterialStateProperty.all(
isFilled
? Theme.of(context).colorScheme.background
: Theme.of(context).colorScheme.secondary,
? Theme.of(context).colorScheme.surface
: Theme.of(context).colorScheme.primary,
),
),
onPressed: onPressed,

View File

@ -1,10 +1,9 @@
import 'dart:typed_data';
import 'package:flutter/material.dart';
import 'package:flutter_i18n/flutter_i18n.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:revanced_manager/app/app.locator.dart';
import 'package:revanced_manager/constants.dart';
import 'package:revanced_manager/ui/views/patcher/patcher_viewmodel.dart';
import 'package:revanced_manager/ui/widgets/shared/custom_card.dart';
class AppSelectorCard extends StatelessWidget {
final Function() onPressed;
@ -18,13 +17,7 @@ class AppSelectorCard extends StatelessWidget {
Widget build(BuildContext context) {
return GestureDetector(
onTap: onPressed,
child: Container(
width: double.infinity,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: Theme.of(context).colorScheme.primary,
),
padding: const EdgeInsets.symmetric(vertical: 18, horizontal: 20),
child: CustomCard(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
@ -32,9 +25,9 @@ class AppSelectorCard extends StatelessWidget {
locator<PatcherViewModel>().selectedApp == null
? 'appSelectorCard.widgetTitle'
: 'appSelectorCard.widgetTitleSelected',
child: Text(
child: const Text(
'',
style: GoogleFonts.roboto(
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.w500,
),
@ -42,13 +35,7 @@ class AppSelectorCard extends StatelessWidget {
),
const SizedBox(height: 10),
locator<PatcherViewModel>().selectedApp == null
? I18nText(
'appSelectorCard.widgetSubtitle',
child: Text(
'',
style: kRobotoTextStyle,
),
)
? I18nText('appSelectorCard.widgetSubtitle')
: Row(
children: <Widget>[
SizedBox(
@ -63,10 +50,7 @@ class AppSelectorCard extends StatelessWidget {
),
),
const SizedBox(width: 4),
Text(
_getAppSelection(),
style: kRobotoTextStyle,
),
Text(_getAppSelection()),
],
),
],

View File

@ -1,10 +1,9 @@
import 'package:flutter/material.dart';
import 'package:flutter_i18n/flutter_i18n.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:revanced_manager/app/app.locator.dart';
import 'package:revanced_manager/constants.dart';
import 'package:revanced_manager/models/patch.dart';
import 'package:revanced_manager/ui/views/patcher/patcher_viewmodel.dart';
import 'package:revanced_manager/ui/widgets/shared/custom_card.dart';
class PatchSelectorCard extends StatelessWidget {
final Function() onPressed;
@ -18,13 +17,7 @@ class PatchSelectorCard extends StatelessWidget {
Widget build(BuildContext context) {
return GestureDetector(
onTap: onPressed,
child: Container(
width: double.infinity,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: Theme.of(context).colorScheme.primary,
),
padding: const EdgeInsets.symmetric(vertical: 18, horizontal: 20),
child: CustomCard(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
@ -32,9 +25,9 @@ class PatchSelectorCard extends StatelessWidget {
locator<PatcherViewModel>().selectedPatches.isEmpty
? 'patchSelectorCard.widgetTitle'
: 'patchSelectorCard.widgetTitleSelected',
child: Text(
child: const Text(
'',
style: GoogleFonts.roboto(
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.w500,
),
@ -42,25 +35,10 @@ class PatchSelectorCard extends StatelessWidget {
),
const SizedBox(height: 10),
locator<PatcherViewModel>().selectedApp == null
? I18nText(
'patchSelectorCard.widgetSubtitle',
child: Text(
'',
style: kRobotoTextStyle,
),
)
? I18nText('patchSelectorCard.widgetSubtitle')
: locator<PatcherViewModel>().selectedPatches.isEmpty
? I18nText(
'patchSelectorCard.widgetEmptySubtitle',
child: Text(
'',
style: kRobotoTextStyle,
),
)
: Text(
_getPatchesSelection(),
style: kRobotoTextStyle,
),
? I18nText('patchSelectorCard.widgetEmptySubtitle')
: Text(_getPatchesSelection()),
],
),
),

View File

@ -1,8 +1,8 @@
import 'package:flutter/material.dart';
import 'package:flutter_i18n/flutter_i18n.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:revanced_manager/ui/widgets/patchesSelectorView/patch_options_fields.dart';
import 'package:revanced_manager/ui/widgets/shared/patch_text_button.dart';
import 'package:revanced_manager/ui/widgets/installerView/custom_material_button.dart';
import 'package:revanced_manager/ui/widgets/shared/custom_card.dart';
// ignore: must_be_immutable
class PatchItem extends StatefulWidget {
@ -43,96 +43,92 @@ class _PatchItemState extends State<PatchItem> {
setState(() => widget.isSelected = !widget.isSelected);
widget.onChanged(widget.isSelected);
},
child: Container(
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.primary,
borderRadius: BorderRadius.circular(12),
),
padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 12),
margin: const EdgeInsets.symmetric(vertical: 4, horizontal: 8),
child: Column(
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Flexible(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: <Widget>[
Text(
widget.simpleName,
style: GoogleFonts.inter(
fontSize: 16,
fontWeight: FontWeight.w600,
),
),
const SizedBox(width: 4),
Text(widget.version)
],
),
const SizedBox(height: 4),
Text(
widget.description,
softWrap: true,
maxLines: 3,
overflow: TextOverflow.visible,
style: GoogleFonts.roboto(
fontSize: 14,
),
),
],
),
),
Transform.scale(
scale: 1.2,
child: Checkbox(
value: widget.isSelected,
activeColor: Theme.of(context).colorScheme.secondary,
onChanged: (newValue) {
setState(() => widget.isSelected = newValue!);
widget.onChanged(widget.isSelected);
},
),
)
],
),
widget.isUnsupported
? Row(
children: <Widget>[
Padding(
padding: const EdgeInsets.only(top: 8),
child: TextButton.icon(
label: I18nText('patchItem.unsupportedWarningButton'),
icon: const Icon(Icons.warning),
onPressed: () => _showUnsupportedWarningDialog(),
style: ButtonStyle(
shape: MaterialStateProperty.all(
RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
side: BorderSide(
width: 1,
color:
Theme.of(context).colorScheme.secondary,
),
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 4.0),
child: CustomCard(
child: Column(
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Flexible(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: <Widget>[
Text(
widget.simpleName,
style: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
),
),
backgroundColor: MaterialStateProperty.all(
Colors.transparent,
),
foregroundColor: MaterialStateProperty.all(
Theme.of(context).colorScheme.secondary,
const SizedBox(width: 4),
Text(widget.version)
],
),
const SizedBox(height: 4),
Text(
widget.description,
softWrap: true,
maxLines: 3,
overflow: TextOverflow.visible,
style: const TextStyle(fontSize: 14),
),
],
),
),
Transform.scale(
scale: 1.2,
child: Checkbox(
value: widget.isSelected,
activeColor: Theme.of(context).colorScheme.primary,
onChanged: (newValue) {
setState(() => widget.isSelected = newValue!);
widget.onChanged(widget.isSelected);
},
),
)
],
),
widget.isUnsupported
? Row(
children: <Widget>[
Padding(
padding: const EdgeInsets.only(top: 8),
child: TextButton.icon(
label:
I18nText('patchItem.unsupportedWarningButton'),
icon: const Icon(Icons.warning),
onPressed: () => _showUnsupportedWarningDialog(),
style: ButtonStyle(
shape: MaterialStateProperty.all(
RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
side: BorderSide(
width: 1,
color:
Theme.of(context).colorScheme.primary,
),
),
),
backgroundColor: MaterialStateProperty.all(
Colors.transparent,
),
foregroundColor: MaterialStateProperty.all(
Theme.of(context).colorScheme.primary,
),
),
),
),
),
],
)
: Container(),
widget.child ?? const SizedBox(),
],
],
)
: Container(),
widget.child ?? const SizedBox(),
],
),
),
),
);
@ -152,14 +148,13 @@ class _PatchItemState extends State<PatchItem> {
},
),
actions: [
PatchTextButton(
text: FlutterI18n.translate(context, 'okButton'),
CustomMaterialButton(
isFilled: true,
label: I18nText('okButton'),
onPressed: () => Navigator.of(context).pop(),
backgroundColor: Theme.of(context).colorScheme.secondary,
borderColor: Theme.of(context).colorScheme.secondary,
)
],
backgroundColor: Theme.of(context).colorScheme.surface,
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
),
);
}

View File

@ -1,7 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter_i18n/flutter_i18n.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:google_fonts/google_fonts.dart';
class MagiskButton extends StatelessWidget {
final Function() onPressed;
@ -20,7 +19,7 @@ class MagiskButton extends StatelessWidget {
onTap: onPressed,
child: CircleAvatar(
radius: 32,
backgroundColor: Theme.of(context).colorScheme.secondary,
backgroundColor: Theme.of(context).colorScheme.primary,
child: SvgPicture.asset(
'assets/images/magisk.svg',
color: Theme.of(context).colorScheme.surface,
@ -32,11 +31,9 @@ class MagiskButton extends StatelessWidget {
const SizedBox(height: 8),
I18nText(
'rootCheckerView.grantPermission',
child: Text(
child: const Text(
'',
style: GoogleFonts.poppins(
fontSize: 15,
),
style: TextStyle(fontSize: 15),
),
),
],

View File

@ -1,7 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter_i18n/flutter_i18n.dart';
import 'package:revanced_manager/constants.dart';
import 'package:revanced_manager/theme.dart';
import 'package:revanced_manager/utils/about_info.dart';
import 'package:flutter/services.dart';
@ -22,7 +20,13 @@ class _AboutWidgetState extends State<AboutWidget> {
children: <Widget>[
I18nText(
'settingsView.aboutLabel',
child: Text('', style: kSettingItemTextStyle),
child: const Text(
'',
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.w500,
),
),
),
const SizedBox(height: 4),
FutureBuilder<Map<String, dynamic>>(
@ -42,30 +46,50 @@ class _AboutWidgetState extends State<AboutWidget> {
);
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(
'Copied to clipboard',
style: TextStyle(
color: isDark ? Colors.white : Colors.grey[300],
),
),
backgroundColor: Theme.of(context).colorScheme.tertiary,
content: const Text('Copied to clipboard'),
backgroundColor:
Theme.of(context).colorScheme.secondary,
),
);
},
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text('Version: ${snapshot.data!['version']}',
style: kSettingItemSubtitleTextStyle),
Text('Build: ${snapshot.data!['buildNumber']}',
style: kSettingItemSubtitleTextStyle),
Text('Model: ${snapshot.data!['model']}',
style: kSettingItemSubtitleTextStyle),
Text(
'Android Version: ${snapshot.data!['androidVersion']}',
style: kSettingItemSubtitleTextStyle),
Text('Arch: ${snapshot.data!['arch']}',
style: kSettingItemSubtitleTextStyle),
'Version: ${snapshot.data!['version']}',
style: const TextStyle(
fontSize: 13,
fontWeight: FontWeight.w300,
),
),
Text(
'Build: ${snapshot.data!['buildNumber']}',
style: const TextStyle(
fontSize: 13,
fontWeight: FontWeight.w300,
),
),
Text(
'Model: ${snapshot.data!['model']}',
style: const TextStyle(
fontSize: 13,
fontWeight: FontWeight.w300,
),
),
Text(
'Android Version: ${snapshot.data!['androidVersion']}',
style: const TextStyle(
fontSize: 13,
fontWeight: FontWeight.w300,
),
),
Text(
'Arch: ${snapshot.data!['arch']}',
style: const TextStyle(
fontSize: 13,
fontWeight: FontWeight.w300,
),
),
],
),
);

View File

@ -12,8 +12,6 @@ class CustomSwitch extends StatelessWidget {
@override
Widget build(BuildContext context) {
Color? activeColor = Theme.of(context).colorScheme.tertiary;
Color? inactiveColor = Theme.of(context).colorScheme.secondary;
return GestureDetector(
onTap: () => onChanged(!value),
child: SizedBox(
@ -30,7 +28,9 @@ class CustomSwitch extends StatelessWidget {
borderRadius: const BorderRadius.all(
Radius.circular(25.0),
),
color: !value ? activeColor : inactiveColor,
color: value
? Theme.of(context).colorScheme.primary
: Theme.of(context).colorScheme.secondary,
),
),
AnimatedAlign(

View File

@ -1,5 +1,4 @@
import 'package:flutter/material.dart';
import 'package:revanced_manager/theme.dart';
class CustomTextField extends StatelessWidget {
final TextEditingController inputController;
@ -17,69 +16,55 @@ class CustomTextField extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
const SizedBox(height: 8),
TextField(
controller: inputController,
onChanged: onChanged,
keyboardType: TextInputType.text,
style: TextStyle(
fontSize: 14,
color: Theme.of(context).textTheme.headline5!.color,
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
const SizedBox(height: 8),
TextField(
controller: inputController,
onChanged: onChanged,
keyboardType: TextInputType.text,
decoration: InputDecoration(
label: label,
filled: true,
fillColor: Theme.of(context).colorScheme.secondaryContainer,
hintText: hint,
contentPadding: const EdgeInsets.symmetric(
vertical: 0.0,
horizontal: 20.0,
),
cursorColor: Theme.of(context).textTheme.headline5!.color,
decoration: InputDecoration(
label: label,
labelStyle: TextStyle(
color: isDark ? Colors.grey[300] : Colors.black,
border: OutlineInputBorder(
borderSide: BorderSide(
color: Theme.of(context).colorScheme.primary,
width: 1.0,
),
filled: true,
fillColor: Theme.of(context).colorScheme.primary,
hintText: hint,
hintStyle: TextStyle(
color: Colors.grey.withOpacity(.75),
borderRadius: BorderRadius.circular(10),
gapPadding: 4.0,
),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Theme.of(context).colorScheme.primary,
width: 2.0,
),
contentPadding: const EdgeInsets.symmetric(
vertical: 0.0,
horizontal: 20.0,
borderRadius: BorderRadius.circular(10),
),
errorBorder: OutlineInputBorder(
borderSide: const BorderSide(
color: Colors.red,
width: 1.0,
),
border: OutlineInputBorder(
borderSide: BorderSide(
color: Theme.of(context).colorScheme.tertiary,
width: 1.0,
),
borderRadius: BorderRadius.circular(10),
gapPadding: 4.0,
),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Theme.of(context).colorScheme.secondary,
width: 2.0,
),
borderRadius: BorderRadius.circular(10),
),
errorBorder: OutlineInputBorder(
borderSide: const BorderSide(
color: Color(0xffEF4444),
width: 1.0,
),
borderRadius: BorderRadius.circular(10),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Theme.of(context).colorScheme.tertiary,
width: 1.0,
),
borderRadius: BorderRadius.circular(10),
borderRadius: BorderRadius.circular(10),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Theme.of(context).colorScheme.primary,
width: 1.0,
),
borderRadius: BorderRadius.circular(10),
),
),
],
),
),
],
);
}
}

View File

@ -23,7 +23,7 @@ class SettingsSection extends StatelessWidget {
child: Text(
'',
style: TextStyle(
color: Theme.of(context).colorScheme.secondary,
color: Theme.of(context).colorScheme.primary,
),
),
),

View File

@ -1,6 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter_i18n/flutter_i18n.dart';
import 'package:revanced_manager/constants.dart';
class SettingsTileDialog extends StatelessWidget {
final String title;
@ -20,9 +19,12 @@ class SettingsTileDialog extends StatelessWidget {
contentPadding: EdgeInsets.zero,
title: I18nText(
title,
child: Text(
child: const Text(
'',
style: kSettingItemTextStyle,
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.w500,
),
),
),
subtitle: I18nText(subtitle),

View File

@ -2,8 +2,7 @@ import 'package:expandable/expandable.dart';
import 'package:flutter/material.dart';
import 'package:flutter_i18n/flutter_i18n.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:revanced_manager/constants.dart';
import 'package:revanced_manager/theme.dart';
import 'package:revanced_manager/ui/widgets/shared/custom_card.dart';
import 'package:url_launcher/url_launcher.dart';
class SocialMediaWidget extends StatelessWidget {
@ -18,32 +17,25 @@ class SocialMediaWidget extends StatelessWidget {
iconPadding: const EdgeInsets.symmetric(vertical: 16.0),
animationDuration: const Duration(milliseconds: 400),
),
header: SizedBox(
width: double.infinity,
child: ListTile(
contentPadding: EdgeInsets.zero,
title: I18nText(
'socialMediaCard.widgetTitle',
child: Text('', style: kSettingItemTextStyle),
),
subtitle: I18nText(
'socialMediaCard.widgetSubtitle',
child: Text(
'',
style: Theme.of(context).textTheme.bodyMedium!.copyWith(
color: isDark ? Colors.grey[400] : Colors.grey[600],
),
header: ListTile(
contentPadding: EdgeInsets.zero,
title: I18nText(
'socialMediaCard.widgetTitle',
child: const Text(
'',
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.w500,
),
),
),
subtitle: I18nText('socialMediaCard.widgetSubtitle'),
),
expanded: Card(
color: isDark
? Theme.of(context).colorScheme.primary
: Theme.of(context).navigationBarTheme.backgroundColor!,
expanded: CustomCard(
child: Column(
children: <Widget>[
ListTile(
contentPadding: EdgeInsets.zero,
leading: Padding(
padding: const EdgeInsets.all(8.0),
child: FaIcon(
@ -59,6 +51,7 @@ class SocialMediaWidget extends StatelessWidget {
),
),
ListTile(
contentPadding: EdgeInsets.zero,
leading: Padding(
padding: const EdgeInsets.all(8.0).copyWith(left: 5),
child: FaIcon(
@ -74,6 +67,7 @@ class SocialMediaWidget extends StatelessWidget {
),
),
ListTile(
contentPadding: EdgeInsets.zero,
leading: Padding(
padding: const EdgeInsets.all(8.0),
child: FaIcon(
@ -89,6 +83,7 @@ class SocialMediaWidget extends StatelessWidget {
),
),
ListTile(
contentPadding: EdgeInsets.zero,
leading: Padding(
padding: const EdgeInsets.all(8.0),
child: FaIcon(
@ -104,6 +99,7 @@ class SocialMediaWidget extends StatelessWidget {
),
),
ListTile(
contentPadding: EdgeInsets.zero,
leading: Padding(
padding: const EdgeInsets.all(8.0),
child: FaIcon(
@ -119,6 +115,7 @@ class SocialMediaWidget extends StatelessWidget {
),
),
ListTile(
contentPadding: EdgeInsets.zero,
leading: Padding(
padding: const EdgeInsets.all(8.0),
child: FaIcon(

View File

@ -2,8 +2,8 @@ import 'package:expandable/expandable.dart';
import 'package:flutter/material.dart';
import 'package:flutter_i18n/flutter_i18n.dart';
import 'package:revanced_manager/constants.dart';
import 'package:revanced_manager/theme.dart';
import 'package:revanced_manager/ui/widgets/settingsView/custom_text_field.dart';
import 'package:revanced_manager/ui/widgets/shared/custom_card.dart';
class SourcesWidget extends StatelessWidget {
final String title;
@ -28,29 +28,21 @@ class SourcesWidget extends StatelessWidget {
iconPadding: const EdgeInsets.symmetric(vertical: 16.0),
animationDuration: const Duration(milliseconds: 400),
),
header: SizedBox(
width: double.infinity,
child: ListTile(
contentPadding: EdgeInsets.zero,
title: I18nText(
'sourcesCard.widgetTitle',
child: Text('', style: kSettingItemTextStyle),
),
subtitle: I18nText(
'sourcesCard.widgetSubtitle',
child: Text(
'',
style: Theme.of(context).textTheme.bodyMedium!.copyWith(
color: isDark ? Colors.grey[400] : Colors.grey[600],
),
header: ListTile(
contentPadding: EdgeInsets.zero,
title: I18nText(
'sourcesCard.widgetTitle',
child: const Text(
'',
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.w500,
),
),
),
subtitle: I18nText('sourcesCard.widgetSubtitle'),
),
expanded: Card(
color: isDark
? Theme.of(context).colorScheme.primary
: Theme.of(context).navigationBarTheme.backgroundColor!,
expanded: CustomCard(
child: Column(
children: <Widget>[
CustomTextField(
@ -59,12 +51,14 @@ class SourcesWidget extends StatelessWidget {
hint: ghOrg,
onChanged: (value) => ghOrg = value,
),
const SizedBox(height: 8),
CustomTextField(
inputController: patchesSourceController,
label: I18nText('sourcesCard.patchesSourceLabel'),
hint: patchesRepo,
onChanged: (value) => patchesRepo = value,
),
const SizedBox(height: 8),
CustomTextField(
inputController: integrationsSourceController,
label: I18nText('sourcesCard.integrationsSourceLabel'),

View File

@ -1,10 +1,8 @@
import 'dart:typed_data';
import 'package:flutter/material.dart';
import 'package:flutter_i18n/flutter_i18n.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:revanced_manager/constants.dart';
import 'package:revanced_manager/theme.dart';
import 'package:revanced_manager/ui/widgets/shared/patch_text_button.dart';
import 'package:revanced_manager/ui/widgets/installerView/custom_material_button.dart';
import 'package:revanced_manager/ui/widgets/shared/custom_card.dart';
import 'package:expandable/expandable.dart';
import 'package:timeago/timeago.dart';
@ -33,56 +31,35 @@ class ApplicationItem extends StatelessWidget {
hasIcon: false,
animationDuration: Duration(milliseconds: 450),
),
header: Container(
height: 60,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: Theme.of(context).colorScheme.primary,
),
padding: const EdgeInsets.symmetric(horizontal: 10.0, vertical: 12.0),
header: CustomCard(
child: Row(
children: <Widget>[
SizedBox(
width: 60,
child: Image.memory(
icon,
height: 39,
width: 39,
),
child: Image.memory(icon, height: 39, width: 39),
),
const SizedBox(width: 4),
SizedBox(
width: MediaQuery.of(context).size.width - 250,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
name,
style: GoogleFonts.roboto(
color: Theme.of(context).colorScheme.secondary,
fontWeight: FontWeight.w600,
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
name,
style: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.w500,
),
Text(
format(patchDate, locale: 'en_short'),
style: kRobotoTextStyle.copyWith(
color: Theme.of(context).colorScheme.tertiary,
),
),
],
),
),
Text(format(patchDate, locale: 'en_short')),
],
),
const Spacer(),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 8.0),
child: PatchTextButton(
text: isUpdatableApp
? 'applicationItem.patchButton'
: 'applicationItem.openButton',
child: CustomMaterialButton(
label: isUpdatableApp
? I18nText('applicationItem.patchButton')
: I18nText('applicationItem.openButton'),
onPressed: onPressed,
borderColor: isDark
? const Color(0xff4D5054)
: const Color.fromRGBO(119, 146, 168, 1),
),
),
],
@ -96,16 +73,13 @@ class ApplicationItem extends StatelessWidget {
children: <Widget>[
I18nText(
'applicationItem.changelogLabel',
child: Text(
child: const Text(
'',
style: kRobotoTextStyle.copyWith(fontWeight: FontWeight.w700),
style: TextStyle(fontWeight: FontWeight.w700),
),
),
const SizedBox(height: 4),
Text(
'\u2022 ${changelog.join('\n\u2022 ')}',
style: kRobotoTextStyle,
),
Text('\u2022 ${changelog.join('\n\u2022 ')}'),
],
),
),

View File

@ -0,0 +1,32 @@
import 'package:flutter/material.dart';
class CustomCard extends StatelessWidget {
final bool isFilled;
final Widget child;
const CustomCard({
Key? key,
this.isFilled = true,
required this.child,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(16),
color: isFilled
? Theme.of(context).colorScheme.secondaryContainer
: Colors.transparent,
border: isFilled
? null
: Border.all(
width: 1,
color: Theme.of(context).colorScheme.secondary,
),
),
padding: const EdgeInsets.all(20),
child: child,
);
}
}

View File

@ -1,5 +1,4 @@
import 'package:flutter/material.dart';
import 'package:revanced_manager/theme.dart';
class CustomSliverAppBar extends StatelessWidget {
final Widget title;
@ -21,10 +20,8 @@ class CustomSliverAppBar extends StatelessWidget {
automaticallyImplyLeading: false,
backgroundColor: MaterialStateColor.resolveWith(
(states) => states.contains(MaterialState.scrolledUnder)
? isDark
? Theme.of(context).colorScheme.primary
: Theme.of(context).navigationBarTheme.backgroundColor!
: Theme.of(context).scaffoldBackgroundColor,
? Theme.of(context).colorScheme.surface
: Theme.of(context).canvasColor,
),
flexibleSpace: FlexibleSpaceBar(
titlePadding: const EdgeInsets.symmetric(

View File

@ -21,7 +21,7 @@ class OpenContainerWrapper extends StatelessWidget {
openColor: Theme.of(context).colorScheme.primary,
closedColor: Colors.transparent,
closedShape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
borderRadius: BorderRadius.circular(16),
),
);
}

View File

@ -1,51 +0,0 @@
import 'package:flutter/material.dart';
import 'package:flutter_i18n/flutter_i18n.dart';
import 'package:revanced_manager/constants.dart';
import 'package:revanced_manager/theme.dart';
class PatchTextButton extends StatelessWidget {
final String text;
final Function() onPressed;
final Color borderColor;
final Color backgroundColor;
const PatchTextButton({
Key? key,
required this.text,
required this.onPressed,
this.borderColor = const Color(0xff7792BA),
this.backgroundColor = Colors.transparent,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return TextButton(
onPressed: onPressed,
style: Theme.of(context).textButtonTheme.style?.copyWith(
backgroundColor: MaterialStateProperty.all<Color?>(backgroundColor),
side: MaterialStateProperty.all<BorderSide>(
BorderSide(
color: borderColor,
width: 1,
),
),
padding: MaterialStateProperty.all<EdgeInsetsGeometry>(
const EdgeInsets.symmetric(
horizontal: 16,
vertical: 4,
),
)),
child: I18nText(text,
child: Text(
'',
style: kInterTextStyle.copyWith(
color: backgroundColor == Colors.transparent
? const Color.fromRGBO(119, 146, 186, 1)
: isDark
? Colors.black
: Colors.white,
),
)),
);
}
}

View File

@ -1,23 +1,16 @@
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
class SearchBar extends StatefulWidget {
final String? hintText;
final Color? fillColor;
final bool showSelectIcon;
final Function(bool)? onSelectAll;
final Color? backgroundColor;
final Color? hintTextColor;
const SearchBar({
Key? key,
required this.hintText,
required this.fillColor,
required this.onQueryChanged,
this.onSelectAll,
this.showSelectIcon = false,
this.backgroundColor = const Color(0xff1B222B),
this.hintTextColor = Colors.white,
this.onSelectAll,
required this.onQueryChanged,
}) : super(key: key);
final Function(String) onQueryChanged;
@ -34,14 +27,8 @@ class _SearchBarState extends State<SearchBar> {
Widget build(BuildContext context) {
return Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: widget.backgroundColor,
border: Border.all(
color: widget.backgroundColor != null
? widget.backgroundColor!
: Colors.white,
width: 1,
),
borderRadius: BorderRadius.circular(16),
color: Theme.of(context).colorScheme.secondaryContainer,
),
child: Row(
children: <Widget>[
@ -49,25 +36,18 @@ class _SearchBarState extends State<SearchBar> {
child: TextFormField(
onChanged: widget.onQueryChanged,
controller: _textController,
cursorColor: Theme.of(context).textTheme.headline5!.color,
decoration: InputDecoration(
fillColor: widget.fillColor,
filled: true,
fillColor: Theme.of(context).colorScheme.secondaryContainer,
contentPadding: const EdgeInsets.all(12.0),
hintText: widget.hintText,
hintStyle: GoogleFonts.poppins(
color: widget.hintTextColor,
fontWeight: FontWeight.w400,
),
prefixIcon: Icon(
Icons.search,
size: 24.0,
color: Theme.of(context).iconTheme.color,
),
suffixIcon: _textController.text.isNotEmpty
? IconButton(
icon: const Icon(Icons.clear),
iconSize: 24.0,
onPressed: () {
_textController.clear();
widget.onQueryChanged('');
@ -78,7 +58,6 @@ class _SearchBarState extends State<SearchBar> {
icon: _toggleSelectAll
? const Icon(Icons.deselect)
: const Icon(Icons.select_all),
iconSize: 24.0,
onPressed: widget.onSelectAll != null
? () {
setState(() {
@ -94,11 +73,6 @@ class _SearchBarState extends State<SearchBar> {
borderSide: BorderSide.none,
),
),
style: GoogleFonts.poppins(
color: Theme.of(context).textTheme.headline5!.color,
fontWeight: FontWeight.w400,
fontSize: 16,
),
),
),
],