2
2
/// Made on Saturday, May 01, 2021
3
3
/// File Name: portfolio_router_delegate.dart
4
4
5
+ import 'dart:html' ;
6
+
5
7
import 'package:flutter/cupertino.dart' ;
6
8
import 'package:flutter/material.dart' ;
7
9
import 'package:controller_widgets/controller_widgets.dart' ;
@@ -78,18 +80,24 @@ class PortfolioRouterDelegate extends RouterDelegate<PortfolioRoutePath>
78
80
}
79
81
80
82
AppBar _createAppbar (BuildContext context) {
83
+ bool needsButtons = MediaQuery .of (context).size.width > 500 ;
81
84
return AppBar (
82
85
title: Text ("Tejas Mehta" , style: TextStyle (color: ThemeController .of (context).isDark ? Colors .white : Colors .black),),
83
86
actions: [
84
- MediaQuery . of (context).size.width > 500 ? TextButton (
87
+ if (needsButtons) TextButton (
85
88
onPressed: () => moveAndUpdateRoute (PortfolioRoutePath .about (), false ),
86
89
child: _createTextTab ("About" , context)
87
- ) : Container () ,
90
+ ),
88
91
Padding (padding: EdgeInsets .all (10 )),
89
- MediaQuery . of (context).size.width > 500 ? TextButton (
92
+ if (needsButtons) TextButton (
90
93
onPressed: () => moveAndUpdateRoute (PortfolioRoutePath .projects (), false ),
91
94
child: _createTextTab ("Projects" , context)
92
- ) : Container (),
95
+ ),
96
+ Padding (padding: EdgeInsets .all (10 )),
97
+ if (needsButtons) TextButton (
98
+ onPressed: _moveToBlog,
99
+ child: _createTextTab ("Blog" , context),
100
+ ),
93
101
Padding (padding: EdgeInsets .all (10 )),
94
102
IconButton (
95
103
icon: Icon (ThemeController .of (context).isDark ? Icons .wb_sunny : Icons .brightness_3), onPressed: () {
@@ -105,6 +113,7 @@ class PortfolioRouterDelegate extends RouterDelegate<PortfolioRoutePath>
105
113
children: [
106
114
ListTile (title: Text ("About" ), onTap: () => moveAndUpdateRoute (PortfolioRoutePath .about (), true ),),
107
115
ListTile (title: Text ("Projects" ), onTap: () => moveAndUpdateRoute (PortfolioRoutePath .projects (), true ),),
116
+ ListTile (title: Text ("Blog" ), onTap: _moveToBlog,)
108
117
],
109
118
),
110
119
);
@@ -127,6 +136,10 @@ class PortfolioRouterDelegate extends RouterDelegate<PortfolioRoutePath>
127
136
onPopPage: (_, __) => false ,
128
137
);
129
138
139
+ void _moveToBlog () {
140
+ window.open ("https://blog.tmthecoder.dev" ,"_blank" );
141
+ }
142
+
130
143
void moveAndUpdateRoute (PortfolioRoutePath path, bool drawer) {
131
144
setNewRoutePath (path);
132
145
if (drawer) _scaffoldKey.currentState? .openEndDrawer ();
0 commit comments