@@ -37,9 +37,18 @@ def close_dialog(_):
37
37
dialog .open = False
38
38
self .app .dialog_area .update ()
39
39
40
+ is_mobile = self .app .is_mobile
41
+
42
+ if is_mobile :
43
+ video_width = 320
44
+ video_height = 180
45
+ else :
46
+ video_width = 800
47
+ video_height = 450
48
+
40
49
video = ft .Video (
41
- width = 800 ,
42
- height = 450 ,
50
+ width = video_width ,
51
+ height = video_height ,
43
52
playlist = [ft .VideoMedia (video_source )],
44
53
autoplay = True
45
54
)
@@ -63,13 +72,46 @@ async def open_in_browser(_):
63
72
else :
64
73
actions .insert (0 , ft .TextButton (self ._ ["copy_video_url" ], on_click = copy_source ))
65
74
66
- dialog = ft .AlertDialog (
67
- modal = True ,
68
- title = ft .Text (title ),
69
- content = video ,
70
- actions = actions ,
71
- actions_alignment = ft .MainAxisAlignment .END
72
- )
75
+ if is_mobile :
76
+ actions_row = ft .Row (
77
+ controls = actions ,
78
+ spacing = 5 ,
79
+ alignment = ft .MainAxisAlignment .CENTER ,
80
+ wrap = True ,
81
+ )
82
+
83
+ video_container = ft .Container (
84
+ content = video ,
85
+ alignment = ft .alignment .center ,
86
+ width = video_width ,
87
+ height = video_height ,
88
+ )
89
+
90
+ dialog = ft .AlertDialog (
91
+ modal = True ,
92
+ title = ft .Text (title , overflow = ft .TextOverflow .ELLIPSIS , max_lines = 1 , size = 14 ),
93
+ content = ft .Column (
94
+ [
95
+ video_container ,
96
+ actions_row
97
+ ],
98
+ spacing = 5 ,
99
+ alignment = ft .MainAxisAlignment .CENTER ,
100
+ horizontal_alignment = ft .CrossAxisAlignment .CENTER ,
101
+ tight = True ,
102
+ ),
103
+ actions = [],
104
+ inset_padding = ft .padding .only (left = 10 , right = 10 , top = 5 , bottom = 5 ),
105
+ content_padding = ft .padding .only (left = 5 , right = 5 , top = 5 , bottom = 0 ),
106
+ )
107
+ else :
108
+ dialog = ft .AlertDialog (
109
+ modal = True ,
110
+ title = ft .Text (title ),
111
+ content = video ,
112
+ actions = actions ,
113
+ actions_alignment = ft .MainAxisAlignment .END
114
+ )
73
115
dialog .open = True
74
116
self .app .dialog_area .content = dialog
75
117
self .app .dialog_area .update ()
0 commit comments