Converted to stateful widget plugin

Extensive changes to support stateful widget plugin conversion