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

@ -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