How to assign unallocated space to ubuntu partition
The little "key" icon indicates partitions that cannot be modified because they are mounted.
It's impossible to resize the partition that houses your booted system.
Instead, boot a LiveUSB. Select the "Try Ubuntu" environment. Now you will find the "key" icons gone, and your installed system partition can be modified.
WARNING: Editing partitions is inherently risky, regardless of how elegant and comforting the User Interface is. Assume that the data on any edited or moved partition will be destroyed, and have backups ready before you begin. Maybe everything will be fine and you won't need the backups.