Skip to content

Commit bac16c8

Browse files
committed
feat(web): add dedicated privacy route and page
1 parent 1dedd97 commit bac16c8

3 files changed

Lines changed: 108 additions & 14 deletions

File tree

website/lib/main.dart

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import 'sections/preview_section.dart';
77
import 'sections/privacy_section.dart';
88
import 'sections/download_section.dart';
99
import 'sections/footer_section.dart';
10+
import 'screens/privacy_page.dart';
1011

1112
void main() {
1213
runApp(const PatternsWebsite());
@@ -30,16 +31,29 @@ class _PatternsWebsiteState extends State<PatternsWebsite> {
3031
theme: WebTheme.lightTheme,
3132
darkTheme: WebTheme.darkTheme,
3233
themeMode: _themeMode,
33-
home: _HomePage(
34-
isDark: _themeMode == ThemeMode.dark,
35-
onThemeToggle: () {
36-
setState(() {
37-
_themeMode = _themeMode == ThemeMode.dark
38-
? ThemeMode.light
39-
: ThemeMode.dark;
40-
});
41-
},
42-
),
34+
initialRoute: '/',
35+
routes: {
36+
'/': (context) => _HomePage(
37+
isDark: _themeMode == ThemeMode.dark,
38+
onThemeToggle: () {
39+
setState(() {
40+
_themeMode = _themeMode == ThemeMode.dark
41+
? ThemeMode.light
42+
: ThemeMode.dark;
43+
});
44+
},
45+
),
46+
'/privacy': (context) => PrivacyPage(
47+
isDark: _themeMode == ThemeMode.dark,
48+
onThemeToggle: () {
49+
setState(() {
50+
_themeMode = _themeMode == ThemeMode.dark
51+
? ThemeMode.light
52+
: ThemeMode.dark;
53+
});
54+
},
55+
),
56+
},
4357
);
4458
}
4559
}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
import 'package:flutter/material.dart';
2+
import '../sections/privacy_section.dart';
3+
import '../widgets/navbar.dart';
4+
import '../theme/web_theme.dart';
5+
6+
class PrivacyPage extends StatefulWidget {
7+
final bool isDark;
8+
final VoidCallback onThemeToggle;
9+
10+
const PrivacyPage({
11+
super.key,
12+
required this.isDark,
13+
required this.onThemeToggle,
14+
});
15+
16+
@override
17+
State<PrivacyPage> createState() => _PrivacyPageState();
18+
}
19+
20+
class _PrivacyPageState extends State<PrivacyPage> {
21+
@override
22+
Widget build(BuildContext context) {
23+
return Scaffold(
24+
backgroundColor: widget.isDark ? WebTheme.darkSurface : WebTheme.lightSurface,
25+
body: Stack(
26+
children: [
27+
SingleChildScrollView(
28+
child: Column(
29+
children: [
30+
const SizedBox(height: 100),
31+
PrivacySection(isDark: widget.isDark),
32+
// Simple footer for the privacy page
33+
Padding(
34+
padding: const EdgeInsets.symmetric(vertical: 40),
35+
child: TextButton(
36+
onPressed: () => Navigator.of(context).pushReplacementNamed('/'),
37+
child: Text(
38+
'← Back to Home',
39+
style: TextStyle(
40+
color: widget.isDark ? WebTheme.primaryYellow : WebTheme.primaryGold,
41+
),
42+
),
43+
),
44+
),
45+
],
46+
),
47+
),
48+
Positioned(
49+
top: 0,
50+
left: 0,
51+
right: 0,
52+
child: Navbar(
53+
isDark: widget.isDark,
54+
onThemeToggle: widget.onThemeToggle,
55+
sectionKeys: const {}, // No scroll keys needed on this page
56+
),
57+
),
58+
],
59+
),
60+
);
61+
}
62+
}

website/lib/widgets/navbar.dart

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,25 +89,25 @@ class _NavbarState extends State<Navbar> {
8989
if (!isMobile) ...[
9090
_NavLink(
9191
label: 'Features',
92-
onTap: () => _scrollTo(widget.sectionKeys['features']!),
92+
onTap: () => _scrollTo('features'),
9393
color: textColor,
9494
),
9595
const SizedBox(width: 32),
9696
_NavLink(
9797
label: 'Preview',
98-
onTap: () => _scrollTo(widget.sectionKeys['preview']!),
98+
onTap: () => _scrollTo('preview'),
9999
color: textColor,
100100
),
101101
const SizedBox(width: 32),
102102
_NavLink(
103103
label: 'Privacy',
104-
onTap: () => _scrollTo(widget.sectionKeys['privacy']!),
104+
onTap: () => _scrollTo('privacy'),
105105
color: textColor,
106106
),
107107
const SizedBox(width: 32),
108108
_NavLink(
109109
label: 'Download',
110-
onTap: () => _scrollTo(widget.sectionKeys['download']!),
110+
onTap: () => _scrollTo('download'),
111111
color: textColor,
112112
),
113113
const SizedBox(width: 24),
@@ -314,3 +314,21 @@ class _GithubButtonState extends State<_GithubButton> {
314314
);
315315
}
316316
}
317+
ns.star_rounded, size: 16, color: Colors.black),
318+
const SizedBox(width: 6),
319+
Text(
320+
'Star on GitHub',
321+
style: GoogleFonts.inter(
322+
fontSize: 14,
323+
fontWeight: FontWeight.w600,
324+
color: Colors.black,
325+
),
326+
),
327+
],
328+
),
329+
),
330+
),
331+
),
332+
);
333+
}
334+
}

0 commit comments

Comments
 (0)