mirror of
https://github.com/revanced/revanced-manager.git
synced 2025-06-12 12:47:37 +02:00
feat: improve app theming code and add Material You (#58)
This commit is contained in:
@ -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,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
@ -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(
|
||||
|
@ -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),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ class SettingsSection extends StatelessWidget {
|
||||
child: Text(
|
||||
'',
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -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),
|
||||
|
@ -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(
|
||||
|
@ -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'),
|
||||
|
Reference in New Issue
Block a user