background

Sending a push notification only when app is in background

北城以北 提交于 2020-08-09 19:54:14
问题 I use NotificationManager, NotificationChannel and NotificationCompat.Builder to display a push notification when an event is triggered, no online Firebase. The push notification appears when my app is in foreground and background, but it only should appear when my app in the background. I have 2 Activities where just only 1 knows the class, where the push notification is created. I could just set a variable that shows if my Activity is in foreground or not (with onResume and onPause), but if

Design a background from 2 images in flutter

五迷三道 提交于 2020-07-07 09:26:07
问题 I'd like to create a a new stateless widget class that is defined by 2 images(top, bottom) and a line(defined by a function, e.g. (x){x+500} , a width(can be 0, if it shouldn't be drawn), and a color) separating the two images. For each pixel: If the y position of a pixel is greater than the result of f(x) + width/2 a pixel of bottom shall be drawn If it's smaller than f(x) - width / 2 a pixel of top shall be drawn Else a pixel of the given line color shall be drawn Blow see an example of