Hi. I'm sorry to hear about the attack on your dog and I hope you're both physically okay.
It's hard to advise without a bit more detail. Was your dog physically injured or just traumatised? Were the other dogs larger or smaller? What age is your dog? There are various factors as to how you can handle or avoid situations.
We were attacked by a loose dog when our previous dog was a young puppy of 16 weeks and it was very traumatic. He suffered puncture wounds to his head and face and was left with a fear of black dogs. There is no easy answer, it can take a long time to regain your confidence.
For me, part of the recovery was to play safe, avoiding any area where we would be likely to encounter off-the-lead dogs, so initially I focused on pavement walks. Not very inspiring, I realise, but it helped me to feel that I had more control over whether he met dogs face to face and I could avoid any that appeared aggressive.
You don't want to completely stop your dog from meeting other dogs so do you have a friend, relative or neighbour with a friendly sociable dog that yours can play with in a controlled environment? It can also help to go for walks with someone else so that in the event that you do face an aggressive dog there is a possibility that one of you can fend it off although obviously that depends on the aggressive dog. When our pup was attacked my husband had him on the lead so I was able to grab the attacking dog (a Labrador) by its collar and restrain it until the owner put the lead on it. If the dog had been a larger breed I wouldn't have risked it. So, as I said, various factors.
It goes without saying that your anxiety can transfer to the dog and mine definitely did; I was a nervous wreck and it left me quite dog phobic for a long time. When we got our next puppy I was initially terrified about her meeting dogs - I eventually started regaining confidence only for her to be jumped on by an aggressive spaniel. Unfortunately, there are too many owners in denial about their dogs behaviour but the majority of dogs will be fine and you have to keep reminding yourself that.
The more you get out and see friendly sociable dogs the better but an attack does stay with you for a long time and there is no quick fix.
Sorry for long winded reply but I can really empathise with your struggle and I hope you are able to regain your confidence before too long.