Skip to content

Commit da45014

Browse files
committed
refactor: tweak top menu for mobile and desktop
1 parent 26df2af commit da45014

File tree

1 file changed

+38
-9
lines changed

1 file changed

+38
-9
lines changed

lib/widgets/top_menu.dart

Lines changed: 38 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import 'package:flutter/services.dart';
33
import 'package:flutter/widgets.dart';
44
import 'package:go_router/go_router.dart';
55
import 'package:shadcn_ui/shadcn_ui.dart';
6+
import 'package:url_launcher/url_launcher.dart';
67

78
class TopMenu extends StatelessWidget {
89
const TopMenu({super.key});
@@ -16,7 +17,7 @@ class TopMenu extends StatelessWidget {
1617

1718
if (isCompact) {
1819
return Container(
19-
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
20+
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 8),
2021
decoration: BoxDecoration(
2122
border: Border(
2223
bottom: BorderSide(
@@ -26,15 +27,24 @@ class TopMenu extends StatelessWidget {
2627
),
2728
),
2829
child: Row(
30+
spacing: 8,
2931
children: [
3032
// Home button
3133
ShadButton(
3234
onPressed: () => context.go('/'),
3335
child: Icon(Icons.home, size: 20),
3436
),
3537
const Spacer(),
38+
GestureDetector(
39+
onTap: () {
40+
launchUrl(Uri.parse('https://github.com/orestesgaolin/shaders_gallery'));
41+
},
42+
child: ShadButton.outline(
43+
child: const Icon(Icons.code, size: 20),
44+
),
45+
),
46+
Text(FlutterVersion.version ?? ''),
3647
if (isRunningWithWasm) ...[
37-
const SizedBox(width: 8),
3848
Text('${FlutterVersion.version} (WASM)'),
3949
],
4050
],
@@ -43,7 +53,7 @@ class TopMenu extends StatelessWidget {
4353
}
4454

4555
return Container(
46-
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 16),
56+
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 8),
4757
decoration: BoxDecoration(
4858
border: Border(
4959
bottom: BorderSide(
@@ -53,25 +63,44 @@ class TopMenu extends StatelessWidget {
5363
),
5464
),
5565
child: Row(
66+
spacing: 8,
5667
children: [
5768
// Home button
5869
ShadButton(
5970
onPressed: () => context.go('/'),
6071
child: const Row(
6172
mainAxisSize: MainAxisSize.min,
73+
spacing: 8,
6274
children: [
6375
Icon(Icons.home, size: 20),
64-
SizedBox(width: 8),
6576
Text('Shader Gallery'),
6677
],
6778
),
6879
),
6980
const Spacer(),
70-
FlutterLogo(size: 14),
71-
Text(FlutterVersion.version ?? ''),
72-
if (isRunningWithWasm) ...[
73-
Text(' WASM'),
74-
],
81+
ShadButton.outline(
82+
onPressed: () {
83+
launchUrl(Uri.parse('https://github.com/orestesgaolin/shaders_gallery'));
84+
},
85+
child: const Row(
86+
mainAxisSize: MainAxisSize.min,
87+
spacing: 8,
88+
children: [
89+
Icon(Icons.code, size: 20),
90+
Text('Source Code'),
91+
],
92+
),
93+
),
94+
Row(
95+
spacing: 2,
96+
children: [
97+
FlutterLogo(size: 14),
98+
Text(FlutterVersion.version ?? ''),
99+
if (isRunningWithWasm) ...[
100+
Text(' WASM'),
101+
],
102+
],
103+
),
75104
],
76105
),
77106
);

0 commit comments

Comments
 (0)