#:import get_color_from_hex kivy.utils.get_color_from_hex
#:import images_path kivymd.images_path
#:import colors kivymd.color_definitions.colors
#:import partial functools.partial
#:import NoTransition kivy.uix.screenmanager.NoTransition
# :import MDCarousel kivymd.uix.carousel.MDCarousel

MyLayout:
    scr_mngr: scr_mngr
    orientation: 'vertical'
    height: self.minimum_height

    canvas:
        Color:
            rgba: 0.925,0.925,0.925,1 #get_color_from_hex(colors['Gray']['900'])
        Rectangle:
            pos: self.pos
            size: self.size
    
    MDToolbar:
        id: toolbar
        title: app.title
        pos_hint: {'center_x': .5, 'center_y': 0.95}
        md_bg_color: 0.1,0.1,0.1,1
        background_palette: 'Red'
        background_hue: '500'
        specific_text_color: 1,0,0,1
        right_action_items: [['radio-tower', partial(root.change_screen, 'feed')], ['account-group', partial(root.change_screen, 'people')], ['calendar', partial(root.change_screen, 'events')], ['message-processing-outline', partial(root.change_screen, 'messages')], ['bell-outline', partial(root.change_screen, 'notifications')]]
        left_action_items: [[f"assets/logo.png", partial(root.change_screen, 'welcome')]]
    
    ScreenManager:
        id: scr_mngr
        # transition: NoTransition()
    

        WelcomeScreen:
            name: 'welcome'
            
            MyLabel:
                text: "Turning and turning in the widening gyre   \nThe falcon cannot hear the falconer;\nThings fall apart; the centre cannot hold;\nMere anarchy is loosed upon the world,\nThe blood-dimmed tide is loosed, and everywhere   \nThe ceremony of innocence is drowned;\nThe best lack all conviction, while the worst   \nAre full of passionate intensity.\n\nSurely some revelation is at hand;\nSurely the Second Coming is at hand.   \nThe Second Coming! Hardly are those words out   \nWhen a vast image out of Spiritus Mundi\nTroubles my sight: somewhere in sands of the desert   \nA shape with lion body and the head of a man,   \nA gaze blank and pitiless as the sun,   \nIs moving its slow thighs, while all about it   \nReel shadows of the indignant desert birds.   \nThe darkness drops again; but now I know   \nThat twenty centuries of stony sleep\nWere vexed to nightmare by a rocking cradle,   \nAnd what rough beast, its hour come round at last,   \nSlouches towards Bethlehem to be born?"
                

        PeopleScreen:
            name: 'people'

            ScrollView:
                id: scroll
                size_hint: (1, 1)
                pos_hint: {'center_x': .5, 'y': 0}
                do_scroll_x: False
                bar_width: 0
                scroll_type: ['content']

                MDList:
                    id: container
                    # size_hint_y: None
                    # height: '100dp'
                    #padding: 0, self._list_vertical_padding



                
        
        FeedScreen:
            name: 'feed'
            #MyLabel:
            #    text: "The falcon cannot hear the falconer..."
            Carousel:
                direction: 'right'

                #AsyncImage:
                #    source:'avatar.jpg'
                MDCard:
                    orientation: "vertical"
                    padding: "8dp"
                    size_hint: 0.9, 0.9
                    # md_bg_color: 1,0,0,1
                    pos_hint: {"center_x": .5, "center_y": .5}
                    
                    MDLabel:
                        text: "Counter culture is dead"
                        theme_text_color: "Secondary"
                        size_hint_y: None
                        height: self.texture_size[1]
                        font_style: 'H5'
                        halign: 'center'
                    AsyncImage:
                        source: 'avatar.jpg'
                    MDLabel:
                        text: "Resistance to popular music (Taylor Swift, etc) is culturally obsolete. It's no longer possible to 'counter' culture as 'bad' or aesthetically impoverished: music is good, TV is good, the internet is funny, and we're all just hooked up to the same cultural 'streams' and 'feeds'."
                        pos_hint: {'center_y':1}
                        font_style: 'Body1'
                MDCard:
                    orientation: "vertical"
                    padding: "8dp"
                    size_hint: 0.9, 0.9
                    # md_bg_color: 1,0,0,1
                    pos_hint: {"center_x": .5, "center_y": .5}
                    
                    MDLabel:
                        text: "Can God compete with Adam?"
                        theme_text_color: "Secondary"
                        size_hint_y: None
                        height: self.texture_size[1]
                        font_style: 'H5'
                        halign: 'center'
                    AsyncImage:
                        source: 'spiral4.png'
                    MDLabel:
                        text: "The lines to break Tech up on are already there, just covered up: Amazon is both the infrastructure connecting all businesses & consumers, while at the same time competing with those businesses—using its omnipotent money and omniscient data like God 'competing' with Adam & Eve."


                MDCard:
                    orientation: "vertical"
                    padding: "8dp"
                    size_hint: 0.9, 0.9
                    pos_hint: {"center_x": .5, "center_y": .5}

                    AsyncImage:
                        source: 'spiral4.png'

                    MDLabel:
                        text: "The lines to break Tech up on are already there, just covered up: Amazon is both the infrastructure connecting all businesses & consumers, while at the same time competing with those businesses—using its omnipotent money and omniscient data like God 'competing' with Adam & Eve."

                AsyncImage:
                    source:'spiral2.png'
                AsyncImage:
                    source: 'spiral4.png'


        EventsScreen:
            name: 'events'

        MessagesScreen:
            name: 'messages'

        NotificationsScreen:
            name: 'notifications'
