Align button to the right side in xamarin forms - xamarin.forms

I have below xaml code and all I need is to aligh the button showin in the image attached to be in the right side . Please see complete code below :
<AbsoluteLayout Padding="0">
<maps:Map AbsoluteLayout.LayoutFlags="All" AbsoluteLayout.LayoutBounds="0, 0, 1, 1" x:Name="map"
MyLocationEnabled="True" IsTrafficEnabled="True" MapType="Street" IsShowingUser="True"
HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" />
<StackLayout VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand" >
<pcv:PancakeView
Margin="0,30,10,-30"
BackgroundColor="White"
CornerRadius="30"
HasShadow="True"
HeightRequest="60"
HorizontalOptions="EndAndExpand"
VerticalOptions="End"
WidthRequest="60">
<Image >
<Image.Source>
<FontImageSource
Glyph="{x:Static local:IoniconsFont.IosCloseOutline }"
Size="30"
Color="Gray"
FontFamily="{StaticResource IonIcons}" />
</Image.Source>
<Image.GestureRecognizers>
<TapGestureRecognizer Tapped="OnBackClicked" />
</Image.GestureRecognizers>
</Image>
</pcv:PancakeView>
</StackLayout>
</AbsoluteLayout>

XAML Tips:
FillAndExpand XY:
AbsoluteLayout.LayoutBounds="0, 0, 1, 1"
AbsoluteLayout.LayoutFlags="All"
Center XY:
AbsoluteLayout.LayoutBounds="0.5, 0.5, -1, -1"
AbsoluteLayout.LayoutFlags="PositionProportional"
Vertical Center, Horizontal Fill:
AbsoluteLayout.LayoutBounds="0.5, 0.5, 1, -1"
AbsoluteLayout.LayoutFlags="PositionProportional"
Vertical End, Horizontal Center
AbsoluteLayout.LayoutBounds="0.5, 1, -1, -1"
AbsoluteLayout.LayoutFlags="PositionProportional"
Vertical Start, Horizontal Center
AbsoluteLayout.LayoutBounds="0.5, 0, -1, -1"
AbsoluteLayout.LayoutFlags="PositionProportional"
Vertical Start, Horizontal Start
AbsoluteLayout.LayoutBounds="0, 0, -1, -1"
AbsoluteLayout.LayoutFlags="PositionProportional"

Related

How to center align one item and right align another using MUI v5?

I would like to center 3 navigation tabs in the middle of my page and have a dropdown on the far right which is used for sorting. I was able to get the dropdown on the far right although can't figure out how to perfectly center the 3 navigation tabs inside the <Box> <Box/> component.
Here is a picture of what I am trying to do:
Here is a code sandbox: https://codesandbox.io/s/45159071-how-to-align-a-component-to-the-center-right-forked-0y60s3?file=/demo.js
<Grid
container
sx={{ marginTop: 3, marginBottom: 3, alignItems: 'center' }}
>
<Box
sx={{ marginRight: 'auto' }}
>
<Tabs
value={activeMenuTab}
onChange={handleChangeTab}
>
<Tab label="Tab 1" />
<Tab label="Tab 2" />
<Tab label="Tab 3" />
</Tabs>
</Box>
<Grid
item
xs
style={{ flexGrow: 0 }}
>
<FormControl
sx={{ minWidth: 150 }}
size="small"
>
<InputLabel id="sort-by">Sort By</InputLabel>
<Select
labelId="sort-by"
value={selectedValue}
label="Sort By"
onChange={handleSorting}
>
<MenuItem value="oldest">Oldest</MenuItem>
</Select>
</FormControl>
</Grid>
</Grid>
I found a similar post which uses pure CSS although struggled to integrate it within the MUI components: Center one and right/left align other flexbox element
Try this solution, I only used the Box component instead of Grid to reproduce just like in the post you pointed to with grid.
<Box
display="grid"
gridTemplateColumns="1fr 1fr 1fr"
gridAutoRows="auto"
rowGap={2}
alignItems="center"
marginY={3}
>
<Box gridColumn="2">
<Tabs centered value={'null'} onChange={handleChangeTab}>
<Tab label="Tab 1" />
<Tab label="Tab 2" />
<Tab label="Tab 3" />
</Tabs>
</Box>
<Box
gridColumn={{ xs: '1 / -1', sm: '3' }}
gridRow={{ xs: '2', sm: '1' }}
justifySelf={{ xs: 'center', sm: 'end' }}
>
<FormControl sx={{ minWidth: 150 }} size="small">
<InputLabel id="sort-by">Sort By</InputLabel>
<Select labelId="sort-by" value="Some Value" label="Sort By" onChange={handleSorting}>
<MenuItem value="oldest">Oldest</MenuItem>
<MenuItem value="newest">Newest</MenuItem>
</Select>
</FormControl>
</Box>
</Box>;

how to disable "--tw-ring-shadow", using tailwindCss for #mui/TimePicker?

if I disable --tw-ring-shadow it works ok
you can see in image !! show image !!
TimePicker Code
<LocalizationProvider dateAdapter={AdapterDateFns}>
<Stack spacing={3}>
<TimePicker
renderInput={(params) => <TextField {...params}/>}
value={value}
label="min/max time"
onChange={(newValue) => {
setValue(newValue);
}}
minTime={new Date(0, 0, 0, 8)}
maxTime={new Date(0, 0, 0, 18, 45)}
/>
</Stack>
</LocalizationProvider>

How to set the minimum width on a react material ui grid item?

I've got this code... I'd like to have one 'column' that is a minimum of 250 pixels wide... I tried the material ui suggestion for sizing: https://material-ui.com/system/sizing/ and didn't seem to have any luck... the 'logo' element will shrink smaller than 250px when the window size shrinks. When that happens, the red grid item (which itself is a grid container with my actual data) obscures the logo.
How can I set the minimum width of a material ui Grid item?
<Grid
container
direction="row"
>
<Grid item xs={3} >
<Box width={250}>
<img src={Logo} key="logo" width="250" height="100" alt="Logo" />
</Box>
</Grid>
<Grid item style={{ backgroundColor: '#f22' }} xs={9}>
<Grid
container
direction="row"
justify="flex-start"
spacing={2}
>
{this.panelGrid(eventID, panelData)}
</Grid>
</Grid>
</Grid>
Just use CSS min-width. The MDN page has details.
<Grid
container
direction="row">
<Grid item xs={3} >
<Box width={250}>
<img src={Logo} key="logo" width="250" height="100" alt="Logo" />
</Box>
</Grid>
<Grid item style={{ backgroundColor: '#f22', min-width: '250px' }} xs={9}>
<Grid
container
direction="row"
justify="flex-start"
spacing={2}
>
{this.panelGrid(eventID, panelData)}
</Grid>
</Grid>
I think you can try this one:
<Grid item xs={3} sx={{minWidth: '250px'}} >

Object reference not set to an instance of an object when using css styling with xamarin forms

I tried to set style to my page using css but i got this exception
Object reference not set to an instance of an object
MainPage.xaml
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="XRetailMobile.Views.MainPage"
xmlns:local="clr-namespace:XRetailMobile.Views.ContentViews"
NavigationPage.HasNavigationBar="False">
<ContentPage.Resources>
<StyleSheet Source="/Styles/style.css"/>
</ContentPage.Resources>
<ContentPage.Content>
<Grid HorizontalOptions="Fill" VerticalOptions="Fill">
<local:ProductBackToolbar StyleClass="toolbarStyle" VerticalOptions="Start">
</local:ProductBackToolbar>
</Grid>
</ContentPage.Content>
</ContentPage>
ProductBackToolbar.xaml(contentview)
<ContentView.Content>
<StackLayout HorizontalOptions="Fill" Orientation="Horizontal">
<Image Source="back" HeightRequest="35" VerticalOptions="Center" WidthRequest="35" HorizontalOptions="StartAndExpand"></Image>
<Image Source="share" HeightRequest="35" VerticalOptions="Center" WidthRequest="35" HorizontalOptions="End"></Image>
<Image Source="shoppingbag" HeightRequest="35" WidthRequest="35" VerticalOptions="Center" HorizontalOptions="End"></Image>
</StackLayout>
</ContentView.Content>
style.css Located in Style Folder and its build action is EmbeddedResources
^contentpage {
background-color: greenyellow;
}
.toolbarStyle {
background-color: blue;
margin: 20px;
padding:20px;
}
if i comment margin and padding it's work fine
what's the wrong ?

React Native - ScrollView with sticky button at the bottom

I want to scroll the view and have a sticky button at the bottom always.
So the requirement are:
ScrollView with items.
Fixed button overlaps scroll view at
the bottom position
Scroll the view and the button need to be
always at bottom of the screen.
The sticky button are always
visible
This is my code:
<ScrollView >
<TouchableOpacity s>
<Image source={..)} />
</TouchableOpacity>
<TouchableOpacity>
<Image source={..)} />
</TouchableOpacity>
<TouchableOpacity>
<Image source={..)} />
</TouchableOpacity>
</ScrollView>
<View style={styles.fabMenuStyle}>
<Image source={..)} />
<Image source={..)} />
<Image source={..)} />
</View>
fabMenuStyle: {
flexDirection: 'row',
position: 'absolute',
bottom: 5,
justifyContent: 'center'
}
The problem is that I can position my buttons view at the bottom of the ScrollView, but I need that to always be visible at the bottom, not only at the end of the ScrollView.

Resources