avatarTrista Signe Ainsworth

Free AI web copilot to create summaries, insights and extended knowledge, download it at here

1763

Abstract

colors = TextFieldDefaults.textFieldColors( backgroundColor = MaterialTheme.colors.surface ), placeholder = { Text(stringResource(R.string.placeholder_search)) }, modifier = modifier .fillMaxWidth() .heightIn(min = <span class="hljs-number">56.</span>dp) ) }</pre></div><h1 id="8783">Explanation</h1><ul><li>You can see in the above figure we need to design the search bar</li><li>The design is divided into many tiny pixels. We can use these pixels to find the dimension or spacing between different items.</li><li>The search bar has a height of 56 dp and a width equal to the parent.</li><li>Each pixel is 56/7=8dp</li><li>We will use a material component called a <b>Text field</b> to implement a search bar.</li><li>It is very similar to Edit Text for views. Like Edit Text it allows users to enter text into a UI.</li><li>It is of two types filled and outlined. It is mainly used in forms and dialogs. like — first name, last name, phone, address, etc.</li></ul><figure id="b858"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*0OlgZ49VIGSscHCP-EO4Fw.png"><figcaption></figcaption></figure><ul><li>As per the design, using a modifier <code>heightIn</code> we have added the min-height of 56.dp, and <code>fillMaxWidth</code> modifier utilizes the entire width of the parent.</li><li>It is the best practice to provide min-height so that the user can increase it according to his preferences.</li><li>we use <b>modifiers </b>to

  • change the composable size, layout, behavior, and appearance
  • Add information like accessibility labels
  • Process user input
  • Add high-level interactions, like making an element clickable, scrollable, draggable, or zoomable.</li><li

Options

we can chain multiple modifier methods to create a more complex adaptation.</li><li><code>value </code>parameter is used to provide any value to the Text field</li><li><code>onValueChange</code> callback performs any action when the Text field value changes.</li><li>SearchBar composable accepts a modifier that it is passing to TextField. It is the best practice followed by every composable.</li><li>It allows the caller to customize the look and feel of the composable, which makes it more flexible and reusable.</li><li>we have added a search icon to the Text field using the parameter <code>leadingIcon</code>.</li><li>We have added a background to the text Field using the parameter <code>colors </code>and method <code>TextFieldDefaults.textFieldColors</code></li><li><code>TextFieldDefaults</code> data class contains many parameters like <code>backgroundColor</code>, <code>textColor</code>, <code>placeholderColor </code>etc. We need not specify different parameters for it, we can simply use inbuilt methods of <code>TextFieldDefaults</code> .</li><li>we have added a placeholder text or hint using the parameter <code>placeholder</code> .</li></ul><h1 id="7309">Source Code</h1><ul><li><a href="https://github.com/abhineshchandra1234/MySoothe">https://github.com/abhineshchandra1234/MySoothe</a></li></ul><h1 id="f826">References</h1><ul><li><a href="https://developer.android.com/codelabs/jetpack-compose-layouts?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fjetpack-compose-for-android-developers-1%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fjetpack-compose-layouts#3">Search bar — Modifiers</a></li><li><a href="https://m3.material.io/components/text-fields/overview">Text fields</a></li></ul></article></body>

Sticks and Stones Heal the Soul: 3 Ways to Take a Meaningful Break

Finding joy in meditation and life

Photo by Mental Health America (MHA) from Pexels

“Now I see the secret of making the best person- it is to grow in the open air and to eat and sleep with the earth.” ~ Walt Whitman

Last week was spring break for my son. Although I did some writing, I was able to experience some time off. Writing three days a week and exploring the other two days brought my soul alive.

I am so grateful I got to explore this schedule fully because now I know a good recipe for my happiness.

The balance between writing, creating, and resting became a reality. My son felt joy in staying up late to design games. I found my heart fulfilled with having more time to explore.

I want to share with you three ways in which I found bliss. These are different methods to meditate or contemplate in your free time. I found I do better with movement-oriented mediations. If you are like me, these might help.

Find Beauty in the Ordinary:

One of my favorite moments last week happened on a sunny Friday afternoon. We have a large patch of ground covered with river rocks near our fire pit in the garden.

Through the fall and winter, I collected twigs and sticks that I placed in a large pile. We used up most of those to make a fire. However, there were still many scattered on the ground amongst the stones.

I delighted in sitting there in the sun, picking up little twigs and placing them into a bag. It was a peaceful meditation, looking for the next little piece of wood to save for the fire.

As I sifted and sorted amongst the rocks, I felt such joy.

It brought me back to the days where I used to go on walks with my grandpa Art. He and my grandma Marion lived in our basement apartment during our growing-up years.

He loved to take short walks up and down our long country driveway. Sometimes I would stop to pick some flowers or observe a plant.

I love how towards the end of the walk, my grandpa would say: I am running out of steam. It signaled that he needed to take a rest.

I knew that was my cue to take a rest too.

We all need to rest and contemplate. Picking up sticks in amongst stones brought me to a place of joy. It felt like my grandpa was right there, smiling at me.

How can you do a meditation out in nature?

Care For Your Hands:

Yesterday afternoon I got out my manicure tools. For more than a year, all I had done was trim my nails and sometimes paint them with a clear polish.

However, yesterday I decided to give my hands some loving care.

Our hands allow us to create, and so we need to take good care of them. Treating yourself to a home manicure is a great way to slow down and take a break.

I took out a bowl and filled it with warm, soapy water. First, I trimmed and filed my nails. Then I gently pushed back the cuticles, and I soaked them in warm, soapy water.

After that, I polished them with a fun, bright pink color and finished them off with a clear coat.

It is a delight to see my painted nails throughout the day. It is a reminder that I care for myself and my hands. Not only did it create a moment of joy and rest, but it also helped me care for myself.

How can you care for your hands?

Sweep It All Away:

Yesterday while my husband and son were busy playing an online game with a group, I decided to do some sweeping.

I use the vacuum from time to time, but sweeping is a gentle way to take care of the dust and dirt.

We have a lot of wood floors in our home. Only two rooms still have carpet. I love the way that a simple broom helps make all of our rooms cleaner and brighter.

Sweeping is another way for me to meditate on life and my days. It is relaxing, and I am also cleaning at the same time.

When I get out a broom, I can sweep away any worries I have.

I went from room to room, and on the stairs, and in the hallway. It was energizing and restful all at the same time.

How can you gently sweep your cares away?

My prayer for you today is that you look for ways to take breaks, meditate and gently focus on what matters to you. You will find that just a few minutes of contemplative activity can take you to another realm.

Day #7: How can you find ways to meditate, contemplate and take breaks?

Here is a video on the ways you can meditate, rest and contemplate:

I am tagging my beautiful friends on Medium who have followed me on my past journeys. I ask that you follow them in return and read their amazing writing:

Dr. Preeti Singh, Michele Thill, Tony Young, Jr., Charlotte Zobeir Ali, Amy Marley, Gurpreet Dhariwal, Desiree Driesenaar, Neha Sandhir S, Melissa Bee, Vishnu*s Virtues, Rasheed Hooda, Karen Madej, Tree Langdon, Joe Luca, Terry Mansfield, Noma Dek, Cocoa Griot, Annelise Lords, Nihan Kucukural, Henery X, Sherry S, Aurora Eliam, CMP, Lanu Pitan, Annick Batamuliza, Bob Jasper, Jenine Bsharah Baines, Rebecca Romanelli, Ashley Nicole, and many more! Thank you!

Connect with Trista on LinkedIn, Twitter, YouTube, or by email: [email protected].

More from Trista Ainsworth:

Meditation
Personal Growth
Personal Development
Life Lessons
Joy
Recommended from ReadMedium