Battery balancing plays a crucial role in improving the overall performance and lifespan of battery packs. However, most balancing strategies only pursue balancing speed and don't consider temperature difference among cells, which leads to a large temperature difference at the end of balancing. Uneven temperature distribution can have adverse effects on the safety, lifespan, and power stability of battery packs. To address this issue, a novel active balancing strategy considering temperature is proposed. Firstly, a distributed bidirectional flyback transformer balancing topology is designed based on the LTC3300 series chips, which enables energy transfer between individual cells and modules. Based on this topology, the balancing strategy that takes temperature into consideration is proposed. This strategy takes state of charge (SOC) difference and temperature difference as the optimization objective. Surrogate optimization algorithm is proposed to solve the optimization problem. Finally, a series of simulation experiments were conducted to validate the superiority of the proposed strategy. The results demonstrate that the proposed strategy can improve SOC and temperature inconsistency. Compared to the maximum difference strategy, although the balancing speed has slightly decreased, the maximum temperature difference at the end of balancing process is reduced by around 35 %-50 %.