Generally maintenance is payable for children for the duration of their education up to the age of 23.
Maintenance for spouse is generally payable until they (a) co-habit, or (b) remarry. However in some cases even if they co-habit you may still be required to maintain them.