Skip to content

Commit a404cba

Browse files
authored
Merge pull request #3 from leoafarias/main
Merge main
2 parents 40ade98 + c0e473d commit a404cba

23 files changed

+248
-115
lines changed

assets/logo.png

4.4 KB
Loading

lib/app_shell.dart

+84-37
Original file line numberDiff line numberDiff line change
@@ -108,44 +108,91 @@ class AppShell extends HookWidget {
108108
Container(
109109
child: Row(
110110
children: <Widget>[
111-
NavigationRail(
112-
leading: const SizedBox(height: 10),
113-
selectedIndex: selectedIndex.value,
114-
minWidth: kNavigationWidth,
115-
minExtendedWidth: kNavigationWidthExtended,
116-
extended: !LayoutSize.isSmall,
117-
onDestinationSelected: (index) {
118-
// If its search
119-
if (index == 5) {
120-
showSearch.value = true;
121-
} else {
122-
navigation.goTo(NavigationRoutes.values[index]);
123-
}
111+
LayoutBuilder(
112+
builder: (_, constraints) {
113+
return SingleChildScrollView(
114+
child: ConstrainedBox(
115+
constraints:
116+
BoxConstraints(minHeight: constraints.maxHeight),
117+
child: IntrinsicHeight(
118+
child: NavigationRail(
119+
leading: Container(
120+
padding: const EdgeInsets.only(
121+
bottom: 15,
122+
left: 15,
123+
right: 15,
124+
top: 25,
125+
),
126+
//constraints: BoxConstraints(maxWidth: 15),
127+
child: Padding(
128+
padding: LayoutSize.isSmall
129+
? EdgeInsets.zero
130+
: const EdgeInsets.symmetric(
131+
horizontal: 5,
132+
),
133+
child: Row(
134+
mainAxisSize: MainAxisSize.min,
135+
children: [
136+
Image.asset(
137+
"assets/logo.png",
138+
width: 50,
139+
gaplessPlayback: true,
140+
),
141+
LayoutSize.isSmall
142+
? Container()
143+
: Text(
144+
" Sidekick",
145+
style: Theme.of(context)
146+
.textTheme
147+
.headline5,
148+
)
149+
],
150+
),
151+
),
152+
),
153+
selectedIndex: selectedIndex.value,
154+
minWidth: kNavigationWidth,
155+
minExtendedWidth: kNavigationWidthExtended,
156+
extended: !LayoutSize.isSmall,
157+
onDestinationSelected: (index) {
158+
// If its search
159+
if (index == 5) {
160+
showSearch.value = true;
161+
} else {
162+
navigation
163+
.goTo(NavigationRoutes.values[index]);
164+
}
165+
},
166+
labelType: NavigationRailLabelType.none,
167+
destinations: [
168+
NavButton(
169+
label: 'Dashboard',
170+
iconData: Icons.category,
171+
),
172+
NavButton(
173+
label: 'Projects',
174+
iconData: MdiIcons.folderMultiple,
175+
),
176+
NavButton(
177+
label: 'Explore',
178+
iconData: Icons.explore,
179+
),
180+
NavButton(
181+
label: 'Packages',
182+
iconData: MdiIcons.package,
183+
),
184+
NavButton(
185+
label: 'Settings',
186+
iconData: Icons.settings,
187+
),
188+
NavButton(
189+
label: 'Search', iconData: Icons.search),
190+
],
191+
),
192+
),
193+
),
194+
);
124195
},
125-
labelType: NavigationRailLabelType.none,
126-
destinations: [
127-
NavButton(
128-
label: 'Dashboard',
129-
iconData: Icons.category,
130-
),
131-
NavButton(
132-
label: 'Projects',
133-
iconData: MdiIcons.folderMultiple,
134-
),
135-
NavButton(
136-
label: 'Explore',
137-
iconData: Icons.explore,
138-
),
139-
NavButton(
140-
label: 'Packages',
141-
iconData: MdiIcons.package,
142-
),
143-
NavButton(
144-
label: 'Settings',
145-
iconData: Icons.settings,
146-
),
147-
NavButton(label: 'Search', iconData: Icons.search),
148-
],
149196
),
150197
const VerticalDivider(thickness: 1, width: 1),
151198
// This is the main content.

lib/components/atoms/console.dart

+6-2
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ class Console extends HookWidget {
4141
crossFadeState:
4242
processing ? CrossFadeState.showSecond : CrossFadeState.showFirst,
4343
firstChild: Container(
44-
color: Colors.black45,
44+
color: Theme.of(context).brightness == Brightness.dark
45+
? Colors.black45
46+
: const Color(0xFFF5F5F5),
4547
height: 40,
4648
child: Row(
4749
mainAxisAlignment: MainAxisAlignment.start,
@@ -64,7 +66,9 @@ class Console extends HookWidget {
6466
secondChild: GestureDetector(
6567
onTap: onExpand,
6668
child: Container(
67-
color: Colors.black45,
69+
color: Theme.of(context).brightness == Brightness.dark
70+
? Colors.black45
71+
: const Color(0xFFF5F5F5),
6872
height: expand ? 160 : 40,
6973
constraints: expand
7074
? const BoxConstraints(maxHeight: 160)

lib/components/atoms/sliver_section_header.dart

+12-4
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class SectionHeaderDelegate extends SliverPersistentHeaderDelegate {
1010
this.title,
1111
this.count = 0,
1212
this.onPress,
13-
this.height = 50,
13+
this.height = 60,
1414
});
1515

1616
@override
@@ -20,10 +20,18 @@ class SectionHeaderDelegate extends SliverPersistentHeaderDelegate {
2020
bool overlapsContent,
2121
) {
2222
return Container(
23-
color: Colors.black38,
23+
margin: const EdgeInsets.symmetric(vertical: 5),
24+
decoration: BoxDecoration(
25+
borderRadius: BorderRadius.circular(5),
26+
color: Theme.of(context).cardColor.withOpacity(0.2),
27+
),
2428
child: ListTile(
25-
title: Text(title),
26-
trailing: Text('${count.toString()} Found'),
29+
title: Text(
30+
title,
31+
),
32+
trailing: Text(
33+
'${count.toString()} Found',
34+
),
2735
onTap: onPress,
2836
),
2937
);

lib/components/molecules/channel_showcase.dart

+66-30
Original file line numberDiff line numberDiff line change
@@ -7,47 +7,83 @@ import 'package:date_time_format/date_time_format.dart';
77
import 'package:flutter/material.dart';
88

99
import 'package:hooks_riverpod/hooks_riverpod.dart';
10+
import 'package:sidekick/utils/layout_size.dart';
1011

1112
class ChannelShowcase extends StatelessWidget {
1213
final ChannelDto channel;
1314
const ChannelShowcase(this.channel, {Key key}) : super(key: key);
1415

1516
@override
1617
Widget build(BuildContext context) {
17-
return OutlinedButton(
18-
onPressed: () {
19-
context.read(selectedInfoProvider).selectVersion(channel);
20-
},
21-
child: Container(
22-
padding: const EdgeInsets.all(20),
23-
child: Row(
24-
crossAxisAlignment: CrossAxisAlignment.stretch,
25-
children: [
26-
Column(
27-
crossAxisAlignment: CrossAxisAlignment.start,
28-
mainAxisAlignment: MainAxisAlignment.center,
18+
return Container(
19+
decoration: BoxDecoration(
20+
border: Border(
21+
left: BorderSide(color: Theme.of(context).dividerColor),
22+
bottom: BorderSide(color: Theme.of(context).dividerColor),
23+
top: BorderSide(color: Theme.of(context).dividerColor),
24+
// TODO: quite a hacky way to achieve this
25+
right: channel.name == "dev"
26+
? BorderSide(color: Theme.of(context).dividerColor)
27+
: BorderSide.none),
28+
),
29+
child: OutlinedButton(
30+
onPressed: () {
31+
context.read(selectedInfoProvider).selectVersion(channel);
32+
},
33+
style: ButtonStyle(
34+
shape: MaterialStateProperty.resolveWith(
35+
(states) => const RoundedRectangleBorder(
36+
borderRadius: BorderRadius.zero,
37+
),
38+
),
39+
side: MaterialStateProperty.resolveWith((states) => BorderSide.none),
40+
),
41+
child: LayoutBuilder(builder: (context, layout) {
42+
return Container(
43+
padding: const EdgeInsets.all(20),
44+
child: Row(
45+
crossAxisAlignment: CrossAxisAlignment.stretch,
2946
children: [
30-
Heading(channel.name),
31-
Subheading(channel.release.version),
32-
const SizedBox(height: 5),
33-
Caption(
34-
DateTimeFormat.relative(
35-
channel.release.releaseDate,
36-
appendIfAfter: 'ago',
37-
),
47+
Column(
48+
crossAxisAlignment: CrossAxisAlignment.start,
49+
mainAxisAlignment: MainAxisAlignment.center,
50+
children: [
51+
Heading(channel.name),
52+
Tooltip(
53+
message: channel.release.version,
54+
child: ConstrainedBox(
55+
constraints: const BoxConstraints(maxWidth: 65),
56+
child: Text(
57+
channel.release.version,
58+
style: Theme.of(context).textTheme.subtitle1,
59+
maxLines: 1,
60+
overflow: TextOverflow.ellipsis,
61+
),
62+
),
63+
),
64+
const SizedBox(height: 5),
65+
Caption(
66+
DateTimeFormat.relative(
67+
channel.release.releaseDate,
68+
appendIfAfter: 'ago',
69+
),
70+
),
71+
],
3872
),
73+
LayoutSize.isSmall ? Container() : const Spacer(),
74+
LayoutSize.isSmall
75+
? Container()
76+
: Column(
77+
mainAxisAlignment: MainAxisAlignment.center,
78+
crossAxisAlignment: CrossAxisAlignment.end,
79+
children: [
80+
VersionInstallButton(channel),
81+
],
82+
)
3983
],
4084
),
41-
const Spacer(),
42-
Column(
43-
mainAxisAlignment: MainAxisAlignment.center,
44-
crossAxisAlignment: CrossAxisAlignment.end,
45-
children: [
46-
VersionInstallButton(channel),
47-
],
48-
)
49-
],
50-
),
85+
);
86+
}),
5187
),
5288
);
5389
}

lib/components/molecules/github_repo_info.dart

+13-3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
33
import 'package:github/github.dart';
44

55
import 'package:material_design_icons_flutter/material_design_icons_flutter.dart';
6+
import 'package:sidekick/utils/open_link.dart';
67

78
class GithubRepoInfo extends StatelessWidget {
89
final Repository repo;
@@ -23,17 +24,26 @@ class GithubRepoInfo extends StatelessWidget {
2324
children: [
2425
const SizedBox(width: 10),
2526
TextButton.icon(
26-
icon: Icon(Icons.star, size: 15),
27+
onPressed: () {
28+
openLink("${repo.htmlUrl}/stargazers");
29+
},
30+
icon: const Icon(Icons.star, size: 15),
2731
label: Text(repo.stargazersCount.toString()),
2832
),
2933
const SizedBox(width: 10),
3034
TextButton.icon(
31-
icon: Icon(MdiIcons.alertCircleOutline, size: 15),
35+
onPressed: () {
36+
openLink("${repo.htmlUrl}/issues");
37+
},
38+
icon: const Icon(MdiIcons.alertCircleOutline, size: 15),
3239
label: Text(repo.openIssuesCount.toString()),
3340
),
3441
const SizedBox(width: 10),
3542
TextButton.icon(
36-
icon: Icon(MdiIcons.sourceFork, size: 15),
43+
onPressed: () {
44+
openLink("${repo.htmlUrl}/network/members");
45+
},
46+
icon: const Icon(MdiIcons.sourceFork, size: 15),
3747
label: Text(repo.forksCount.toString()),
3848
),
3949
],

lib/components/molecules/package_item.dart

+8-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,14 @@ class PackageItem extends StatelessWidget {
2222
FvmListTile(
2323
leading: CircleAvatar(
2424
backgroundColor: Colors.black26,
25-
child: Text(position.toString()),
25+
child: Text(
26+
position.toString(),
27+
style: TextStyle(
28+
color: Theme.of(context).brightness == Brightness.light
29+
? Colors.black
30+
: Colors.white,
31+
),
32+
),
2633
),
2734
title: Text(package.name),
2835
subtitle: Text(

lib/components/molecules/project_item.dart

+21-12
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,14 @@ class ProjectItem extends HookWidget {
3838
child: ListTile(
3939
leading: const Icon(MdiIcons.alphaPBox),
4040
title: Subheading(project.name),
41-
trailing: IconButton(
42-
iconSize: 20,
43-
icon: const Icon(MdiIcons.cog),
44-
onPressed: () {},
41+
trailing: Tooltip(
42+
message: "Open in your IDE (Coming Soon)",
43+
child: IconButton(
44+
iconSize: 20,
45+
splashRadius: 20,
46+
icon: const Icon(MdiIcons.microsoftVisualStudioCode),
47+
onPressed: () {},
48+
),
4549
),
4650
),
4751
),
@@ -68,14 +72,19 @@ class ProjectItem extends HookWidget {
6872
Row(
6973
children: [
7074
const SizedBox(width: 10),
71-
TextButton(
72-
onPressed: () {
73-
openLink(project.projectDir.path);
74-
},
75-
child: Text(
76-
truncate(project.projectDir.path, 25,
77-
position: TruncatePosition.middle),
78-
style: const TextStyle(fontSize: 12),
75+
Tooltip(
76+
message: "Open in explorer",
77+
child: TextButton(
78+
onPressed: () {
79+
openLink(
80+
"file://${project.projectDir.absolute.path.replaceAll("\\", "/")}",
81+
);
82+
},
83+
child: Text(
84+
truncate(project.projectDir.path, 25,
85+
position: TruncatePosition.middle),
86+
style: const TextStyle(fontSize: 12),
87+
),
7988
),
8089
),
8190
const Spacer(),

0 commit comments

Comments
 (0)