Fakultas Ilmu Komputer UI
Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ppl-fasilkom-ui
2021
Kelas D
Fundex.id - Security Crowdfunding Mobile Application
ppl2021-D-SLhape
Commits
020e73dc
Commit
020e73dc
authored
May 23, 2021
by
Muhammad Farhan Ghaffar
Browse files
[GREEN] added code for typeahead latar belakang
parent
3a3bda15
Pipeline
#78429
passed with stages
in 7 minutes and 28 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
lib/pages/kyc/biodata_pendukung.dart
View file @
020e73dc
import
'package:flutter/material.dart'
;
import
'package:flutter_typeahead/flutter_typeahead.dart'
;
import
'package:fundex_app/assets/colors.dart'
;
import
'package:fundex_app/main-screen.dart'
;
import
'package:fundex_app/pages/kyc/data_identitas.dart'
;
...
...
@@ -23,6 +24,12 @@ class ValidasiEmail {
}
}
class
ValidasiTempat
{
static
String
validate
(
String
value
){
return
value
.
isEmpty
?
'Harus di isi.'
:
null
;
}
}
class
DataPendukung
extends
StatefulWidget
{
@override
_DataPendukungState
createState
()
=>
_DataPendukungState
();
...
...
@@ -30,6 +37,7 @@ class DataPendukung extends StatefulWidget {
class
_DataPendukungState
extends
State
<
DataPendukung
>
{
final
GlobalKey
<
FormState
>
_formkey
=
GlobalKey
<
FormState
>();
final
TextEditingController
_typeAheadController
=
TextEditingController
();
// ignore: unused_field
String
_latarBelakang
;
...
...
@@ -52,6 +60,7 @@ class _DataPendukungState extends State<DataPendukung> {
bool
valueCheckbox
=
false
;
bool
_checkBox
=
false
;
var
_onPressed
;
String
dropdownValue
;
final
notifikasiCheckbox
=
[
CheckboxNotificationSetting
(
title:
'Gaji'
),
...
...
@@ -99,6 +108,20 @@ class _DataPendukungState extends State<DataPendukung> {
_onPressed
=
null
;
}
List
<
String
>
listLatarBelakang
(
String
query
)
{
List
<
String
>
matches
=
[];
matches
.
add
(
"SD"
);
matches
.
add
(
"SMP"
);
matches
.
add
(
"SMA"
);
matches
.
add
(
"D3"
);
matches
.
add
(
"D4"
);
matches
.
add
(
"S1"
);
matches
.
add
(
"S2"
);
matches
.
add
(
"S3"
);
matches
.
add
(
"Lainnya"
);
matches
.
retainWhere
((
s
)
=>
s
.
toLowerCase
().
contains
(
query
.
toLowerCase
()));
return
matches
;
}
return
MaterialApp
(
home:
Scaffold
(
...
...
@@ -243,6 +266,34 @@ class _DataPendukungState extends State<DataPendukung> {
style:
miniTitleTextStyle
(),
),
),
Container
(
width:
343
,
child:
TypeAheadFormField
(
key:
Key
(
'latarBelakangPend'
),
textFieldConfiguration:
TextFieldConfiguration
(
controller:
this
.
_typeAheadController
,
decoration:
formInputDecoration
()
),
suggestionsCallback:
(
pattern
)
{
return
listLatarBelakang
(
pattern
);
},
itemBuilder:
(
context
,
suggestion
)
{
return
ListTile
(
title:
Text
(
suggestion
),
);
},
transitionBuilder:
(
context
,
suggestionsBox
,
controller
)
{
return
suggestionsBox
;
},
onSuggestionSelected:
(
suggestion
)
{
this
.
_typeAheadController
.
text
=
suggestion
;
},
// ignore: missing_return
validator:
ValidasiTempat
.
validate
,
onSaved:
(
value
)
=>
this
.
_latarBelakang
=
value
,
),
),
])
],
),
...
...
Write
Preview
Supports
Markdown
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