import 'package:flutter/material.dart'; import 'package:flutter_redux/flutter_redux.dart'; import 'package:invoiceninja_flutter/redux/app/app_state.dart'; class ActionIconButton extends StatelessWidget { const ActionIconButton({ this.onPressed, this.tooltip, this.icon, this.isSaving = false, this.isDirty = false, this.isVisible = true, }); final bool isSaving; final bool isDirty; final bool isVisible; final Function onPressed; final String tooltip; final IconData icon; @override Widget build(BuildContext context) { if (!isVisible) { return Container(); } if (isSaving) { return SizedBox( width: 88, child: IconButton( onPressed: null, icon: SizedBox( width: 28, height: 28, child: CircularProgressIndicator(), ), ), ); } final state = StoreProvider.of(context).state; return FlatButton( child: Text( tooltip, style: TextStyle( color: isDirty ? (state.uiState.enableDarkMode ? Theme.of(context).accentColor : Colors.yellowAccent) : Colors.white), ), onPressed: onPressed, ); } }