Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Salis Romdoni
StartFlutter01
Commits
dd2249f2
Commit
dd2249f2
authored
Apr 17, 2019
by
Salis Romdoni
Browse files
semua step selesai tapi masih eror
parent
540253b3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
13 deletions
+32
-13
lib/main.dart
lib/main.dart
+32
-13
No files found.
lib/main.dart
View file @
dd2249f2
...
...
@@ -7,25 +7,44 @@ class MyApp extends StatelessWidget {
@override
Widget
build
(
BuildContext
context
)
{
return
MaterialApp
(
title:
'Welcome to Flutter'
,
home:
Scaffold
(
appBar:
AppBar
(
title:
Text
(
'Welcome to Flutter'
),
),
body:
Center
(
child:
RandomWords
(),
),
),
title:
'Startup Name Generator'
,
home:
RandomWords
(),
);
}
}
class
RandomWordsState
extends
State
<
RandomWords
>
{
final
_suggestions
=
<
WordPair
>[];
final
_biggerFont
=
const
TextStyle
(
fontSize:
18.0
);
Widget
_buildSuggestions
()
{
return
ListView
.
builder
(
padding:
const
EdgeInsets
.
all
(
16.0
),
itemBuilder:
/*1*/
(
context
,
i
)
{
if
(
i
.
isOdd
)
return
Divider
();
/*2*/
final
index
=
i
~/
2
;
/*3*/
if
(
index
>=
_suggestions
.
length
)
{
_suggestions
.
addAll
(
generateWordPairs
().
take
(
10
));
/*4*/
}
return
_buildRow
(
_suggestions
[
index
]);
},
);
}
Widget
_buildRow
(
WordPair
pair
)
{
return
ListTile
(
title:
Text
(
pair
.
asPascalCase
,
style:
_biggerFont
,
),
);
}
@override
Widget
build
(
BuildContext
context
)
{
final
wordPair
=
WordPair
.
random
();
return
Text
(
wordPair
.
asPascalCase
);
}
return
Scaffold
(
appBar:
AppBar
(
title:
Text
(
'Startup Name Generator'
),
),
body:
_buildSuggestions
(),
);
}
class
RandomWords
extends
StatefulWidget
{
...
...
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