quanshousio/ToastUI

Custom toast question

barrylachapelle opened this issue · 2 comments

Pre-requisites:

  • [ *] Yes, I looked through both open and closed issues looking for what I needed
  • [ *] No, I did not find what I was looking for

Nice work guys - question how did you pull off the green bottom aligned toast in the animated gif example exactly? Would love to see an example.

Screen Shot 2020-12-23 at 2 18 42 PM

You can have a look at the CustomizedToastWithoutToastViewExample in AdvancedExamples.swift in ToastUISample for more detail. Here's the snippet of that example describing the view.

struct ContentView: View {
  var text: String

  var body: some View {
    VStack {
      Spacer()
      Text(text)
        .bold()
        .foregroundColor(.white)
        .padding()
        .background(Color.green)
        .cornerRadius(8.0)
        .shadow(radius: 4)
        .padding()
    }
  }
}

VStack is already vertically centered and padded by default, then a Spacer is used to push the view downward.

Ack missed the AdvancedExamples - apologies, and thanks for the response. Nice work again.