i am creating a project where i need to show a progress bar in the appbar.the code is given below
bool loader_saver=false;
return Scaffold(
appBar: new AppBar(
title: new Text("add data"),
actions: <Widget>[
loader_saver?
new CircularProgressIndicator()
:
new FlatButton(
onPressed: () {
_add_Data();
},
child: new Icon(
Icons.save,
color: Colors.white,
))
],
)
here is the onpressed method
void _add_data(){
final _formstate = _form_key.currentState;
if (_formstate.validate()) {
_form_key.currentState.save();
setState(() {
loader_saver=true;
});
}
}