refactor: improve code readability according to formatter

This commit is contained in:
Pun Butrach
2023-07-10 19:36:50 +07:00
parent b272988929
commit 6a45db8a38
9 changed files with 55 additions and 48 deletions

View File

@ -34,7 +34,8 @@ class AppSkeletonLoader extends StatelessWidget {
style: SkeletonLineStyle(
height: 20,
width: screenWidth * 0.4,
borderRadius: const BorderRadius.all(Radius.circular(10)),
borderRadius:
const BorderRadius.all(Radius.circular(10)),
),
),
),
@ -45,7 +46,8 @@ class AppSkeletonLoader extends StatelessWidget {
style: SkeletonLineStyle(
height: 15,
width: screenWidth * 0.6,
borderRadius: const BorderRadius.all(Radius.circular(10)),
borderRadius:
const BorderRadius.all(Radius.circular(10)),
),
),
),
@ -56,7 +58,8 @@ class AppSkeletonLoader extends StatelessWidget {
style: SkeletonLineStyle(
height: 15,
width: screenWidth * 0.5,
borderRadius: const BorderRadius.all(Radius.circular(10)),
borderRadius:
const BorderRadius.all(Radius.circular(10)),
),
),
),

View File

@ -66,7 +66,7 @@ class _InstalledAppItemState extends State<InstalledAppItem> {
context,
'installed',
translationParams: {
'version':'v${widget.installedVersion}'
'version': 'v${widget.installedVersion}'
},
),
),
@ -75,8 +75,9 @@ class _InstalledAppItemState extends State<InstalledAppItem> {
I18nText(
'suggested',
translationParams: {
'version' : widget.suggestedVersion.isEmpty
? FlutterI18n.translate(context, 'appSelectorCard.allVersions')
'version': widget.suggestedVersion.isEmpty
? FlutterI18n.translate(
context, 'appSelectorCard.allVersions')
: 'v${widget.suggestedVersion}',
},
),

View File

@ -60,8 +60,7 @@ class _NotInstalledAppItem extends State<NotInstalledAppItem> {
child: Text(
'',
style: TextStyle(
color:
Theme.of(context).textTheme.titleLarge!.color,
color: Theme.of(context).textTheme.titleLarge!.color,
),
),
),
@ -70,8 +69,9 @@ class _NotInstalledAppItem extends State<NotInstalledAppItem> {
I18nText(
'suggested',
translationParams: {
'version' : widget.suggestedVersion.isEmpty
? FlutterI18n.translate(context, 'appSelectorCard.allVersions')
'version': widget.suggestedVersion.isEmpty
? FlutterI18n.translate(
context, 'appSelectorCard.allVersions')
: 'v${widget.suggestedVersion}',
},
),

View File

@ -45,8 +45,7 @@ class UpdateConfirmationDialog extends StatelessWidget {
children: [
Expanded(
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
I18nText(
'homeView.updateDialogTitle',
@ -63,14 +62,12 @@ class UpdateConfirmationDialog extends StatelessWidget {
children: [
Icon(
Icons.new_releases_outlined,
color: Theme.of(context)
.colorScheme
.secondary,
color:
Theme.of(context).colorScheme.secondary,
),
const SizedBox(width: 8.0),
Text(
snapshot.data!['tag_name'] ??
'Unknown',
snapshot.data!['tag_name'] ?? 'Unknown',
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.w500,
@ -96,8 +93,7 @@ class UpdateConfirmationDialog extends StatelessWidget {
),
),
Padding(
padding:
const EdgeInsets.only(left: 24.0, bottom: 12.0),
padding: const EdgeInsets.only(left: 24.0, bottom: 12.0),
child: I18nText(
'homeView.updateChangelogTitle',
child: Text(
@ -113,12 +109,9 @@ class UpdateConfirmationDialog extends StatelessWidget {
),
),
Container(
margin:
const EdgeInsets.symmetric(horizontal: 24.0),
margin: const EdgeInsets.symmetric(horizontal: 24.0),
decoration: BoxDecoration(
color: Theme.of(context)
.colorScheme
.secondaryContainer,
color: Theme.of(context).colorScheme.secondaryContainer,
borderRadius: BorderRadius.circular(12.0),
),
child: Markdown(

View File

@ -42,7 +42,9 @@ class PatchItem extends StatefulWidget {
class _PatchItemState extends State<PatchItem> {
@override
Widget build(BuildContext context) {
widget.isSelected = widget.isSelected && (!widget.isUnsupported || widget._managerAPI.areExperimentalPatchesEnabled());
widget.isSelected = widget.isSelected &&
(!widget.isUnsupported ||
widget._managerAPI.areExperimentalPatchesEnabled());
return Padding(
padding: const EdgeInsets.symmetric(vertical: 4.0),
child: Opacity(
@ -117,7 +119,7 @@ class _PatchItemState extends State<PatchItem> {
value: widget.isSelected,
activeColor: Theme.of(context).colorScheme.primary,
checkColor:
Theme.of(context).colorScheme.secondaryContainer,
Theme.of(context).colorScheme.secondaryContainer,
side: BorderSide(
width: 2.0,
color: Theme.of(context).colorScheme.primary,
@ -128,14 +130,15 @@ class _PatchItemState extends State<PatchItem> {
!widget._managerAPI
.areExperimentalPatchesEnabled()) {
widget.isSelected = false;
widget.toast
.showBottom('patchItem.unsupportedPatchVersion');
widget.toast.showBottom(
'patchItem.unsupportedPatchVersion');
} else {
widget.isSelected = newValue!;
}
if (widget.isUnsupported &&
widget.isSelected &&
!selectedUnsupportedPatches.contains(widget.name)) {
!selectedUnsupportedPatches
.contains(widget.name)) {
selectedUnsupportedPatches.add(widget.name);
}
});

View File

@ -34,9 +34,11 @@ class _SExperimentalPatchesState extends State<SExperimentalPatches> {
setState(() {
_settingsViewModel.useExperimentalPatches(value);
});
if(!value) {
if (!value) {
for (final patch in selectedUnsupportedPatches) {
PatchesSelectorViewModel().selectedPatches.removeWhere((element) => patch == element.name);
PatchesSelectorViewModel()
.selectedPatches
.removeWhere((element) => patch == element.name);
}
selectedUnsupportedPatches.clear();
}