Skip to content

Commit 7be71df

Browse files
authored
Merge branch 'main' into feature/transparency
2 parents 8942796 + 7885c5e commit 7be71df

14 files changed

+328
-86
lines changed

.fvm/fvm_config.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"flutterSdkVersion": "2.5.3",
2+
"flutterSdkVersion": "stable",
33
"flavors": {}
44
}

.vscode/settings.json

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
{
2-
"dart.flutterSdkPath":"/Users/leofarias/fvm/versions/stable",
2+
"dart.flutterSdkPath": ".fvm/flutter_sdk",
3+
// Remove .fvm files from search
34
"search.exclude": {
45
"**/.fvm": true
6+
},
7+
// Remove from file watching
8+
"files.watcherExclude": {
9+
"**/.fvm": true
510
}
611
}

lib/main.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,11 @@ class FvmApp extends StatelessWidget {
7070
return const ErrorDBScreen();
7171
}
7272

73+
final settings = SettingsService.read();
74+
7375
return ValueListenableBuilder<Box<SidekickSettings>>(
7476
valueListenable: SettingsService.box.listenable(),
7577
builder: (context, box, widget) {
76-
final settings = SettingsService.read();
77-
7878
return OKToast(
7979
child: MaterialApp(
8080
localizationsDelegates: [

lib/src/components/atoms/console.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,13 @@ class Console extends HookWidget {
6666
children: [
6767
Container(
6868
width: MediaQuery.of(context).size.width - 100,
69-
child: ConsoleText(lines.value.first)
70-
),
69+
child: ConsoleText(lines.value.first)),
7170
],
7271
),
7372
),
7473
secondChild: CupertinoScrollbar(
7574
child: ListView.builder(
75+
primary: false,
7676
shrinkWrap: true,
7777
reverse: true,
7878
padding: const EdgeInsets.fromLTRB(20, 10, 20, 10),

lib/src/components/molecules/version_install_button.dart

+8-6
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ class VersionInstallButton extends HookWidget {
2424
final hovering = useState(false);
2525
final queueProvider = useProvider(fvmQueueProvider);
2626

27+
final isCached = version?.isCached == true;
28+
2729
useEffect(() {
2830
final isInstalling = queueProvider.activeItem != null &&
2931
queueProvider.activeItem.version == version;
@@ -49,7 +51,7 @@ class VersionInstallButton extends HookWidget {
4951
}
5052

5153
Widget installIcon() {
52-
if ((isQueued.value && !version.isCached)) {
54+
if ((isQueued.value && !isCached)) {
5355
return SizedBox(
5456
height: 20,
5557
width: 20,
@@ -60,7 +62,7 @@ class VersionInstallButton extends HookWidget {
6062
);
6163
}
6264

63-
if (version.isCached) {
65+
if (isCached) {
6466
return Icon(
6567
Icons.check,
6668
size: 20,
@@ -87,14 +89,14 @@ class VersionInstallButton extends HookWidget {
8789
}
8890
},
8991
child: Opacity(
90-
opacity: (version?.isCached ?? false) ? 0.3 : 1,
92+
opacity: isCached ? 0.3 : 1,
9193
child: IconButton(
9294
onPressed: onInstall,
9395
splashRadius: 20,
9496
icon: Tooltip(
95-
message:
96-
(version?.isCached ?? false) ? installedMsg : notInstalledMsg,
97-
child: installIcon()),
97+
message: isCached ? installedMsg : notInstalledMsg,
98+
child: installIcon(),
99+
),
98100
),
99101
),
100102
);

lib/src/components/organisms/shortcut_manager.dart

+10-15
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import 'package:flutter/material.dart';
22
import 'package:flutter/services.dart';
3-
import 'package:flutter_hooks/flutter_hooks.dart';
43
import 'package:hooks_riverpod/hooks_riverpod.dart';
54
import 'package:sidekick/src/modules/navigation/navigation.provider.dart';
65

@@ -16,24 +15,26 @@ class NavigationIntent extends Intent {
1615
}
1716

1817
/// Shorcut manager
19-
class SkShortcutManager extends HookWidget {
18+
class SkShortcutManager extends StatelessWidget {
2019
/// Constructor
2120
const SkShortcutManager({
2221
Key key,
2322
this.child,
23+
@required this.focusNode,
2424
}) : super(key: key);
2525

2626
/// Child
2727
final Widget child;
28+
final FocusNode focusNode;
2829
@override
2930
Widget build(BuildContext context) {
30-
final focusNode = useFocusNode();
3131
// Handles route change
3232
void handleRouteChange(NavigationRoutes route) {
3333
context.read(navigationProvider.notifier).goTo(route);
3434
}
3535

36-
return Shortcuts(
36+
return FocusableActionDetector(
37+
autofocus: true,
3738
shortcuts: <LogicalKeySet, Intent>{
3839
LogicalKeySet(
3940
LogicalKeyboardKey.metaLeft,
@@ -52,17 +53,11 @@ class SkShortcutManager extends HookWidget {
5253
LogicalKeyboardKey.keyF,
5354
): const NavigationIntent(route: NavigationRoutes.searchScreen),
5455
},
55-
child: Actions(
56-
actions: <Type, Action<Intent>>{
57-
NavigationIntent: CallbackAction<NavigationIntent>(
58-
onInvoke: (intent) => handleRouteChange(intent.route)),
59-
},
60-
child: Focus(
61-
autofocus: true,
62-
focusNode: focusNode,
63-
child: child,
64-
),
65-
),
56+
actions: <Type, Action<Intent>>{
57+
NavigationIntent: CallbackAction<NavigationIntent>(
58+
onInvoke: (intent) => handleRouteChange(intent.route)),
59+
},
60+
child: child,
6661
);
6762
}
6863
}

lib/src/modules/common/app_shell.dart

+29-18
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,19 @@ import 'package:flutter_hooks/flutter_hooks.dart';
55
import 'package:hooks_riverpod/hooks_riverpod.dart';
66
import 'package:i18next/i18next.dart';
77
import 'package:material_design_icons_flutter/material_design_icons_flutter.dart';
8+
import 'package:sidekick/src/components/organisms/app_bottom_bar.dart';
9+
import 'package:sidekick/src/modules/common/utils/indexed_transition_switcher.dart';
10+
import 'package:sidekick/src/modules/search/components/search_bar.dart';
11+
import 'package:sidekick/src/modules/selected_detail/components/info_drawer.dart';
812

913
import '../../components/molecules/top_app_bar.dart';
10-
import '../../components/organisms/app_bottom_bar.dart';
1114
import '../../components/organisms/shortcut_manager.dart';
1215
import '../../modules/common/utils/layout_size.dart';
1316
import '../../theme.dart';
1417
import '../fvm/fvm.screen.dart';
1518
import '../navigation/navigation.provider.dart';
1619
import '../projects/projects.screen.dart';
1720
import '../releases/releases.screen.dart';
18-
import '../search/components/search_bar.dart';
19-
import '../selected_detail/components/info_drawer.dart';
2021
import '../selected_detail/selected_detail.provider.dart';
2122
import 'constants.dart';
2223

@@ -33,12 +34,29 @@ class AppShell extends HookWidget {
3334
/// Constructor
3435
const AppShell({Key key}) : super(key: key);
3536

37+
NavigationRailDestination renderNavButton(
38+
BuildContext context,
39+
String label,
40+
IconData iconData,
41+
) {
42+
return NavigationRailDestination(
43+
icon: Icon(iconData, size: 20),
44+
selectedIcon: Icon(
45+
iconData,
46+
size: 20,
47+
color: Theme.of(context).colorScheme.secondary,
48+
),
49+
label: Text(label),
50+
);
51+
}
52+
3653
@override
3754
Widget build(BuildContext context) {
38-
LayoutSize.init(context);
55+
// LayoutSize.init(context);
3956
final navigation = useProvider(navigationProvider.notifier);
4057
final currentRoute = useProvider(navigationProvider);
4158
final selectedInfo = useProvider(selectedDetailProvider).state;
59+
final focusNode = useFocusNode();
4260

4361
// Index of item selected
4462
final selectedIndex = useState(0);
@@ -65,19 +83,8 @@ class AppShell extends HookWidget {
6583
}
6684
});
6785

68-
NavigationRailDestination renderNavButton(String label, IconData iconData) {
69-
return NavigationRailDestination(
70-
icon: Icon(iconData, size: 20),
71-
selectedIcon: Icon(
72-
iconData,
73-
size: 20,
74-
color: Theme.of(context).colorScheme.secondary,
75-
),
76-
label: Text(label),
77-
);
78-
}
79-
8086
return SkShortcutManager(
87+
focusNode: focusNode,
8188
child: Scaffold(
8289
appBar: const SkAppBar(),
8390
bottomNavigationBar: const AppBottomBar(),
@@ -97,14 +104,17 @@ class AppShell extends HookWidget {
97104
},
98105
destinations: [
99106
renderNavButton(
107+
context,
100108
I18Next.of(context).t('modules:common.navButtonDashboard'),
101109
Icons.category,
102110
),
103111
renderNavButton(
112+
context,
104113
I18Next.of(context).t('modules:common.navButtonProjects'),
105114
MdiIcons.folderMultiple,
106115
),
107116
renderNavButton(
117+
context,
108118
I18Next.of(context).t('modules:common.navButtonExplore'),
109119
Icons.explore,
110120
),
@@ -124,7 +134,7 @@ class AppShell extends HookWidget {
124134
children: <Widget>[
125135
// This is the main content.
126136
Expanded(
127-
child: PageTransitionSwitcher(
137+
child: IndexedTransitionSwitcher(
128138
duration: const Duration(milliseconds: 250),
129139
reverse: selectedIndex.value <
130140
(navigation.previous.index ?? 0),
@@ -142,7 +152,8 @@ class AppShell extends HookWidget {
142152
child: child,
143153
);
144154
},
145-
child: pages[selectedIndex.value],
155+
index: selectedIndex.value,
156+
children: pages,
146157
),
147158
),
148159
],

0 commit comments

Comments
 (0)