@@ -222,6 +222,8 @@ def __init__(self, params: TViewParams):
222222 ]
223223
224224
225+
226+ SIDEBAR_WIDTH = 250 # width of the sidebar menu in home screen
225227class HomeScreen (TView , UserControl ):
226228 """The home screen"""
227229
@@ -239,15 +241,17 @@ def __init__(
239241 )
240242 self .selected_tab = 0
241243
242- self .main_menu = views .TNavigationMenu (
244+ self .main_menu = views .TNavigationMenuNoLeading (
243245 title = self .main_menu_handler .menu_title ,
244246 destinations = self .get_menu_destinations (),
245247 on_change = lambda e : self .on_menu_destination_change (e ),
248+
246249 )
247- self .secondary_menu = views .TNavigationMenu (
250+ self .secondary_menu = views .TNavigationMenuNoLeading (
248251 title = self .secondary_menu_handler .menu_title ,
249252 destinations = self .get_menu_destinations (menu_level = 1 ),
250253 on_change = lambda e : self .on_menu_destination_change (e , menu_level = 1 ),
254+
251255 )
252256 self .current_menu_handler = self .main_menu_handler
253257 self .destination_view = self .current_menu_handler .items [0 ].destination
@@ -347,22 +351,23 @@ def build(self):
347351 ),
348352 height = dimens .FOOTER_HEIGHT ,
349353 )
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+ ),
362364 )
363365 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+ ),
366371 content = Column (
367372 controls = [
368373 self .main_menu ,
@@ -384,7 +389,7 @@ def build(self):
384389 self .home_screen_view = Container (
385390 Column (
386391 [
387- ResponsiveRow (
392+ Row (
388393 controls = [
389394 self .side_bar ,
390395 self .main_body ,
@@ -419,18 +424,14 @@ def load_preferred_theme(self):
419424 self .show_snack (result .error_msg , is_error = True )
420425 return
421426 self .preferred_theme = result .data
422- side_bar_components = [
423- self .side_bar ,
424- self .main_menu ,
425- self .secondary_menu ,
426- ]
427427 side_bar_bg_color = colors .SIDEBAR_DARK_COLOR # default is dark mode
428428 self .action_bar .bgcolor = colors .ACTION_BAR_DARK_COLOR
429429 if self .preferred_theme == theme .THEME_MODES .light .value :
430430 side_bar_bg_color = colors .SIDEBAR_LIGHT_COLOR
431431 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 )
434435 self .footer .bgcolor = side_bar_bg_color # footer and side bar have same bgcolor
435436 self .update_self ()
436437
@@ -443,6 +444,7 @@ def on_window_resized_listener(self, width, height):
443444 self .action_bar .height + self .footer .height + 50
444445 )
445446 self .destination_content_container .height = DESTINATION_CONTENT_PERCENT_HEIGHT
447+ self .main_body .width = self .page_width - SIDEBAR_WIDTH
446448 self .update_self ()
447449
448450 def will_unmount (self ):
0 commit comments