Skip to content

Commit

Permalink
Auto formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
leoafarias committed Jun 3, 2021
1 parent b9d0c5d commit 06d303a
Show file tree
Hide file tree
Showing 33 changed files with 114 additions and 120 deletions.
2 changes: 1 addition & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ void main() async {
await SettingsService.init();
await ProjectsService.init();
} on FileSystemException {
print("There was an issue opening the DB");
print('There was an issue opening the DB');
}

if (Platform.isWindows || Platform.isLinux || Platform.isMacOS) {
Expand Down
6 changes: 3 additions & 3 deletions lib/src/components/molecules/delete_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,23 @@ void showDeleteDialog(
builder: (context) {
// return object of type Dialog
return AlertDialog(
title: const Text("Are you sure you want to remove?"),
title: const Text('Are you sure you want to remove?'),
content: Text('This will remove ${item.name} cache from your system.'),
buttonPadding: const EdgeInsets.all(15),
actions: <Widget>[
// usually buttons at the bottom of the dialog
TextButton(
child: const Text("Cancel"),
onPressed: () {
Navigator.of(context).pop();
},
child: const Text('Cancel'),
),
TextButton(
child: const Text("Confirm"),
onPressed: () async {
Navigator.of(context).pop();
onDelete();
},
child: const Text('Confirm'),
),
],
);
Expand Down
4 changes: 2 additions & 2 deletions lib/src/components/organisms/cleanup_unused_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,12 @@ Future<void> cleanupUnusedDialog(BuildContext context) async {
actions: <Widget>[
// usually buttons at the bottom of the dialog
TextButton(
child: const Text("Cancel"),
onPressed: () {
Navigator.of(context).pop();
},
child: const Text('Cancel'),
),
TextButton(
child: const Text("Confirm"),
onPressed: () async {
final unusedSelected = unusedVersions.where(
(element) => selected.containsKey(element.name),
Expand All @@ -42,6 +41,7 @@ Future<void> cleanupUnusedDialog(BuildContext context) async {

Navigator.of(context).pop();
},
child: const Text('Confirm'),
),
],
content: Container(
Expand Down
10 changes: 5 additions & 5 deletions lib/src/components/organisms/global_info_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ Future<void> showGlobalInfoDialog(BuildContext context) async {
title: const Heading('Global configuration'),
actions: <Widget>[
TextButton(
child: const Text("OK"),
style: ButtonStyle(
padding: MaterialStateProperty.resolveWith(
(states) => const EdgeInsets.all(20),
)),
onPressed: () {
Navigator.of(context).pop();
},
child: const Text('OK'),
),
],
content: Container(
Expand All @@ -34,15 +34,15 @@ Future<void> showGlobalInfoDialog(BuildContext context) async {
mainAxisSize: MainAxisSize.min,
children: [
const Subheading(
"Flutter PATH is pointing to\n ",
'Flutter PATH is pointing to\n ',
),
Caption("${configured.currentPath}.\n\n"),
Caption('${configured.currentPath}.\n\n'),
!configured.isSetup
? Column(
children: [
const Subheading(
"Change the path to\n"
"if you want to Flutter SDK through FVM",
'Change the path to\n'
'if you want to Flutter SDK through FVM',
),
Row(
children: [
Expand Down
4 changes: 2 additions & 2 deletions lib/src/modules/common/app_shell.dart
Original file line number Diff line number Diff line change
Expand Up @@ -134,21 +134,21 @@ class AppShell extends HookWidget {
duration: const Duration(milliseconds: 250),
reverse: selectedIndex.value <
(navigation.previous.index ?? 0),
child: renderPage(selectedIndex.value),
transitionBuilder: (
child,
animation,
secondaryAnimation,
) {
return SharedAxisTransition(
fillColor: Colors.transparent,
child: child,
animation: animation,
secondaryAnimation: secondaryAnimation,
transitionType:
SharedAxisTransitionType.vertical,
child: child,
);
},
child: renderPage(selectedIndex.value),
),
),
],
Expand Down
2 changes: 1 addition & 1 deletion lib/src/modules/common/atoms/group_tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ class SkGroupTile extends HookWidget {
title: title,
leading: leading,
trailing: trailing,
children: children,
tilePadding: const EdgeInsets.fromLTRB(20, 5, 20, 5),
backgroundColor: Colors.white12,
onExpansionChanged: (expanded) {
isExpanded.value = expanded;
},
children: children,
),
);
}
Expand Down
4 changes: 2 additions & 2 deletions lib/src/modules/common/constants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@ Map<String, String> channelDescriptions = {

/// Sidekick repository slug
final kSidekickRepoSlug = RepositorySlug(
"leoafarias",
"sidekick",
'leoafarias',
'sidekick',
);
4 changes: 2 additions & 2 deletions lib/src/modules/common/utils/helpers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ extension StringExtension on String {
/// Iterable extension
extension ExtendedIterable<E> on Iterable<E> {
/// Like Iterable<T>.map but callback have index as second argument
Iterable<T> mapIndexed<T>(T f(E e, int i)) {
Iterable<T> mapIndexed<T>(T Function(E e, int i) f) {
var i = 0;
return map((e) => f(e, i++));
}

/// For each with index
void forEachIndexed(void f(E e, int i)) {
void forEachIndexed(void Function(E e, int i) f) {
var i = 0;
forEach((e) => f(e, i++));
}
Expand Down
6 changes: 4 additions & 2 deletions lib/src/modules/common/utils/scan_directory.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import 'dart:io';

import 'package:flutter/material.dart';

/// Scans [rootDir] for a certain condition
Future<List<FileSystemEntity>> scanDirectoryForCondition({
bool Function(FileSystemEntity) condition,
Directory rootDir,
@required bool Function(FileSystemEntity) condition,
@required Directory rootDir,
}) async {
assert(condition != null);
assert(rootDir != null);
Expand Down
2 changes: 1 addition & 1 deletion lib/src/modules/fvm/components/fvm_release_actions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,10 @@ class FvmReleaseActions extends StatelessWidget {
context.read(fvmQueueProvider.notifier).upgrade(release);
}
},
child: const Icon(MdiIcons.dotsVertical),
itemBuilder: (context) {
return renderMenuOptions();
},
child: const Icon(MdiIcons.dotsVertical),
);
}
}
2 changes: 1 addition & 1 deletion lib/src/modules/fvm/fvm.provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class FvmCacheProvider extends StateNotifier<List<CacheVersion>> {
channels = localVersions.where((item) => item.isChannel).toList();
versions = localVersions.where((item) => item.isChannel == false).toList();
all = [...channels, ...versions];
_setTotalCacheSize();
await _setTotalCacheSize();
}

CacheVersion getChannel(String name) {
Expand Down
6 changes: 3 additions & 3 deletions lib/src/modules/fvm/fvm_queue.provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class FvmQueueState extends StateNotifier<FvmQueue> {
final action =
skipSetup ? QueueAction.install : QueueAction.installAndSetup;

_addToQueue(version, action: action);
await _addToQueue(version, action: action);
}

/// Adds setup action to queue
Expand Down Expand Up @@ -122,7 +122,7 @@ class FvmQueueState extends StateNotifier<FvmQueue> {
case QueueAction.installAndSetup:
await FVMClient.install(item.version.name);
await FVMClient.setup(item.version.name);
await notify('Version ${item.version.name} has been installed.');
notify('Version ${item.version.name} has been installed.');
break;
case QueueAction.channelUpgrade:
await FVMClient.upgradeChannel(item.version.cache);
Expand Down Expand Up @@ -158,7 +158,7 @@ class FvmQueueState extends StateNotifier<FvmQueue> {
Future<void> pinVersion(FlutterProject project, String version) async {
await FVMClient.pinVersion(project, version);
await ref.read(projectsProvider.notifier).reload(project);
await notify('Version $version pinned to ${project.name}');
notify('Version $version pinned to ${project.name}');
}

Future<void> _addToQueue(ReleaseDto version, {QueueAction action}) async {
Expand Down
6 changes: 3 additions & 3 deletions lib/src/modules/packages/components/package_github_info.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,23 @@ class PackageGithubInfo extends StatelessWidget {
const SizedBox(width: 10),
TextButton.icon(
onPressed: () {
openLink("${repo.htmlUrl}/stargazers");
openLink('${repo.htmlUrl}/stargazers');
},
icon: const Icon(Icons.star, size: 15),
label: Text(repo.stargazersCount.toString()),
),
const SizedBox(width: 10),
TextButton.icon(
onPressed: () {
openLink("${repo.htmlUrl}/issues");
openLink('${repo.htmlUrl}/issues');
},
icon: const Icon(MdiIcons.alertCircleOutline, size: 15),
label: Text(repo.openIssuesCount.toString()),
),
const SizedBox(width: 10),
TextButton.icon(
onPressed: () {
openLink("${repo.htmlUrl}/network/members");
openLink('${repo.htmlUrl}/network/members');
},
icon: const Icon(MdiIcons.sourceFork, size: 15),
label: Text(repo.forksCount.toString()),
Expand Down
2 changes: 1 addition & 1 deletion lib/src/modules/packages/packages.screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class PackagesScreen extends HookWidget {
loading: () => const SkLoadingIndicator(),
error: (_, __) => Container(
child: const Text(
"There was an issue loading your packages.",
'There was an issue loading your packages.',
),
),
);
Expand Down
2 changes: 1 addition & 1 deletion lib/src/modules/projects/components/project_actions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ class ProjectActions extends StatelessWidget {
);
}
},
child: const Icon(MdiIcons.dotsVertical),
itemBuilder: (context) {
return renderMenuOptions();
},
child: const Icon(MdiIcons.dotsVertical),
);
}
}
2 changes: 1 addition & 1 deletion lib/src/modules/projects/components/project_list_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class ProjectListItem extends HookWidget {
children: [
const SizedBox(width: 10),
Tooltip(
message: "Open terminal playground",
message: 'Open terminal playground',
child: IconButton(
iconSize: 20,
splashRadius: 20,
Expand Down
34 changes: 17 additions & 17 deletions lib/src/modules/projects/components/project_release_select.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,22 @@ class ProjectReleaseSelect extends StatelessWidget {

// elevation: 1,
padding: EdgeInsets.zero,
onSelected: (version) async {
await context.read(fvmQueueProvider.notifier).pinVersion(project, version);
},
itemBuilder: (context) {
return releases
.map(
(version) => PopupMenuItem(
value: version.name,
child: Text(
version.name,
style: const TextStyle(fontSize: 12),
),
),
)
.toList();
},
child: Container(
padding: const EdgeInsets.fromLTRB(10, 0, 5, 0),
constraints: const BoxConstraints(
Expand All @@ -45,22 +61,6 @@ class ProjectReleaseSelect extends StatelessWidget {
const Icon(MdiIcons.menuDown),
],
),
),
onSelected: (version) async {
context.read(fvmQueueProvider.notifier).pinVersion(project, version);
},
itemBuilder: (context) {
return releases
.map(
(version) => PopupMenuItem(
value: version.name,
child: Text(
version.name,
style: const TextStyle(fontSize: 12),
),
),
)
.toList();
});
));
}
}
8 changes: 4 additions & 4 deletions lib/src/modules/projects/projects.provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ final projectsPerVersionProvider = Provider((ref) {

for (final project in projects) {
final version =
project.pinnedVersion != null ? project.pinnedVersion : 'NONE';
project.pinnedVersion ?? 'NONE';
final versionProjects = list[version];
if (versionProjects != null) {
versionProjects.add(project);
Expand Down Expand Up @@ -84,8 +84,8 @@ class ProjectsStateNotifier extends StateNotifier<List<FlutterProject>> {
final project = await FVMClient.getProjectByDirectory(Directory(path));
if (project.isFlutterProject) {
final ref = ProjectRef(name: path.split('/').last, path: path);
ProjectsService.box.put(path, ref);
load();
await ProjectsService.box.put(path, ref);
await load();
} else {
notify('Not a Flutter project');
}
Expand All @@ -104,7 +104,7 @@ class ProjectsStateNotifier extends StateNotifier<List<FlutterProject>> {

if (settings.projectPaths.isNotEmpty) {
for (final path in settings.projectPaths) {
ProjectsService.box.put(
await ProjectsService.box.put(
path,
ProjectRef(
name: path.split('/').last,
Expand Down
2 changes: 1 addition & 1 deletion lib/src/modules/projects/projects.screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class ProjectsScreen extends HookWidget {
// Operation was canceled by the user.
return;
}
notifier.addProject(directoryPath);
await notifier.addProject(directoryPath);
}

useEffect(() {
Expand Down
2 changes: 1 addition & 1 deletion lib/src/modules/projects/projects.service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class ProjectsService {
return FlutterProject.fromProject(project, pubspec);
} else {
/// If it does not exist should be removed
box.delete(project.projectDir.path);
await box.delete(project.projectDir.path);
}
}).toList();

Expand Down
4 changes: 2 additions & 2 deletions lib/src/modules/sandbox/components/terminal.dart
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ class SandboxConsole extends HookWidget {
});
}

handleKey(RawKeyEvent key) {
if (key.runtimeType.toString() == "RawKeyDownEvent") {
void handleKey(RawKeyEvent key) {
if (key.runtimeType.toString() == 'RawKeyDownEvent') {
if (key.data.logicalKey == LogicalKeyboardKey.arrowUp) {
if (terminalState.cmdHistory.length > currentCmdIdx.value) {
moveCmdIndex(1);
Expand Down
Loading

0 comments on commit 06d303a

Please sign in to comment.