Skip to content

Commit 42bd3b4

Browse files
authored
Fix many mobile issues with dartdoc (#1873)
* Basic work for getting mobile search/navigation up to par * Cleanups * Rebuild test package docs * review comments
1 parent 0c8b0bd commit 42bd3b4

File tree

1,948 files changed

+24654
-19
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,948 files changed

+24654
-19
lines changed

lib/resources/script.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,4 +197,5 @@ document.addEventListener("DOMContentLoaded", function() {
197197
initSideNav();
198198
initSearch("search-box");
199199
initSearch("search-body");
200+
initSearch("search-sidebar");
200201
});

lib/resources/styles.css

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ header form {
4949
padding-right: 30px;
5050
}
5151

52+
header#header-search-sidebar {
53+
height: 50px;
54+
margin-bottom: 25px;
55+
}
56+
5257
footer {
5358
flex: 0 0 16px;
5459
text-align: center;
@@ -110,9 +115,15 @@ nav.navbar {
110115
border: 0;
111116
}
112117

113-
@media (max-width: 767px) {
118+
@media (max-width: 768px) {
114119
.hidden-xs {
115-
display: none!important;
120+
display: none !important;
121+
}
122+
}
123+
124+
@media (min-width: 769px) {
125+
.hidden-l {
126+
display: none !important;
116127
}
117128
}
118129

@@ -740,6 +751,11 @@ button {
740751
padding: 10px;
741752
}
742753

754+
ol#sidebar-nav {
755+
font-size: 18px;
756+
white-space: pre-line;
757+
}
758+
743759
.sidebar-offcanvas-left.active {
744760
left: 0; /* this animates our drawer into the page */
745761
}
@@ -777,7 +793,7 @@ button {
777793
border: 0;
778794
}
779795

780-
@media screen and (max-width: 500px) {
796+
@media screen and (max-width: 768px) {
781797
form.search {
782798
display: none;
783799
}

lib/src/html/templates.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ const _partials = const <String>[
2525
'features',
2626
'documentation',
2727
'name_summary',
28+
'search_sidebar',
2829
'sidebar_for_class',
2930
'sidebar_for_category',
3031
'sidebar_for_enum',

lib/src/model_utils.dart

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ import 'dart:io';
1010
import 'package:analyzer/dart/ast/ast.dart';
1111
import 'package:analyzer/dart/element/element.dart';
1212
import 'package:analyzer/src/dart/ast/utilities.dart';
13-
import 'package:analyzer/src/generated/engine.dart';
14-
import 'package:analyzer/src/generated/sdk.dart';
15-
import 'package:analyzer/src/generated/source_io.dart';
1613
import 'package:dartdoc/src/model.dart';
1714

1815
final Map<String, String> _fileContents = <String, String>{};

lib/templates/404error.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{{>head}}
22

33
<div class="col-xs-6 col-sm-3 col-md-2 sidebar sidebar-offcanvas-left">
4+
{{>search_sidebar}}
45
<h5><span class="package-name">{{self.name}}</span> <span class="package-kind">{{self.kind}}</span></h5>
56
{{>packages}}
67
</div>

lib/templates/_head.html

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,7 @@
3030
<div id="overlay-under-drawer"></div>
3131

3232
<header id="title">
33-
{{^navLinks.isEmpty}}
3433
<button id="sidenav-left-toggle" type="button">&nbsp;</button>
35-
{{/navLinks.isEmpty}}
3634
<ol class="breadcrumbs gt-separated dark hidden-xs">
3735
{{#navLinks}}
3836
<li><a href="{{href}}">{{name}}</a></li>

lib/templates/_search_sidebar.html

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<header id="header-search-sidebar" class="hidden-l">
2+
<form class="search-sidebar" role="search">
3+
<input type="text" id="search-sidebar" autocomplete="off" disabled class="form-control typeahead" placeholder="Loading search...">
4+
</form>
5+
</header>
6+
7+
<ol class="breadcrumbs gt-separated dark hidden-l" id="sidebar-nav">
8+
{{#navLinks}}
9+
<li><a href="{{href}}">{{name}}</a></li>
10+
{{/navLinks}}
11+
{{#navLinksWithGenerics}}
12+
<li><a href="{{href}}">{{name}}{{#hasGenericParameters}}<span class="signature">{{{genericParameters}}}</span>{{/hasGenericParameters}}</a></li>
13+
{{/navLinksWithGenerics}}
14+
{{^hasHomepage}}
15+
<li class="self-crumb">{{{ layoutTitle }}}</li>
16+
{{/hasHomepage}}
17+
{{#hasHomepage}}
18+
<li><a href="{{homepage}}">{{{ layoutTitle }}}</a></li>
19+
{{/hasHomepage}}
20+
</ol>
21+

lib/templates/category.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{{>head}}
22

33
<div class="col-xs-6 col-sm-3 col-md-2 sidebar sidebar-offcanvas-left">
4+
{{>search_sidebar}}
45
<h5><span class="package-name">{{parent.name}}</span> <span class="package-kind">{{parent.kind}}</span></h5>
56
{{>packages}}
67
</div>

lib/templates/class.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{{>head}}
22

33
<div class="col-xs-6 col-sm-3 col-md-2 sidebar sidebar-offcanvas-left">
4+
{{>search_sidebar}}
45
<h5>{{parent.name}} {{parent.kind}}</h5>
56
{{>sidebar_for_library}}
67
</div>

lib/templates/constant.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{{>head}}
22

33
<div class="col-xs-6 col-sm-3 col-md-2 sidebar sidebar-offcanvas-left">
4+
{{>search_sidebar}}
45
<h5>{{parent.name}} {{parent.kind}}</h5>
56
{{>sidebar_for_class}}
67
</div><!--/.sidebar-offcanvas-left-->

lib/templates/constructor.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{{>head}}
22

33
<div class="col-xs-6 col-sm-3 col-md-2 sidebar sidebar-offcanvas-left">
4+
{{>search_sidebar}}
45
<h5>{{parent.name}} {{parent.kind}}</h5>
56
{{>sidebar_for_class}}
67
</div><!--/.sidebar-offcanvas-left-->

lib/templates/enum.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{{>head}}
22

33
<div class="col-xs-6 col-sm-3 col-md-2 sidebar sidebar-offcanvas-left">
4+
{{>search_sidebar}}
45
<h5>{{parent.name}} {{parent.kind}}</h5>
56
{{>sidebar_for_library}}
67
</div>

lib/templates/function.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{{>head}}
22

33
<div class="col-xs-6 col-sm-3 col-md-2 sidebar sidebar-offcanvas-left">
4+
{{>search_sidebar}}
45
<h5>{{parent.name}} {{parent.kind}}</h5>
56
{{>sidebar_for_library}}
67
</div><!--/.sidebar-offcanvas-left-->

lib/templates/index.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{{>head}}
22

33
<div class="col-xs-6 col-sm-3 col-md-2 sidebar sidebar-offcanvas-left">
4-
<h5><span class="package-name">{{self.name}}</span> <span class="package-kind">{{self.kind}}</span></h5>
4+
{{>search_sidebar}}
5+
<h5 class="hidden-xs"><span class="package-name">{{self.name}}</span> <span class="package-kind">{{self.kind}}</span></h5>
56
{{>packages}}
67
</div>
78

lib/templates/library.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{{>head}}
22

33
<div class="col-xs-6 col-sm-3 col-md-2 sidebar sidebar-offcanvas-left">
4+
{{>search_sidebar}}
45
<h5><span class="package-name">{{parent.name}}</span> <span class="package-kind">{{parent.kind}}</span></h5>
56
{{>packages}}
67
</div>

lib/templates/method.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{{>head}}
22

33
<div class="col-xs-6 col-sm-3 col-md-2 sidebar sidebar-offcanvas-left">
4+
{{>search_sidebar}}
45
<h5>{{parent.name}} {{parent.kind}}</h5>
56
{{>sidebar_for_class}}
67
</div><!--/.sidebar-offcanvas-->

lib/templates/mixin.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{{>head}}
22

33
<div class="col-xs-6 col-sm-3 col-md-2 sidebar sidebar-offcanvas-left">
4+
{{>search_sidebar}}
45
<h5>{{parent.name}} {{parent.kind}}</h5>
56
{{>sidebar_for_library}}
67
</div>

lib/templates/property.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{{>head}}
22

33
<div class="col-xs-6 col-sm-3 col-md-2 sidebar sidebar-offcanvas-left">
4+
{{>search_sidebar}}
45
<h5>{{parent.name}} {{parent.kind}}</h5>
56
{{>sidebar_for_class}}
67
</div><!--/.sidebar-offcanvas-->

lib/templates/top_level_constant.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{{>head}}
22

33
<div class="col-xs-6 col-sm-3 col-md-2 sidebar sidebar-offcanvas-left">
4+
{{>search_sidebar}}
45
<h5>{{parent.name}} {{parent.kind}}</h5>
56
{{>sidebar_for_library}}
67
</div><!--/.sidebar-offcanvas-left-->

lib/templates/top_level_property.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{{>head}}
22

33
<div class="col-xs-6 col-sm-3 col-md-2 sidebar sidebar-offcanvas-left">
4+
{{>search_sidebar}}
45
<h5>{{parent.name}} {{parent.kind}}</h5>
56
{{>sidebar_for_library}}
67
</div><!--/.sidebar-offcanvas-left-->

lib/templates/typedef.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{{>head}}
22

33
<div class="col-xs-6 col-sm-3 col-md-2 sidebar sidebar-offcanvas-left">
4+
{{>search_sidebar}}
45
<h5>{{parent.name}} {{parent.kind}}</h5>
56
{{>sidebar_for_library}}
67
</div><!--/.sidebar-offcanvas-left-->

testing/test_package_docs/__404error.html

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

testing/test_package_docs/anonymous_library/anonymous_library-library.html

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

testing/test_package_docs/anonymous_library/doesStuff.html

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

testing/test_package_docs/another_anonymous_lib/another_anonymous_lib-library.html

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

testing/test_package_docs/another_anonymous_lib/greeting.html

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

testing/test_package_docs/categoriesExported/IAmAClassWithCategories-class.html

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

testing/test_package_docs/categoriesExported/IAmAClassWithCategories/IAmAClassWithCategories.html

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

testing/test_package_docs/categoriesExported/IAmAClassWithCategories/hashCode.html

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)