Skip to content

Commit 15a52c2

Browse files
committed
Search Packages
*Create ability to search features from search box.
1 parent 35f6cb5 commit 15a52c2

2 files changed

Lines changed: 13 additions & 5 deletions

File tree

lib/ui/blocks.dart

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ class Header extends StatelessWidget {
104104
),
105105
margin: EdgeInsets.symmetric(horizontal: 48, vertical: 20),
106106
child: TextField(
107+
onSubmitted: (value) => openUrl(buildSearchUrlFromQuery(value)),
107108
style: TextStyle(color: Colors.white, fontSize: 24),
108109
decoration: InputDecoration(
109110
border: InputBorder.none,
@@ -214,11 +215,14 @@ class FlutterFavorites extends StatelessWidget {
214215
alignment: Alignment.centerRight,
215216
child: Padding(
216217
padding: EdgeInsets.only(right: 16),
217-
child: Text('VIEW ALL',
218-
style: TextStyle(
219-
color: linkColor,
220-
fontSize: 16,
221-
fontWeight: FontWeight.bold)),
218+
child: GestureDetector(
219+
onTap: () => openUrl('https://pub.dev/flutter/favorites'),
220+
child: Text('VIEW ALL',
221+
style: TextStyle(
222+
color: linkColor,
223+
fontSize: 16,
224+
fontWeight: FontWeight.bold)),
225+
),
222226
),
223227
),
224228
],

lib/utils/utils.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,7 @@ String buildPackageUrlFromName(String name) {
1818
String buildPublisherUrlFromName(String name) {
1919
return 'https://pub.dev/publishers/$name/packages';
2020
}
21+
22+
String buildSearchUrlFromQuery(String query) {
23+
return 'https://pub.dev/packages?q=$query';
24+
}

0 commit comments

Comments
 (0)