Create a separate widget for both Tags and TagsCloud?

we can create by category and we conver to custom category widget.
There are a few plugins that are supposed to enable filtering tags for specific category. For example: TDO Tag Fixes and Sensitive Tags.

//Getting Tags for a Specific Category

<?php
    query_posts('cat=1&posts_per_page=-1');
    if(have_posts()): while (have_posts()) : the_post();
        $all_tag_objects = get_the_tags();
        if($all_tag_objects){
            foreach($all_tag_objects as $tag) {
                if($tag->count > 0) {$all_tag_ids[] = $tag -> term_id;}
            }
        }
    endwhile;endif;
    $tag_ids_unique = array_unique($all_tag_ids);

//Listing tags per category



     foreach($tag_ids_unique as $tag_id) {
            $post_tag = get_term( $tag_id, 'post_tag' );
            echo '<li><a href="'.get_tag_link($tag_id).'">'.$post_tag->name.' ( '.$post_tag->count.' )</a></li>';
        }?>

//Creating a tag cloud for a specific category



     wp_tag_cloud('include=" . implode(",', $tag_ids_unique));