The error occurs because you do not have any code for saving and retrieving your field data. $this->extrafields
is undefined.
How to solve this depends on how and where you want to store your data. If you have no preference and just want the fields to have their own tab in the form, keep using params
field group but use a custom the fieldset:
<fields name="params">
<fieldset name="extrafields">
<field
name="theme"
This way your fields are stored along with params and are accessible the same way:
$this->params->get('theme');