Conditional functions.php on page template

You can make use of the conditional tag is_page_template()

This Conditional Tag allows you to determine if you are in any page template. Optionally checks if a specific Page Template is being used in a Page. This is a boolean function, meaning it returns either TRUE or FALSE.

You can try something like

if( is_page_template( 'template-flat.php' ) ) {

    //Do something if the current template is template-flat.php

}else{

    //Do something else if the current template is not template-flat.php

}