Reputation: 675
I have a variable _PhotoName, this variable is null, but when I take a photo and repeat the term base64 from another screen, I would like the variable _PhotoNameto be a timestamp.img , if base64 is not null. here is the part of the code that displays this variable, and there is also code where base 64 is returned:
Container(
padding: EdgeInsets.only(left: 15, right: 15, top: 5),
color: Colors.white,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Expanded(
child: Text(
"$_PhotoName",
style: TextStyle(color: Colors.black, fontSize: 15)
),
),
Expanded(
child: ButtonTheme(
alignedDropdown: true,
child: new RaisedButton.icon(
label: Text('Add Image'),//Добавити фото
onPressed: () async{
_imageB64 = await Navigator.push(
context,
MaterialPageRoute(
builder: (context) => image.PicturePreview(camera)),
);
},
icon : Icon(Icons.camera_alt),
)
),
),
],
),
),
Upvotes: 2
Views: 133
Reputation: 86
I might have not understood the question but you could check if base64
is null
and if so update the state
if (_imageB64 != null) {
setState ((){
_PhotoName = WHAT_IT_NEEDS_TO_BE_EQUAL_TO;
});
}
Upvotes: 2