Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make the contents of an ion-item fill the space available?

I have a fairly simple template for ion-item cards:

<ion-list>
    <div class="card">

        <ion-item ng-repeat="item in items"
                    item="item"
                    ui-sref="main.tabs.create({id: item.id})">

            <div class="item item-avatar item-fill-space">
                <img data-ng-src="data:image/jpg;base64,{{ item.image[0] }}" data-err-src="../../../../../res/icons/android/icon-48-mdpi.png">
                <h2>{{ item.title }}</h2>
            </div>

            <div class="item item-body item-fill-space">
                {{ item.message }}
            </div>
        </ion-item>
    </div>
    <ion-infinite-scroll ng-if="!noMoreItemsAvailable" on-infinite="loadMore()" distance="10%"></ion-infinite-scroll>
</ion-list>

It's appearing like this on the screen:

enter image description here

The horizontal line in the middle isn't reaching the full width of the container (with respect to the margin on the opposite side). How can I fix this?

I've tried adding the class

.item-fill-space {
    width: 100%;
}

but it doesn't work unless I specify a width of more than 100%, but that's a bit hacky.

like image 561
DaveDev Avatar asked Oct 30 '22 03:10

DaveDev


2 Answers

I have the same problem, with a similar code:

<ion-view>
  <ion-content>
    <ion-list>
      <ion-item ng-repeat="aviso in avisos | filter: filter" href="#/app/avisos/{{aviso.id}}">
        <div class="item item-divider aviso">
          <strong>{{aviso.create_date | dateFormat}}</strong>
        </div>
        <div class="item aviso">{{aviso.formated_message}}</div>
      </ion-item>
    </ion-list>
  </ion-content>
</ion-view>

And, like DaveDev said, the only workaround solution is to use a width of more then 100% (in my case, 110% worked for the "aviso" class). But I'm not happy with this too.

like image 172
Fernando Ghisi Avatar answered Nov 08 '22 05:11

Fernando Ghisi


'ion-content' comes with padding into it.

Try and see what happens when you take out that padding in your outer directive which contains your 'ion-list'.

like image 28
Dee Avatar answered Nov 08 '22 06:11

Dee