@@ -222,6 +222,8 @@ def __init__(self, params: TViewParams):
222
222
]
223
223
224
224
225
+
226
+ SIDEBAR_WIDTH = 250 # width of the sidebar menu in home screen
225
227
class HomeScreen (TView , UserControl ):
226
228
"""The home screen"""
227
229
@@ -239,15 +241,17 @@ def __init__(
239
241
)
240
242
self .selected_tab = 0
241
243
242
- self .main_menu = views .TNavigationMenu (
244
+ self .main_menu = views .TNavigationMenuNoLeading (
243
245
title = self .main_menu_handler .menu_title ,
244
246
destinations = self .get_menu_destinations (),
245
247
on_change = lambda e : self .on_menu_destination_change (e ),
248
+
246
249
)
247
- self .secondary_menu = views .TNavigationMenu (
250
+ self .secondary_menu = views .TNavigationMenuNoLeading (
248
251
title = self .secondary_menu_handler .menu_title ,
249
252
destinations = self .get_menu_destinations (menu_level = 1 ),
250
253
on_change = lambda e : self .on_menu_destination_change (e , menu_level = 1 ),
254
+
251
255
)
252
256
self .current_menu_handler = self .main_menu_handler
253
257
self .destination_view = self .current_menu_handler .items [0 ].destination
@@ -347,22 +351,23 @@ def build(self):
347
351
),
348
352
height = dimens .FOOTER_HEIGHT ,
349
353
)
350
- self .main_body = Column (
351
- col = {
352
- "xs" : 8 ,
353
- "md" : 9 ,
354
- "lg" : 10 ,
355
- },
356
- alignment = utils .START_ALIGNMENT ,
357
- horizontal_alignment = utils .START_ALIGNMENT ,
358
- controls = [
359
- self .action_bar ,
360
- self .destination_content_container ,
361
- ],
354
+ self .main_body = Container (
355
+ width = dimens .MIN_WINDOW_WIDTH - SIDEBAR_WIDTH ,
356
+ content = Column (
357
+ alignment = utils .START_ALIGNMENT ,
358
+ horizontal_alignment = utils .START_ALIGNMENT ,
359
+ controls = [
360
+ self .action_bar ,
361
+ self .destination_content_container ,
362
+ ],
363
+ ),
362
364
)
363
365
self .side_bar = Container (
364
- col = {"xs" : 4 , "md" : 3 , "lg" : 2 },
365
- padding = padding .only (top = dimens .SPACE_XL ),
366
+ width = SIDEBAR_WIDTH ,
367
+ padding = padding .only (
368
+ top = dimens .SPACE_XL ,
369
+ left = 0 ,
370
+ ),
366
371
content = Column (
367
372
controls = [
368
373
self .main_menu ,
@@ -384,7 +389,7 @@ def build(self):
384
389
self .home_screen_view = Container (
385
390
Column (
386
391
[
387
- ResponsiveRow (
392
+ Row (
388
393
controls = [
389
394
self .side_bar ,
390
395
self .main_body ,
@@ -419,18 +424,14 @@ def load_preferred_theme(self):
419
424
self .show_snack (result .error_msg , is_error = True )
420
425
return
421
426
self .preferred_theme = result .data
422
- side_bar_components = [
423
- self .side_bar ,
424
- self .main_menu ,
425
- self .secondary_menu ,
426
- ]
427
427
side_bar_bg_color = colors .SIDEBAR_DARK_COLOR # default is dark mode
428
428
self .action_bar .bgcolor = colors .ACTION_BAR_DARK_COLOR
429
429
if self .preferred_theme == theme .THEME_MODES .light .value :
430
430
side_bar_bg_color = colors .SIDEBAR_LIGHT_COLOR
431
431
self .action_bar .bgcolor = colors .ACTION_BAR_LIGHT_COLOR
432
- for component in side_bar_components :
433
- component .bgcolor = side_bar_bg_color
432
+ self .side_bar .bgcolor = side_bar_bg_color
433
+ self .main_menu .setBgColor (side_bar_bg_color )
434
+ self .secondary_menu .setBgColor (side_bar_bg_color )
434
435
self .footer .bgcolor = side_bar_bg_color # footer and side bar have same bgcolor
435
436
self .update_self ()
436
437
@@ -443,6 +444,7 @@ def on_window_resized_listener(self, width, height):
443
444
self .action_bar .height + self .footer .height + 50
444
445
)
445
446
self .destination_content_container .height = DESTINATION_CONTENT_PERCENT_HEIGHT
447
+ self .main_body .width = self .page_width - SIDEBAR_WIDTH
446
448
self .update_self ()
447
449
448
450
def will_unmount (self ):
0 commit comments