feat: about info card and flutter convention style

This commit is contained in:
Aunali321 2022-08-19 18:34:40 +05:30
parent 614a694a77
commit e373aef2d9
11 changed files with 119 additions and 28 deletions

View file

@ -8,8 +8,16 @@ const purple40 = Color(0xFF6650a4);
const purpleGrey40 = Color(0xFF625b71);
const pink40 = Color(0xFF7D5260);
final interTextStyle = GoogleFonts.inter();
final robotoTextStyle = GoogleFonts.roboto();
final kInterTextStyle = GoogleFonts.inter();
final kRobotoTextStyle = GoogleFonts.roboto();
final kSettingItemTextStyle = GoogleFonts.roboto(
fontSize: 20,
fontWeight: FontWeight.w500,
);
final kSettingItemSubtitleTextStyle = GoogleFonts.roboto(
fontSize: 13,
fontWeight: FontWeight.w300,
);
const ghOrg = 'revanced';
const patchesRepo = 'revanced-patches';

View file

@ -1,7 +1,10 @@
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/settings/settings_viewmodel.dart';
import 'package:revanced_manager/ui/widgets/about_info_widget.dart';
import 'package:stacked/stacked.dart';
import 'package:stacked_themes/stacked_themes.dart';
@ -15,18 +18,30 @@ class SettingsView extends StatelessWidget {
builder: (context, SettingsViewModel model, child) => Scaffold(
body: SafeArea(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: ListView(
padding: const EdgeInsets.all(12.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
const SizedBox(height: 12),
I18nText(
'settingsView.widgetTitle',
child: Text(
'',
style: Theme.of(context).textTheme.headline5,
style: GoogleFonts.inter(
fontSize: 28,
fontWeight: FontWeight.w500,
),
),
),
const SizedBox(height: 12),
ListTile(
title: I18nText('settingsView.themeLabel'),
title: I18nText(
'settingsView.themeLabel',
child: Text(
'',
style: kSettingItemTextStyle,
),
),
subtitle: I18nText('settingsView.themeHint'),
trailing: Switch(
value: isDark,
@ -46,12 +61,7 @@ class SettingsView extends StatelessWidget {
children: [
I18nText(
'settingsView.languageLabel',
child: const Text(
'',
style: TextStyle(
fontSize: 16,
),
),
child: Text('', style: kSettingItemTextStyle),
),
DropdownButton(
value: 'en',
@ -73,12 +83,13 @@ class SettingsView extends StatelessWidget {
),
),
ListTile(
title: I18nText('settingsView.aboutLabel'),
),
ListTile(
title: I18nText('settingsView.contributorsLabel'),
title: I18nText(
'settingsView.contributorsLabel',
child: Text('', style: kSettingItemTextStyle),
),
onTap: model.navigateToContributors,
),
const AboutWidget(),
],
),
),

View file

@ -0,0 +1,54 @@
import 'package:flutter/material.dart';
import 'package:flutter_i18n/widgets/I18nText.dart';
import 'package:revanced_manager/constants.dart';
import 'package:revanced_manager/utils/about_info.dart';
class AboutWidget extends StatefulWidget {
const AboutWidget({Key? key}) : super(key: key);
@override
State<AboutWidget> createState() => _AboutWidgetState();
}
class _AboutWidgetState extends State<AboutWidget> {
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
I18nText(
'settingsView.aboutLabel',
child: Text('', style: kSettingItemTextStyle),
),
const SizedBox(height: 4),
FutureBuilder<Map<String, dynamic>>(
future: AboutInfo.getInfo(),
builder: (context, snapshot) {
if (snapshot.hasData) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
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),
],
);
} else {
return Container();
}
},
),
],
),
);
}
}

View file

@ -49,7 +49,7 @@ class AppSelectorCard extends StatelessWidget {
'appSelectorCard.widgetSubtitle',
child: Text(
'',
style: robotoTextStyle,
style: kRobotoTextStyle,
),
)
: Row(
@ -68,7 +68,7 @@ class AppSelectorCard extends StatelessWidget {
const SizedBox(width: 4),
Text(
_getAppSelection(),
style: robotoTextStyle,
style: kRobotoTextStyle,
),
],
),

View file

@ -67,7 +67,7 @@ class ApplicationItem extends StatelessWidget {
),
Text(
format(patchDate, locale: 'en_short'),
style: robotoTextStyle.copyWith(
style: kRobotoTextStyle.copyWith(
color: Theme.of(context).colorScheme.tertiary,
),
),
@ -100,12 +100,12 @@ class ApplicationItem extends StatelessWidget {
'applicationItem.changelogLabel',
child: Text(
'',
style: robotoTextStyle.copyWith(fontWeight: FontWeight.w700),
style: kRobotoTextStyle.copyWith(fontWeight: FontWeight.w700),
),
),
Text(
changelog,
style: robotoTextStyle,
style: kRobotoTextStyle,
),
],
),

View file

@ -60,7 +60,7 @@ class _InstalledAppItemState extends State<InstalledAppItem> {
const SizedBox(height: 4),
Text(
widget.pkgName,
style: robotoTextStyle,
style: kRobotoTextStyle,
),
],
),

View file

@ -61,7 +61,7 @@ class _LatestCommitCardState extends State<LatestCommitCard> {
context,
'latestCommitCard.loadingLabel',
),
style: robotoTextStyle,
style: kRobotoTextStyle,
),
),
],
@ -91,7 +91,7 @@ class _LatestCommitCardState extends State<LatestCommitCard> {
context,
'latestCommitCard.loadingLabel',
),
style: robotoTextStyle,
style: kRobotoTextStyle,
),
),
],

View file

@ -48,7 +48,7 @@ class PatchSelectorCard extends StatelessWidget {
'patchSelectorCard.widgetSubtitle',
child: Text(
'',
style: robotoTextStyle,
style: kRobotoTextStyle,
),
)
: locator<PatcherViewModel>().selectedPatches.isEmpty
@ -56,12 +56,12 @@ class PatchSelectorCard extends StatelessWidget {
'patchSelectorCard.widgetEmptySubtitle',
child: Text(
'',
style: robotoTextStyle,
style: kRobotoTextStyle,
),
)
: Text(
_getPatchesSelection(),
style: robotoTextStyle,
style: kRobotoTextStyle,
),
],
),

View file

@ -37,7 +37,7 @@ class PatchTextButton extends StatelessWidget {
child: I18nText(text,
child: Text(
'',
style: interTextStyle.copyWith(
style: kInterTextStyle.copyWith(
color: backgroundColor == Colors.transparent
? const Color.fromRGBO(119, 146, 186, 1)
: isDark

17
lib/utils/about_info.dart Normal file
View file

@ -0,0 +1,17 @@
import 'package:package_info_plus/package_info_plus.dart';
import 'package:device_info_plus/device_info_plus.dart';
class AboutInfo {
static Future<Map<String, dynamic>> getInfo() async {
final packageInfo = await PackageInfo.fromPlatform();
final info = await DeviceInfoPlugin().androidInfo;
return {
'version': packageInfo.version,
'buildNumber': packageInfo.buildNumber,
'model': info.model,
'androidVersion': info.version.release,
'arch': info.supported64BitAbis
};
}
}

View file

@ -16,6 +16,7 @@ dependencies:
git:
url: https://github.com/ponces/flutter_plugin_device_apps
ref: appinfo-from-storage
device_info_plus: ^4.1.2
expandable: ^5.0.1
file_picker: ^5.0.1
flutter: