Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
496 changes: 496 additions & 0 deletions flet_contrib/notify/README.md

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions flet_contrib/notify/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from flet_contrib.notify.src.notify import (
NotifyMode, NotifyTheme, NotifyOpenDirection, DefaultOffsets, Notify
)
60 changes: 60 additions & 0 deletions flet_contrib/notify/examples/notify_directions_example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
from flet import *

from flet_contrib.notify import NotifyMode, NotifyOpenDirection, Notify

def main(page: Page):

def open_notify(e):
notify.open('test', 'Message', 'Header') # open notify with 'test' mode

def notify_direction_change(e):
notify.open_direction = NotifyOpenDirection.__getattribute__(NotifyOpenDirection, e.control.value)

page.add(
Column(
tight=True,
controls=[
Dropdown(
value='BOTTOM_TO_TOP',
options=[
DropdownOption('BOTTOM_TO_TOP'),
DropdownOption('BOTTOM_RIGHT_TO_LEFT'),
DropdownOption('BOTTOM_LEFT_TO_RIGHT'),
DropdownOption('TOP_TO_BOTTOM'),
DropdownOption('TOP_RIGHT_TO_LEFT'),
DropdownOption('TOP_LEFT_TO_RIGHT'),
], on_change=notify_direction_change
),
TextButton('open', on_click=open_notify),
]
),
)

page.window.width = 700
page.window.height = 500

page.vertical_alignment = 'center'
page.horizontal_alignment = 'center'

notify = Notify(
modes=[
NotifyMode(name='test') # register NotifyMode object with default parameters
],
open_direction=NotifyOpenDirection.BOTTOM_TO_TOP,
bottom_to_top_end=Offset(0, 2.4), # set custom end offset. Because default is not enough
bottom_right_to_left_start=Offset(3, 2.4),
bottom_right_to_left_end=Offset(0.625, 2.4),
bottom_left_to_right_start=Offset(-3, 2.4),
bottom_left_to_right_end=Offset(-0.625, 2.4),
top_to_bottom_start=Offset(0, -6),
top_to_bottom_end=Offset(0, -4.1),
top_right_to_left_start=Offset(3, -4.1),
top_right_to_left_end=Offset(0.625, -4.1),
top_left_to_right_start=Offset(-3, -4.1),
top_left_to_right_end=Offset(-0.625, -4.1),
divider_visible=False # turn off divider visibility
)

page.add(notify)

app(target=main)
53 changes: 53 additions & 0 deletions flet_contrib/notify/examples/notify_example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
from flet import *

from flet_contrib.notify import NotifyMode, NotifyOpenDirection, Notify

def main(page: Page):

def open_notify(e):
notify.open(e.control.text, 'Message', 'Header') # open notify with 'e.control.text' mode

page.add(
Row(
tight=True,
controls=[
TextButton('test', on_click=open_notify),
TextButton('warning', on_click=open_notify),
TextButton('error', on_click=open_notify)
]
)
)

page.window.width = 700
page.window.height = 500

page.vertical_alignment = 'center'
page.horizontal_alignment = 'center'

notify = Notify(
modes=[
NotifyMode( # register NotifyMode object with default parameters
name='test'
),
NotifyMode( # register NotifyMode object with half of parameters
name='warning',
color='deeppurple500',
icon=Icons.WARNING_ROUNDED
),
NotifyMode( # register NotifyMode object with almost all parameters
name='error',
color='red900',
icon=Icons.ERROR_ROUNDED,
icon_color='bluegrey800',
header_color='bluegrey800',
message_color='bluegrey900'
)
],
open_direction=NotifyOpenDirection.BOTTOM_TO_TOP,
bottom_to_top_end=Offset(0, 2.9), # set custom end offset. Because default is not enough
divider_visible=False # turn off divider visibility
)

page.add(notify)

app(target=main)
41 changes: 41 additions & 0 deletions flet_contrib/notify/examples/notify_with_text_example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
from flet import *

from flet_contrib.notify import NotifyMode, NotifyOpenDirection, Notify

def main(page: Page):

def open_notify(e):
notify.open('test', message.value, header.value) # open notify with 'test' mode

header = TextField(label='Header', value='Header')
message = TextField(label='Message', value='Message')

page.add(
Column(
tight=True,
controls=[
header,
message,
TextButton('open', on_click=open_notify),
]
),
)

page.window.width = 700
page.window.height = 500

page.vertical_alignment = 'center'
page.horizontal_alignment = 'center'

notify = Notify(
modes=[
NotifyMode(name='test') # register NotifyMode object with default parameters
],
open_direction=NotifyOpenDirection.BOTTOM_TO_TOP,
bottom_to_top_end=Offset(0, 1.95), # set custom end offset. Because default is not enough
divider_visible=False # turn off divider visibility
)

page.add(notify)

app(target=main)
35 changes: 35 additions & 0 deletions flet_contrib/notify/examples/notify_without_header_example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
from flet import *

from flet_contrib.notify import NotifyMode, Notify

def main(page: Page):

def open_notify(e):
notify.open('test', 'Notification without header') # open notify with 'test' mode

page.add(
Row(
tight=True,
controls=[
TextButton('notify without header', on_click=open_notify)
]
)
)

page.window.width = 700
page.window.height = 500

page.vertical_alignment = 'center'
page.horizontal_alignment = 'center'

notify = Notify(
modes=[
NotifyMode(name='test') # register NotifyMode object with default parameters
],
bottom_to_top_end=Offset(0, 2.9), # set custom end offset. Because default is not enough
divider_visible=False # turn off divider visibility
)

page.add(notify)

app(target=main)
Binary file added flet_contrib/notify/media/action.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added flet_contrib/notify/media/default_notify.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added flet_contrib/notify/media/error_notify.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added flet_contrib/notify/media/warning_notify.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading