progress state button
a customizable progress button for flutter.
test with dartpad
installation
https://pub.dev/packages/flutter_state_button
progress-state-button: "^1.0.0"
usage
icon
progressbutton.icon(iconedbuttons: {
buttonstate.idle:
iconedbutton(
text: "send",
icon: icon(icons.send,color: colors.white),
color: colors.deeppurple.shade500),
buttonstate.loading:
iconedbutton(
text: "loading",
color: colors.deeppurple.shade700),
buttonstate.fail:
iconedbutton(
text: "failed",
icon: icon(icons.cancel,color: colors.white),
color: colors.red.shade300),
buttonstate.success:
iconedbutton(
text: "success",
icon: icon(icons.check_circle,color: colors.white,),
color: colors.green.shade400)
},
onpressed: onpressed,
state: buttonstate.idle);
with custom widgets
progressbutton(
statewidgets: {
buttonstate.idle: text("idle",style: textstyle(color: colors.white, fontweight: fontweight.w500),),
buttonstate.loading: text("loading",style: textstyle(color: colors.white, fontweight: fontweight.w500),),
buttonstate.fail: text("fail",style: textstyle(color: colors.white, fontweight: fontweight.w500),),
buttonstate.success: text("success",style: textstyle(color: colors.white, fontweight: fontweight.w500),)
},
statecolors: {
buttonstate.idle: colors.grey.shade400,
buttonstate.loading: colors.blue.shade300,
buttonstate.fail: colors.red.shade300,
buttonstate.success: colors.green.shade400,
},
onpressed: onpressed,
state: buttonstate.idle,
);
constructors
default constructor of progressbutton
statewidgets - widgets of states
statecolors - background color oof states
state = buttonstate.idle` - current state of button
onpressed - onpressed function same like raisedbutton
onanimationend - onanimatedend function calls like that onanimatedend(animationstatus animationstatus,buttonstate currentstate).
minwidth = 200.0 - loading state width
maxwidth = 400.0 - failed,success,idle states width
radius = 16.0 - button radius
height = 53.0 - button height
circularprogressindicator - circularprogressindicator widget, default is instating with current state color.
progressindicatoraligment = mainaxisalignment.spacebetween` - progressindicator aligment
padding = edgeinsets.zero - padding of button
progressbutton.icon() specific constructors
map<buttonstate, iconedbutton> iconedbuttons- state and iconedbutton map
double iconpadding: 4.0 - padding of icon
textstyle textstyle - textstyle of all of states
Comments are closed.