Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
font_awesome_flutter
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
font_awesome_flutter
Commits
9cea0574
Commit
9cea0574
authored
Jun 24, 2017
by
Brian Egan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Playing around with the example code a bit doing some refinement
parent
46a0ba72
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
55 additions
and
44 deletions
+55
-44
main.dart
example/lib/main.dart
+55
-44
No files found.
example/lib/main.dart
View file @
9cea0574
...
@@ -28,58 +28,22 @@ class FontAwesomeGalleryHome extends StatefulWidget {
...
@@ -28,58 +28,22 @@ class FontAwesomeGalleryHome extends StatefulWidget {
}
}
class
FontAwesomeGalleryHomeState
extends
State
<
FontAwesomeGalleryHome
>
{
class
FontAwesomeGalleryHomeState
extends
State
<
FontAwesomeGalleryHome
>
{
var
searchTerm
=
""
;
var
_
searchTerm
=
""
;
var
isSearching
=
false
;
var
_
isSearching
=
false
;
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
return
new
Scaffold
(
return
new
Scaffold
(
appBar:
new
AppBar
(
appBar:
_isSearching
?
_searchBar
(
context
)
:
_titleBar
(),
leading:
isSearching
?
new
IconButton
(
icon:
new
Icon
(
FontAwesomeIcons
.
arrowLeft
),
onPressed:
()
=>
setState
(()
{
isSearching
=
false
;
searchTerm
=
""
;
}))
:
null
,
title:
isSearching
?
new
TextField
(
onChanged:
(
text
)
=>
setState
(()
=>
searchTerm
=
text
),
autofocus:
true
,
style:
new
TextStyle
(
fontSize:
18.0
),
decoration:
new
InputDecoration
(
hideDivider:
true
),
)
:
new
Text
(
"Font Awesome Flutter Gallery"
),
actions:
isSearching
?
null
:
[
new
IconButton
(
icon:
new
Icon
(
FontAwesomeIcons
.
search
),
onPressed:
()
{
ModalRoute
.
of
(
context
).
addLocalHistoryEntry
(
new
LocalHistoryEntry
(
onRemove:
()
{
setState
(()
{
searchTerm
=
""
;
isSearching
=
false
;
});
}));
setState
(()
{
isSearching
=
true
;
});
})
],
),
body:
new
GridView
.
count
(
body:
new
GridView
.
count
(
crossAxisCount:
crossAxisCount:
MediaQuery
.
of
(
context
).
orientation
==
Orientation
.
portrait
MediaQuery
.
of
(
context
).
orientation
==
Orientation
.
portrait
?
2
?
2
:
3
,
:
3
,
children:
(
icons
..
sort
())
children:
icons
.
where
((
icon
)
=>
.
where
((
icon
)
=>
searchTerm
.
isEmpty
||
_
searchTerm
.
isEmpty
||
icon
.
title
.
toLowerCase
().
startsWith
(
searchTerm
.
toLowerCase
()))
icon
.
title
.
toLowerCase
().
startsWith
(
_
searchTerm
.
toLowerCase
()))
.
map
((
icon
)
=>
new
InkWell
(
.
map
((
icon
)
=>
new
InkWell
(
onTap:
()
{
onTap:
()
{
Navigator
.
push
(
Navigator
.
push
(
...
@@ -115,9 +79,56 @@ class FontAwesomeGalleryHomeState extends State<FontAwesomeGalleryHome> {
...
@@ -115,9 +79,56 @@ class FontAwesomeGalleryHomeState extends State<FontAwesomeGalleryHome> {
.
toList
()),
.
toList
()),
);
);
}
}
AppBar
_titleBar
()
{
return
new
AppBar
(
title:
new
Text
(
"Font Awesome Flutter Gallery"
),
actions:
[
new
IconButton
(
icon:
new
Icon
(
FontAwesomeIcons
.
search
),
onPressed:
()
{
ModalRoute
.
of
(
context
)
.
addLocalHistoryEntry
(
new
LocalHistoryEntry
(
onRemove:
()
{
setState
(()
{
_searchTerm
=
""
;
_isSearching
=
false
;
});
}));
setState
(()
{
_isSearching
=
true
;
});
})
],
);
}
AppBar
_searchBar
(
BuildContext
context
)
{
return
new
AppBar
(
leading:
new
IconButton
(
icon:
new
Icon
(
FontAwesomeIcons
.
arrowLeft
),
onPressed:
()
{
setState
(
()
{
Navigator
.
pop
(
context
);
_isSearching
=
false
;
_searchTerm
=
""
;
},
);
},
),
title:
new
TextField
(
onChanged:
(
text
)
=>
setState
(()
=>
_searchTerm
=
text
),
autofocus:
true
,
style:
new
TextStyle
(
fontSize:
18.0
),
decoration:
new
InputDecoration
(
hideDivider:
true
),
),
);
}
}
}
final
List
<
IconDefinition
>
icons
=
<
IconDefinition
>[
final
List
<
IconDefinition
>
icons
=
(
<
IconDefinition
>[
new
IconDefinition
(
FontAwesomeIcons
.
glass
,
"glass"
),
new
IconDefinition
(
FontAwesomeIcons
.
glass
,
"glass"
),
new
IconDefinition
(
FontAwesomeIcons
.
music
,
"music"
),
new
IconDefinition
(
FontAwesomeIcons
.
music
,
"music"
),
new
IconDefinition
(
FontAwesomeIcons
.
search
,
"search"
),
new
IconDefinition
(
FontAwesomeIcons
.
search
,
"search"
),
...
@@ -872,7 +883,7 @@ final List<IconDefinition> icons = <IconDefinition>[
...
@@ -872,7 +883,7 @@ final List<IconDefinition> icons = <IconDefinition>[
new
IconDefinition
(
FontAwesomeIcons
.
superpowers
,
"superpowers"
),
new
IconDefinition
(
FontAwesomeIcons
.
superpowers
,
"superpowers"
),
new
IconDefinition
(
FontAwesomeIcons
.
wpexplorer
,
"wpexplorer"
),
new
IconDefinition
(
FontAwesomeIcons
.
wpexplorer
,
"wpexplorer"
),
new
IconDefinition
(
FontAwesomeIcons
.
meetup
,
"meetup"
),
new
IconDefinition
(
FontAwesomeIcons
.
meetup
,
"meetup"
),
];
]
..
sort
())
;
class
IconDefinition
implements
Comparable
{
class
IconDefinition
implements
Comparable
{
final
IconData
iconData
;
final
IconData
iconData
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment